From e1219e7351e0522327696006fd6577045f343ad5 Mon Sep 17 00:00:00 2001 From: kyleburnette Date: Fri, 16 Jul 2021 21:04:37 -0700 Subject: [PATCH] en_invadepoh OK (#200) * Applied changes to master on new branch * some docs * minor change * Slight improvement to last draw func * Got rid of all warnings * Removed extra text file * Readded warnings text file * Fixed warnings text file * Some cleanup, added engineer's new matched functions! * Marked non-equivalent functions as such * Improved last draw func (still non-equivalent) * Made most of anghelo's suggested changes * Slightly better code for func_80B4A350, though it's not matching still * Engineer matched 2 funcs so I'm pushing those * Added a function from engineer and one of my own * Fixed warning * Slightly better code for func_80B44C80 * Slightly better code for func_80B44C80 * Matched func_80B44C80 * Pushing engineer's matched draw func. All rodata funcs matched! * Build NOT OK - rodata. Pushing anyway because I did a lot of work and it's close * Build NOT OK (see previous commit) - func_80B440B8 matched * Build NOT OK (see previous commit) - func_80B43BC8 matched * All funcs matched! Build not OK still though * almost ok * OK now * Fixed some warnings * Fixed more warnings * More warnings work * Fixed all warnings (I think) * Fixed all warnings (I think) * Moderate amount of cleanup * More cleanup * More cleanup and some slight documentation * Decent amount of documentation * More documentation * Fixed build (forgot to replace one struct member) * More documentation and cleanup * Fixed merge conflict, added binang_sub macro usages, and otherwise added most of the suggested changes f git commit * Organized things a bit, added a few more CLOCKTIME macros * Added extra output to timeconvert.py * Formatting * Made all suggested changes * 'Downgraded' timeconv script to version without seconds * Added a macro for part of the params usages plus an enum * Actually fixed header file (didn't save before) * Renamed milk get item in enum * Fixed GI enum update Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com> Co-authored-by: Zelllll Co-authored-by: angie --- include/functions.h | 6 +- include/macros.h | 2 + include/z64.h | 8 +- include/z64item.h | 1 + include/z64scene.h | 2 +- linker_scripts/code_script.txt | 4 +- linker_scripts/object_script.txt | 53 + src/overlays/actors/ovl_En_Door/z_en_door.h | 4 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 5016 +++++++++++++++-- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 144 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 2 +- tables/functions.txt | 20 +- tables/variables.txt | 15 - tools/timeconv.py | 24 + .../warnings_count/warnings_setup_current.txt | 2 +- 15 files changed, 4828 insertions(+), 475 deletions(-) create mode 100755 tools/timeconv.py diff --git a/include/functions.h b/include/functions.h index 29c7d3c06a..c82225588e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1769,7 +1769,7 @@ void func_800F6FF8(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightCo // void func_800F8CD4(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800F8D84(void); // void func_800F9728(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_800F9824(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE2 param_10, UNK_TYPE1 param_11); +void func_800F9824(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f vec, f32 arg5, f32 arg6, s8 arg7, s8 arg8); // void func_800FA39C(void); // void func_800FA3C4(void); // void func_800FA9FC(void); @@ -1814,7 +1814,7 @@ u32 func_800FE4B8(GlobalContext* globalCtx); // void func_800FE590(void); // void func_800FE5D0(void); // UNK_TYPE4 func_800FE610(void); -// void func_800FE620(void); +s32 func_800FE620(GlobalContext* globalCtx); // void func_800FE658(void); // UNK_TYPE4 func_800FE6F8(UNK_TYPE4 param_1, s16 param_2, s16 param_3); // void func_800FE778(void); @@ -3935,7 +3935,7 @@ void func_801A2ED8(void); // void func_801A2F88(void); // void func_801A3000(void); // void func_801A3038(void); -// void func_801A3098(void); +void func_801A3098(u16 arg0); // void func_801A312C(void); void func_801A31EC(UNK_TYPE1 arg1, UNK_TYPE4 arg2, u8 arg3); // void func_801A3238(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); diff --git a/include/macros.h b/include/macros.h index 8e7310a366..8122b98a85 100644 --- a/include/macros.h +++ b/include/macros.h @@ -32,6 +32,8 @@ #define CURRENT_DAY (gSaveContext.day % 5) +#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60))) + #define SLOT(item) gItemSlots[item] #define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)] #define INV_CONTENT(item) gSaveContext.inventory.items[SLOT(item)] diff --git a/include/z64.h b/include/z64.h index 26714b538d..ecb1277aaf 100644 --- a/include/z64.h +++ b/include/z64.h @@ -986,11 +986,9 @@ typedef struct { /* 0x12070 */ UNK_TYPE1 pad12070[0x8]; /* 0x12078 */ s32 bankRupeesSelected; /* 0x1207C */ s32 bankRupees; - /* 0x12080 */ UNK_TYPE1 pad12080[0x30]; - /* 0x120B0 */ UNK_TYPE1 pad120B0[0x1]; - /* 0x120B1 */ u8 unk_120B1; - /* 0x120B2 */ UNK_TYPE1 pad120B2[0x2]; - /* 0x120B4 */ UNK_TYPE1 pad120B4[0x2C]; + /* 0x12080 */ UNK_TYPE1 pad12080[0x31]; + /* 0x120B1 */ u8 unk120B1; + /* 0x120B2 */ UNK_TYPE1 pad120B2[0x2E]; } MessageContext; // size = 0x120E0 typedef struct ActorBgMbarChair ActorBgMbarChair; diff --git a/include/z64item.h b/include/z64item.h index d204b80731..7682e7f136 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -90,6 +90,7 @@ typedef enum { /* 0x5C */ GI_POTION_GREEN, /* 0x5D */ GI_POTION_BLUE, /* 0x5E */ GI_FAIRY, + /* 0x60 */ GI_MILK_BOTTLE = 0x60, /* 0x7E */ GI_MASK_ALL_NIGHT = 0x7E, /* 0x8C */ GI_MASK_BREMEN = 0x8C, /* 0x9B */ GI_SWORD_GREAT_FAIRY = 0x9B, diff --git a/include/z64scene.h b/include/z64scene.h index bc77076022..afab46ec44 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -470,7 +470,7 @@ typedef struct { typedef struct { /* 0x00 */ u8 count; // number of points in the path - /* 0x01 */ s8 unk1; + /* 0x01 */ u8 unk1; /* 0x02 */ s16 unk2; /* 0x04 */ Vec3s* points; // Segment Address to the array of points } Path; // size = 0x8 diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 092fd0534e..e49c431ae8 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -6925,9 +6925,9 @@ SECTIONS ovl_En_Invadepoh : AT(RomLocation) { build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.text) - build/asm/overlays/ovl_En_Invadepoh_data.o(.data) + build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.data) build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.rodata) - build/asm/overlays/ovl_En_Invadepoh_rodata.o(.rodata) + build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_overlay.o(.ovl) ovl_En_Invadepoh_bss_start = .; } . += 0x170; diff --git a/linker_scripts/object_script.txt b/linker_scripts/object_script.txt index 7112f73f7b..e1af6574a6 100644 --- a/linker_scripts/object_script.txt +++ b/linker_scripts/object_script.txt @@ -1,9 +1,14 @@ /* KEEPS */ /* gameplay_keep (segment 04) */ + D_040008D0 = 0x040008D0; D_0400DEA8 = 0x0400DEA8; D_0400E2A8 = 0x0400E2A8; +D_04023210 = 0x04023210; +D_0402E510 = 0x0402E510; +D_04029CB0 = 0x04029CB0; +D_04029CF0 = 0x04029CF0; D_04029CB0 = 0x04029CB0; D_04029CF0 = 0x04029CF0; D_04058BA0 = 0x04058BA0; @@ -39,6 +44,7 @@ D_0408EFE0 = 0x0408EFE0; D_0408F3E0 = 0x0408F3E0; D_0408F7E0 = 0x0408F7E0; + /* gameplay_dangeon_keep (segment 05) */ D_05018090 = 0x05018090; D_05017EA0 = 0x05017EA0; @@ -349,6 +355,53 @@ D_06012A78 = 0x06012A78; D_060137A0 = 0x060137A0; D_06014860 = 0x06014860; +/* z_en_invadepoh */ +D_06000080 = 0x06000080; +D_06000550 = 0x06000550; +D_06000560 = 0x06000560; +D_06000608 = 0x06000608; +D_060006C8 = 0x060006C8; +D_06000720 = 0x06000720; +D_06000998 = 0x06000998; +D_06001560 = 0x06001560; +D_06001674 = 0x06001674; +D_06001BD8 = 0x06001BD8; +D_06001D80 = 0x06001D80; +D_060021C8 = 0x060021C8; +D_06002A8C = 0x06002A8C; +D_06004010 = 0x06004010; +D_06004264 = 0x06004264; +D_06004C30 = 0x06004C30; +D_06004E50 = 0x06004E50; +D_06004E98 = 0x06004E98; +D_06007328 = 0x06007328; +D_060080F0 = 0x060080F0; +D_06009E58 = 0x06009E58; +D_0600A174 = 0x0600A174; +D_0600FFC8 = 0x0600FFC8; +D_060107C8 = 0x060107C8; +D_06010FC8 = 0x06010FC8; +D_060117C8 = 0x060117C8; +D_06011AD8 = 0x06011AD8; +D_06011FC8 = 0x06011FC8; +D_060122D8 = 0x060122D8; +D_060127C8 = 0x060127C8; +D_06012AD8 = 0x06012AD8; +D_06012BC8 = 0x06012BC8; +D_06012FC8 = 0x06012FC8; +D_060132D8 = 0x060132D8; +D_060133C8 = 0x060133C8; +D_06013928 = 0x06013928; +D_06013AD8 = 0x06013AD8; +D_06014088 = 0x06014088; +D_060142D8 = 0x060142D8; +D_06014AD8 = 0x06014AD8; +D_06014ED8 = 0x06014ED8; +D_060152D8 = 0x060152D8; +D_06015C28 = 0x06015C28; +D_060156D8 = 0x060156D8; +D_06016720 = 0x06016720; + /* z_en_jc_mato */ D_06000390 = 0x06000390; 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 9ece0d90c0..b2ecdfa4f5 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -7,7 +7,9 @@ struct EnDoor; typedef struct EnDoor { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x88]; + /* 0x144 */ char unk_144[0x63]; + /* 0x1A7 */ s8 unk1A7; + /* 0x1A8 */ char unk1A8[0x24]; } EnDoor; // size = 0x1CC extern const ActorInit En_Door_InitVars; diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index fbaaf19859..b5349054dd 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,4 +1,11 @@ +/* + * File z_en_invadepoh.c + * Overlay: ovl_en_invadepoh + * Description: Ranch nighttime actors + */ + #include "z_en_invadepoh.h" +#include "../ovl_En_Door/z_en_door.h" #define FLAGS 0x00000010 @@ -8,7 +15,218 @@ void EnInvadepoh_Init(Actor* thisx, GlobalContext* globalCtx); void EnInvadepoh_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnInvadepoh_Update(Actor* thisx, GlobalContext* globalCtx); -/* +void func_80B46DA8(EnInvadepoh* this); +void func_80B46DC8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46E20(EnInvadepoh* this); +void func_80B46E44(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46EC0(EnInvadepoh* this); +void func_80B46EE8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46F88(EnInvadepoh* this); +void func_80B46FA8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47064(EnInvadepoh* this); +void func_80B47084(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B470E0(EnInvadepoh* this); +void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B471C0(EnInvadepoh* this); +void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47248(EnInvadepoh* this); +void func_80B47268(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47304(EnInvadepoh* this); +void func_80B47324(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B473E4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B474DC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47600(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B477B4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48324(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4ACF0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AD3C(EnInvadepoh* this); +void func_80B4AD60(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4ADB8(EnInvadepoh* this); +void func_80B4ADCC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AEC0(EnInvadepoh* this); +void func_80B4AEDC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AF80(EnInvadepoh* this); +void func_80B4AF94(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B024(EnInvadepoh* this); +void func_80B4B048(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B484(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B510(EnInvadepoh* this); +void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B724(EnInvadepoh* this); +void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B820(EnInvadepoh* this); +void func_80B4B864(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48374(EnInvadepoh* this); +void func_80B483CC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4994C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B497EC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49628(EnInvadepoh* this); +void func_80B49670(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49454(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4934C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B491EC(EnInvadepoh* this); +void func_80B49228(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49C38(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4A5E4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4D480(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47568(EnInvadepoh* this); +void func_80B478F4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47938(EnInvadepoh* this); +void func_80B479E8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4843C(EnInvadepoh* this); +void func_80B484EC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48588(EnInvadepoh* this); +void func_80B48610(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48848(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47278(EnInvadepoh* this); +void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49404(EnInvadepoh* this); +void func_80B4A570(EnInvadepoh* this); +void func_80B4C1BC(EnInvadepoh* this); +void func_80B4D290(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4CC70(EnInvadepoh* this); +void func_80B4770C(EnInvadepoh* this); +void func_80B48948(EnInvadepoh* this); +void func_80B49904(EnInvadepoh* this); +void func_80B499BC(EnInvadepoh* this); +void func_80B492FC(EnInvadepoh* this); +void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitAlien(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitParentCow(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitChildCow(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitDog(EnInvadepoh* this, GlobalContext* globalCtx); +void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46BB0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46BC0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C08(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C34(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C7C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46C94(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46CC0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46CF4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46D28(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4D670(Actor* thisx, GlobalContext* globalCtx); +void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx); +void func_80B47D30(Actor* thisx, GlobalContext* globalCtx); +void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx); +void func_80B48060(Actor* thisx, GlobalContext* globalCtx); +void func_80B481C4(Actor* thisx, GlobalContext* globalCtx); +void func_80B4827C(Actor* thisx, GlobalContext* globalCtx); +void func_80B48620(Actor* thisx, GlobalContext* globalCtx); +void func_80B48FB0(Actor* thisx, GlobalContext* globalCtx); +void func_80B49F88(Actor* thisx, GlobalContext* globalCtx); +void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx); +void func_80B4B0C4(Actor* thisx, GlobalContext* globalCtx); +void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx); +void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx); +void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx); +void func_80B49B1C(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E158(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx); +void func_80B4D9B4(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E1B0(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E324(Actor* thisx, GlobalContext* globalCtx); +void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E660(Actor* thisx, GlobalContext* globalCtx); +void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx); +void func_80B4E7BC(Actor* thisx, GlobalContext* globalCtx); +void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx); +void func_80B4ABDC(Actor* thisx, GlobalContext* globalCtx); +void func_80B4D054(Actor* thisx, GlobalContext* globalCtx); +void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx); +void func_80B4D760(Actor* thisx, GlobalContext* globalCtx); +void func_80B4A168(Actor* thisx, GlobalContext* globalCtx); +void func_80B4873C(Actor* thisx, GlobalContext* globalCtx); +void func_80B490F0(Actor* thisx, GlobalContext* globalCtx); +void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx); +void func_80B4B218(Actor* thisx, GlobalContext* globalCtx); +void func_80B4BA30(Actor* thisx, GlobalContext* globalCtx); +void func_80B4C568(Actor* thisx, GlobalContext* globalCtx); +void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx); +void func_80B46184(unkStruct80B50350* unkStruct); +s32 func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); +s32 func_80B4516C(EnInvadepoh* this); +void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u); +void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u); +void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u); + +extern AnimatedMaterial D_06000550; +extern AnimatedMaterial D_06000560; + +extern AnimationHeader D_06000608; +extern AnimationHeader D_060006C8; +extern AnimationHeader D_06000998; +extern AnimationHeader D_06001560; +extern AnimationHeader D_06001674; +extern AnimationHeader D_06001BD8; +extern AnimationHeader D_06001D80; +extern AnimationHeader D_060021C8; +extern AnimationHeader D_06002A8C; +extern AnimationHeader D_06004264; +extern AnimationHeader D_06004E98; +extern AnimationHeader D_06007328; +extern AnimationHeader D_06009E58; +extern AnimationHeader D_0600A174; +extern AnimationHeader D_06014088; +extern AnimationHeader D_06016720; + +extern FlexSkeletonHeader D_060080F0; +extern FlexSkeletonHeader D_06004010; +extern FlexSkeletonHeader D_06004C30; +extern FlexSkeletonHeader D_06004E50; +extern FlexSkeletonHeader D_06013928; +extern FlexSkeletonHeader D_06015C28; + +extern Gfx D_0600FFC8[]; +extern Gfx D_060107C8[]; +extern Gfx D_06010FC8[]; +extern Gfx D_060117C8[]; +extern Gfx D_06011FC8[]; +extern Gfx D_060127C8[]; +extern Gfx D_06012BC8[]; +extern Gfx D_06012FC8[]; +extern Gfx D_060133C8[]; +extern Gfx D_06011AD8[]; +extern Gfx D_060122D8[]; +extern Gfx D_06012AD8[]; +extern Gfx D_060132D8[]; +extern Gfx D_06013AD8[]; +extern Gfx D_060142D8[]; +extern Gfx D_06014AD8[]; +extern Gfx D_06014ED8[]; +extern Gfx D_060152D8[]; +extern Gfx D_060156D8[]; +extern Gfx D_04023210[]; +extern Gfx D_060003B0[]; +extern Gfx D_04029CB0[]; +extern Gfx D_04029CF0[]; +extern Gfx D_06000720[]; +extern Gfx D_0402E510[]; +extern Gfx D_06000080[]; + +extern s32 D_801BDA9C; +extern Vec3s D_801D15BC; + const ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, @@ -20,492 +238,4420 @@ const ActorInit En_Invadepoh_InitVars = { (ActorFunc)EnInvadepoh_Update, (ActorFunc)NULL, }; -*/ -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B439B0.asm") +static ColliderCylinderInit sCylinderInitAlien = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK4, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0x00003820, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NONE, + BUMP_ON, + OCELEM_ON, + }, + { 40, 95, 10, { 0, 0, 0 } }, +}; + +static ColliderCylinderInit sCylinderInitRomaniAndCremia = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, + { 18, 46, 0, { 0, 0, 0 } }, +}; + +static ColliderCylinderInit sCylinderInitDog = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, + { 13, 19, 0, { 0, 0, 0 } }, +}; + +static Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; + +static s32 D_80B4E940 = 0; + +static Gfx* D_80B4E944[] = { + D_0600FFC8, D_060107C8, D_06010FC8, D_060117C8, D_06011FC8, +}; + +static Gfx* D_80B4E958[] = { + D_060127C8, + D_06012BC8, + D_06012FC8, + D_060133C8, +}; + +static s8 D_80B4E968 = 0; + +static Gfx* D_80B4E96C[] = { + D_06011AD8, D_060122D8, D_06012AD8, D_060132D8, D_06013AD8, D_060142D8, +}; + +static Gfx* D_80B4E984[] = { + D_06014AD8, + D_06014ED8, + D_060152D8, + D_060156D8, +}; + +static s8 D_80B4E994 = 0; + +static s8 D_80B4E998 = NULL; + +static s8 D_80B4E99C[] = { 0 }; + +static s8 D_80B4E9A0[] = { 0, 1, 2, 0 }; + +static s8 D_80B4E9A4[] = { 0, 1, 2, 1, 0 }; + +static s8 D_80B4E9AC[] = { 0, 1, 2, 2, 1, 0 }; + +static s8 D_80B4E9B4[] = { + 0, 1, 2, 1, 0, 1, 2, 0, +}; + +static s8 D_80B4E9BC[] = { 1 }; + +static s8 D_80B4E9C0[] = { 3 }; + +static unkstructInvadepoh0 D_80B4E9C4 = { D_80B4E99C, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43A24.asm") +static unkstructInvadepoh0 D_80B4E9CC = { D_80B4E9A0, 4 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43A74.asm") +static unkstructInvadepoh0 D_80B4E9D4 = { D_80B4E9A4, 5 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43A9C.asm") +static unkstructInvadepoh0 D_80B4E9DC = { D_80B4E9AC, 6 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43AB0.asm") +static unkstructInvadepoh0 D_80B4E9E4 = { D_80B4E9B4, 8 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43AF0.asm") +static unkstructInvadepoh0 D_80B4E9EC = { D_80B4E9BC, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43B80.asm") +static unkstructInvadepoh0 D_80B4E9F4 = { D_80B4E9C0, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43BC8.asm") +static unkstructInvadepoh2 D_80B4E9FC = { 0, &D_80B4E9C4 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43DD4.asm") +static unkstructInvadepoh1 D_80B4EA04[] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.97f }, + { 5, 1.0f }, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43E6C.asm") +static unkstructInvadepoh1 D_80B4EA24[] = { + { 1, 1.0f }, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43F0C.asm") +static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3c }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B43F70.asm") +static unkstructInvadepoh3 D_80B4EA40 = { + 1, + &D_80B4E9CC, + 1, + D_80B4EA24, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44024.asm") +static unkstructInvadepoh3 D_80B4EA50 = { + 1, + &D_80B4E9D4, + 1, + D_80B4EA24, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4407C.asm") +static unkstructInvadepoh3 D_80B4EA60 = { + 1, + &D_80B4E9DC, + 1, + D_80B4EA24, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B440B8.asm") +static unkstructInvadepoh3 D_80B4EA70 = { + 1, + &D_80B4E9E4, + 1, + D_80B4EA24, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44234.asm") +static unkstructInvadepoh2 D_80B4EA80 = { + 0, + &D_80B4E9EC, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B442E4.asm") +static unkstructInvadepoh2 D_80B4EA88 = { + 0, + &D_80B4E9F4, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B443A0.asm") +static void* D_80B4EA90[] = { + &D_80B4E9FC, &D_80B4EA2C, &D_80B4EA40, &D_80B4EA50, &D_80B4EA60, &D_80B4EA70, &D_80B4EA80, &D_80B4EA88, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B444BC.asm") +static s8 D_80B4EAB0[] = { 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B444F4.asm") +static s8 D_80B4EAB4[] = { 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44514.asm") +static s8 D_80B4EAB8[] = { 2 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44540.asm") +static s8 D_80B4EABC[] = { 3 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44570.asm") +static unkstructInvadepoh0 D_80B4EAC0 = { D_80B4EAB0, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44620.asm") +static unkstructInvadepoh0 D_80B4EAC8 = { D_80B4EAB4, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44640.asm") +static unkstructInvadepoh0 D_80B4EAD0 = { D_80B4EAB8, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44664.asm") +static unkstructInvadepoh0 D_80B4EAD8 = { D_80B4EABC, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44690.asm") +static unkstructInvadepoh2 D_80B4EAE0 = { 0, &D_80B4EAC0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B446D0.asm") +static unkstructInvadepoh2 D_80B4EAE8 = { 0, &D_80B4EAC8 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44700.asm") +static unkstructInvadepoh2 D_80B4EAF0 = { 0, &D_80B4EAD0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B447C0.asm") +static unkstructInvadepoh2 D_80B4EAF8 = { 0, &D_80B4EAD8 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44A90.asm") +static void* D_80B4EB00[] = { + &D_80B4EAE0, + &D_80B4EAE8, + &D_80B4EAF0, + &D_80B4EAF8, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44B78.asm") +static s8 D_80B4EB10[] = { 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44B84.asm") +static s8 D_80B4EB14[] = { 0, 1, 2, 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44C24.asm") +static s8 D_80B4EB18[] = { 0, 1, 2, 1, 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44C80.asm") +static s8 D_80B4EB20[] = { 0, 1, 2, 2, 1, 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44E90.asm") +static s8 D_80B4EB28[] = { 0, 1, 2, 1, 0, 1, 2, 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44EFC.asm") +static unkstructInvadepoh0 D_80B4EB30 = { D_80B4EB10, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44F58.asm") +static unkstructInvadepoh0 D_80B4EB38 = { D_80B4EB14, 4 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B44FEC.asm") +static unkstructInvadepoh0 D_80B4EB40 = { D_80B4EB18, 5 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45080.asm") +static unkstructInvadepoh0 D_80B4EB48 = { D_80B4EB20, 6 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B450C0.asm") +static unkstructInvadepoh0 D_80B4EB50 = { D_80B4EB28, 8 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4516C.asm") +static unkstructInvadepoh2 D_80B4EB58 = { 0, &D_80B4EB30 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B451A0.asm") +static unkstructInvadepoh1 D_80B4EB60[] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.95f }, + { 5, 1.0f }, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B452EC.asm") +static unkstructInvadepoh1 D_80B4EB80[] = { + { 1, 1.0f }, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B453F4.asm") +static unkstructInvadepoh4 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 0x28, 0x3C }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45460.asm") +static unkstructInvadepoh3 D_80B4EB9C = { + 1, + &D_80B4EB38, + 1, + D_80B4EB80, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B454BC.asm") +static unkstructInvadepoh3 D_80B4EBAC = { + 1, + &D_80B4EB40, + 1, + D_80B4EB80, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45518.asm") +static unkstructInvadepoh3 D_80B4EBBC = { + 1, + &D_80B4EB48, + 1, + D_80B4EB80, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45550.asm") +static unkstructInvadepoh3 D_80B4EBCC = { + 1, + &D_80B4EB50, + 1, + D_80B4EB80, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4560C.asm") +static void* D_80B4EBDC[] = { + &D_80B4EB58, &D_80B4EB88, &D_80B4EB9C, &D_80B4EBAC, &D_80B4EBBC, &D_80B4EBCC, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45648.asm") +static s8 D_80B4EBF4[] = { 0 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B456A8.asm") +static unkstructInvadepoh0 D_80B4EBF8 = { D_80B4EBF4, 1 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B457A0.asm") +static unkstructInvadepoh2 D_80B4EC00 = { 0, &D_80B4EBF8 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B458D8.asm") +static void* D_80B4EC08[] = { &D_80B4EC00 }; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45980.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B459E8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45A4C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45A94.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45B1C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45BB8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45C04.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45CE0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B45EC8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46118.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46184.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B461DC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4627C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46414.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46520.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B465CC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46644.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B468B4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B469C4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46A80.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/EnInvadepoh_Init.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46BB0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46BC0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46C08.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46C34.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46C50.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46C7C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46C94.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46CC0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46CF4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46D28.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/EnInvadepoh_Destroy.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46DA8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46DC8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46E20.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46E44.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46EC0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46EE8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46F88.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B46FA8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47064.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47084.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B470E0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47108.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B471C0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B471E0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47248.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47268.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47278.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47298.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47304.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47324.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/EnInvadepoh_Update.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47380.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B473E4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47478.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B474DC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47568.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47600.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4770C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B477B4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47830.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B478F4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47938.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B479E8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47BAC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47D30.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B47FA8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48060.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B481C4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4827C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B482D4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48324.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48374.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B483CC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4843C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B484EC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48588.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48610.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48620.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4873C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B487B4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48848.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48948.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48AD4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48DE4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48E4C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B48FB0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B490F0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B491EC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49228.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B492FC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4934C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49404.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49454.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49628.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49670.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B497A4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B497EC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49904.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4994C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B499BC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49A00.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49B1C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49BD0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49C38.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49DA0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49DFC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B49F88.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A168.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A1B8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A2C0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A350.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A570.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A5E4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A614.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A67C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A7C0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A81C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4A9C8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AB8C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4ABDC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4ACDC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4ACF0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AD3C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AD60.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4ADB8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4ADCC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AEC0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AEDC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AF80.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4AF94.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B024.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B048.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B0C4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B218.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B3DC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B430.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B484.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B510.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B564.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B724.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B768.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B820.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B864.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4B8BC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4BA30.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4BA84.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4BBE0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4BC4C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4BFFC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C058.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C1BC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C218.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C3A0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C568.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C5C0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C6C8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4C730.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CAB0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CB0C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CC70.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CCCC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CE54.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4CFFC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D054.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D15C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D290.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D3E4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D480.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D670.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D760.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D7B8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D9B4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D9D8.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4D9F4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4DB14.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E120.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E158.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E1B0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E200.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E2AC.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E324.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E3F0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E5B0.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E61C.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E660.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E6E4.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E784.asm") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh_0x80B439B0/func_80B4E7BC.asm") +static void (*D_80B4EC0C[])(struct EnInvadePohStruct*, unkstructInvadepoh4** arg1) = { + func_80B45A4C, + func_80B45A94, + func_80B45B1C, +}; + +static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; + +static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; + +static void (*D_80B4EC20[])(struct unkStruct80B50350*) = { func_80B46184 }; + +static InitChainEntry D_80B4EC24[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +}; + +static InitChainEntry sInitChainParentCow[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +}; + +static InitChainEntry sInitChainChildCow[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +}; + +static InitChainEntry sInitChainRomani[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +}; + +static InitChainEntry D_80B4EC68[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape, 0, ICHAIN_CONTINUE), + ICHAIN_F32(minVelocityY, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), +}; + +static InitChainEntry sInitChainDog[] = { + ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 50, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 50, ICHAIN_CONTINUE), + ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_STOP), +}; + +static InitChainEntry sInitChainCremia[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +}; + +static EnInvadepohInitFunc D_80B4ECB0[] = { + func_80B4627C, + EnInvadepoh_InitAlien, + EnInvadepoh_InitParentCow, + EnInvadepoh_InitChildCow, + EnInvadepoh_InitRomani, + EnInvadepoh_InitRomani, + func_80B468B4, + EnInvadepoh_InitRomani, + EnInvadepoh_InitRomani, + EnInvadepoh_InitRomani, + EnInvadepoh_InitDog, + EnInvadepoh_InitCremia, + EnInvadepoh_InitRomani, + EnInvadepoh_InitAlien, +}; + +static EnInvadepohDestroyFunc D_80B4ECE8[] = { + func_80B46BB0, func_80B46BC0, func_80B46C08, func_80B46C34, func_80B46C50, func_80B46C50, func_80B46C7C, + func_80B46C50, func_80B46C50, func_80B46C50, func_80B46C94, func_80B46CC0, func_80B46CF4, func_80B46D28, +}; + +static s16 D_80B4ED20[] = { + 130, 125, 115, 100, 80, 78, 76, 74, +}; + +static Vec3f D_80B4ED30[] = { + { 0.01f, 0.01f, 0.01f }, { 0.02f, 0.01f, 0.005f }, { -0.01f, 0.0f, 0.0f }, + { 0.01f, 0.01f, 0.01f }, { 0.005f, 0.01f, 0.02f }, +}; + +static Vec3f D_80B4ED6C[] = { + { 0.0005f, 0.0279999990016f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { -0.01f, 0.0f, 0.0f }, + { 0.016f, 0.0004f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { 0.0005f, 0.0005f, 0.0005f }, + { 0.0002f, 0.0002f, 0.0002f }, +}; + +static s16 D_80B4EDC0[] = { 0xE0C0, 0xE890, 0xD508 }; + +static s16 D_80B4EDC8[] = { + -1800, + -1000, + 0, + 2000, +}; + +static Vec3f D_80B4EDD0[] = { + { -1813.0f, 374.0f, 1900.0f }, { 2198.0f, 153.0f, 3365.0f }, { -1434.0f, 262.0f, 3365.0f }, + { -393.0f, 396.0f, 1084.0f }, { 0.0f, 1500.0f, 0.0f }, +}; + +static unkstruct80B4EE0C D_80B4EE0C[] = { + { 0.08f, 0x02BC, 0xFFF6 }, + { 0.09f, 0x012C, 0xFFFB }, + { 0.05f, 0x0190, 0x0000 }, +}; + +static Vec3f D_80B4EE24 = { + 2000.0f, + 1000.0f, + 0.0f, +}; + +static Vec3f D_80B4EE30 = { + 400.0f, + 270.0f, + 0.0f, +}; + +MtxF D_80B502A0; +MtxF D_80B502E0; +EnInvadepoh* D_80B50320[8]; +u8 D_80B50340[8]; +UNK_TYPE1 D_80B50348; +unkStruct80B50350 D_80B50350[10]; +EnInvadepoh* D_80B503F0; +EnInvadepoh* D_80B503F4; +EnInvadepoh* D_80B503F8; +AnimatedMaterial* D_80B503FC; +AnimatedMaterial* D_80B50400; +s16 D_80B50404[3]; +EnInvadepoh* D_80B5040C; + +void func_80B439B0(s32 arg0, s32 arg1) { + arg1 -= 0x1AAA; + if (arg1 < 0) { + arg1 = 0; + } + + if (!(arg0 & 1)) { + gSaveContext.roomInf[124][arg0 >> 1] = (gSaveContext.roomInf[124][arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); + } else { + gSaveContext.roomInf[124][arg0 >> 1] = + (gSaveContext.roomInf[124][arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); + } +} + +s32 func_80B43A24(s32 arg0) { + u32 phi_v1; + + if ((arg0 & 1) == 0) { + phi_v1 = gSaveContext.roomInf[124][arg0 >> 1] & 0xFFFF; + } else { + phi_v1 = (gSaveContext.roomInf[124][arg0 >> 1] & 0xFFFF0000) >> 0x10; + } + return phi_v1 + 0x1AAA; +} + +void func_80B43A74(s32 arg0) { + gSaveContext.roomInf[124][4] = (gSaveContext.roomInf[124][4] & ~0xFF) | arg0 & 0xFF; +} + +s32 func_80B43A9C(void) { + return (gSaveContext.roomInf[124][4] >> 0) & 0xFF; +} + +s32 func_80B43AB0(void) { + s32 retVal = func_80B43A9C(); + + if (retVal < 0xC) { + retVal++; + func_80B43A74(retVal); + } + return retVal; +} + +void func_80B43AF0(s32 arg0) { + s32 currentTime = gSaveContext.time; + + if (((CURRENT_DAY == 1) && (currentTime >= CLOCK_TIME(2, 30))) && (currentTime < CLOCK_TIME(5, 15))) { + s32 adjustment = (0xC - func_80B43A9C()) * 25.0f; + + func_80B439B0(arg0, currentTime + adjustment); + } +} + +s32 func_80B43B80(EnInvadepoh* this) { + s32 i; + s32 temp = this->endPoint - 1; + + for (i = 0; i < temp; i++) { + if (this->unk37C[i] > this->clockTime) { + break; + } + } + + return i; +} + +void func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { + s32 temp_s5 = this->endPoint; + f32 pathTotalDistInv = 1.0f / this->pathTotalDist; + Vec3s* phi_s0 = &this->pathPoints[1]; + Vec3s* phi_s1 = &this->pathPoints[0]; + f32 new_var; + Vec3f sp70; + s32 phi_s2; + f32 temp_f0; + f32 temp_f12; + f32 temp_f14; + f32 temp_f6; + f32 phi_f20 = 0.0f; + f32 phi_f24 = 0.0f; + + for (phi_s2 = 0; phi_s2 < temp_s5; phi_s2++) { + sp70.x = phi_s0->x - phi_s1->x; + sp70.y = phi_s0->y - phi_s1->y; + sp70.z = phi_s0->z - phi_s1->z; + new_var = Math3D_Vec3fMagnitude(&sp70); + temp_f14 = phi_f20 + new_var; + temp_f12 = temp_f14 * pathTotalDistInv; + + if (this->clockTime <= temp_f12) { + temp_f6 = temp_f12 - phi_f24; + *arg1 = phi_s2; + temp_f0 = (this->clockTime - phi_f24) / temp_f6; + arg2->x = (temp_f0 * sp70.x) + phi_s1->x; + arg2->y = (temp_f0 * sp70.y) + phi_s1->y; + arg2->z = (temp_f0 * sp70.z) + phi_s1->z; + return; + } + + phi_s1 = phi_s0; + phi_s0++; + phi_f20 = temp_f14; + phi_f24 = temp_f12; + } + + *arg1 = temp_s5; + arg2->x = this->pathPoints[temp_s5].x; + arg2->y = this->pathPoints[temp_s5].y; + arg2->z = this->pathPoints[temp_s5].z; +} + +void func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { + s32 pad; + Vec3s* arr = &this->pathPoints[this->pathIndex]; + s32 pad2; + Vec3f sp30; + Vec3f sp24; + + if (this->pathIndex != this->endPoint) { + Math_Vec3s_ToVec3f(&sp30, &arr[0]); + Math_Vec3s_ToVec3f(&sp24, &arr[1]); + Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); + } +} + +void func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { + s32 pad; + Vec3s* arr = &this->pathPoints[this->pathIndex]; + s32 pad2; + Vec3f sp38; + Vec3f sp2C; + + if (this->pathIndex != this->endPoint) { + Math_Vec3s_ToVec3f(&sp38, &arr[0]); + Math_Vec3s_ToVec3f(&sp2C, &arr[1]); + Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp38, &sp2C), arg1, arg2, arg3); + } +} + +void func_80B43F0C(EnInvadepoh* this) { + s32 pad; + Vec3s* arr = &this->pathPoints[this->pathIndex]; + s32 pad2; + Vec3f sp28; + Vec3f sp1C; + + Math_Vec3s_ToVec3f(&sp28, &arr[0]); + Math_Vec3s_ToVec3f(&sp1C, &arr[1]); + this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp28, &sp1C); +} + +f32 EnInvadepoh_GetTotalPathLength(EnInvadepoh* this) { + f32 distance; + s32 pad; + Vec3f sp54; + Vec3f pathPointF; + Vec3s* pathPoint; + f32 totalDistance; + s32 i; + s32 temp_s4; + + temp_s4 = this->endPoint + 1; + pathPoint = this->pathPoints; + totalDistance = 0.0f; + Math_Vec3s_ToVec3f(&pathPointF, pathPoint); + pathPoint++; + for (i = 1; i < temp_s4; i++) { + Math_Vec3f_Copy(&sp54, &pathPointF); + Math_Vec3s_ToVec3f(&pathPointF, pathPoint); + distance = Math3D_Distance(&sp54, &pathPointF); + pathPoint++; + totalDistance += distance; + } + + return totalDistance; +} + +void func_80B44024(EnInvadepoh* this, GlobalContext* globalCtx) { + Path* path = &globalCtx->setupPathList[(this->actor.params >> 8) & 0x7F]; + + this->endPoint = path->count - 1; + this->pathPoints = Lib_SegmentedToVirtual(path->points); +} + +void EnInvadepoh_SetPathPointToWorldPos(EnInvadepoh* this, s32 pathIndex) { + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[pathIndex]); +} + +s32 func_80B440B8(EnInvadepoh* this, f32 arg1, f32 arg2) { + Vec3s* temp_a3 = &this->pathPoints[this->pathIndex + 1]; + Vec3s* sp48 = &this->pathPoints[this->pathIndex]; + f32 new_var; + f32 sp40; + f32 sp3C; + f32 sp38; + f32 sp34; + f32 sp30; + f32 sp2C; + f32 temp_f12_2; + s32 pad1; + s32 pad2; + s16 sp1E; + + if (this->pathIndex >= this->endPoint) { + return false; + } + + sp40 = temp_a3->x - sp48->x; + sp3C = temp_a3->z - sp48->z; + sp1E = Math_FAtan2F(sp3C, sp40); + sp38 = Math_CosS(sp1E); + sp34 = Math_SinS(sp1E); + sp30 = this->actor.world.pos.x - sp48->x; + sp2C = this->actor.world.pos.z - sp48->z; + + if ((arg1 - arg2) < fabsf((sp30 * sp38) - (sp2C * sp34))) { + return false; + } + + temp_f12_2 = (sp2C * sp38) + (sp30 * sp34); + new_var = Math3D_XZLength(sp40, sp3C); + + if ((temp_f12_2 < 0.0f) || (new_var < temp_f12_2)) { + return false; + } + + return true; +} + +s32 func_80B44234(EnInvadepoh* this, Vec3f* vec) { + f32 distance; + s8 temp_s3 = this->endPoint; + f32 min = FLT_MAX; + Vec3f sp48; + s32 i; + s32 ret = 0; + Vec3s* arr; + + for (i = 0, arr = this->pathPoints; i < temp_s3; i++, arr++) { + Math_Vec3s_ToVec3f(&sp48, arr); + distance = Math3D_DistanceSquared(&sp48, vec); + if (distance < min) { + min = distance; + ret = i; + } + } + + return ret; +} + +void func_80B442E4(EnInvadepoh* this) { + s32 pad; + s32 sp18 = gSaveContext.time; + s32 temp_v1_2 = sp18 - func_80B43A24(this->actor.params & 7); + + if (D_80B4E940 == 1) { + this->clockTime = 0.0f; + } else if (D_80B4E940 == 2) { + if (temp_v1_2 < 0) { + this->clockTime = 0.0f; + } else { + this->clockTime = temp_v1_2 * 0.00027777779f; + if (this->clockTime > 1.0f) { + this->clockTime = 1.0f; + } + } + } + + this->pathIndex = func_80B43B80(this); +} + +void func_80B443A0(EnInvadepoh* this) { + f32 pathTotalDistInv; + s8 temp_s5; + Vec3s* phi_s1; + Vec3f sp70; + Vec3f sp64; + f32* phi_s0; + f32 phi_f20; + s32 i; + + temp_s5 = this->endPoint; + pathTotalDistInv = 1.0f / this->pathTotalDist; + phi_f20 = 0.0f; + phi_s1 = this->pathPoints; + Math_Vec3s_ToVec3f(&sp64, phi_s1); + phi_s1++; + phi_s0 = this->unk37C; + + for (i = 1; i < temp_s5; i++, phi_s1++, phi_s0++) { + Math_Vec3f_Copy(&sp70, &sp64); + Math_Vec3s_ToVec3f(&sp64, phi_s1); + phi_f20 += Math3D_Distance(&sp70, &sp64); + *phi_s0 = phi_f20 * pathTotalDistInv; + if (*phi_s0 < 0.0f) { + *phi_s0 = 0.0f; + } else if (*phi_s0 > 1.0f) { + *phi_s0 = 1.0f; + } + } +} + +void func_80B444BC(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); + this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); + func_80B443A0(this); +} + +void func_80B444F4(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); +} + +void func_80B44514(EnInvadepoh* this) { + this->pathIndex++; + if (this->pathIndex >= this->endPoint) { + this->pathIndex = 0; + } +} + +void func_80B44540(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); + this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); +} + +void func_80B44570(EnInvadepoh* this) { + s32 currentTime = gSaveContext.time; + + if ((currentTime < CLOCK_TIME(2, 0)) || (currentTime >= CLOCK_TIME(6, 0))) { + this->clockTime = 0.0f; + } else if ((currentTime >= CLOCK_TIME(2, 15)) && (currentTime < CLOCK_TIME(6, 0))) { + this->clockTime = 1.0f; + } else { + f32 new_var = (currentTime - 0x1555) * 0.0014641288f; + + this->clockTime = new_var; + this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); + } +} + +void func_80B44620(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); +} + +void func_80B44640(EnInvadepoh* this) { + if (this->pathIndex < this->endPoint) { + this->pathIndex++; + } +} + +void func_80B44664(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); + this->direction = DIRECTION_FORWARD; +} + +void func_80B44690(EnInvadepoh* this) { + this->pathIndex += this->direction; + if (this->pathIndex >= this->endPoint) { + this->pathIndex = 0; + } else if (this->pathIndex < 0) { + this->pathIndex = this->endPoint - 1; + } +} + +void func_80B446D0(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44024(this, globalCtx); + this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); +} + +void func_80B44700(EnInvadepoh* this) { + s32 currentTime = gSaveContext.time; + s32 new_var4 = 0xFFFF2AAB; + + if ((currentTime < CLOCK_TIME(20, 0)) && (currentTime >= CLOCK_TIME(6, 0))) { + this->clockTime = 0.0f; + } else if ((currentTime > 0xD7E0) || (currentTime < CLOCK_TIME(6, 0))) { + this->clockTime = 1.0f; + } else { + f32 new_var = 0.00153374229558f; + this->clockTime = (currentTime + new_var4) * new_var; + this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); + } +} + +void func_80B447C0(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad1; + Vec3s* sp60; + s32 pad2; + Vec3f sp50; + Vec3f sp44; + f32 sp40 = this->actor.world.pos.y; + f32 sp3C; + s32 pad3; + f32 sp34; + f32 sp30; + f32 sp2C; + f32 phi_f2; + + sp60 = &this->pathPoints[this->pathIndex]; + if (this->pathIndex <= 0) { + sp3C = 0.0f; + } else { + sp3C = this->unk37C[this->pathIndex - 1]; + } + + if (this->pathIndex < (this->endPoint - 1)) { + phi_f2 = this->unk37C[this->pathIndex]; + } else { + phi_f2 = 1.0f; + } + + if ((phi_f2 - sp3C) < 0.001f) { + Math_Vec3s_ToVec3f(&this->curPathPos, sp60); + } else { + sp34 = this->clockTime - sp3C; + sp30 = phi_f2 - this->clockTime; + sp2C = 1.0f / (phi_f2 - sp3C); + Math_Vec3s_ToVec3f(&sp50, &sp60[0]); + Math_Vec3s_ToVec3f(&sp44, &sp60[1]); + this->curPathPos.x = ((sp50.x * sp30) + (sp44.x * sp34)) * sp2C; + this->curPathPos.y = ((sp50.y * sp30) + (sp44.y * sp34)) * sp2C; + this->curPathPos.z = ((sp50.z * sp30) + (sp44.z * sp34)) * sp2C; + } + + Math_Vec3f_Copy(&this->actor.world.pos, &this->curPathPos); + func_800B4AEC(globalCtx, &this->actor, 0.0f); + if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { + if (sp40 < this->actor.floorHeight) { + if (this->actor.velocity.y < 0.0f) { + this->actor.velocity.y = 0.0f; + } else { + this->actor.velocity.y += 2.0f; + this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 30.0f); + } + this->actor.world.pos.y = this->actor.velocity.y + sp40; + if (this->actor.world.pos.y > this->actor.floorHeight) { + this->actor.world.pos.y = this->actor.floorHeight; + } + } else { + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } else { + this->actor.velocity.y -= 2.0f; + } + + this->actor.world.pos.y = this->actor.velocity.y + sp40; + if (this->actor.world.pos.y < this->actor.floorHeight) { + this->actor.world.pos.y = this->actor.floorHeight; + this->actor.velocity.y = CLAMP_MIN(this->actor.velocity.y, -30.0f); + } + } + } else { + this->actor.world.pos.y = sp40; + } +} + +void func_80B44A90(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actor.bgCheckFlags & 1) { + this->actor.velocity.y *= 0.3f; + this->actor.speedXZ *= 0.8f; + } else if (this->actor.bgCheckFlags & 8) { + this->actor.velocity.y *= 0.8f; + this->actor.speedXZ *= 0.3f; + } else { + this->actor.velocity.y *= 0.8f; + this->actor.speedXZ *= 0.8f; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 40.0f, 0.0f, 5); +} + +void func_80B44B78(EnInvadepoh* this) { +} + +s32 func_80B44B84(EnInvadepoh* this, GlobalContext* globalCtx, f32 speed, f32 arg3) { + s32 pad; + Vec3s* pathPoint = &this->pathPoints[this->pathIndex + 1]; + s32 retVal = func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, pathPoint->x, pathPoint->z, speed); + + func_800B4AEC(globalCtx, &this->actor, arg3); + func_80B4516C(this); + return retVal; +} + +void func_80B44C24(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + f32 worldPosY = this->actor.world.pos.y; + + func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); + this->actor.world.pos.y = worldPosY; + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); +} + +s32 func_80B44C80(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad[6]; + Vec3s* temp_a2 = &this->pathPoints[this->pathIndex]; + f32 temp_f0; + Vec3f sp6C; + Vec3f sp60; + f32 temp_f0_2; + Vec3s* temp_v0_2; + f32 temp_f0_3; + f32 temp_f12; + f32 temp_f2; + f32 temp_f14; + f32 sp44; + s32 sp40 = 0; + s32 temp_v1 = this->pathIndex + this->direction; + s32 phi_v0; + + if (temp_v1 >= this->endPoint) { + temp_v1 = 0; + } else if (temp_v1 < 0) { + temp_v1 = this->endPoint - 1; + } + + temp_v0_2 = &this->pathPoints[temp_v1]; + + temp_f0 = temp_a2->x; + temp_f2 = temp_a2->z; + temp_f12 = temp_v0_2->x; + temp_f14 = temp_v0_2->z; + sp6C.x = temp_f12 - temp_f0; + sp6C.y = 0.0f; + sp6C.z = temp_f14 - temp_f2; + sp60.x = temp_f12 - this->actor.world.pos.x; + sp60.y = 0.0f; + sp60.z = temp_f14 - this->actor.world.pos.z; + temp_f0_3 = temp_f0 - this->actor.world.pos.x; + temp_f0_2 = temp_f2 - this->actor.world.pos.z; + + if (this->actor.speedXZ > 0.0f) { + if (Math3D_AngleBetweenVectors(&sp6C, &sp60, &sp44) != 0) { + sp40 = 1; + } else if (sp44 <= 0.0f) { + sp40 = 1; + } + } + + Math_SmoothStepToS(&this->actor.world.rot.y, + Math_FAtan2F(((sp60.z + temp_f0_2) * 0.9f) + sp6C.z, ((sp60.x + temp_f0_3) * 0.9f) + sp6C.x), 4, + 0xFA0, 0x64); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (func_80B440B8(this, 50.0f, 15.0f)) { + phi_v0 = 4; + } else { + phi_v0 = 5; + } + + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 0.0f, phi_v0); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); + return sp40; +} + +void func_80B44E90(EnInvadepoh* this, GlobalContext* globalCtx) { + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 0.0f, 5); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); +} + +void func_80B44EFC(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + f32 worldPosY = this->actor.world.pos.y; + + func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); + this->actor.world.pos.y = worldPosY; + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); +} + +void func_80B44F58(void) { + s32 i; + Gfx** iter; + + if (!D_80B4E968) { + D_80B4E968 = true; + for (i = 0, iter = D_80B4E944; i < ARRAY_COUNT(D_80B4E944); i++, iter++) { + *iter = Lib_SegmentedToVirtual(*iter); + } + + for (i = 0, iter = D_80B4E958; i < ARRAY_COUNT(D_80B4E958); i++, iter++) { + *iter = Lib_SegmentedToVirtual(*iter); + } + } +} + +void func_80B44FEC(void) { + s32 i; + Gfx** iter; + + if (!D_80B4E994) { + D_80B4E994 = true; + for (i = 0, iter = D_80B4E96C; i < ARRAY_COUNT(D_80B4E96C); i++, iter++) { + *iter = Lib_SegmentedToVirtual(*iter); + } + + for (i = 0, iter = D_80B4E984; i < ARRAY_COUNT(D_80B4E984); i++, iter++) { + *iter = Lib_SegmentedToVirtual(*iter); + } + } +} + +void func_80B45080(void) { + D_80B50400 = Lib_SegmentedToVirtual(&D_06000560); + D_80B503FC = Lib_SegmentedToVirtual(&D_06000550); +} + +s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed) { + f32 deltaX = x2 - *x1; + f32 deltaZ = z2 - *z1; + f32 temp_f0 = Math3D_XZLength(deltaX, deltaZ); + + if (speed < temp_f0) { + f32 temp_f2 = speed / temp_f0; + *x1 += (temp_f2 * deltaX); + *z1 += (temp_f2 * deltaZ); + return false; + } else { + *x1 = x2; + *z1 = z2; + return true; + } +} + +s32 func_80B4516C(EnInvadepoh* this) { + if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { + this->actor.world.pos.y = this->actor.floorHeight; + return true; + } + return false; +} + +void func_80B451A0(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 currentTime; + s32 temp_v0_2; + s32 i; + s32 phi_s1_3; + + if (D_80B4E940 == 0) { + if (CURRENT_DAY <= 0) { + D_80B4E940 = 1; + } else if (CURRENT_DAY == 1) { + currentTime = gSaveContext.time; + if ((currentTime < CLOCK_TIME(2, 30)) || (currentTime >= CLOCK_TIME(6, 0))) { + D_80B4E940 = 1; + } else if (currentTime < CLOCK_TIME(5, 15)) { + phi_s1_3 = CLOCK_TIME(5, 15); + for (i = 0; i < this->unk379; i++) { + temp_v0_2 = func_80B43A24(i); + if (temp_v0_2 < phi_s1_3) { + phi_s1_3 = temp_v0_2; + } + } + + if (currentTime < (phi_s1_3 + 0xE11)) { + D_80B4E940 = 2; + } + + if (i) {} // required + } + } + + if (D_80B4E940 == 0) { + if (gSaveContext.weekEventReg[22] & 1) { + D_80B4E940 = 3; + } else { + D_80B4E940 = 4; + } + } + } +} + +void func_80B452EC(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 phi_s2 = (this->actor.params >> 8) & 0x7F; + s32 i; + + for (i = 0; i < this->unk379; i++) { + D_80B50320[i] = (EnInvadepoh*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + (i & 7) | ((phi_s2 << 8) & 0x7F00) | 0x10); + if (phi_s2 != 0xFF) { + Path* path = &globalCtx->setupPathList[phi_s2]; + phi_s2 = path->unk1; + } + } +} + +void func_80B453F4(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { + Actor_SpawnWithParent(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, + this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); +} + +void func_80B45460(EnInvadepoh* this, GlobalContext* globalCtx) { + Actor_SpawnWithParent(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, + this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x40); +} + +void func_80B454BC(EnInvadepoh* this, GlobalContext* globalCtx) { + D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x60); +} + +void EnInvadepoh_SetSysMatrix(Vec3f* vec) { + MtxF* sysMatrix = SysMatrix_GetCurrentState(); + + sysMatrix->wx = vec->x; + sysMatrix->wy = vec->y; + sysMatrix->wz = vec->z; +} + +s32 func_80B45550(EnInvadepoh* this, GlobalContext* globalCtx, f32 range, s32 arg3) { + s32 pad; + Actor* actorIterator = globalCtx->actorCtx.actorList[ACTORCAT_DOOR].first; + s32 retVal = false; + + while (actorIterator != NULL) { + if ((actorIterator->id == ACTOR_EN_DOOR) && (actorIterator->update != NULL) && + (actorIterator->room == this->actor.room) && + Math3D_DistanceSquared(&actorIterator->world.pos, &this->actor.world.pos) < range) { + ((EnDoor*)actorIterator)->unk1A7 = arg3; + retVal = true; + break; + } + actorIterator = actorIterator->next; + } + return retVal; +} + +void EnInvadepoh_SetTextID(EnInvadepoh* this, GlobalContext* globalCtx, u16 arg2) { + this->textId = arg2; + func_801518B0(globalCtx, arg2 & 0xFFFF, &this->actor); +} + +void func_80B45648(EnInvadepoh* this) { + s32 i; + s16 cs = this->actor.cutscene; + + for (i = 0; i < 3; i++) { + D_80B50404[i] = cs; + cs = ActorCutscene_GetAdditionalCutscene(cs); + } +} + +s32 func_80B456A8(GlobalContext* globalCtx, Vec3f* vec) { + Vec3f multDest; + f32 wDest; + + func_800B4EDC(globalCtx, vec, &multDest, &wDest); + if (((multDest.z > 1.0f) && (fabsf(multDest.x * wDest) < 1.0f)) && (fabsf(multDest.y * wDest) < 1.0f)) { + s32 wX = (multDest.x * wDest * 160.0f) + 160.0f; + s32 wY = (multDest.y * wDest * -120.0f) + 120.0f; + s32 wZ = (s32)(multDest.z * wDest * 16352.0f) + 0x3FE0; + s32 zBuf = func_80178A94(wX, wY); + if (wZ < zBuf) { + return true; + } + } + + return false; +} + +void func_80B457A0(EnInvadepoh* this) { + f32 distanceSquared; + f32 phi_f20 = FLT_MAX; + s32 i; + s32 phi_s5 = -1; + + for (i = 0; i < this->unk379; i++) { + if ((D_80B50320[i] != NULL) && D_80B50320[i]->drawAlien) { + distanceSquared = Math3D_DistanceSquared(&D_80B50320[i]->actor.world.pos, &this->actor.world.pos); + if (distanceSquared < phi_f20) { + phi_f20 = distanceSquared; + phi_s5 = i; + } + } + D_80B50340[i] &= ~2; + } + + D_80B50348 = 0; + if (phi_f20 <= SQ(2000.0f)) { + D_80B50340[phi_s5] |= 2; + if (phi_f20 <= SQ(340.0f)) { + D_80B50348 = 1; + } + } +} + +EnInvadepoh* func_80B458D8(void) { + s32 i; + + for (i = 0; i < 8; i++) { + if (D_80B50340[i] & 2) { + return D_80B50320[i]; + } + } + + return NULL; +} + +s8 func_80B45980(unkstructInvadepoh1* arg0, s32 arg1) { + f32 rand = Rand_ZeroOne(); + s32 i; + + arg1--; + for (i = 0; i < arg1; i++) { + dummy:; + if (arg0[i].unk04 >= rand) { + break; + } + } + + return (arg0 + i)->unk00; +} + +void func_80B459E8(EnInvadePohStruct* s, unkstructInvadepoh4* u) { + s->unk4 = u->unk00; + s->unk8 = u; + s->unkE = 0; + s->unkF = *u->unk04->unk00; + if (s->unk4 == 2) { + s->unkC = Rand_S16Offset(u->unk10, u->unk12); + } +} + +void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { + unkstructInvadepoh4* new_var = s->unk8; + unkstructInvadepoh0* temp_v1 = new_var->unk04; + + if (s->unkE < (temp_v1->unk04 - 1)) { + s->unkE++; + s->unkF = temp_v1->unk00[s->unkE]; + } +} + +void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u) { + unkstructInvadepoh0* temp_v1 = s->unk8->unk04; + unkstructInvadepoh1* temp_a0; + + if (s->unkE < (temp_v1->unk04 - 1)) { + s->unkE++; + s->unkF = temp_v1->unk00[s->unkE]; + } else { + func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); + } +} + +void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { + unkstructInvadepoh0* temp_v1 = s->unk8->unk04; + unkstructInvadepoh1* temp_a0; + + if (s->unkE < (temp_v1->unk04 - 1)) { + s->unkE++; + s->unkF = temp_v1->unk00[s->unkE]; + } else if (s->unkC > 0) { + s->unkC--; + } else { + func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); + } +} + +void func_80B45BB8(EnInvadePohStruct* s) { + if ((s->unk0 != 0) && (s->unk8 != 0)) { + D_80B4EC0C[s->unk4](s, (unkstructInvadepoh4**)s->unk0); + } +} + +void func_80B45C04(AlienBehaviorInfo* substruct, void* arg1[], s32 arg2, void* arg3[], s32 arg4, Vec3s* arg5, s16 arg6, + f32 arg7, f32 arg8, f32 arg9) { + unkstructInvadepoh4* temp_v0; + + Math_Vec3s_Copy(&substruct->unk26, arg5); + substruct->unk2C = arg6; + substruct->unk30 = arg7; + substruct->unk38 = arg8; + substruct->unk3C = arg9; + if (arg1 != NULL) { + temp_v0 = arg1[arg2]; + substruct->unk0.unk0 = (unkstructInvadepoh4*)arg1; + substruct->unk0.unk4 = temp_v0->unk00; + substruct->unk0.unkC = 0; + substruct->unk0.unkE = 0; + substruct->unk0.unk8 = temp_v0; + substruct->unk0.unkF = *temp_v0->unk04->unk00; + } + if (arg3 != NULL) { + temp_v0 = arg3[arg4]; + substruct->unk10.unk0 = (unkstructInvadepoh4*)arg3; + substruct->unk10.unk4 = temp_v0->unk00; + substruct->unk10.unkC = 0; + substruct->unk10.unkE = 0; + substruct->unk10.unk8 = temp_v0; + substruct->unk10.unkF = *temp_v0->unk04->unk00; + } +} + +void func_80B45CE0(AlienBehaviorInfo* substruct) { + Vec3f sp3C; + Vec3s sp34; + s16 step; + + sp34.x = substruct->unk26.x - substruct->unk20.x; + sp34.y = substruct->unk26.y - substruct->unk20.y; + sp34.z = substruct->unk26.z - substruct->unk20.z; + Math_Vec3s_ToVec3f(&sp3C, &sp34); + Math_Vec3f_Scale(&sp3C, substruct->unk30); + Math_Vec3f_ToVec3s(&sp34, &sp3C); + sp34.x = ABS(sp34.x); + sp34.y = ABS(sp34.y); + sp34.z = ABS(sp34.z); + sp34.x = CLAMP_MAX(sp34.x, substruct->unk2C); + sp34.y = CLAMP_MAX(sp34.y, substruct->unk2C); + sp34.z = CLAMP_MAX(sp34.z, substruct->unk2C); + Math_ScaledStepToS(&substruct->unk20.x, substruct->unk26.x, sp34.x); + Math_ScaledStepToS(&substruct->unk20.y, substruct->unk26.y, sp34.y); + Math_ScaledStepToS(&substruct->unk20.z, substruct->unk26.z, sp34.z); + Math_StepToF(&substruct->unk34, substruct->unk38, substruct->unk3C); + + if (substruct->unk40 != substruct->unk42) { + step = substruct->unk42 - substruct->unk40; + step *= substruct->unk44; + step = ABS(step); + step = CLAMP(step, 100, substruct->unk48); + Math_ScaledStepToS(&substruct->unk40, substruct->unk42, step); + } + func_80B45BB8(&substruct->unk0); + func_80B45BB8(&substruct->unk10); +} + +void func_80B45EC8(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { + s16 phi_s0 = 0; + Vec3f spA8; + Vec3f sp9C; + Vec3f sp90; + f32 temp_f20; + s32 i; + + for (i = 0; i < arg2; i++) { + phi_s0 += (s16)(65536.0f / arg2); + + temp_f20 = (Rand_ZeroOne() * 0.5f) + 0.5f; + spA8.x = Math_SinS(phi_s0) * temp_f20; + spA8.z = Math_CosS(phi_s0) * temp_f20; + + sp9C.x = ((Rand_ZeroOne() * 16.0f) + (spA8.x * 30.0f)) - 8.0f; + sp9C.y = -8.0f; + sp9C.z = ((Rand_ZeroOne() * 16.0f) + (spA8.z * 30.0f)) - 8.0f; + + sp90.x = sp9C.x * -0.025f; + sp90.y = sp9C.y * -0.025f; + sp90.z = sp9C.z * -0.025f; + + spA8.x = (spA8.x * 100.0f) + this->actor.world.pos.x; + spA8.y = ((Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y) - 90.0f; + spA8.z = (spA8.z * 100.0f) + this->actor.world.pos.z; + + EffectSsKiraKira_SpawnDispersed(globalCtx, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); + } +} + +s32 func_80B46118(Vec3f* actorPos) { + unkStruct80B50350* phi_v1; + s32 i; + + for (phi_v1 = D_80B50350, i = 0; i < 10; phi_v1++, i++) { + if (phi_v1->unk1 <= 0) { + phi_v1->unk0 = 0; + phi_v1->unk1 = 40; + Math_Vec3f_Copy(&phi_v1->unk4, actorPos); + phi_v1->unk2 = 0; + return true; + } + } + return false; +} + +void func_80B46184(unkStruct80B50350* unkStruct) { + if (unkStruct->unk1 > 20) { + if (unkStruct->unk2 < 125) { + unkStruct->unk2 += 10; + } else { + unkStruct->unk2 = 135; + } + } else if (unkStruct->unk2 > 13) { + unkStruct->unk2 -= 13; + + } else { + unkStruct->unk2 = 0; + } +} + +s32 func_80B461DC(void) { + s32 phi_s4 = false; + unkStruct80B50350* phi_s0; + s32 i; + + for (phi_s0 = D_80B50350, i = 0; i < 10; phi_s0++, i++) { + if (phi_s0->unk1 > 0) { + D_80B4EC20[phi_s0->unk0](phi_s0); + phi_s0->unk1--; + phi_s4 = true; + } + } + return phi_s4; +} + +void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 invadepohType; + s32 i; + + this->actor.flags |= 0x20; + invadepohType = (this->actor.params >> 8) & 0x7F; + + for (i = 1; i < 8; i++) { + Path* path = &globalCtx->setupPathList[invadepohType]; + invadepohType = path->unk1; + if (invadepohType == 0xFF) { + break; + } + } + + this->unk379 = i; + func_80B451A0(this, globalCtx); + func_80B45648(this); + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_SWITCH); + + if (D_80B4E940 == 1) { + func_80B46DA8(this); + } else if (D_80B4E940 == 2) { + if (gSaveContext.time < CLOCK_TIME(2, 31)) { + func_80B46DA8(this); + } else { + func_80B454BC(this, globalCtx); + func_80B452EC(this, globalCtx); + func_801A89A8(0x800D); + func_80B46F88(this); + } + } else if (D_80B4E940 == 3) { + if (gSaveContext.entranceIndex == 0x6460) { + func_80B471C0(this); + + } else if (gSaveContext.entranceIndex == 0x6470) { + func_80B47248(this); + } else { + func_80B47248(this); + } + } else if (D_80B4E940 == 4) { + func_80B47304(this); + } +} + +void EnInvadepoh_InitAlien(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Actor_ProcessInitChain(&this->actor, D_80B4EC24); + Collider_InitCylinder(globalCtx, &this->collider); + ActorShape_Init(&this->actor.shape, 6800.0f, func_800B4088, 150.0f); + this->actor.shape.shadowAlpha = 140; + this->actor.flags = 0x80001010; + if (INVADEPOH_TYPE(this) == TYPE_ALIEN1) { + this->actor.update = func_80B4D670; + this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; + } else { + this->actor.update = func_80B47BAC; + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitAlien); + this->actor.colChkInfo.mass = 0x28; + } + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_UCH); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_InitParentCow(EnInvadepoh* this, GlobalContext* globalCtx) { + Actor_ProcessInitChain(&this->actor, sInitChainParentCow); + this->actor.update = func_80B47FA8; + Actor_SpawnWithParent(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, + 0x30); + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_COW); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_InitChildCow(EnInvadepoh* this, GlobalContext* globalCtx) { + Actor_ProcessInitChain(&this->actor, sInitChainChildCow); + this->actor.update = func_80B481C4; + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_COW); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + s32 temp = INVADEPOH_TYPE(this); + + Actor_ProcessInitChain(&this->actor, sInitChainRomani); + + this->actor.targetMode = (temp == 7 || temp == 0xC) ? 3 : 6; + + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + Collider_InitCylinder(globalCtx, &this->collider); + if (temp != 4) { + ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 18.0f); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + } + if (temp == 4) { + this->actor.update = func_80B48620; + } else if (temp == 5) { + this->actor.update = func_80B48FB0; + this->actor.flags = 0x19; + } else if (temp == 7) { + this->actor.update = func_80B49F88; + } else if (temp == 8) { + this->actor.update = func_80B4A9C8; + } else if (temp == 9) { + this->actor.update = func_80B4B0C4; + } else { + this->actor.update = func_80B4CE54; + } + + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MA1); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } + if (temp == 5) { + if (gSaveContext.weekEventReg[22] & 0x1) { + Actor_MarkForDeath(&this->actor); + return; + } + } else if (temp == 7) { + if (gSaveContext.time < CLOCK_TIME(6, 0) && gSaveContext.time >= CLOCK_TIME(2, 15)) { + Actor_MarkForDeath(&this->actor); + return; + } + } else if (temp != 8) { + if (temp == 9) { + if (gSaveContext.entranceIndex != 0x6460) { + Actor_MarkForDeath(&this->actor); + return; + } + } else if (temp == 0xC) { + if (!(gSaveContext.weekEventReg[22] & 0x1)) { + Actor_MarkForDeath(&this->actor); + } + D_80B503F4 = this; + } + } +} + +void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx) { + Actor_ProcessInitChain(&this->actor, D_80B4EC68); + this->actor.update = func_80B49B1C; + this->actor.draw = func_80B4E3F0; + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + if (D_80B4E940 == 1 || gSaveContext.time < CLOCK_TIME(2, 31)) { + this->actor.world.pos.x += D_80B4E934.x; + this->actor.world.pos.y += D_80B4E934.y + 3000.0f; + this->actor.world.pos.z += D_80B4E934.z; + func_80B491EC(this); + } else if (D_80B4E940 == 2) { + this->actor.world.pos.y += 1500.0f; + func_80B49628(this); + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_InitDog(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Actor_ProcessInitChain(&this->actor, sInitChainDog); + this->actor.update = func_80B4B8BC; + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitDog); + this->actor.colChkInfo.mass = 0x50; + ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 24.0f); + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DOG); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Actor_ProcessInitChain(&this->actor, sInitChainCremia); + this->actor.update = func_80B4C3A0; + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); + this->actor.colChkInfo.mass = MASS_HEAVY; + ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 18.0f); + this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MA2); + if (this->bankIndex < 0) { + Actor_MarkForDeath(&this->actor); + } + if (!(gSaveContext.weekEventReg[0x16] & 1)) { + Actor_MarkForDeath(&this->actor); + } + D_80B503F8 = this; +} + +void EnInvadepoh_Init(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + D_80B4ECB0[INVADEPOH_TYPE(this)](this, globalCtx); +} + +void func_80B46BB0(EnInvadepoh* this, GlobalContext* globalCtx) { +} + +void func_80B46BC0(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + s32 invadepohType = this->actor.params & 7; + + Collider_DestroyCylinder(globalCtx, &this->collider); + D_80B50320[invadepohType] = 0; +} + +void func_80B46C08(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actor.parent != NULL) { + this->actor.parent->child = NULL; + } + + if (this->actor.child != NULL) { + this->actor.child->parent = NULL; + } +} + +void func_80B46C34(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actor.parent != NULL) { + this->actor.parent->child = NULL; + } +} + +void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx) { + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80B46C7C(EnInvadepoh* this, GlobalContext* globalCtx) { + D_80B503F0 = NULL; +} + +void func_80B46C94(EnInvadepoh* this, GlobalContext* globalCtx) { + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80B46CC0(EnInvadepoh* this, GlobalContext* globalCtx) { + Collider_DestroyCylinder(globalCtx, &this->collider); + D_80B503F8 = NULL; +} + +void func_80B46CF4(EnInvadepoh* this, GlobalContext* globalCtx) { + Collider_DestroyCylinder(globalCtx, &this->collider); + D_80B503F4 = NULL; +} + +void func_80B46D28(EnInvadepoh* this, GlobalContext* globalCtx) { + Collider_DestroyCylinder(globalCtx, &this->collider); + if (!this) {} // required to match + if (this->actor.child != NULL) { + this->actor.child->parent = NULL; + } +} + +void EnInvadepoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + D_80B4ECE8[INVADEPOH_TYPE(this)](this, globalCtx); +} + +void func_80B46DA8(EnInvadepoh* this) { + D_80B4E940 = 1; + this->actionFunc = func_80B46DC8; +} + +void func_80B46DC8(EnInvadepoh* this, GlobalContext* globalCtx) { + if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 30))) { + func_80B454BC(this, globalCtx); + func_80B452EC(this, globalCtx); + func_80B46E20(this); + } +} + +void func_80B46E20(EnInvadepoh* this) { + D_80B4E940 = 2; + this->actionTimer = 2; + this->actionFunc = func_80B46E44; +} + +void func_80B46E44(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actionTimer > 0) { + this->actionTimer--; + } else if (ActorCutscene_GetCanPlayNext(D_80B50404[0])) { + ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[0], &this->actor); + func_80B46EC0(this); + } else { + ActorCutscene_SetIntentToPlay(D_80B50404[0]); + } +} + +void func_80B46EC0(EnInvadepoh* this) { + D_80B4E940 = 2; + this->actionTimer = 160; + this->actionFunc = func_80B46EE8; +} + +void func_80B46EE8(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 i; + + for (i = 0; i < 8; i++) { + if (this->actionTimer == D_80B4ED20[i]) { + D_80B50340[i] |= 1; + } + } + + this->actionTimer--; + if (this->actionTimer <= 0) { + ActorCutscene_Stop(D_80B50404[0]); + func_801A89A8(0x800D); + func_80B46F88(this); + } +} + +void func_80B46F88(EnInvadepoh* this) { + D_80B4E940 = 2; + this->actionFunc = func_80B46FA8; +} + +void func_80B46FA8(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 i; + + if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(5, 15))) { + gSaveContext.weekEventReg[22] |= 1; + func_80B47064(this); + } else { + func_80B457A0(this); + for (i = 0; i < this->unk379; i++) { + if ((D_80B50320[i] != NULL) && (D_80B50320[i]->unk38A != 0)) { + func_80B47278(this); + break; + } + } + } +} + +void func_80B47064(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = func_80B47084; +} + +void func_80B47084(EnInvadepoh* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(D_80B50404[1])) { + ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[1], &this->actor); + func_80B470E0(this); + } else { + ActorCutscene_SetIntentToPlay(D_80B50404[1]); + } +} + +void func_80B470E0(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionTimer = 110; + this->actionFunc = func_80B47108; +} + +void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actionTimer == 100) { + func_801A3098(0x19); + } + this->actionTimer--; + if (this->actionTimer <= 0) { + globalCtx->nextEntranceIndex = 0x6460; + gSaveContext.unk_3F4A = 0; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 0x49; + gSaveContext.nextTransition = 0x48; + D_801BDAA0 = 1; + D_801BDA9C = 0; + func_80B47248(this); + } +} + +void func_80B471C0(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = func_80B471E0; +} + +void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx) { + if (D_80B4E998) { + globalCtx->nextEntranceIndex = 0x6470; + gSaveContext.unk_3F4A = 0; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 0x48; + gSaveContext.nextTransition = 0x48; + func_80B47248(this); + } +} + +void func_80B47248(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = func_80B47268; +} + +void func_80B47268(EnInvadepoh* this, GlobalContext* globalCtx) { +} + +void func_80B47278(EnInvadepoh* this) { + D_80B4E940 = 4; + this->actionFunc = func_80B47298; +} + +void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) { + globalCtx->nextEntranceIndex = 0x6400; + gSaveContext.unk_3F4A = 0xFFF3; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 0x48; + gSaveContext.nextTransition = 0x48; + gSaveContext.weekEventReg[89] |= 0x10; + func_80B47304(this); +} + +void func_80B47304(EnInvadepoh* this) { + D_80B4E940 = 4; + this->actionFunc = func_80B47324; +} + +void func_80B47324(EnInvadepoh* this, GlobalContext* globalCtx) { +} + +void EnInvadepoh_Update(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + this->actionFunc(this, globalCtx); + if (func_80B461DC()) { + this->actor.draw = func_80B4D9B4; + } else { + this->actor.draw = NULL; + } +} + +void func_80B47380(EnInvadepoh* this) { + this->collider.base.atFlags &= ~1; + this->collider.base.acFlags &= ~1; + this->collider.base.ocFlags1 &= ~1; + this->actor.flags &= ~0x80000000; + this->alienAlpha = 0; + this->actor.draw = NULL; + this->drawAlien = false; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 0; + this->actionFunc = func_80B473E4; +} + +void func_80B473E4(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B442E4(this); + func_80B447C0(this, globalCtx); + func_80B43DD4(this, 800, 0); + if (D_80B50340[this->actor.params & 7] & 1) { + Actor_SetScale(&this->actor, 0.01f); + func_80B4516C(this); + func_80B46118(&this->actor.world.pos); + func_80B47568(this); + } +} + +void func_80B47478(EnInvadepoh* this) { + this->collider.base.atFlags &= ~1; + this->collider.base.acFlags &= ~1; + this->collider.base.ocFlags1 &= ~1; + this->actor.flags &= ~0x80000000; + this->alienAlpha = 0; + this->actor.draw = NULL; + this->drawAlien = false; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 0; + this->actionFunc = func_80B474DC; +} + +void func_80B474DC(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B442E4(this); + func_80B447C0(this, globalCtx); + func_80B43DD4(this, 800, 0); + if (this->clockTime > 0.0f) { + Actor_SetScale(&this->actor, 0.01f); + func_80B4516C(this); + func_80B46118(&this->actor.world.pos); + func_80B47568(this); + } +} + +void func_80B47568(EnInvadepoh* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001D80, -6.0f); + this->collider.base.atFlags &= ~0x1; + this->collider.base.acFlags &= ~0x1; + this->collider.base.ocFlags1 &= ~0x1; + this->alienAlpha = 0; + this->actor.draw = func_80B4DB14; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 0; + this->actor.flags |= 0x80000000; + this->actionFunc = func_80B47600; +} + +void func_80B47600(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B442E4(this); + func_80B447C0(this, globalCtx); + func_80B43DD4(this, 800, 0); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); + if (this->clockTime >= 0.9999f) { + this->unk38A = 1; + } + if (this->alienAlpha > 248) { + this->alienAlpha = 255; + } else { + this->alienAlpha += 6; + } + if (this->alienAlpha > 128) { + this->collider.base.atFlags |= 1; + this->collider.base.acFlags |= 1; + this->collider.base.ocFlags1 |= 1; + } + if (this->alienAlpha == 255) { + if (this->alienBeamAlpha >= 245) { + this->alienBeamAlpha = 255; + func_80B4770C(this); + } else { + this->alienBeamAlpha += 10; + } + } +} + +void func_80B4770C(EnInvadepoh* this) { + if (this->skelAnime.animCurrentSeg != &D_06001D80) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001D80, -6.0f); + } + this->collider.base.atFlags |= 1; + this->collider.base.acFlags |= 1; + this->collider.base.ocFlags1 |= 1; + this->alienAlpha = 255; + this->actor.draw = func_80B4DB14; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 255; + this->actor.flags |= 0x80000000; + this->actionFunc = func_80B477B4; +} + +void func_80B477B4(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B442E4(this); + func_80B447C0(this, globalCtx); + func_80B43DD4(this, 800, 0); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); + if (this->clockTime >= 0.9999f) { + this->unk38A = 1; + } +} + +void func_80B47830(EnInvadepoh* this) { + this->collider.base.atFlags &= ~1; + this->collider.base.acFlags &= ~1; + this->collider.base.ocFlags1 |= 1; + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060006C8); + func_800BCB70(&this->actor, 0x4000, 255, 0, 16); + this->alienAlpha = 255; + this->actor.draw = func_80B4DB14; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 0; + this->actionTimer = 8; + this->counter = 0; + this->actor.flags |= 0x80000000; + this->actionFunc = func_80B478F4; +} + +void func_80B478F4(EnInvadepoh* this, GlobalContext* globalCtx) { + func_80B44A90(this, globalCtx); + this->actionTimer--; + if (this->actionTimer <= 0) { + func_80B47938(this); + } +} + +void func_80B47938(EnInvadepoh* this) { + this->collider.base.atFlags &= ~1; + this->collider.base.acFlags &= ~1; + this->collider.base.ocFlags1 &= ~1; + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06000608); + this->actor.flags &= ~1; + this->actionTimer = 10; + this->alienAlpha = 255; + this->actor.draw = func_80B4DB14; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 255; + this->actor.flags |= 0x80000000; + this->actionFunc = func_80B479E8; +} + +void func_80B479E8(EnInvadepoh* this, GlobalContext* globalCtx) { + s16 unk2F2; + u32 index; + + func_80B44B78(this); + if (this->counter < 5) { + if (D_80B4ED30[this->counter].x > 0.0f) { + this->drawAlien = true; + this->alienBeamAlpha = 255; + Math_Vec3f_Copy(&this->actor.scale, &D_80B4ED30[this->counter]); + } else { + this->drawAlien = false; + this->alienBeamAlpha = 0; + } + } else { + this->drawAlien = false; + this->alienBeamAlpha = 0; + } + + unk2F2 = this->counter; + if ((unk2F2 >= 2) && (unk2F2 < 9)) { + index = unk2F2 - 2; + if (D_80B4ED6C[index].x > 0.0f) { + this->drawAlienDeathEffect = true; + Math_Vec3f_Copy(&this->alienDeathEffectScale, &D_80B4ED6C[index]); + } else { + this->drawAlienDeathEffect = false; + } + } else { + this->drawAlienDeathEffect = false; + } + + this->counter++; + if (this->actionTimer == 8) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + this->actor.world.pos.y - 10.0f, this->actor.world.pos.z, 0, 0, 3, 200); + } + + if (this->actionTimer == 8) { + func_800BBA88(globalCtx, &this->actor); + } + + this->actionTimer--; + if (this->actionTimer <= 0) { + func_80B43AF0(this->actor.params & 7); + func_80B43AB0(); + Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_ARROWS_30); + func_80B47478(this); + } +} + +void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B45080(); + this->actor.update = func_80B47D30; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004E50, &D_06001D80, this->limbDrawTable, + this->transitionDrawTable, 14); + this->skelAnime.animCurrentFrame = (this->actor.params & 7) * this->skelAnime.animFrameCount * 0.125f; + func_80B444BC(this, globalCtx); + func_80B442E4(this); + func_80B447C0(this, globalCtx); + func_80B43F0C(this); + func_80B4516C(this); + if (D_80B4E940 == 1 || gSaveContext.time < CLOCK_TIME(2, 31)) { + func_80B47380(this); + } else if (D_80B4E940 == 2) { + if (this->clockTime >= 0.0001f) { + func_80B4770C(this); + } else { + func_80B47568(this); + } + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void func_80B47D30(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + + if (D_80B4E940 == 3) { + if ((this->actionFunc == func_80B477B4) || (this->actionFunc == func_80B47600)) { + thisx->speedXZ = 0.0f; + thisx->velocity.y = 0.0f; + thisx->gravity = 0.0f; + func_80B47830(this); + } else if ((this->actionFunc == func_80B474DC) || (this->actionFunc == func_80B473E4)) { + Actor_MarkForDeath(&this->actor); + return; + } + } else if (this->collider.base.acFlags & 2) { + Actor* acAttached = this->collider.base.ac; + + thisx->speedXZ = acAttached->speedXZ * 0.5f; + thisx->speedXZ = CLAMP(thisx->speedXZ, -60.0f, 60.0f); + thisx->world.rot.y = acAttached->world.rot.y; + thisx->gravity = 0.0f; + thisx->velocity.y = acAttached->velocity.y * 0.5f; + thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); + func_800F0568(globalCtx, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); + func_80B47830(this); + } + + this->actionFunc(this, globalCtx); + if (thisx->draw != NULL) { + this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime); + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.atFlags &= ~AT_HIT; + } + + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.acFlags &= ~AC_HIT; + } + + if (this->collider.base.ocFlags1 & OC1_ON) { + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.ocFlags1 &= ~OC1_HIT; + } +} + +void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, thisx); + this->actor.update = func_80B48060; + this->actor.draw = func_80B4E158; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004010, NULL, this->limbDrawTable, this->transitionDrawTable, + 6); + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06004264); + } +} + +void func_80B48060(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + s32 temp; + s32 pad2; + MtxF unkMtx; + + if (D_80B503F0 == NULL || this->actor.parent == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + + temp = this->actor.params & 7; + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[temp], 0x32); + if (this->actor.child != NULL) { + SysMatrix_StatePush(); + SysMatrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, &this->actor.shape.rot); + SysMatrix_InsertTranslation(0, 57.0f, -36.0f, MTXMODE_APPLY); + SysMatrix_InsertXRotation_s(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); + SysMatrix_InsertZRotation_s(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); + SysMatrix_GetStateTranslation(&this->actor.child->world.pos); + SysMatrix_CopyCurrentState(&unkMtx); + func_8018219C(&unkMtx, &this->actor.child->shape.rot, 0); + SysMatrix_StatePop(); + } +} + +void func_80B481C4(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + this->actor.update = func_80B4827C; + this->actor.draw = func_80B4E1B0; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004C30, NULL, this->limbDrawTable, this->transitionDrawTable, + 6); + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06004E98); + } +} + +void func_80B4827C(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if (D_80B503F0 == NULL || this->actor.parent == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + + SkelAnime_FrameUpdateMatrix(&this->skelAnime); +} + +void func_80B482D4(EnInvadepoh* this) { + this->actionTimer = 40; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002A8C, -10.0f); + this->actor.draw = NULL; + this->actionFunc = func_80B48324; +} + +void func_80B48324(EnInvadepoh* this, GlobalContext* globalCtx) { + this->actionTimer--; + if (this->actionTimer <= 0) { + EnInvadepoh_SetTextID(this, globalCtx, 0x332F); + this->actor.draw = func_80B4E324; + func_80B48374(this); + } +} + +void func_80B48374(EnInvadepoh* this) { + this->actionTimer = 60; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002A8C, -10.0f); + this->actor.draw = func_80B4E324; + this->actionFunc = func_80B483CC; +} + +void func_80B483CC(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actionTimer == 20) { + f32 unkFloat = 0.1f; + + this->behaviorInfo.unk26.x = 2000; + this->behaviorInfo.unk26.y = 0; + this->behaviorInfo.unk26.z = 0; + this->behaviorInfo.unk30 = unkFloat; + this->behaviorInfo.unk2C = 1000; + } + + this->actionTimer--; + if (this->actionTimer <= 0) { + func_80B4843C(this); + } +} + +void func_80B4843C(EnInvadepoh* this) { + this->behaviorInfo.unk26.x = 3000; + this->behaviorInfo.unk26.y = 0; + this->behaviorInfo.unk26.z = 0; + this->behaviorInfo.unk30 = 0.24f; + this->behaviorInfo.unk2C = 3000; + this->behaviorInfo.unk42 = 15000; + this->behaviorInfo.unk44 = 0.1f; + this->behaviorInfo.unk48 = 2000; + this->actionTimer = 50; + SkelAnime_ChangeAnim(&this->skelAnime, &D_06007328, 2.0f, 0.0f, 0.0f, 0, -5.0f); + this->actor.draw = func_80B4E324; + this->actionFunc = func_80B484EC; +} + +void func_80B484EC(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actionTimer == 40) { + this->behaviorInfo.unk26.y = 7000; + } else if (this->actionTimer == 30) { + this->behaviorInfo.unk26.y = -7000; + } else if (this->actionTimer == 20) { + this->behaviorInfo.unk26.y = 7000; + } else if (this->actionTimer == 10) { + this->behaviorInfo.unk26.y = 0; + } + this->actionTimer--; + if (this->actionTimer <= 0) { + func_80B48588(this); + } +} + +void func_80B48588(EnInvadepoh* this) { + this->behaviorInfo.unk26.x = 0; + this->behaviorInfo.unk26.y = 0; + this->behaviorInfo.unk26.z = 0; + this->behaviorInfo.unk30 = 0.24f; + this->behaviorInfo.unk2C = 5000; + this->behaviorInfo.unk42 = 0; + this->behaviorInfo.unk44 = 0.28f; + this->behaviorInfo.unk48 = 7000; + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009E58, -10.0f); + this->actor.draw = func_80B4E324; + this->actionFunc = func_80B48610; +} + +void func_80B48610(EnInvadepoh* this, GlobalContext* globalCtx) { +} + +void func_80B48620(Actor* thisx, GlobalContext* globalCtx) { + s32 pad[2]; + EnInvadepoh* this = THIS; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + this->actor.update = func_80B4873C; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->limbDrawTable, + this->transitionDrawTable, 23); + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &D_801D15BC, 5000, 0.05f, 0.3f, 0.12f); + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06009E58); + func_80B482D4(this); + } +} + +void func_80B4873C(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + if (this->actor.parent == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + this->actionFunc(this, globalCtx); + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(substruct); + if (substruct->unk40 != 0) { + this->actor.shape.rot.x = -substruct->unk40; + } +} + +void func_80B487B4(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + u32 new_var; + + this->actionTimer = Rand_S16Offset(150, 250); + new_var = Rand_Next(); + substruct->unk26.x = D_80B4EDC8[new_var >> 0x1E]; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 800; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f); + this->actionFunc = func_80B48848; +} + +void func_80B48848(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); + if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + func_80B44514(this); + this->behaviorInfo.unk4C = 0xC8; + this->actor.speedXZ *= 0.25f; + } else { + Math_StepToS(&this->behaviorInfo.unk4C, 0x7D0, 0x46); + } + func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x46); + if (((this->actor.flags & 0x40) == 0x40) && (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK); + } + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B48948(this); + } +} + +void func_80B48948(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + f32 rand = Rand_ZeroOne(); + + this->actionTimer = Rand_S16Offset(150, 150); + if (rand < 0.5f) { + this->rand = 0; + Math_Vec3s_Copy(&substruct->unk26, &D_801D15BC); + substruct->unk30 = 0.1f; + substruct->unk2C = 1000; + } else if (rand < 0.75f) { + this->rand = 1; + substruct->unk26.x = Rand_S16Offset(0, 2000); + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.06f; + substruct->unk2C = 1000; + } else if (rand < 0.8f) { + this->rand = 2; + substruct->unk26.x = Rand_S16Offset(-2000, 2000); + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.05f; + substruct->unk2C = 1000; + } else { + this->rand = 3; + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = Rand_S16Offset(-2500, 5000); + substruct->unk30 = 0.04f; + substruct->unk2C = 1000; + } + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + this->actionFunc = func_80B48AD4; +} + +void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player; + s16 new_var3; + s16 temp_v1; + s32 temp_v1_3; + + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + func_80B44514(this); + } + + if (this->rand == 0) { + if ((this->actor.xzDistToPlayer < 350.0f) && ((globalCtx->gameplayFrames & 0x60) != 0)) { + player = PLAYER; + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -2500, 2500); + new_var3 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = new_var3 * 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + } + + dummy:; + + } else { + substruct->unk26.x = 0; + substruct->unk26.y = 0; + } + + if (this->actionTimer > 0) { + temp_v1_3 = this->actionTimer & 0x1F; + if ((temp_v1_3 == 0) && (Rand_ZeroOne() < 0.3f)) { + temp_v1_3 = Rand_Next() % 4; + if (temp_v1_3 != this->rand) { + this->rand = temp_v1_3; + if (this->rand == 0) { + Math_Vec3s_Copy(&substruct->unk26, &D_801D15BC); + substruct->unk30 = 0.07f; + } else if (this->rand == 1) { + substruct->unk26.x = Rand_S16Offset(1000, 1000); + substruct->unk26.y = Rand_S16Offset(-1000, 2000); + substruct->unk26.z = Rand_S16Offset(-800, 1600); + substruct->unk30 = 0.06f; + } else if (this->rand == 2) { + substruct->unk26.x = Rand_S16Offset(-2000, 1000); + substruct->unk26.y = Rand_S16Offset(-1000, 2000); + substruct->unk26.z = Rand_S16Offset(-800, 1600); + substruct->unk30 = 0.05f; + } else { + substruct->unk26.x = Rand_S16Offset(-1000, 2000); + substruct->unk26.y = Rand_S16Offset(-2000, 4000); + substruct->unk26.z = Rand_S16Offset(-2000, 4000); + substruct->unk30 = 0.04f; + } + } + } + + this->actionTimer--; + } else { + func_80B487B4(this); + } +} + +void func_80B48DE4(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + this->actor.speedXZ = 0.0f; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + this->behaviorInfo.unk4C = 0; + substruct->unk30 = 0.05f; + substruct->unk2C = 1200; + this->actionFunc = func_80B48E4C; +} + +void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 50); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 35); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); + temp_v1 *= 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff * 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + if (func_800B867C(&this->actor, globalCtx)) { + func_80B48948(this); + } +} + +void func_80B48FB0(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + this->actor.update = func_80B490F0; + this->actor.draw = func_80B4E324; + this->actor.textId = 0x3330; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->limbDrawTable, + this->transitionDrawTable, 23); + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &D_801D15BC, 100, 0.03, 0.3, 0.03); + func_80B444F4(this, globalCtx); + EnInvadepoh_SetPathPointToWorldPos(this, 0); + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); + func_80B487B4(this); + } +} + +void func_80B490F0(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 sp2C = (this->actor.flags & 0x40) == 0x40; + s32 isTalking = func_800B84D0(&this->actor, globalCtx); + + if (isTalking) { + func_80151BB4(globalCtx, 5); + func_80B48DE4(this); + } + this->actionFunc(this, globalCtx); + if (sp2C) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(&this->behaviorInfo); + if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) { + func_800B8614(&this->actor, globalCtx, 100.0f); + } + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B491EC(EnInvadepoh* this) { + this->scaleFactorAdj = 0.0f; + this->scaleStep = 0.0f; + this->unk3AA = 0; + this->actor.gravity = -15.0f; + this->scaleTarget = 1.0f; + this->actionFunc = func_80B49228; +} + +void func_80B49228(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + f32 temp_f0; + + Actor_SetVelocityYRotationAndGravity(&this->actor); + this->actor.velocity.y *= 0.97f; + temp_f0 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + D_80B4E934.y + 300.0f, 0.7f, + fabsf(this->actor.velocity.y), 1.0f); + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); + if (fabsf(temp_f0) < 1.0f) { + func_80B45EC8(this, globalCtx, 50); + func_80B492FC(this); + } +} + +void func_80B492FC(EnInvadepoh* this) { + this->actor.velocity.y *= 0.1f; + this->actionTimer = 20; + this->scaleTarget = 0.3f; + this->scaleStep = 0.03f; + this->unk3AA = 3000; + this->actionFunc = func_80B4934C; +} + +void func_80B4934C(EnInvadepoh* this, GlobalContext* globalCtx) { + f32 temp = this->actor.home.pos.y + D_80B4E934.y + 300.0f; + + if (this->actor.world.pos.y < temp) { + this->actor.gravity = 3.0f; + } else { + this->actor.gravity = -2.0f; + } + this->actor.velocity.y *= 0.96f; + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); + this->actionTimer--; + if (this->actionTimer <= 0) { + func_80B49404(this); + } +} + +void func_80B49404(EnInvadepoh* this) { + this->actionTimer = 120; + this->scaleTarget = 0.2f; + this->scaleStep = 0.01f; + this->unk3AA = 3000; + this->unk3AC = 0; + this->counter = 0; + this->actor.gravity = 33.0f; + this->actionFunc = func_80B49454; +} + +void func_80B49454(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp30; + s32 pad2; + + if (this->counter < 25) { + this->counter++; + } else { + this->counter = 0; + this->unk3AC++; + this->unk3AC = CLAMP_MAX(this->unk3AC, 4); + this->actor.gravity = 33.0f; + func_80B45EC8(this, globalCtx, 20); + } + + Math_Vec3f_Sum(&D_80B4EDD0[this->unk3AC], &this->actor.home.pos, &sp30); + if (Math3D_DistanceSquared(&this->actor.world.pos, &sp30) < SQ(400.0f)) { + this->actor.speedXZ *= 0.8f; + } else { + Math_StepToF(&this->actor.speedXZ, 170.0f, 21.0f); + this->actor.speedXZ *= 0.98f; + } + if (func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, this->actor.speedXZ)) { + this->actor.speedXZ = 0.0f; + } + if (sp30.y < this->actor.world.pos.y) { + Math_StepToF(&this->actor.gravity, -12.0f, 7.0f); + } else { + Math_StepToF(&this->actor.gravity, 5.0f, 4.0f); + } + this->actor.velocity.y += this->actor.gravity; + this->actor.velocity.y *= 0.97f; + this->actor.world.pos.y += this->actor.velocity.y; + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B49628(this); + } +} + +void func_80B49628(EnInvadepoh* this) { + this->scaleTarget = 0.2f; + this->scaleStep = 0.01f; + this->unk3AA = 3000; + this->actor.velocity.y *= 0.8f; + this->actionFunc = func_80B49670; +} + +void func_80B49670(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp30; + + sp30.x = this->actor.home.pos.x; + sp30.y = this->actor.home.pos.y + 1500.0f; + sp30.z = this->actor.home.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 0xA, 0xBB8, 0x64); + if ((globalCtx->gameplayFrames % 64) < 14) { + Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); + } else { + this->actor.speedXZ *= 0.97f; + } + if (sp30.y < this->actor.world.pos.y) { + this->actor.gravity = -0.5f; + } else { + this->actor.gravity = 2.0f; + } + this->actor.velocity.y *= 0.97f; + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (D_80B4E940 == 3) { + func_80B499BC(this); + } +} + +void func_80B497A4(EnInvadepoh* this) { + this->scaleTarget = 0.2f; + this->scaleStep = 0.01f; + this->unk3AA = 3000; + this->actionTimer = 35; + this->actor.gravity = -1.5f; + this->actionFunc = func_80B497EC; +} + +void func_80B497EC(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp30; + + sp30.x = this->actor.home.pos.x + D_80B4E934.x; + sp30.y = this->actor.home.pos.y + D_80B4E934.y + 400.0f; + sp30.z = this->actor.home.pos.z + D_80B4E934.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); + Math_StepToF(&this->actor.speedXZ, 70.0f, 3.0f); + if (sp30.y < this->actor.world.pos.y) { + this->actor.gravity = -2.0f; + } else { + this->actor.gravity = 2.0f; + } + this->actor.velocity.y *= 0.97f; + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B49904(this); + } +} + +void func_80B49904(EnInvadepoh* this) { + this->scaleTarget = 0.2f; + this->scaleStep = 0.01f; + this->unk3AA = 3000; + this->actionTimer = 60; + this->actor.gravity = 1.0f; + this->actionFunc = func_80B4994C; +} + +void func_80B4994C(EnInvadepoh* this, GlobalContext* globalCtx) { + Math_StepToF(&this->actor.speedXZ, 150.0f, 4.0f); + this->actor.velocity.y *= 0.95f; + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B499BC(EnInvadepoh* this) { + this->actionTimer = 40; + this->scaleTarget = 0.2f; + this->scaleStep = 0.01f; + this->unk3AA = 3000; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80B49A00; +} + +void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp30; + + sp30.x = this->actor.home.pos.x; + sp30.y = this->actor.home.pos.y + 800.0f; + sp30.z = this->actor.home.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); + Math_StepToF(&this->actor.speedXZ, 30.0f, 3.0f); + this->actor.velocity.y *= 0.98f; + if (sp30.y < this->actor.world.pos.y) { + this->actor.gravity = -0.5f; + } else { + this->actor.gravity = 2.0f; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B497A4(this); + } +} + +void func_80B49B1C(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + f32 scale; + + this->actionFunc(this, globalCtx); + this->scaleAdjAngle += this->unk3AA; + Math_StepToF(&this->scaleFactorAdj, this->scaleTarget, this->scaleStep); + scale = Math_SinS(this->scaleAdjAngle) * this->scaleFactorAdj + 1.0f; + Actor_SetScale(&this->actor, 0.27f * scale); + Math_StepToS(&this->unk306, 600, 8); + this->actor.world.rot.y += this->unk306; + this->unk304 += 600; +} + +void func_80B49BD0(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 800; + this->actionFunc = func_80B49C38; +} + +void func_80B49C38(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + s32 temp_v0_2; + + func_80B44570(this); + func_80B44C24(this, globalCtx); + func_80B43E6C(this, 6, 2000, 100); + if (1) {} + if (this->pathIndex == 0 || (this->pathIndex + 1) == this->endPoint) { + if (this->unk378 == 0) { + temp_v0_2 = func_800FE620(globalCtx); + if (temp_v0_2 > 0) { + temp_v0_2 = (REG(15) * -16.0f / temp_v0_2) - 0.5f; + this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), temp_v0_2); + } + } + this->actor.flags &= ~(0x8 | 0x1); + } else { + this->unk378 = 0; + this->actor.flags |= (0x8 | 0x1); + } + + if (((this->actor.flags & 0x40) == 0x40) && (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK); + } + if (this->clockTime >= 0.9999f) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B49DA0(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 2000; + this->behaviorInfo.unk4C = 0; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + this->actionFunc = func_80B49DFC; +} + +void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); + temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + if (func_800B867C(&this->actor, globalCtx)) { + if (this->actor.textId == 0x332D) { + gSaveContext.weekEventReg[54] |= 0x10; + this->actor.textId = 0x332E; + } + func_80B49BD0(this); + } +} + +void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { + s32 pad[2]; + EnInvadepoh* this = THIS; + s32 sp38; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + sp38 = gSaveContext.time; + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable, + this->transitionDrawTable, 23); + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &D_801D15BC, 100, 0.03, 0.3, 0.03); + func_80B44540(this, globalCtx); + func_80B44570(this); + func_80B44C24(this, globalCtx); + func_80B43F0C(this); + func_80B4516C(this); + if (0x20 & gSaveContext.weekEventReg[21]) { + if (gSaveContext.weekEventReg[54] & 0x10) { + this->actor.textId = 0x332E; + } else { + this->actor.textId = 0x332D; + } + + } else { + this->actor.textId = 0x332C; + } + + if (sp38 >= CLOCK_TIME(18, 0) || sp38 < CLOCK_TIME(2, 0)) { + this->actor.update = func_80B4A168; + this->actor.draw = NULL; + } else if ((sp38 < CLOCK_TIME(6, 0)) && (sp38 >= CLOCK_TIME(2, 0)) && (sp38 < CLOCK_TIME(2, 15))) { + this->actor.update = func_80B4A1B8; + this->actor.draw = func_80B4E324; + func_80B49BD0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void func_80B4A168(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 0))) { + this->actor.update = func_80B4A1B8; + this->actor.draw = func_80B4E324; + func_80B49BD0(this); + } +} + +void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 sp2C = (this->actor.flags & 0x40) == 0x40; + s32 isTalking = func_800B84D0(&this->actor, globalCtx); + + if (isTalking) { + func_80151BB4(globalCtx, 5); + func_80B49DA0(this); + } + this->actionFunc(this, globalCtx); + if (sp2C && this->actor.update != NULL) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(&this->behaviorInfo); + if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) { + func_800B8614(&this->actor, globalCtx, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4A2C0(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 1500; + this->actionTimer = Rand_S16Offset(200, 200); + this->unk304 = this->actor.shape.rot.y; + this->actor.flags |= (0x8 | 0x1); + this->actionFunc = func_80B4A350; +} + +void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { + s16 temp_v0; + s16 temp_v1_2; + s16 diff; + Vec3f sp44; + s16 sp42; + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + if ((globalCtx->gameplayFrames % 256) == 0) { + Math_Vec3s_ToVec3f(&sp44, this->pathPoints); + sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); + temp_v0 = Rand_S16Offset(-0x1F40, 0x3E80); + this->unk304 = temp_v0 + sp42; + this->behaviorInfo.unk4C = 0; + } + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40); + if (this->actor.xzDistToPlayer < 300.0f) { + Player* player = PLAYER; + + temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); + temp_v1_2 *= 0.85f; + temp_v1_2 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1_2, -0x9C4, 0x9C4); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1_2 = diff; + temp_v1_2 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1_2, -0x1F40, 0x1F40); + if ((globalCtx->gameplayFrames % 256) == 0) { + substruct->unk26.z = Rand_S16Offset(-0x5DC, 0xBB8); + } + } else { + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + } + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B4A570(this); + } +} + +void func_80B4A570(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002A8C, -10.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 800; + this->actor.flags |= (0x8 | 0x1); + this->actionFunc = func_80B4A5E4; +} + +void func_80B4A5E4(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->animPlayFlag) { + func_80B4A2C0(this); + } +} + +void func_80B4A614(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, 0.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 800; + this->actionFunc = func_80B4A67C; +} + +void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); + if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + func_80B44640(this); + this->behaviorInfo.unk4C = 0x5DC; + this->actor.speedXZ *= 0.5f; + } else { + Math_StepToS(&this->behaviorInfo.unk4C, 0x190, 0x32); + } + func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x32); + if (this->pathIndex == 0) { + if (this->unk378 == 0) { + this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), -0xF); + } + this->actor.flags &= ~(0x8 | 0x1); + } else { + this->unk378 = 0; + this->actor.flags |= (0x8 | 0x1); + } + if (((this->actor.flags & 0x40) == 0x40) && (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK); + } + if (this->pathIndex == this->endPoint) { + func_80B4A2C0(this); + } +} + +void func_80B4A7C0(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 2000; + this->behaviorInfo.unk4C = 0; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, 0.0f); + this->actionFunc = func_80B4A81C; +} + +void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); + temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + + if (func_800B867C(&this->actor, globalCtx)) { + if (this->actor.textId == 0x332D) { + gSaveContext.weekEventReg[54] |= 0x10; + this->actor.textId = 0x332E; + } + if (this->pathIndex == this->endPoint) { + func_80B4A2C0(this); + } else { + func_80B4A614(this); + } + } +} + +void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad[2]; + s32 sp38; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + sp38 = gSaveContext.time; + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable, + this->transitionDrawTable, 23); + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f); + func_80B44620(this, globalCtx); + if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) { + this->pathIndex = 0; + this->actor.update = func_80B4AB8C; + } else { + this->pathIndex = this->endPoint; + this->actor.update = func_80B4ABDC; + this->actor.draw = func_80B4E324; + func_80B4A2C0(this); + } + + EnInvadepoh_SetPathPointToWorldPos(this, this->pathIndex); + func_80B43F0C(this); + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); + if (gSaveContext.weekEventReg[21] & 0x20) { + if (gSaveContext.weekEventReg[54] & 0x10) { + this->actor.textId = 0x332E; + } else { + this->actor.textId = 0x332D; + } + } else { + this->actor.textId = 0x332C; + } + } +} + +void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 15))) { + this->actor.update = func_80B4ABDC; + this->actor.draw = func_80B4E324; + func_80B4A614(this); + } +} + +void func_80B4ABDC(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 sp2C = (this->actor.flags & 0x40) == 0x40; + s32 isTalking = func_800B84D0(&this->actor, globalCtx); + + if (isTalking) { + func_80151BB4(globalCtx, 5); + func_80B4A7C0(this); + } + this->actionFunc(this, globalCtx); + if (sp2C) { + this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(&this->behaviorInfo); + if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) { + func_800B8614(&this->actor, globalCtx, 100.0f); + } + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4ACDC(EnInvadepoh* this) { + this->actionFunc = func_80B4ACF0; +} + +void func_80B4ACF0(EnInvadepoh* this, GlobalContext* globalCtx) { + if (gSaveContext.weekEventReg[22] & 1) { + this->actor.draw = func_80B4E324; + this->actor.flags |= (0x8 | 0x1); + func_80B4AD3C(this); + } +} + +void func_80B4AD3C(EnInvadepoh* this) { + this->actor.flags |= 0x10000; + this->actionFunc = func_80B4AD60; +} + +void func_80B4AD60(EnInvadepoh* this, GlobalContext* globalCtx) { + if (func_800B84D0(&this->actor, globalCtx)) { + EnInvadepoh_SetTextID(this, globalCtx, 0x3331); + func_80B4ADB8(this); + } else { + func_800B8614(&this->actor, globalCtx, 2000.0f); + } +} + +void func_80B4ADB8(EnInvadepoh* this) { + this->actionFunc = func_80B4ADCC; +} + +void func_80B4ADCC(EnInvadepoh* this, GlobalContext* globalCtx) { + if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + if (this->textId == 0x3331) { + if (gSaveContext.weekEventReg[22] & 2) { + EnInvadepoh_SetTextID(this, globalCtx, 0x3334); + func_80151BB4(globalCtx, 0x1D); + func_80151BB4(globalCtx, 5); + return; + } + EnInvadepoh_SetTextID(this, globalCtx, 0x3333); + return; + } + if (this->textId == 0x3333) { + func_80B4AEC0(this); + } + else if (this->textId == 0x3334) { + func_801477B4(globalCtx); + func_80B4B024(this); + } + } +} + +void func_80B4AEC0(EnInvadepoh* this) { + this->actionTimer = 2; + this->actionFunc = func_80B4AEDC; +} + +void func_80B4AEDC(EnInvadepoh* this, GlobalContext* globalCtx) { + if (this->actionTimer > 0) { + this->actionTimer--; + if (this->actionTimer == 0) { + func_801477B4(globalCtx); + } + } + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.parent = NULL; + gSaveContext.weekEventReg[22] |= 2; + func_80B4AF80(this); + } else { + func_800B8A1C(&this->actor, globalCtx, GI_MILK_BOTTLE, 2000.0f, 2000.0f); + } +} + +void func_80B4AF80(EnInvadepoh* this) { + this->actionFunc = func_80B4AF94; +} + +void func_80B4AF94(EnInvadepoh* this, GlobalContext* globalCtx) { + if (func_800B84D0(&this->actor, globalCtx)) { + EnInvadepoh_SetTextID(this, globalCtx, 0x3334); + func_80151BB4(globalCtx, 0x1E); + func_80151BB4(globalCtx, 0x1D); + func_80151BB4(globalCtx, 5); + func_80B4ADB8(this); + } else { + func_800B85E0(&this->actor, globalCtx, 2000.0f, -1); + } +} + +void func_80B4B024(EnInvadepoh* this) { + this->actor.flags &= ~9; + this->actionFunc = func_80B4B048; +} + +void func_80B4B048(EnInvadepoh* this, GlobalContext* globalCtx) { + if (globalCtx->msgCtx.unk120B1 == 0) { + if (globalCtx->msgCtx.unk11F22 == 0) { + D_80B4E998 = 1; + } else if ((func_80152498(&globalCtx->msgCtx) == 6) || (func_80152498(&globalCtx->msgCtx) == 5)) { + D_80B4E998 = 1; + } + } +} + +void func_80B4B0C4(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + AlienBehaviorInfo* substruct; + s32 pad; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + this->actor.update = func_80B4B218; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable, + this->transitionDrawTable, 23); + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, 0.0f); + substruct = &this->behaviorInfo; + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &D_801D15BC, 2000, 0.08f, 0.3f, 0.03f); + substruct->unk30 = 0.08f; + substruct->unk2C = 0x7D0; + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); + func_80B4ACDC(this); + } +} + +void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) { + s16 diff; + EnInvadepoh* this = THIS; + s16 temp_v1; + s32 sp38 = (this->actor.flags & 0x40) == 0x40; + Player* player; + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + + this->actionFunc(this, globalCtx); + if (sp38 && this->actor.update != NULL) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + player = PLAYER; + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); + temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f); + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + func_80B45CE0(substruct); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4B3DC(EnInvadepoh* this) { + s32 pad; + + if (func_801378B8(&this->skelAnime, 1.0f) || func_801378B8(&this->skelAnime, 7.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_MONKEY_WALK); + } +} + +void func_80B4B430(EnInvadepoh* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060021C8, -6.0f); + this->actionTimer = Rand_S16Offset(50, 80); + this->actionFunc = func_80B4B484; +} + +void func_80B4B484(EnInvadepoh* this, GlobalContext* globalCtx) { + Math_StepToF(&this->actor.speedXZ, 1.1f, 0.5f); + if (func_80B44C80(this, globalCtx)) { + func_80B44690(this); + } + func_80B4B3DC(this); + if (this->unk3BC >= 0) { + this->actionTimer = 0; + } + + if (this->actionTimer > 0) { + this->actionTimer--; + } else { + func_80B4B510(this); + } +} + +void func_80B4B510(EnInvadepoh* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001BD8, -6.0f); + this->actionTimer = Rand_S16Offset(50, 200); + this->actionFunc = func_80B4B564; +} + +void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp28; + f32 temp_f0; + + Math_StepToF(&this->actor.speedXZ, 3.8f, 0.45f); + + if (this->unk3BC >= 0) { + Math_Vec3s_ToVec3f(&sp28, &this->pathPoints[this->unk3BC]); + temp_f0 = Math3D_DistanceSquared(&this->actor.world.pos, &sp28); + if (temp_f0 < SQ(80.0f)) { + this->actor.speedXZ *= 0.85f; + } else if (temp_f0 < SQ(150.0f)) { + this->actor.speedXZ *= 0.93f; + } else if (temp_f0 < SQ(250.0f)) { + this->actor.speedXZ *= 0.96f; + } + if (this->pathIndex == this->unk3BC || temp_f0 < SQ(50.0f)) { + this->actionTimer = 0; + } + } + func_80B4B3DC(this); + if (func_80B44C80(this, globalCtx)) { + func_80B44690(this); + } + + if (this->actionTimer > 0) { + this->actionTimer--; + } else if (this->unk3BC >= 0) { + if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); + } + func_80B4B724(this); + } else { + func_80B4B430(this); + } +} + +void func_80B4B724(EnInvadepoh* this) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000998, -6.0f); + this->actionFunc = func_80B4B768; +} + +void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx) { + s32 pad; + + Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_SmoothStepToS(&this->actor.world.rot.y, Actor_YawBetweenActors(&this->actor, &D_80B5040C->actor), 5, 0x1388, 0x64); + func_80B44E90(this, globalCtx); + if (func_801378B8(&this->skelAnime, 13.0f) || func_801378B8(&this->skelAnime, 19.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); + } + if (this->animPlayFlag) { + func_80B4B510(this); + } +} + +void func_80B4B820(EnInvadepoh* this) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001560, -6.0f); + this->actionFunc = func_80B4B864; +} + +void func_80B4B864(EnInvadepoh* this, GlobalContext* globalCtx) { + Math_StepToF(&this->actor.speedXZ, 0.5f, 1.0f); + func_80B44E90(this, globalCtx); + if (this->animPlayFlag) { + func_80B4B510(this); + } +} + +void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 pad; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060080F0, &D_060021C8, this->limbDrawTable, + this->transitionDrawTable, 13); + func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &D_801D15BC, 3000, 0.1f, 0.0f, 0.0f); + func_80B44664(this, globalCtx); + EnInvadepoh_SetPathPointToWorldPos(this, 0); + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); + Math_Vec3f_Copy(&this->curPathPos, &this->actor.world.pos); + if (D_80B4E940 == 2) { + this->actor.update = func_80B4BA84; + this->actor.draw = func_80B4E660; + this->actor.flags |= 1; + func_80B4B430(this); + } else if (D_80B4E940 == 1) { + this->actor.update = func_80B4BA30; + } else { + Actor_MarkForDeath(&this->actor); + if (!this) {} + } + } +} + +void func_80B4BA30(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if (D_80B4E940 == 2) { + this->actor.update = func_80B4BA84; + this->actor.draw = func_80B4E660; + this->actor.flags |= 1; + func_80B4B430(this); + } +} + +void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + s32 temp_v0_3; + s32 sp34 = (this->actor.flags & 0x40) == 0x40; + s32 temp_v1_2; + s32 sp2C; + s32 temp_v0_2; + s32 phi_v0; + + D_80B5040C = func_80B458D8(); + if (D_80B5040C == NULL) { + temp_v0_2 = (this->unk3BC < 0) ^ 1; + this->unk3BC = -1; + if (temp_v0_2) { + func_80B4B820(this); + } + } else { + sp2C = this->unk3BC; + this->unk3BC = func_80B44234(this, &D_80B5040C->actor.world.pos); + if (sp2C != this->unk3BC) { + phi_v0 = this->pathIndex; + phi_v0 = this->unk3BC - this->pathIndex; + temp_v0_3 = phi_v0; + if (temp_v0_3 < 0) { + phi_v0 += this->endPoint; + } + + temp_v0_3 = this->endPoint >> 1; + if (temp_v0_3 < phi_v0) { + this->direction = DIRECTION_BACKWARD; + } else if (phi_v0 < temp_v0_3) { + this->direction = DIRECTION_FORWARD; + } + } + } + + this->actionFunc(this, globalCtx); + this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (sp34 && (this->actor.update != NULL)) { + func_80B45CE0(&this->behaviorInfo); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4BBE0(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06016720, -6.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 800; + + this->behaviorInfo.unk4C = 0; + this->actionFunc = func_80B4BC4C; +} + +void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) { + s8 temp_v0; + s16 diff; + EnInvadepoh* temp_t6 = D_80B503F4; + s16 temp_v1_2; + s32 temp_v1; + AlienBehaviorInfo* substruct = &this->behaviorInfo; + s16 temp_a0; + s16 sp40; + + if (temp_t6 != NULL) { + temp_v0 = temp_t6->pathIndex; + if (temp_v0 == 0) { + this->xzPosAdjFactor = 40.0f; + this->unk304 = -0x8000; + this->actor.flags &= ~(0x8 | 0x1); + + } else if (temp_v0 < (temp_t6->endPoint - 1)) { + this->xzPosAdjFactor = 40.0f; + Math_ScaledStepToS(&this->unk304, -0x4800, 0xC8); + this->actor.flags |= (0x8 | 0x1); + } else { + Math_StepToF(&this->xzPosAdjFactor, 5.0f, 3.0f); + Math_ScaledStepToS(&this->unk304, -0x8000, 0x12C); + this->actor.flags &= ~(0x8 | 0x1); + } + temp_a0 = this->unk304 + temp_t6->actor.world.rot.y; + this->actor.world.pos.x = (Math_SinS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.x; + this->actor.world.pos.y = temp_t6->actor.world.pos.y; + this->actor.world.pos.z = (Math_CosS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.z; + func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_80B4516C(this); + Math_StepToS(&this->behaviorInfo.unk4C, 0xBB8, 0x1F5); + if (Math3D_DistanceSquared(&this->actor.prevPos, &this->actor.world.pos) > SQ(0.01f)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.prevPos, &this->actor.world.pos), + 3, this->behaviorInfo.unk4C, 0x1F4); + } + temp_v1 = (globalCtx->gameplayFrames + 0x14) % 128; + if ((temp_v1 & 0x40) != 0) { + sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &temp_t6->actor.world.pos); + if (temp_v1 == 64) { + this->behaviorInfo.unk4C = 0; + } + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->behaviorInfo.unk4C, 40); + temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &temp_t6->actor.focus.pos); + temp_v1_2 *= 0.85f; + temp_v1_2 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1_2, -3000, 3000); + diff = BINANG_SUB(sp40, this->actor.shape.rot.y); + temp_v1_2 = diff; + temp_v1_2 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1_2, -8000, 8000); + } + } + + if (((this->actor.flags & 0x40) == 0x40) && (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 12.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK); + } + if (gSaveContext.time > CLOCK_TIME(20, 15)) { + Actor_MarkForDeath(&this->actor); + } else if ((temp_t6 != NULL) && (temp_t6->actionFunc == func_80B4CB0C)) { + func_80B4C1BC(this); + } +} + +void func_80B4BFFC(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 2000; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A174, -6.0f); + this->behaviorInfo.unk4C = 0; + this->actionFunc = func_80B4C058; +} + +void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2500, 450); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); + temp_v1 *= 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + + if (func_800B867C(&this->actor, globalCtx)) { + func_80B4BBE0(this); + } +} + +void func_80B4C1BC(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 2000; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A174, -6.0f); + this->behaviorInfo.unk4C = 0; + this->actionFunc = func_80B4C218; +} + +void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + Actor* temp_v0; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); + temp_v1 *= 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + + if (D_80B503F4 == NULL) { + func_80B4BBE0(this); + } else if ((D_80B503F4 != NULL) && (D_80B503F4->actionFunc != func_80B4CB0C)) { + func_80B4BBE0(this); + } +} + +void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + s32 pad[2]; + s32 currentTime = gSaveContext.time; + + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44FEC(); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06015C28, &D_06016720, (0, this->limbDrawTable), + this->transitionDrawTable, 22); + func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f); + this->actor.textId = 0x33CD; + if (currentTime < 0xD5A0) { + this->unk304 = -0x8000; + this->xzPosAdjFactor = 40.0f; + } else if (currentTime >= 0xD7D4) { + this->unk304 = -0x4800; + this->xzPosAdjFactor = 20.0f; + } else { + this->unk304 = -0x8000; + this->xzPosAdjFactor = 40.0f; + } + + if ((currentTime >= CLOCK_TIME(6, 0)) && (currentTime < 0xD573)) { + this->actor.update = func_80B4C568; + this->actor.draw = NULL; + } else if ((currentTime >= 0xD573) && (currentTime < CLOCK_TIME(20, 15))) { + this->actor.update = func_80B4C5C0; + this->actor.draw = func_80B4E7BC; + func_80B4BBE0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void func_80B4C568(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if ((gSaveContext.time >= 0xD573) && (gSaveContext.time < CLOCK_TIME(20, 15))) { + this->actor.update = func_80B4C5C0; + this->actor.draw = func_80B4E7BC; + func_80B4BBE0(this); + } +} + +void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 sp2C = (this->actor.flags & 0x40) == 0x40; + s32 isTalking = func_800B84D0(&this->actor, globalCtx); + + if (isTalking) { + func_80151BB4(globalCtx, 6); + func_80B4BFFC(this); + } + this->actionFunc(this, globalCtx); + if (sp2C && (this->actor.update != NULL)) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(&this->behaviorInfo); + if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) { + func_800B8614(&this->actor, globalCtx, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4C6C8(EnInvadepoh* this) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f); + substruct->unk26.x = 0; + substruct->unk26.y = 0; + substruct->unk26.z = 0; + substruct->unk30 = 0.1f; + substruct->unk2C = 0x320; + this->actionFunc = func_80B4C730; +} + +void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + EnInvadepoh* sp68 = D_80B503F8; + s32 phi_a2; + s32 temp_v1_3; + s16 temp_v1_4; + s32 temp_v0_2; + Vec3f sp4C; + Vec3f sp40; + s16 diff; + s8 temp_v1; + s16 sp3A; + s8 temp_v0; + + func_80B44700(this); + func_80B44EFC(this, globalCtx); + func_80B43E6C(this, 6, 2000, 100); + if (1) {} + temp_v1 = this->pathIndex; + temp_v0 = this->endPoint; + phi_a2 = temp_v0 - 1; + if (temp_v1 < temp_v0) { + phi_a2 = temp_v1; + } else if (temp_v1_3) { + } + + Math_Vec3s_ToVec3f(&sp4C, &this->pathPoints[phi_a2]); + Math_Vec3s_ToVec3f(&sp40, &this->pathPoints[phi_a2 + 1]); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40), 5, 0x7D0, 0x64); + if ((this->pathIndex == 0) || ((this->pathIndex + 1) == this->endPoint)) { + if (this->unk378 == 0) { + temp_v0_2 = func_800FE620(globalCtx); + if (temp_v0_2 > 0) { + temp_v0_2 = (REG(15) * -23.0f / temp_v0_2) - 0.5f; + this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), temp_v0_2); + } + } + + this->actor.flags &= ~(0x8 | 0x1); + } else { + this->unk378 = 0; + this->actor.flags |= (0x8 | 0x1); + } + + temp_v1_3 = globalCtx->gameplayFrames % 128; + if ((temp_v1_3 & 0x40) != 0) { + sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); + if (temp_v1_3 == 64) { + this->behaviorInfo.unk4C = 0; + } + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->behaviorInfo.unk4C, 40); + temp_v1_4 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos); + temp_v1_4 *= 0.85f; + temp_v1_4 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1_4, -3000, 3000); + diff = BINANG_SUB(sp3A, this->actor.shape.rot.y); + temp_v1_4 = diff; + temp_v1_4 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1_4, -8000, 8000); + } + + if (((this->actor.flags & 0x40) == 0x40) && (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK); + } + + if (this->clockTime >= 0.9999f) { + Actor_MarkForDeath(&this->actor); + return; + } + + if ((sp68 != NULL) && (sp68->actionFunc == func_80B4C058)) { + func_80B4CC70(this); + } +} + +void func_80B4CAB0(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 4000; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + this->behaviorInfo.unk4C = 0; + this->actionFunc = func_80B4CB0C; +} + +void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 3000, 500); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); + temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos)); + temp_v1 *= 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + if (func_800B867C(&this->actor, globalCtx)) { + func_80B4C6C8(this); + } +} + +void func_80B4CC70(EnInvadepoh* this) { + this->behaviorInfo.unk30 = 0.08f; + this->behaviorInfo.unk2C = 2000; + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f); + this->behaviorInfo.unk4C = 0; + this->actionFunc = func_80B4CCCC; +} + +void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx) { + AlienBehaviorInfo* substruct = &this->behaviorInfo; + Player* player = PLAYER; + s16 temp_v1; + s16 diff; + + Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); + temp_v1 *= 0.85f; + temp_v1 -= this->actor.shape.rot.x; + substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); + diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); + temp_v1 = diff; + temp_v1 *= 0.7f; + substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); + if (D_80B503F8 == NULL) { + func_80B4C6C8(this); + } else if ((D_80B503F8 != NULL) && (D_80B503F8->actionFunc != func_80B4C058)) { + func_80B4C6C8(this); + } +} + +void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) { + s32 pad[2]; + EnInvadepoh* this = THIS; + s32 sp38; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + sp38 = gSaveContext.time; + + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B44F58(); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable, + this->transitionDrawTable, 23); + func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f); + func_80B446D0(this, globalCtx); + this->actor.world.rot.y = this->actor.shape.rot.y; + func_80B44700(this); + func_80B44EFC(this, globalCtx); + func_80B43F0C(this); + func_80B4516C(this); + this->actor.textId = 0x33CE; + if ((sp38 >= CLOCK_TIME(6, 0)) && (sp38 < CLOCK_TIME(20, 0))) { + this->actor.update = func_80B4CFFC; + this->actor.draw = NULL; + } else if ((sp38 >= 0xD555) && (sp38 < 0xD7E1)) { + this->actor.update = func_80B4D054; + this->actor.draw = func_80B4E324; + func_80B4C6C8(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + if ((gSaveContext.time >= CLOCK_TIME(20, 0)) && (gSaveContext.time < 0xD7E1)) { + this->actor.update = func_80B4D054; + this->actor.draw = func_80B4E324; + func_80B4C6C8(this); + } +} + +void func_80B4D054(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 sp2C = (this->actor.flags & 0x40) == 0x40; + s32 isTalking = func_800B84D0(&this->actor, globalCtx); + + if (isTalking) { + func_80151BB4(globalCtx, 5); + func_80B4CAB0(this); + } + this->actionFunc(this, globalCtx); + if (sp2C && this->actor.update != NULL) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_80B45CE0(&this->behaviorInfo); + if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) { + func_800B8614(thisx, globalCtx, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B4D15C(EnInvadepoh* this) { + s32 pad; + s32 temp_v1 = this->actor.params & 7; + unkstruct80B4EE0C* temp_v0; + + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001674); + this->skelAnime.animCurrentFrame = ((this->actor.params & 7) * this->skelAnime.animFrameCount) * 0.25f; + this->alienAlpha = 255; + this->actor.draw = func_80B4DB14; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 255; + temp_v0 = &D_80B4EE0C[temp_v1]; + this->velocityStep = temp_v0->unk00; + this->unk304 = temp_v1 * 0x5555; + this->actor.world.pos.x = this->actor.home.pos.x + (Math_SinS(this->unk304) * 80.0f); + this->actor.world.pos.y = this->actor.home.pos.y; + this->actor.world.pos.z = this->actor.home.pos.z + (Math_CosS(this->unk304) * 80.0f); + this->actor.shape.rot.y = this->unk304 + 0x4000; + this->behaviorInfo.unk4C = temp_v0->unk04; + this->behaviorInfo.unk4E = temp_v0->unk06; + this->actionFunc = func_80B4D290; + this->actor.velocity.y = 0.0f; +} + +void func_80B4D290(EnInvadepoh* this, GlobalContext* globalCtx) { + f32 temp_f10; + f32 sp28; + Actor* temp_v1; + + if (D_80B503F0 == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + + Math_StepToF(&this->actor.velocity.y, 15.0f, this->velocityStep); + sp28 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, this->actor.velocity.y, + 0.01f); + this->unk304 += 0x2BC; + this->actor.world.pos.x = (Math_SinS(this->unk304) * 80.0f) + this->actor.home.pos.x; + temp_f10 = Math_CosS(this->unk304) * 80.0f; + this->behaviorInfo.unk4C += this->behaviorInfo.unk4E; + temp_v1 = this->actor.child; + this->actor.shape.rot.y += this->behaviorInfo.unk4C; + this->actor.world.pos.z = this->actor.home.pos.z + ((0, temp_f10)); + if (this->actor.child != NULL) { + this->actor.child->world.pos.x = this->actor.world.pos.x; + temp_v1->world.pos.y = this->actor.world.pos.y - 38.0f; + temp_v1->world.pos.z = this->actor.world.pos.z; + temp_v1->shape.rot.y = this->actor.shape.rot.y; + } + + if (sp28 < 5.0f) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B4D3E4(EnInvadepoh* this) { + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001674); + this->skelAnime.animCurrentFrame = (this->actor.params & 7) * this->skelAnime.animFrameCount * 0.25f; + this->alienAlpha = 255; + this->actor.draw = NULL; + this->drawAlien = true; + this->drawAlienDeathEffect = false; + this->alienBeamAlpha = 255; + this->unk306 = 400; + this->unk304 = 0; + this->actionTimer = 200; + this->actor.velocity.y = 0.0f; + this->actionFunc = func_80B4D480; +} + +void func_80B4D480(EnInvadepoh* this, GlobalContext* globalCtx) { + f32 target; + s32 pad2; + s32 sp2C = false; + f32 new_var3; + + if (this->actionTimer > 0) { + this->actionTimer--; + } + + if (this->actionTimer > 160) { + this->actor.draw = NULL; + } else { + this->actor.draw = func_80B4DB14; + if (1) {} + if ((this->actionTimer < 105) && (this->actionTimer >= 100)) { + this->actor.gravity = -1.0f; + Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); + } else { + this->actor.gravity = 0.7f; + Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 8, 0x320, 0x28); + } + + this->actor.velocity.y += this->actor.gravity; + this->actor.velocity.y *= 0.92f; + if (this->actionTimer > 80) { + this->actor.world.pos.y += this->actor.velocity.y; + } else { + target = (this->actor.home.pos.y + 850.0f); + sp2C = Math_StepToF(&this->actor.world.pos.y, target, fabsf(this->actor.velocity.y)); + } + + new_var3 = (this->unk304 * -0.06f + this->unk306); + new_var3 *= 0.98f; + this->unk306 = new_var3; + this->actor.shape.rot.y += this->unk306; + + if (this->actor.child != NULL) { + Actor* temp_v1 = this->actor.child; + + temp_v1->world.pos.x = this->actor.world.pos.x; + temp_v1->world.pos.y = this->actor.world.pos.y - 30.0f; + temp_v1->world.pos.z = this->actor.world.pos.z; + temp_v1->shape.rot.y = this->actor.shape.rot.y; + } + } + + if ((this->actionTimer <= 0) || sp2C) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B4D670(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvadepoh* this = THIS; + s32 invadepohType; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + invadepohType = this->actor.params & 7; + this->actor.objBankIndex = this->bankIndex; + Actor_SetObjectSegment(globalCtx, &this->actor); + func_80B45080(); + this->actor.update = func_80B4D760; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004E50, &D_06001674, this->limbDrawTable, + this->transitionDrawTable, 14); + if (invadepohType < 3) { + func_80B453F4(this, globalCtx, invadepohType); + func_80B4D15C(this); + } else { + func_80B45460(this, globalCtx); + func_80B4D3E4(this); + } + } +} + +void func_80B4D760(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + this->actionFunc(this, globalCtx); + if (this->actor.update != NULL) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); + } +} + +void func_80B4D7B8(GlobalContext* globalCtx) { + s32 temp_v0; + u32 temp_s5; + u32 temp_s6; + unkStruct80B50350* phi_s2; + s32 i; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + for (phi_s2 = D_80B50350, i = 0; i < 10; phi_s2++, i++) { + if (phi_s2->unk1 > 0) { + temp_v0 = globalCtx->gameplayFrames; + temp_s5 = (temp_v0 + ((0x10 * i) & 0xFFU)) & 0x7F; + temp_s6 = (u8)(temp_v0 * -0xF); + SysMatrix_InsertTranslation(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, phi_s2->unk2); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); + temp_v0 = globalCtx->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, &D_0402E510); + } + } + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80B4D9B4(Actor* thisx, GlobalContext* globalCtx) { + func_80B4D7B8(globalCtx); +} + +s32 func_80B4D9D8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + return 0; +} + +void func_80B4D9F4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + EnInvadepoh* this = THIS; + + if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) { + SysMatrix_StatePush(); + SysMatrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY); + Matrix_RotateY(-0x3830, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + SysMatrix_CopyCurrentState(&D_80B502A0); + SysMatrix_StatePop(); + } else if ((limbIndex == 13) && (this->alienBeamAlpha != 0)) { + SysMatrix_StatePush(); + SysMatrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY); + Matrix_RotateY(-0x47D0, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + SysMatrix_CopyCurrentState(&D_80B502E0); + SysMatrix_StatePop(); + } + if (limbIndex == 11) { + SysMatrix_MultiplyVector3fByState(&D_80B4EE24, &this->actor.focus.pos); + } +} + +void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + Gfx* gfx; + GraphicsContext* spCC = globalCtx->state.gfxCtx; + + OPEN_DISPS(spCC); + func_8012C2DC(spCC); + SysMatrix_StatePush(); + if (this->drawAlien) { + Gfx* new_var6; + Gfx* spBC; + GraphicsContext* spB8; + + if (this->alienAlpha == 255) { + func_8012C28C(globalCtx->state.gfxCtx); + AnimatedMat_Draw(globalCtx, D_80B50400); + Scene_SetRenderModeXlu(globalCtx, 0, 1); + gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255); + spCC->polyOpa.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, + this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, + spCC->polyOpa.p); + } else { + AnimatedMat_Draw(globalCtx, D_80B50400); + Scene_SetRenderModeXlu(globalCtx, 1, 2); + gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha); + spCC->polyXlu.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, + this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, + spCC->polyXlu.p); + } + + if (this->alienBeamAlpha != 0) { + AnimatedMat_Draw(globalCtx, D_80B503FC); + spB8 = globalCtx->state.gfxCtx; + gfx = spBC = spB8->polyXlu.p; + gDPPipeSync(spBC++); + gDPSetPrimColor(spBC++, 0, 255, 240, 180, 100, 60); + gDPSetEnvColor(spBC++, 255, 255, 255, this->alienBeamAlpha * (150.0f / 255.0f)); + SysMatrix_InsertMatrix(&D_80B502A0, MTXMODE_NEW); + gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(spBC++, D_06000080); + SysMatrix_InsertMatrix(&D_80B502E0, MTXMODE_NEW); + gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(spBC++, D_06000080); + spB8->polyXlu.p = spBC; + } + } + + if (this->drawAlienDeathEffect) { + SysMatrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f, + this->actor.world.pos.z, &this->actor.shape.rot); + Matrix_Scale(this->alienDeathEffectScale.x, this->alienDeathEffectScale.y, this->alienDeathEffectScale.z, + MTXMODE_APPLY); + gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(spCC->polyXlu.p++, D_06000720); + } + + if (this->drawAlien) { + Vec3f sp80; + Vec3f sp74; + s32 alpha2; + GraphicsContext* sp6C = globalCtx->state.gfxCtx; + u32 pad; + + gfx = sp6C->polyXlu.p; + gfx = func_8012C868(gfx); + gSPSetOtherMode(gfx++, G_SETOTHERMODE_H, 4, 4, 0x00000080); + gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, + 0); + SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW); + SysMatrix_GetStateTranslationAndScaledZ(60.0f, &sp80); + sp74.x = thisx->world.pos.x + sp80.x; + sp74.y = thisx->world.pos.y + sp80.y + 68.0f; + sp74.z = thisx->world.pos.z + sp80.z; + SysMatrix_InsertTranslation(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); + Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); + alpha2 = this->alienAlpha * (100.0f / 255.0f); + gSPDisplayList(gfx++, D_04029CB0); + gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, alpha2); + gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, D_04029CF0); + sp6C->polyXlu.p = gfx; + if ((this->alienAlpha > 128) && func_80B456A8(globalCtx, &sp74)) { + func_800F9824(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, sp74, 10.0f, 9.0f, + 0, 0); + } + } + + SysMatrix_StatePop(); + CLOSE_DISPS(spCC); +} + +s32 func_80B4E120(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if (limbIndex == 5) { + EnInvadepoh* this = THIS; + rot->x -= this->actor.shape.rot.x; + } + return 0; +} + +void func_80B4E158(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + func_8012C5B0(globalCtx->state.gfxCtx); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + func_80B4E120, NULL, &this->actor); +} + +void func_80B4E1B0(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + func_8012C5B0(globalCtx->state.gfxCtx); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL, + NULL, &this->actor); +} + +s32 func_80B4E200(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if (limbIndex == 14) { + EnInvadepoh* this = THIS; // both of these needed to match + rot->x += this->behaviorInfo.unk20.y; + rot->y += this->behaviorInfo.unk20.z; + rot->z += this->behaviorInfo.unk20.x; + } else if (limbIndex == 13) { + EnInvadepoh* this = THIS; // both of these needed to match + rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); + rot->z += this->behaviorInfo.unk40; + } + return 0; +} + +void func_80B4E2AC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnInvadepoh* this = THIS; + + if (limbIndex == 19) { + OPEN_DISPS(globalCtx->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, D_060003B0); + CLOSE_DISPS(globalCtx->state.gfxCtx); + } else if (limbIndex == 14) { + SysMatrix_MultiplyVector3fByState(&D_80B4EE30, &this->actor.focus.pos); + } +} + +void func_80B4E324(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E958[this->behaviorInfo.unk10.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E944[this->behaviorInfo.unk0.unkF]); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + func_80B4E200, func_80B4E2AC, &this->actor); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx) { + s32 pad[2]; + Vec3f sp5C; + + SysMatrix_StatePush(); + SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW); + SysMatrix_GetStateTranslationAndScaledZ(200.0f, &sp5C); + SysMatrix_StatePop(); + sp5C.x += thisx->world.pos.x; + sp5C.y += thisx->world.pos.y; + sp5C.z += thisx->world.pos.z; + EnInvadepoh_SetSysMatrix(&sp5C); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); + SysMatrix_InsertZRotation_s(((EnInvadepoh*)thisx)->unk304, MTXMODE_APPLY); + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); + gSPDisplayList(POLY_XLU_DISP++, D_04023210); + if (func_80B456A8(globalCtx, &sp5C)) { + func_800F9824(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, + 0); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +s32 func_80B4E5B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7)) { + EnInvadepoh* this = THIS; + rot->x += this->behaviorInfo.unk20.x; + rot->y += this->behaviorInfo.unk20.y; + rot->z += this->behaviorInfo.unk20.z; + } + + return 0; +} + +void func_80B4E61C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + if (limbIndex == 5) { + SysMatrix_GetStateTranslationAndScaledY(20.0f, &thisx->focus.pos); + } +} + +void func_80B4E660(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + func_80B4E5B0, func_80B4E61C, &this->actor); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +s32 func_80B4E6E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if (limbIndex == 9) { + EnInvadepoh* this = THIS; // both of these needed to match + rot->x += this->behaviorInfo.unk20.y; + rot->y += this->behaviorInfo.unk20.z; + rot->z += this->behaviorInfo.unk20.x; + } else if (limbIndex == 2) { + EnInvadepoh* this = THIS; // both of these needed to match + rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); + } + return 0; +} + +void func_80B4E784(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + if (limbIndex == 9) { + SysMatrix_GetStateTranslation(&thisx->focus.pos); + } +} + +void func_80B4E7BC(Actor* thisx, GlobalContext* globalCtx) { + EnInvadepoh* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E984[this->behaviorInfo.unk10.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E96C[this->behaviorInfo.unk0.unkF]); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + func_80B4E6E4, func_80B4E784, &this->actor); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h index db4b394845..52cde0e270 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -5,9 +5,151 @@ struct EnInvadepoh; +typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, GlobalContext*); +typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, GlobalContext*); +typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, GlobalContext*); + +#define INVADEPOH_TYPE(x) (x->actor.params >> 4 & 0xF) + +typedef enum{ + /* 0 */ TYPE_UNK0, + /* 1 */ TYPE_ALIEN, + /* 2 */ TYPE_PARENT_COW, + /* 3 */ TYPE_CHILD_COW, + /* 4 */ TYPE_ROMANI, + /* 5 */ TYPE_ROMANI1, + /* 6 */ TYPE_UNK6, + /* 7 */ TYPE_ROMANI2, + /* 8 */ TYPE_ROMANI3, + /* 9 */ TYPE_ROMANI4, + /* 10 */ TYPE_DOG, + /* 11 */ TYPE_CREMIA, + /* 12 */ TYPE_ROMANI5, + /* 13 */ TYPE_ALIEN1 +} EnInvadepohType; + +typedef enum { + /* -1 */ DIRECTION_BACKWARD = -1, + /* 1 */ DIRECTION_FORWARD = 1, +} EnInvadepohDirection; + +typedef struct unkStruct80B50350 { + /* 0x000 */ s8 unk0; + /* 0x001 */ s8 unk1; + /* 0x002 */ u8 unk2; + /* 0x004 */ Vec3f unk4; +} unkStruct80B50350; // size = 0x10; + +typedef struct { + /* 0x00 */ s8* unk00; + /* 0x04 */ s8 unk04; +} unkstructInvadepoh0; // size = 0x08 + +typedef struct { + /* 0x00 */ s8 unk00; + /* 0x04 */ f32 unk04; +} unkstructInvadepoh1; // size = 0x08 + +typedef struct { + /* 0x00 */ s8 unk00; + /* 0x04 */ unkstructInvadepoh0* unk04; +} unkstructInvadepoh2; // size = 0x08 + +typedef struct { + /* 0x00 */ s8 unk0; + /* 0x04 */ unkstructInvadepoh0* unk4; + /* 0x08 */ s8 unk8; + /* 0x0C */ unkstructInvadepoh1* unkC; +} unkstructInvadepoh3; // size = 0x10 + +typedef struct { + /* 0x00 */ s8 unk00; + /* 0x04 */ unkstructInvadepoh0* unk04; + /* 0x08 */ s8 unk08; + /* 0x0C */ unkstructInvadepoh1* unk0C; + /* 0x10 */ s16 unk10; + /* 0x12 */ s16 unk12; +} unkstructInvadepoh4; // size = 0x14 + +typedef struct { + /* 0x00 */ f32 unk00; + /* 0x04 */ s16 unk04; + /* 0x06 */ s16 unk06; +} unkstruct80B4EE0C; // size = 0x08 + +typedef struct EnInvadePohStruct { + /* 0x000 */ unkstructInvadepoh4* unk0; + /* 0x004 */ s8 unk4; + /* 0x008 */ unkstructInvadepoh4* unk8; + /* 0x00C */ s16 unkC; + /* 0x00E */ s8 unkE; + /* 0x00F */ s8 unkF; +} EnInvadePohStruct; // size = 0x10; + +typedef struct AlienBehaviorInfo { + /* 0x000 */ EnInvadePohStruct unk0; + /* 0x010 */ EnInvadePohStruct unk10; + /* 0x020 */ Vec3s unk20; + /* 0x026 */ Vec3s unk26; + /* 0x02C */ s16 unk2C; + /* 0x02E */ u16 unk2E; + /* 0x030 */ f32 unk30; + /* 0x034 */ f32 unk34; + /* 0x038 */ f32 unk38; + /* 0x03C */ f32 unk3C; + /* 0x040 */ s16 unk40; + /* 0x042 */ s16 unk42; + /* 0x044 */ f32 unk44; + /* 0x048 */ s16 unk48; + /* 0x04A */ char unk4A[0x2]; + /* 0x04C */ s16 unk4C; + /* 0x04E */ s16 unk4E; +} AlienBehaviorInfo; // size = 0x50 + typedef struct EnInvadepoh { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x27C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s limbDrawTable[23]; + /* 0x212 */ Vec3s transitionDrawTable[23]; + /* 0x29C */ s8 animPlayFlag; + /* 0x2A0 */ ColliderCylinder collider; + /* 0x2EC */ EnInvadepohActionFunc actionFunc; + /* 0x2F0 */ s16 actionTimer; + /* 0x2F2 */ s16 counter; // general counter variable + /* 0x2F4 */ s8 bankIndex; + /* 0x2F8 */ f32 xzPosAdjFactor; + /* 0x2FC */ UNK_TYPE unk2FC; // unused + /* 0x300 */ f32 velocityStep; + /* 0x304 */ s16 unk304; // angle of some sort + /* 0x306 */ s16 unk306; + /* 0x308 */ s8 endPoint; + /* 0x309 */ s8 pathIndex; + /* 0x30A */ s8 direction; // only ever 1 or -1 + /* 0x30C */ Vec3s* pathPoints; + /* 0x310 */ f32 pathTotalDist; + /* 0x314 */ Vec3f curPathPos; + /* 0x320 */ f32 clockTime; + /* 0x324 */ AlienBehaviorInfo behaviorInfo; + /* 0x374 */ s8 rand; + /* 0x376 */ u16 textId; + /* 0x378 */ s8 unk378; + /* 0x379 */ s8 unk379; + /* 0x37C */ f32 unk37C[3]; + /* 0x388 */ s8 unk388; // unused + /* 0x389 */ u8 alienAlpha; + /* 0x38A */ s8 unk38A; // bool + /* 0x38B */ s8 drawAlien; + /* 0x38C */ s8 drawAlienDeathEffect; + /* 0x38D */ u8 alienBeamAlpha; + /* 0x390 */ Vec3f alienDeathEffectScale; + /* 0x39C */ f32 scaleFactorAdj; + /* 0x3A0 */ f32 scaleTarget; + /* 0x3A4 */ f32 scaleStep; + /* 0x3A8 */ s16 scaleAdjAngle; + /* 0x3AA */ s16 unk3AA; + /* 0x3AC */ s8 unk3AC; // index for D_80B4EDD0 + /* 0x3AD */ char unk3AD[0xF]; + /* 0x3BC */ s8 unk3BC; } EnInvadepoh; // size = 0x3C0 extern const ActorInit En_Invadepoh_InitVars; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 499fca5881..872cc7551e 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -663,7 +663,7 @@ void EnMa4_DialogueHandler(EnMa4* this, GlobalContext* globalCtx) { case 6: // End conversation if (func_80147624(globalCtx) != 0) { - if ((globalCtx->msgCtx.unk_120B1 == 0) || + if ((globalCtx->msgCtx.unk120B1 == 0) || (((temp_v0 = gSaveContext.inventory.questItems) & gBitFlags[0x12]) == 0)) { EnMa4_SetupWait(this); } diff --git a/tables/functions.txt b/tables/functions.txt index dc26e9c513..0ca1b0bce9 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -13748,9 +13748,9 @@ 0x80B43DD4:("func_80B43DD4",), 0x80B43E6C:("func_80B43E6C",), 0x80B43F0C:("func_80B43F0C",), - 0x80B43F70:("func_80B43F70",), + 0x80B43F70:("EnInvadepoh_GetTotalPathDistance",), 0x80B44024:("func_80B44024",), - 0x80B4407C:("func_80B4407C",), + 0x80B4407C:("EnInvadepoh_SetPathPointToWorldPos",), 0x80B440B8:("func_80B440B8",), 0x80B44234:("func_80B44234",), 0x80B442E4:("func_80B442E4",), @@ -13784,9 +13784,9 @@ 0x80B453F4:("func_80B453F4",), 0x80B45460:("func_80B45460",), 0x80B454BC:("func_80B454BC",), - 0x80B45518:("func_80B45518",), + 0x80B45518:("EnInvadepoh_SetSysMatrix",), 0x80B45550:("func_80B45550",), - 0x80B4560C:("func_80B4560C",), + 0x80B4560C:("EnInvadepoh_SetTextID",), 0x80B45648:("func_80B45648",), 0x80B456A8:("func_80B456A8",), 0x80B457A0:("func_80B457A0",), @@ -13804,13 +13804,13 @@ 0x80B46184:("func_80B46184",), 0x80B461DC:("func_80B461DC",), 0x80B4627C:("func_80B4627C",), - 0x80B46414:("func_80B46414",), - 0x80B46520:("func_80B46520",), - 0x80B465CC:("func_80B465CC",), - 0x80B46644:("func_80B46644",), + 0x80B46414:("EnInvadepoh_InitAlien",), + 0x80B46520:("EnInvadepoh_InitParentCow",), + 0x80B465CC:("EnInvadepoh_InitChildCow",), + 0x80B46644:("EnInvadepoh_InitRomani",), 0x80B468B4:("func_80B468B4",), - 0x80B469C4:("func_80B469C4",), - 0x80B46A80:("func_80B46A80",), + 0x80B469C4:("EnInvadepoh_InitDog",), + 0x80B46A80:("EnInvadepoh_InitCremia",), 0x80B46B74:("EnInvadepoh_Init",), 0x80B46BB0:("func_80B46BB0",), 0x80B46BC0:("func_80B46BC0",), diff --git a/tables/variables.txt b/tables/variables.txt index b783ba06d4..41751b990e 100644 --- a/tables/variables.txt +++ b/tables/variables.txt @@ -16056,21 +16056,6 @@ 0x80B4EE0C:("D_80B4EE0C","UNK_TYPE1","",0x1), 0x80B4EE24:("D_80B4EE24","UNK_TYPE1","",0x1), 0x80B4EE30:("D_80B4EE30","UNK_TYPE1","",0x1), - 0x80B4EE40:("D_80B4EE40","f32","",0x4), - 0x80B4EE44:("D_80B4EE44","f32","",0x4), - 0x80B4EE48:("D_80B4EE48","f32","",0x4), - 0x80B4EE4C:("D_80B4EE4C","f32","",0x4), - 0x80B4EE50:("D_80B4EE50","f32","",0x4), - 0x80B4EE54:("D_80B4EE54","f32","",0x4), - 0x80B4EE58:("D_80B4EE58","f32","",0x4), - 0x80B4EE5C:("D_80B4EE5C","f32","",0x4), - 0x80B4EE60:("D_80B4EE60","f32","",0x4), - 0x80B4EE64:("D_80B4EE64","f32","",0x4), - 0x80B4EE68:("D_80B4EE68","f32","",0x4), - 0x80B4EE6C:("D_80B4EE6C","f32","",0x4), - 0x80B4EE70:("D_80B4EE70","f32","",0x4), - 0x80B4EE74:("D_80B4EE74","f32","",0x4), - 0x80B4EE78:("D_80B4EE78","f32","",0x4), 0x80B4EE7C:("D_80B4EE7C","f32","",0x4), 0x80B4EE80:("D_80B4EE80","f32","",0x4), 0x80B4EE84:("D_80B4EE84","f32","",0x4), diff --git a/tools/timeconv.py b/tools/timeconv.py new file mode 100755 index 0000000000..2486b7f94a --- /dev/null +++ b/tools/timeconv.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# +# Convert time values such as 0x1AAA to their clock time, i.e. 2,30 +# The time is output with a comma for easy copy-pasting into a macro +# + +import sys + +time = sys.argv[1] +time = int(time, 16 if time.startswith("0x") else 10) + +minutes = round(((24 * 60) / 0x10000) * time) + +hours = int(minutes // 60) +minutes = round(minutes - 60 * hours) + +# Since multiple values are mapped to the same clock time, check that it +# still matches once converted. If it doesn't match as it is, print a warning. +macro_val = int((hours * 60 + minutes) * (0x10000 / (24 * 60))) + +print(f"{hours},{minutes:02} -> 0x{macro_val:04X}") +print(f"CLOCK_TIME({hours}, {minutes})") +if time != macro_val: + print("Warning: Result does not match as-is") diff --git a/tools/warnings_count/warnings_setup_current.txt b/tools/warnings_count/warnings_setup_current.txt index 30314771e1..d828c6a7ce 100644 --- a/tools/warnings_count/warnings_setup_current.txt +++ b/tools/warnings_count/warnings_setup_current.txt @@ -4,4 +4,4 @@ In function ‘strncpy’, inlined from ‘parse_int’ at vtxdis.c:41:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file