From 8b4b404a997c4344d9896cc3945dbb0432968bec Mon Sep 17 00:00:00 2001 From: petrie911 Date: Fri, 30 Sep 2022 19:35:52 -0500 Subject: [PATCH 01/10] deimplementation complete --- spec | 5 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 5119 ++--------------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 153 +- tools/disasm/functions.txt | 20 +- 4 files changed, 634 insertions(+), 4663 deletions(-) diff --git a/spec b/spec index b4a8a6108..1bb3614c0 100644 --- a/spec +++ b/spec @@ -3846,7 +3846,10 @@ beginseg name "ovl_En_Invadepoh" compress include "build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o" - include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.data.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.bss.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.reloc.o" + // include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" endseg beginseg 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 2050c7316..a459c96e7 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,122 +1,73 @@ -/* - * File: z_en_invadepoh.c - * Overlay: ovl_En_Invadepoh - * Description: Ranch nighttime actors - */ - #include "z_en_invadepoh.h" -#include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_ma1/object_ma1.h" -#include "objects/object_ma2/object_ma2.h" -#include "objects/object_dog/object_dog.h" -#include "objects/object_cow/object_cow.h" -#include "objects/object_uch/object_uch.h" +// #include "assets/objects/gameplay_keep/gameplay_keep.h" +// #include "assets/objects/object_uch/object_uch.h" +// #include "assets/objects/object_ma1/object_ma1.h" +// #include "assets/objects/object_ma2/object_ma2.h" +// #include "assets/objects/object_cow/object_cow.h" +// #include "assets/objects/object_dog/object_dog.h" -#define FLAGS (ACTOR_FLAG_10) +#define FLAGS 0x00000010 #define THIS ((EnInvadepoh*)thisx) +typedef struct { + f32 unk0; + s16 unk4; + s16 unk6; +} EnInvadepohUnkStruct1; + +typedef struct { + u8* unk0; + u8 unk4; +} EnInvadepohUnkStruct2; + +typedef struct { + s32 unk0; + EnInvadepohUnkStruct2* unk4; +} EnInvadepohUnkStruct3; + +typedef struct { + u8 unk0; + f32 unk4; +} EnInvadepohUnkStruct4; + +typedef struct { + u8 unk0; + EnInvadepohUnkStruct2* unk4; + u8 unk8; + EnInvadepohUnkStruct4* unkC; +} EnInvadepohUnkStruct5; + +typedef struct { + u8 unk0; + EnInvadepohUnkStruct2* unk4; + u8 unk8; + EnInvadepohUnkStruct4* unkC; + s16 unk10; + s16 unk12; +} EnInvadepohUnkStruct6; + void EnInvadepoh_Init(Actor* thisx, PlayState* play); void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); void EnInvadepoh_Update(Actor* thisx, PlayState* play); -void func_80B46DA8(EnInvadepoh* this); -void func_80B46DC8(EnInvadepoh* this, PlayState* play); -void func_80B46E20(EnInvadepoh* this); -void func_80B46E44(EnInvadepoh* this, PlayState* play); -void func_80B46EC0(EnInvadepoh* this); -void func_80B46EE8(EnInvadepoh* this, PlayState* play); -void func_80B46F88(EnInvadepoh* this); -void func_80B46FA8(EnInvadepoh* this, PlayState* play); -void func_80B47064(EnInvadepoh* this); -void func_80B47084(EnInvadepoh* this, PlayState* play); -void func_80B470E0(EnInvadepoh* this); -void func_80B47108(EnInvadepoh* this, PlayState* play); -void func_80B471C0(EnInvadepoh* this); -void func_80B471E0(EnInvadepoh* this, PlayState* play); -void func_80B47248(EnInvadepoh* this); -void func_80B47268(EnInvadepoh* this, PlayState* play); -void func_80B47298(EnInvadepoh* this, PlayState* play); -void func_80B47304(EnInvadepoh* this); -void func_80B47324(EnInvadepoh* this, PlayState* play); -void func_80B473E4(EnInvadepoh* this, PlayState* play); -void func_80B474DC(EnInvadepoh* this, PlayState* play); -void func_80B47600(EnInvadepoh* this, PlayState* play); -void func_80B477B4(EnInvadepoh* this, PlayState* play); -void func_80B48324(EnInvadepoh* this, PlayState* play); -void func_80B4ACF0(EnInvadepoh* this, PlayState* play); -void func_80B4AD3C(EnInvadepoh* this); -void func_80B4AD60(EnInvadepoh* this, PlayState* play); -void func_80B4ADB8(EnInvadepoh* this); -void func_80B4ADCC(EnInvadepoh* this, PlayState* play); -void func_80B4AEC0(EnInvadepoh* this); -void func_80B4AEDC(EnInvadepoh* this, PlayState* play); -void func_80B4AF80(EnInvadepoh* this); -void func_80B4AF94(EnInvadepoh* this, PlayState* play); -void func_80B4B024(EnInvadepoh* this); -void func_80B4B048(EnInvadepoh* this, PlayState* play); -void func_80B4B484(EnInvadepoh* this, PlayState* play); -void func_80B4B510(EnInvadepoh* this); -void func_80B4B564(EnInvadepoh* this, PlayState* play); -void func_80B4B724(EnInvadepoh* this); -void func_80B4B768(EnInvadepoh* this, PlayState* play); -void func_80B4B820(EnInvadepoh* this); -void func_80B4B864(EnInvadepoh* this, PlayState* play); -void func_80B48374(EnInvadepoh* this); -void func_80B483CC(EnInvadepoh* this, PlayState* play); -void func_80B49A00(EnInvadepoh* this, PlayState* play); -void func_80B4994C(EnInvadepoh* this, PlayState* play); -void func_80B497EC(EnInvadepoh* this, PlayState* play); -void func_80B49628(EnInvadepoh* this); -void func_80B49670(EnInvadepoh* this, PlayState* play); -void func_80B49454(EnInvadepoh* this, PlayState* play); -void func_80B4934C(EnInvadepoh* this, PlayState* play); -void func_80B491EC(EnInvadepoh* this); -void func_80B49228(EnInvadepoh* this, PlayState* play); -void func_80B49C38(EnInvadepoh* this, PlayState* play); -void func_80B49DFC(EnInvadepoh* this, PlayState* play); -void func_80B4A350(EnInvadepoh* this, PlayState* play); -void func_80B4A5E4(EnInvadepoh* this, PlayState* play); -void func_80B4A67C(EnInvadepoh* this, PlayState* play); -void func_80B4A81C(EnInvadepoh* this, PlayState* play); -void func_80B4BC4C(EnInvadepoh* this, PlayState* play); -void func_80B4C058(EnInvadepoh* this, PlayState* play); -void func_80B4C218(EnInvadepoh* this, PlayState* play); -void func_80B4C730(EnInvadepoh* this, PlayState* play); -void func_80B4CB0C(EnInvadepoh* this, PlayState* play); -void func_80B4CCCC(EnInvadepoh* this, PlayState* play); -void func_80B4D480(EnInvadepoh* this, PlayState* play); -void func_80B47568(EnInvadepoh* this); -void func_80B478F4(EnInvadepoh* this, PlayState* play); -void func_80B47938(EnInvadepoh* this); -void func_80B479E8(EnInvadepoh* this, PlayState* play); -void func_80B4843C(EnInvadepoh* this); -void func_80B484EC(EnInvadepoh* this, PlayState* play); -void func_80B48588(EnInvadepoh* this); -void func_80B48610(EnInvadepoh* this, PlayState* play); -void func_80B48848(EnInvadepoh* this, PlayState* play); -void func_80B47278(EnInvadepoh* this); -void func_80B48AD4(EnInvadepoh* this, PlayState* play); -void func_80B48E4C(EnInvadepoh* this, PlayState* play); -void func_80B49404(EnInvadepoh* this); -void func_80B4A570(EnInvadepoh* this); -void func_80B4C1BC(EnInvadepoh* this); -void func_80B4D290(EnInvadepoh* this, PlayState* play); -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_80B4D9B4(Actor* thisx, PlayState* play); + void func_80B4627C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play); +void func_80B46414(EnInvadepoh* this, PlayState* play); +void func_80B46520(EnInvadepoh* this, PlayState* play); +void func_80B465CC(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); void func_80B468B4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); +void func_80B469C4(EnInvadepoh* this, PlayState* play); +void func_80B46A80(EnInvadepoh* this, PlayState* play); +void func_80B46644(EnInvadepoh* this, PlayState* play); +void func_80B46414(EnInvadepoh* this, PlayState* play); + void func_80B46BB0(EnInvadepoh* this, PlayState* play); void func_80B46BC0(EnInvadepoh* this, PlayState* play); void func_80B46C08(EnInvadepoh* this, PlayState* play); @@ -131,53 +82,126 @@ void func_80B46C94(EnInvadepoh* this, PlayState* play); void func_80B46CC0(EnInvadepoh* this, PlayState* play); void func_80B46CF4(EnInvadepoh* this, PlayState* play); void func_80B46D28(EnInvadepoh* this, PlayState* play); -void func_80B4D670(Actor* thisx, PlayState* play); -void func_80B47BAC(Actor* thisx, PlayState* play); -void func_80B47D30(Actor* thisx, PlayState* play); -void func_80B47FA8(Actor* thisx, PlayState* play); -void func_80B48060(Actor* thisx, PlayState* play); -void func_80B481C4(Actor* thisx, PlayState* play); -void func_80B4827C(Actor* thisx, PlayState* play); -void func_80B48620(Actor* thisx, PlayState* play); -void func_80B48FB0(Actor* thisx, PlayState* play); -void func_80B49F88(Actor* thisx, PlayState* play); -void func_80B4A9C8(Actor* thisx, PlayState* play); -void func_80B4B0C4(Actor* thisx, PlayState* play); -void func_80B4CE54(Actor* thisx, PlayState* play); -void func_80B4B8BC(Actor* thisx, PlayState* play); -void func_80B4C3A0(Actor* thisx, PlayState* play); -void func_80B49B1C(Actor* thisx, PlayState* play); -void func_80B4E158(Actor* thisx, PlayState* play); -void func_80B4E3F0(Actor* thisx, PlayState* play); -void func_80B4D9B4(Actor* thisx, PlayState* play); -void func_80B4E1B0(Actor* thisx, PlayState* play); -void func_80B4E324(Actor* thisx, PlayState* play); -void func_80B4BA84(Actor* thisx, PlayState* play); -void func_80B4E660(Actor* thisx, PlayState* play); -void func_80B4C5C0(Actor* thisx, PlayState* play); -void func_80B4E7BC(Actor* thisx, PlayState* play); -void func_80B4A1B8(Actor* thisx, PlayState* play); -void func_80B4ABDC(Actor* thisx, PlayState* play); -void func_80B4D054(Actor* thisx, PlayState* play); -void func_80B4DB14(Actor* thisx, PlayState* play); -void func_80B4D760(Actor* thisx, PlayState* play); -void func_80B4A168(Actor* thisx, PlayState* play); -void func_80B4873C(Actor* thisx, PlayState* play); -void func_80B490F0(Actor* thisx, PlayState* play); -void func_80B4AB8C(Actor* thisx, PlayState* play); -void func_80B4B218(Actor* thisx, PlayState* play); -void func_80B4BA30(Actor* thisx, PlayState* play); -void func_80B4C568(Actor* thisx, PlayState* play); -void func_80B4CFFC(Actor* thisx, PlayState* play); -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 s32 D_801BDA9C; +extern ColliderCylinderInit D_80B4E8B0; +extern ColliderCylinderInit D_80B4E8DC; +extern ColliderCylinderInit D_80B4E908; +extern Vec3f D_80B4E934; +extern s32 D_80B4E940; +extern TexturePtr sRomaniEyeTextures[]; +extern TexturePtr sRomaniMouthTextures[]; +extern s32 D_80B4E968; +extern TexturePtr sCremiaEyeTextures[]; +extern TexturePtr sCremiaMouthTextures[]; +extern s32 D_80B4E994; +extern s32 D_80B4E998; +extern u8 D_80B4E99C[]; +extern u8 D_80B4E9A0[]; +extern u8 D_80B4E9A4[]; +extern u8 D_80B4E9AC[]; +extern u8 D_80B4E9B4[]; +extern u8 D_80B4E9BC[]; +extern u8 D_80B4E9C0[]; +extern u8 D_80B4EAB0[]; +extern EnInvadepohUnkStruct2 D_80B4E9C4[]; +extern EnInvadepohUnkStruct2 D_80B4E9CC[]; +extern EnInvadepohUnkStruct2 D_80B4E9D4[]; +extern EnInvadepohUnkStruct2 D_80B4E9DC[]; +extern EnInvadepohUnkStruct2 D_80B4E9E4[]; +extern EnInvadepohUnkStruct2 D_80B4E9EC[]; +extern EnInvadepohUnkStruct2 D_80B4E9F4[]; +extern EnInvadepohUnkStruct3 D_80B4E9FC; +extern EnInvadepohUnkStruct4 D_80B4EA04[]; +extern EnInvadepohUnkStruct4 D_80B4EA24; +extern EnInvadepohUnkStruct6 D_80B4EA2C; +extern EnInvadepohUnkStruct5 D_80B4EA40; +extern EnInvadepohUnkStruct5 D_80B4EA50; +extern EnInvadepohUnkStruct5 D_80B4EA60; +extern EnInvadepohUnkStruct5 D_80B4EA70; +extern EnInvadepohUnkStruct3 D_80B4EA80; +extern EnInvadepohUnkStruct3 D_80B4EA88; +extern void* D_80B4EA90[]; +extern u8 D_80B4EAB0[]; +extern u8 D_80B4EAB4[]; +extern u8 D_80B4EAB8[]; +extern u8 D_80B4EABC[]; +extern EnInvadepohUnkStruct2 D_80B4EAC0; +extern EnInvadepohUnkStruct2 D_80B4EAC8; +extern EnInvadepohUnkStruct2 D_80B4EAD0; +extern EnInvadepohUnkStruct2 D_80B4EAD8; +extern EnInvadepohUnkStruct3 D_80B4EAE0; +extern EnInvadepohUnkStruct3 D_80B4EAE8; +extern EnInvadepohUnkStruct3 D_80B4EAF0; +extern EnInvadepohUnkStruct3 D_80B4EAF8; +extern EnInvadepohUnkStruct3* D_80B4EB00[]; +extern u8 D_80B4EB10[]; +extern u8 D_80B4EB14[]; +extern u8 D_80B4EB18[]; +extern u8 D_80B4EB20[]; +extern u8 D_80B4EB28[]; +extern EnInvadepohUnkStruct2 D_80B4EB30; +extern EnInvadepohUnkStruct2 D_80B4EB38; +extern EnInvadepohUnkStruct2 D_80B4EB40; +extern EnInvadepohUnkStruct2 D_80B4EB48; +extern EnInvadepohUnkStruct2 D_80B4EB50; +extern EnInvadepohUnkStruct2 D_80B4EB58; +extern EnInvadepohUnkStruct3 D_80B4EB58; +extern EnInvadepohUnkStruct4 D_80B4EB60[]; +extern EnInvadepohUnkStruct4 D_80B4EB80; +extern EnInvadepohUnkStruct6 D_80B4EB88; +extern EnInvadepohUnkStruct5 D_80B4EB9C; +extern EnInvadepohUnkStruct5 D_80B4EBAC; +extern EnInvadepohUnkStruct5 D_80B4EBBC; +extern EnInvadepohUnkStruct5 D_80B4EBCC; +extern void* D_80B4EBDC[]; +extern u8 D_80B4EBF4[]; +extern EnInvadepohUnkStruct2 D_80B4EBF8; +extern EnInvadepohUnkStruct3 D_80B4EC00; +extern EnInvadepohUnkStruct3* D_80B4EC08; +extern void* D_80B4EC0C[]; +extern Color_RGBA8 D_80B4EC18; +extern Color_RGBA8 D_80B4EC1C; +extern void* D_80B4EC20; +extern InitChainEntry D_80B4EC24[]; +extern InitChainEntry D_80B4EC34[]; +extern InitChainEntry D_80B4EC44[]; +extern InitChainEntry D_80B4EC54[]; +extern InitChainEntry D_80B4EC68[]; +extern InitChainEntry D_80B4EC80[]; +extern InitChainEntry D_80B4EC98[]; +extern EnInvadepohInitFunc* D_80B4ECB0[]; +extern EnInvadepohDestFunc* D_80B4ECE8[]; +extern s16 D_80B4ED20[]; +extern Vec3f D_80B4ED30[]; +extern Vec3f D_80B4ED6C[]; +extern Vec3s D_80B4EDC0; +extern Vec3s D_80B4EDC8; +extern Vec3f D_80B4EDD0[]; +extern EnInvadepohUnkStruct1 D_80B4EE0C[]; +extern Vec3f D_80B4EE24; +extern Vec3f D_80B4EE30; +extern MtxF D_80B502A0; +extern MtxF D_80B502E0; +extern Actor *D_80B50320; +extern s32 D_80B50324; +extern s32 D_80B50328; +extern s32 D_80B5032C; +extern u8 D_80B50340; +extern s8 D_80B50348; +extern s32 D_80B50350[]; +extern Actor *D_80B503F0; +extern EnInvadepoh *D_80B503F4; +extern EnInvadepoh *D_80B503F8; +extern AnimatedMaterial *sAlienEmptyTexAnim; +extern AnimatedMaterial *sAlienEyeBeamTexAnim; +extern s16 D_80B50404; +extern s16 D_80B50406; +extern s16 D_80B5040A; +extern Actor *D_80B5040C; + + +/* const ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, @@ -189,4413 +213,492 @@ const ActorInit En_Invadepoh_InitVars = { (ActorFunc)EnInvadepoh_Update, (ActorFunc)NULL, }; +*/ -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 TexturePtr sRomaniEyeTextures[] = { - gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, -}; - -static TexturePtr sRomaniMouthTextures[] = { - gRomaniMouthHappyTex, - gRomaniMouthFrownTex, - gRomaniMouthHangingOpenTex, - gRomaniMouthSmileTex, -}; - -static s8 D_80B4E968 = 0; - -static TexturePtr sCremiaEyeTextures[] = { - gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, -}; - -static TexturePtr sCremiaMouthTextures[] = { - gCremiaMouthNormalTex, - gCremiaMouthSlightSmileTex, - gCremiaMouthFrownTex, - gCremiaMouthHangingOpenTex, -}; - -static s8 D_80B4E994 = 0; - -static s8 D_80B4E998 = 0; - -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/func_80B439B0.s") -static unkstructInvadepoh0 D_80B4E9CC = { D_80B4E9A0, 4 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A24.s") -static unkstructInvadepoh0 D_80B4E9D4 = { D_80B4E9A4, 5 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A74.s") -static unkstructInvadepoh0 D_80B4E9DC = { D_80B4E9AC, 6 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A9C.s") -static unkstructInvadepoh0 D_80B4E9E4 = { D_80B4E9B4, 8 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AB0.s") -static unkstructInvadepoh0 D_80B4E9EC = { D_80B4E9BC, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AF0.s") -static unkstructInvadepoh0 D_80B4E9F4 = { D_80B4E9C0, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43B80.s") -static unkstructInvadepoh2 D_80B4E9FC = { 0, &D_80B4E9C4 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43BC8.s") -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/func_80B43DD4.s") -static unkstructInvadepoh1 D_80B4EA24[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43E6C.s") -static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F0C.s") -static unkstructInvadepoh3 D_80B4EA40 = { - 1, - &D_80B4E9CC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F70.s") -static unkstructInvadepoh3 D_80B4EA50 = { - 1, - &D_80B4E9D4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44024.s") -static unkstructInvadepoh3 D_80B4EA60 = { - 1, - &D_80B4E9DC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4407C.s") -static unkstructInvadepoh3 D_80B4EA70 = { - 1, - &D_80B4E9E4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B440B8.s") -static unkstructInvadepoh2 D_80B4EA80 = { - 0, - &D_80B4E9EC, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44234.s") -static unkstructInvadepoh2 D_80B4EA88 = { - 0, - &D_80B4E9F4, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B442E4.s") -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/func_80B443A0.s") -static s8 D_80B4EAB0[] = { 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444BC.s") -static s8 D_80B4EAB4[] = { 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444F4.s") -static s8 D_80B4EAB8[] = { 2 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44514.s") -static s8 D_80B4EABC[] = { 3 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44540.s") -static unkstructInvadepoh0 D_80B4EAC0 = { D_80B4EAB0, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44570.s") -static unkstructInvadepoh0 D_80B4EAC8 = { D_80B4EAB4, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44620.s") -static unkstructInvadepoh0 D_80B4EAD0 = { D_80B4EAB8, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44640.s") -static unkstructInvadepoh0 D_80B4EAD8 = { D_80B4EABC, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44664.s") -static unkstructInvadepoh2 D_80B4EAE0 = { 0, &D_80B4EAC0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44690.s") -static unkstructInvadepoh2 D_80B4EAE8 = { 0, &D_80B4EAC8 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B446D0.s") -static unkstructInvadepoh2 D_80B4EAF0 = { 0, &D_80B4EAD0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44700.s") -static unkstructInvadepoh2 D_80B4EAF8 = { 0, &D_80B4EAD8 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B447C0.s") -static void* D_80B4EB00[] = { - &D_80B4EAE0, - &D_80B4EAE8, - &D_80B4EAF0, - &D_80B4EAF8, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44A90.s") -static s8 D_80B4EB10[] = { 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B78.s") -static s8 D_80B4EB14[] = { 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B84.s") -static s8 D_80B4EB18[] = { 0, 1, 2, 1, 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C24.s") -static s8 D_80B4EB20[] = { 0, 1, 2, 2, 1, 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C80.s") -static s8 D_80B4EB28[] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44E90.s") -static unkstructInvadepoh0 D_80B4EB30 = { D_80B4EB10, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44EFC.s") -static unkstructInvadepoh0 D_80B4EB38 = { D_80B4EB14, 4 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44F58.s") -static unkstructInvadepoh0 D_80B4EB40 = { D_80B4EB18, 5 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44FEC.s") -static unkstructInvadepoh0 D_80B4EB48 = { D_80B4EB20, 6 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45080.s") -static unkstructInvadepoh0 D_80B4EB50 = { D_80B4EB28, 8 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B450C0.s") -static unkstructInvadepoh2 D_80B4EB58 = { 0, &D_80B4EB30 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4516C.s") -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/func_80B451A0.s") -static unkstructInvadepoh1 D_80B4EB80[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B452EC.s") -static unkstructInvadepoh4 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 0x28, 0x3C }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B453F4.s") -static unkstructInvadepoh3 D_80B4EB9C = { - 1, - &D_80B4EB38, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45460.s") -static unkstructInvadepoh3 D_80B4EBAC = { - 1, - &D_80B4EB40, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B454BC.s") -static unkstructInvadepoh3 D_80B4EBBC = { - 1, - &D_80B4EB48, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45518.s") -static unkstructInvadepoh3 D_80B4EBCC = { - 1, - &D_80B4EB50, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45550.s") -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/func_80B4560C.s") -static s8 D_80B4EBF4[] = { 0 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45648.s") -static unkstructInvadepoh0 D_80B4EBF8 = { D_80B4EBF4, 1 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B456A8.s") -static unkstructInvadepoh2 D_80B4EC00 = { 0, &D_80B4EBF8 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B457A0.s") -static void* D_80B4EC08[] = { &D_80B4EC00 }; +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B458D8.s") -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.rot, 0, ICHAIN_CONTINUE), - ICHAIN_F32(terminalVelocity, -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* sAlienEyeBeamTexAnim; -AnimatedMaterial* sAlienEmptyTexAnim; -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.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); - } else { - gSaveContext.save.unk_E88[arg0 >> 1] = - (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); - } -} - -s32 func_80B43A24(s32 arg0) { - u32 phi_v1; - - if ((arg0 & 1) == 0) { - phi_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; - } else { - phi_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; - } - return phi_v1 + 0x1AAA; -} - -void func_80B43A74(s32 arg0) { - gSaveContext.save.unk_E88[4] = (gSaveContext.save.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); -} - -s32 func_80B43A9C(void) { - return (gSaveContext.save.unk_E88[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.save.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, PlayState* play) { - Path* path = &play->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_Vec3fDistSq(&sp48, vec); - if (distance < min) { - min = distance; - ret = i; - } - } - - return ret; -} - -void func_80B442E4(EnInvadepoh* this) { - s32 temp_v1_2 = ((void)0, (s32)gSaveContext.save.time) - 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, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); - func_80B443A0(this); -} - -void func_80B444F4(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44514(EnInvadepoh* this) { - this->pathIndex++; - if (this->pathIndex >= this->endPoint) { - this->pathIndex = 0; - } -} - -void func_80B44540(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44570(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.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, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44640(EnInvadepoh* this) { - if (this->pathIndex < this->endPoint) { - this->pathIndex++; - } -} - -void func_80B44664(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - 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, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44700(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.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, PlayState* play) { - 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(play, &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, PlayState* play) { - 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_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); -} - -void func_80B44B78(EnInvadepoh* this) { -} - -s32 func_80B44B84(EnInvadepoh* this, PlayState* play, 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(play, &this->actor, arg3); - func_80B4516C(this); - return retVal; -} - -void func_80B44C24(EnInvadepoh* this, PlayState* play) { - 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(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -s32 func_80B44C80(EnInvadepoh* this, PlayState* play) { - 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_MoveWithGravity(&this->actor); - if (func_80B440B8(this, 50.0f, 15.0f)) { - phi_v0 = 4; - } else { - phi_v0 = 5; - } - - Actor_UpdateBgCheckInfo(play, &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, PlayState* play) { - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &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, PlayState* play) { - 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(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -void func_80B44F58(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E968) { - D_80B4E968 = true; - for (i = 0, iter = sRomaniEyeTextures; i < ARRAY_COUNT(sRomaniEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sRomaniMouthTextures; i < ARRAY_COUNT(sRomaniMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B44FEC(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E994) { - D_80B4E994 = true; - for (i = 0, iter = sCremiaEyeTextures; i < ARRAY_COUNT(sCremiaEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sCremiaMouthTextures; i < ARRAY_COUNT(sCremiaMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B45080(void) { - sAlienEmptyTexAnim = Lib_SegmentedToVirtual(gAlienEmptyTexAnim); - sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); -} - -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, PlayState* play) { - 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.save.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.save.weekEventReg[22] & 1) { - D_80B4E940 = 3; - } else { - D_80B4E940 = 4; - } - } - } -} - -void func_80B452EC(EnInvadepoh* this, PlayState* play) { - s32 phi_s2 = (this->actor.params >> 8) & 0x7F; - s32 i; - - for (i = 0; i < this->unk379; i++) { - D_80B50320[i] = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, 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 = &play->setupPathList[phi_s2]; - phi_s2 = path->unk1; - } - } -} - -void func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 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, PlayState* play) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 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, PlayState* play) { - D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, 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 = Matrix_GetCurrent(); - - sysMatrix->xw = vec->x; - sysMatrix->yw = vec->y; - sysMatrix->zw = vec->z; -} - -s32 func_80B45550(EnInvadepoh* this, PlayState* play, f32 range, s32 arg3) { - s32 pad; - Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_DOOR].first; - s32 retVal = false; - - while (actorIterator != NULL) { - if ((actorIterator->id == ACTOR_EN_DOOR) && (actorIterator->update != NULL) && - (actorIterator->room == this->actor.room) && - Math3D_Vec3fDistSq(&actorIterator->world.pos, &this->actor.world.pos) < range) { - ((EnDoor*)actorIterator)->unk_1A7 = arg3; - retVal = true; - break; - } - actorIterator = actorIterator->next; - } - return retVal; -} - -void EnInvadepoh_SetTextID(EnInvadepoh* this, PlayState* play, u16 arg2) { - this->textId = arg2; - Message_StartTextbox(play, arg2, &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(PlayState* play, Vec3f* worldPos) { - Vec3f projectedPos; - f32 invW; - - Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); - if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { - s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); - s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); - s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; - s32 zBuf = func_80178A94(screenPosX, screenPosY); - 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_Vec3fDistSq(&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; - unkstructInvadepoh1* ptr = arg0; - - arg1--; - for (i = 0; i < arg1; i++, ptr++) { - if (ptr->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, PlayState* play, 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(play, &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, PlayState* play) { - s32 invadepohType; - s32 i; - - this->actor.flags |= ACTOR_FLAG_20; - invadepohType = (this->actor.params >> 8) & 0x7F; - - for (i = 1; i < 8; i++) { - Path* path = &play->setupPathList[invadepohType]; - invadepohType = path->unk1; - if (invadepohType == 0xFF) { - break; - } - } - - this->unk379 = i; - func_80B451A0(this, play); - func_80B45648(this); - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_SWITCH); - - if (D_80B4E940 == 1) { - func_80B46DA8(this); - } else if (D_80B4E940 == 2) { - if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { - func_80B46DA8(this); - } else { - func_80B454BC(this, play); - func_80B452EC(this, play); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); - func_80B46F88(this); - } - } else if (D_80B4E940 == 3) { - if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { - func_80B471C0(this); - - } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { - func_80B47248(this); - } else { - func_80B47248(this); - } - } else if (D_80B4E940 == 4) { - func_80B47304(this); - } -} - -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, D_80B4EC24); - Collider_InitCylinder(play, &this->collider); - ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); - this->actor.shape.shadowAlpha = 140; - this->actor.flags = (ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000); - if (INVADEPOH_TYPE(&this->actor) == TYPE_ALIEN_CARRYING_COW) { - 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(play, &this->collider, &this->actor, &sCylinderInitAlien); - this->actor.colChkInfo.mass = 40; - } - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_UCH); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } -} - -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainParentCow); - this->actor.update = func_80B47FA8; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } -} - -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainChildCow); - this->actor.update = func_80B481C4; - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } -} - -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 temp = INVADEPOH_TYPE(&this->actor); - - Actor_ProcessInitChain(&this->actor, sInitChainRomani); - - this->actor.targetMode = (temp == 7 || temp == 0xC) ? 3 : 6; - - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - if (temp != 4) { - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - Collider_SetCylinder(play, &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 = (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10); - } 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(&play->objectCtx, OBJECT_MA1); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } - if (temp == 5) { - if (gSaveContext.save.weekEventReg[22] & 1) { - Actor_MarkForDeath(&this->actor); - return; - } - } else if (temp == 7) { - if (gSaveContext.save.time < CLOCK_TIME(6, 0) && gSaveContext.save.time >= CLOCK_TIME(2, 15)) { - Actor_MarkForDeath(&this->actor); - return; - } - } else if (temp != 8) { - if (temp == 9) { - if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { - Actor_MarkForDeath(&this->actor); - return; - } - } else if (temp == 0xC) { - if (!(gSaveContext.save.weekEventReg[22] & 1)) { - Actor_MarkForDeath(&this->actor); - } - D_80B503F4 = this; - } - } -} - -void func_80B468B4(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, D_80B4EC68); - this->actor.update = func_80B49B1C; - this->actor.draw = func_80B4E3F0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - if (D_80B4E940 == 1 || gSaveContext.save.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, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainDog); - this->actor.update = func_80B4B8BC; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDog); - this->actor.colChkInfo.mass = 80; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DOG); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } -} - -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainCremia); - this->actor.update = func_80B4C3A0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); - this->actor.colChkInfo.mass = MASS_HEAVY; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA2); - if (this->bankIndex < 0) { - Actor_MarkForDeath(&this->actor); - } - if (!(gSaveContext.save.weekEventReg[22] & 1)) { - Actor_MarkForDeath(&this->actor); - } - D_80B503F8 = this; -} - -void EnInvadepoh_Init(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECB0[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46BB0(EnInvadepoh* this, PlayState* play) { -} - -void func_80B46BC0(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 invadepohType = this->actor.params & 7; - - Collider_DestroyCylinder(play, &this->collider); - D_80B50320[invadepohType] = 0; -} - -void func_80B46C08(EnInvadepoh* this, PlayState* play) { - 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, PlayState* play) { - if (this->actor.parent != NULL) { - this->actor.parent->child = NULL; - } -} - -void func_80B46C50(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46C7C(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = NULL; -} - -void func_80B46C94(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46CC0(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F8 = NULL; -} - -void func_80B46CF4(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F4 = NULL; -} - -void func_80B46D28(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - if (!this) {} // required to match - if (this->actor.child != NULL) { - this->actor.child->parent = NULL; - } -} - -void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECE8[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46DA8(EnInvadepoh* this) { - D_80B4E940 = 1; - this->actionFunc = func_80B46DC8; -} - -void func_80B46DC8(EnInvadepoh* this, PlayState* play) { - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { - func_80B454BC(this, play); - func_80B452EC(this, play); - func_80B46E20(this); - } -} - -void func_80B46E20(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionTimer = 2; - this->actionFunc = func_80B46E44; -} - -void func_80B46E44(EnInvadepoh* this, PlayState* play) { - 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, PlayState* play) { - 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]); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); - func_80B46F88(this); - } -} - -void func_80B46F88(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionFunc = func_80B46FA8; -} - -void func_80B46FA8(EnInvadepoh* this, PlayState* play) { - s32 i; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - gSaveContext.save.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, PlayState* play) { - 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, PlayState* play) { - if (this->actionTimer == 100) { - Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); - } - this->actionTimer--; - if (this->actionTimer <= 0) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_73; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - 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, PlayState* play) { - if (D_80B4E998) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - func_80B47248(this); - } -} - -void func_80B47248(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B47268; -} - -void func_80B47268(EnInvadepoh* this, PlayState* play) { -} - -void func_80B47278(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47298; -} - -void func_80B47298(EnInvadepoh* this, PlayState* play) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); - gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - gSaveContext.save.weekEventReg[89] |= 0x10; - func_80B47304(this); -} - -void func_80B47304(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47324; -} - -void func_80B47324(EnInvadepoh* this, PlayState* play) { -} - -void EnInvadepoh_Update(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (func_80B461DC()) { - this->actor.draw = func_80B4D9B4; - } else { - this->actor.draw = NULL; - } -} - -void func_80B47380(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - 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, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - 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 &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - 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, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - 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) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->alienAlpha = 0; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B47600; -} - -void func_80B47600(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - 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 |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - } - 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.animation != &gAlienFloatAnim) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - } - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B477B4; -} - -void func_80B477B4(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - 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 &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); - Actor_SetColorFilter(&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 |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B478F4; -} - -void func_80B478F4(EnInvadepoh* this, PlayState* play) { - func_80B44A90(this, play); - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B47938(this); - } -} - -void func_80B47938(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); - this->actor.flags &= ~ACTOR_FLAG_1; - this->actionTimer = 10; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B479E8; -} - -void func_80B479E8(EnInvadepoh* this, PlayState* play) { - 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(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, - this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); - } - - if (this->actionTimer == 8) { - Enemy_StartFinishingBlow(play, &this->actor); - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B43AF0(this->actor.params & 7); - func_80B43AB0(); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_30); - func_80B47478(this); - } -} - -void func_80B47BAC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, - ALIEN_LIMB_MAX); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.125f; - func_80B444BC(this, play); - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (D_80B4E940 == 1 || gSaveContext.save.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, PlayState* play) { - 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 & AC_HIT) { - 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); - SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); - func_80B47830(this); - } - - this->actionFunc(this, play); - if (thisx->draw != NULL) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - } - - Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.atFlags &= ~AT_HIT; - } - - if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.acFlags &= ~AC_HIT; - } - - if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.ocFlags1 &= ~OC1_HIT; - } -} - -void func_80B47FA8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, thisx); - this->actor.update = func_80B48060; - this->actor.draw = func_80B4E158; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); - } -} - -void func_80B48060(Actor* thisx, PlayState* play) { - 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_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[temp], 0x32); - if (this->actor.child != NULL) { - Matrix_Push(); - Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - &this->actor.shape.rot); - Matrix_Translate(0, 57.0f, -36.0f, MTXMODE_APPLY); - Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); - Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); - Matrix_MultZero(&this->actor.child->world.pos); - Matrix_Get(&unkMtx); - Matrix_MtxFToYXZRot(&unkMtx, &this->actor.child->shape.rot, false); - Matrix_Pop(); - } -} - -void func_80B481C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - this->actor.update = func_80B4827C; - this->actor.draw = func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, - COW_TAIL_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); - } -} - -void func_80B4827C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B503F0 == NULL || this->actor.parent == NULL) { - Actor_MarkForDeath(&this->actor); - return; - } - - SkelAnime_Update(&this->skelAnime); -} - -void func_80B482D4(EnInvadepoh* this) { - this->actionTimer = 40; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = NULL; - this->actionFunc = func_80B48324; -} - -void func_80B48324(EnInvadepoh* this, PlayState* play) { - this->actionTimer--; - if (this->actionTimer <= 0) { - EnInvadepoh_SetTextID(this, play, 0x332F); - this->actor.draw = func_80B4E324; - func_80B48374(this); - } -} - -void func_80B48374(EnInvadepoh* this) { - this->actionTimer = 60; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B483CC; -} - -void func_80B483CC(EnInvadepoh* this, PlayState* play) { - 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; - Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B484EC; -} - -void func_80B484EC(EnInvadepoh* this, PlayState* play) { - 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; - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B48610; -} - -void func_80B48610(EnInvadepoh* this, PlayState* play) { -} - -void func_80B48620(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 5000, 0.05f, 0.3f, 0.12f); - Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); - func_80B482D4(this); - } -} - -void func_80B4873C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if (this->actor.parent == NULL) { - Actor_MarkForDeath(&this->actor); - return; - } - this->actionFunc(this, play); - SkelAnime_Update(&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; - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - this->actionFunc = func_80B48848; -} - -void func_80B48848(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); - if (func_80B44B84(this, play, 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 (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&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, &gZeroVec3s); - 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; - } - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B48AD4; -} - -void func_80B48AD4(EnInvadepoh* this, PlayState* play) { - 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, play, this->actor.speedXZ, 50.0f)) { - func_80B44514(this); - } - - if (this->rand == 0) { - s32 requiredScopeTemp; - - if ((this->actor.xzDistToPlayer < 350.0f) && ((play->gameplayFrames & 0x60) != 0)) { - player = GET_PLAYER(play); - 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); - } - } 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 = (s32)Rand_Next() % 4; - if (temp_v1_3 != this->rand) { - this->rand = temp_v1_3; - if (this->rand == 0) { - Math_Vec3s_Copy(&substruct->unk26, &gZeroVec3s); - 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; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - substruct->unk30 = 0.05f; - substruct->unk2C = 1200; - this->actionFunc = func_80B48E4C; -} - -void func_80B48E4C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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 (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B48948(this); - } -} - -void func_80B48FB0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B490F0; - this->actor.draw = func_80B4E324; - this->actor.textId = 0x3330; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B444F4(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B487B4(this); - } -} - -void func_80B490F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B48DE4(this); - } - this->actionFunc(this, play); - if (sp2C) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->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, PlayState* play) { - s32 pad; - f32 temp_f0; - - Actor_UpdateVelocityWithGravity(&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, play, 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, PlayState* play) { - 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_MoveWithGravity(&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, PlayState* play) { - 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, play, 20); - } - - Math_Vec3f_Sum(&D_80B4EDD0[this->unk3AC], &this->actor.home.pos, &sp30); - if (Math3D_Vec3fDistSq(&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, PlayState* play) { - 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 ((play->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_MoveWithGravity(&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, PlayState* play) { - 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_MoveWithGravity(&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, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 150.0f, 4.0f); - this->actor.velocity.y *= 0.95f; - Actor_MoveWithGravity(&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, PlayState* play) { - 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_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B497A4(this); - } -} - -void func_80B49B1C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - f32 scale; - - this->actionFunc(this, play); - 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; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -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, PlayState* play) { - s32 pad; - s32 temp_v0_2; - - func_80B44570(this); - func_80B44C24(this, play); - 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(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (REG(15) * -16.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&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; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B49DFC; -} - -void func_80B49DFC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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 (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[54] |= 0x10; - this->actor.textId = 0x332E; - } - func_80B49BD0(this); - } -} - -void func_80B49F88(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B44540(this, play); - func_80B44570(this); - func_80B44C24(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (0x20 & gSaveContext.save.weekEventReg[21]) { - if (gSaveContext.save.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, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 0))) { - this->actor.update = func_80B4A1B8; - this->actor.draw = func_80B4E324; - func_80B49BD0(this); - } -} - -void func_80B4A1B8(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B49DA0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4A2C0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -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 |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A350; -} - -void func_80B4A350(EnInvadepoh* this, PlayState* play) { - s16 temp_v0; - s16 temp_v1_2; - s16 diff; - Vec3f sp44; - s16 sp42; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if ((play->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 = GET_PLAYER(play); - - 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 ((play->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; - - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A5E4; -} - -void func_80B4A5E4(EnInvadepoh* this, PlayState* play) { - if (this->animPlayFlag) { - func_80B4A2C0(this); - } -} - -void func_80B4A614(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 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, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); - if (func_80B44B84(this, play, 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, play, SQ(80.0f), -0xF); - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&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; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - this->actionFunc = func_80B4A81C; -} - -void func_80B4A81C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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 (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[54] |= 0x10; - this->actor.textId = 0x332E; - } - if (this->pathIndex == this->endPoint) { - func_80B4A2C0(this); - } else { - func_80B4A614(this); - } - } -} - -void func_80B4A9C8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad[2]; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B44620(this, play); - 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(play, &this->actor, 50.0f); - func_80B4516C(this); - if (gSaveContext.save.weekEventReg[21] & 0x20) { - if (gSaveContext.save.weekEventReg[54] & 0x10) { - this->actor.textId = 0x332E; - } else { - this->actor.textId = 0x332D; - } - } else { - this->actor.textId = 0x332C; - } - } -} - -void func_80B4AB8C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { - this->actor.update = func_80B4ABDC; - this->actor.draw = func_80B4E324; - func_80B4A614(this); - } -} - -void func_80B4ABDC(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4A7C0(this); - } - this->actionFunc(this, play); - if (sp2C) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4ACDC(EnInvadepoh* this) { - this->actionFunc = func_80B4ACF0; -} - -void func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[22] & 1) { - this->actor.draw = func_80B4E324; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80B4AD3C(this); - } -} - -void func_80B4AD3C(EnInvadepoh* this) { - this->actor.flags |= ACTOR_FLAG_10000; - this->actionFunc = func_80B4AD60; -} - -void func_80B4AD60(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3331); - func_80B4ADB8(this); - } else { - func_800B8614(&this->actor, play, 2000.0f); - } -} - -void func_80B4ADB8(EnInvadepoh* this) { - this->actionFunc = func_80B4ADCC; -} - -void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - if (this->textId == 0x3331) { - if (gSaveContext.save.weekEventReg[22] & 2) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - return; - } - EnInvadepoh_SetTextID(this, play, 0x3333); - return; - } - if (this->textId == 0x3333) { - func_80B4AEC0(this); - } else if (this->textId == 0x3334) { - func_801477B4(play); - func_80B4B024(this); - } - } -} - -void func_80B4AEC0(EnInvadepoh* this) { - this->actionTimer = 2; - this->actionFunc = func_80B4AEDC; -} - -void func_80B4AEDC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer > 0) { - this->actionTimer--; - if (this->actionTimer == 0) { - func_801477B4(play); - } - } - if (Actor_HasParent(&this->actor, play)) { - this->actor.parent = NULL; - gSaveContext.save.weekEventReg[22] |= 2; - func_80B4AF80(this); - } else { - Actor_PickUp(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); - } -} - -void func_80B4AF80(EnInvadepoh* this) { - this->actionFunc = func_80B4AF94; -} - -void func_80B4AF94(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1E); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - func_80B4ADB8(this); - } else { - func_800B85E0(&this->actor, play, 2000.0f, PLAYER_AP_MINUS1); - } -} - -void func_80B4B024(EnInvadepoh* this) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4B048; -} - -void func_80B4B048(EnInvadepoh* this, PlayState* play) { - if (play->msgCtx.unk120B1 == 0) { - if (play->msgCtx.msgMode == 0) { - D_80B4E998 = 1; - } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || - (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { - D_80B4E998 = 1; - } - } -} - -void func_80B4B0C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - AlienBehaviorInfo* substruct; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - substruct = &this->behaviorInfo; - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 2000, 0.08f, 0.3f, 0.03f); - substruct->unk30 = 0.08f; - substruct->unk2C = 0x7D0; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B4ACDC(this); - } -} - -void func_80B4B218(Actor* thisx, PlayState* play) { - s16 diff; - EnInvadepoh* this = THIS; - s16 temp_v1; - s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - Player* player; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - this->actionFunc(this, play); - if (sp38 && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - player = GET_PLAYER(play); - 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(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4B3DC(EnInvadepoh* this) { - s32 pad; - - if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); - } -} - -void func_80B4B430(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 80); - this->actionFunc = func_80B4B484; -} - -void func_80B4B484(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 1.1f, 0.5f); - if (func_80B44C80(this, play)) { - 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) { - Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 200); - this->actionFunc = func_80B4B564; -} - -void func_80B4B564(EnInvadepoh* this, PlayState* play) { - 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_Vec3fDistSq(&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, play)) { - func_80B44690(this); - } - - if (this->actionTimer > 0) { - this->actionTimer--; - } else if (this->unk3BC >= 0) { - if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); - } - func_80B4B724(this); - } else { - func_80B4B430(this); - } -} - -void func_80B4B724(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogBarkAnim, -6.0f); - this->actionFunc = func_80B4B768; -} - -void func_80B4B768(EnInvadepoh* this, PlayState* play) { - 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, play); - if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); - } - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B820(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogJumpAnim, -6.0f); - this->actionFunc = func_80B4B864; -} - -void func_80B4B864(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.5f, 1.0f); - func_80B44E90(this, play); - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B8BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, - DOG_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &gZeroVec3s, 3000, 0.1f, 0.0f, 0.0f); - func_80B44664(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &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 |= ACTOR_FLAG_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, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B4E940 == 2) { - this->actor.update = func_80B4BA84; - this->actor.draw = func_80B4E660; - this->actor.flags |= ACTOR_FLAG_1; - func_80B4B430(this); - } -} - -void func_80B4BA84(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 temp_v0_3; - s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - 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; - 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->unk3BC - this->pathIndex; - if (phi_v0 < 0) { - phi_v0 += this->endPoint; - } - - if ((this->endPoint >> 1) < phi_v0) { - this->direction = DIRECTION_BACKWARD; - } else if (phi_v0 < (this->endPoint >> 1)) { - this->direction = DIRECTION_FORWARD; - } - } - } - - this->actionFunc(this, play); - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - if (sp34 && (this->actor.update != NULL)) { - func_80B45CE0(&this->behaviorInfo); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4BBE0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -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, PlayState* play) { - 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 &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - - } else if (temp_v0 < (temp_t6->endPoint - 1)) { - this->xzPosAdjFactor = 40.0f; - Math_ScaledStepToS(&this->unk304, -0x4800, 0xC8); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - Math_StepToF(&this->xzPosAdjFactor, 5.0f, 3.0f); - Math_ScaledStepToS(&this->unk304, -0x8000, 0x12C); - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - 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(play, &this->actor, 50.0f); - func_80B4516C(this); - Math_StepToS(&this->behaviorInfo.unk4C, 0xBB8, 0x1F5); - if (Math3D_Vec3fDistSq(&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 = (play->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 (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (gSaveContext.save.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; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C058; -} - -void func_80B4C058(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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 (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4BBE0(this); - } -} - -void func_80B4C1BC(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C218; -} - -void func_80B4C218(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - s32 pad[2]; - s32 currentTime = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, - CREMIA_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 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, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { - this->actor.update = func_80B4C5C0; - this->actor.draw = func_80B4E7BC; - func_80B4BBE0(this); - } -} - -void func_80B4C5C0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 6); - func_80B4BFFC(this); - } - this->actionFunc(this, play); - if (sp2C && (this->actor.update != NULL)) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4C6C8(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -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, PlayState* play) { - 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; - s16 pad; - s16 sp3A; - s16 pad2; - - func_80B44700(this); - func_80B44EFC(this, play); - func_80B43E6C(this, 6, 2000, 100); - phi_a2 = ((this->pathIndex < this->endPoint) ? this->pathIndex : this->endPoint - 1); - - 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(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (REG(15) * -23.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - temp_v1_3 = play->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 (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&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; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CB0C; -} - -void func_80B4CB0C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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 (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4C6C8(this); - } -} - -void func_80B4CC70(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CCCC; -} - -void func_80B4CCCC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - 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, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B446D0(this, play); - this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44700(this); - func_80B44EFC(this, play); - 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, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (gSaveContext.save.time < 0xD7E1)) { - this->actor.update = func_80B4D054; - this->actor.draw = func_80B4E324; - func_80B4C6C8(this); - } -} - -void func_80B4D054(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4CAB0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) { - func_800B8614(thisx, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4D15C(EnInvadepoh* this) { - s32 pad; - s32 temp_v1 = this->actor.params & 7; - unkstruct80B4EE0C* temp_v0; - - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = ((this->actor.params & 7) * this->skelAnime.endFrame) * 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, PlayState* play) { - Actor* temp_v1; - f32 sp28; - - 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 = this->actor.home.pos.x + Math_SinS(this->unk304) * 80.0f; - this->actor.world.pos.z = this->actor.home.pos.z + Math_CosS(this->unk304) * 80.0f; - this->behaviorInfo.unk4C += this->behaviorInfo.unk4E; - this->actor.shape.rot.y += this->behaviorInfo.unk4C; - temp_v1 = this->actor.child; - - 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) { - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 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, PlayState* play) { - 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, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 invadepohType; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - invadepohType = this->actor.params & 7; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B4D760; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, - this->morphTable, ALIEN_LIMB_MAX); - if (invadepohType < 3) { - func_80B453F4(this, play, invadepohType); - func_80B4D15C(this); - } else { - func_80B45460(this, play); - func_80B4D3E4(this); - } - } -} - -void func_80B4D760(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - } -} - -void func_80B4D7B8(PlayState* play) { - u32 temp_s5; - u32 temp_s6; - unkStruct80B50350* phi_s2; - s32 i; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - for (phi_s2 = D_80B50350, i = 0; i < 10; phi_s2++, i++) { - if (phi_s2->unk1 > 0) { - temp_s5 = (play->gameplayFrames + ((0x10 * i) & 0xFF)) & 0x7F; - temp_s6 = (u8)(play->gameplayFrames * -0xF); - Matrix_Translate(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); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_02E510); - } - } - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4D9B4(Actor* thisx, PlayState* play) { - func_80B4D7B8(play); -} - -s32 func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { - return false; -} - -void func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - EnInvadepoh* this = THIS; - - if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x3830, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502A0); - Matrix_Pop(); - } else if ((limbIndex == 13) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502E0); - Matrix_Pop(); - } - if (limbIndex == 11) { - Matrix_MultVec3f(&D_80B4EE24, &this->actor.focus.pos); - } -} - -void func_80B4DB14(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - Gfx* gfx; - GraphicsContext* spCC = play->state.gfxCtx; - - OPEN_DISPS(spCC); - func_8012C2DC(spCC); - Matrix_Push(); - if (this->drawAlien) { - Gfx* new_var6; - Gfx* spBC; - GraphicsContext* spB8; - - if (this->alienAlpha == 255) { - func_8012C28C(play->state.gfxCtx); - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 0, 1); - gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255); - spCC->polyOpa.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyOpa.p); - } else { - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 1, 2); - gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha); - spCC->polyXlu.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyXlu.p); - } - - if (this->alienBeamAlpha != 0) { - AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); - spB8 = play->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)); - Matrix_Mult(&D_80B502A0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - Matrix_Mult(&D_80B502E0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - spB8->polyXlu.p = spBC; - } - } - - if (this->drawAlienDeathEffect) { - Matrix_SetTranslateRotateYXZ(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(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spCC->polyXlu.p++, gAlienDeathFlashDL); - } - - if (this->drawAlien) { - Vec3f sp80; - Vec3f sp74; - s32 alpha2; - GraphicsContext* sp6C = play->state.gfxCtx; - u32 pad; - - gfx = sp6C->polyXlu.p; - gfx = func_8012C868(gfx); - gDPSetDither(gfx++, G_CD_NOISE); - gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, - 0); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(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; - Matrix_Translate(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++, gameplay_keep_DL_029CB0); - gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, alpha2); - gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); - sp6C->polyXlu.p = gfx; - if ((this->alienAlpha > 128) && func_80B456A8(play, &sp74)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); - } - } - - Matrix_Pop(); - CLOSE_DISPS(spCC); -} - -s32 func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 5) { - EnInvadepoh* this = THIS; - rot->x -= this->actor.shape.rot.x; - } - return false; -} - -void func_80B4E158(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E120, NULL, &this->actor); -} - -void func_80B4E1B0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); -} - -s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == ROMANI_LIMB_HEAD) { - 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 == ROMANI_LIMB_TORSO) { - 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 false; -} - -void func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == ROMANI_LIMB_LEFT_HAND) { - OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); - CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == ROMANI_LIMB_HEAD) { - Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); - } -} - -void func_80B4E324(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E200, func_80B4E2AC, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4E3F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - Vec3f sp5C; - - Matrix_Push(); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(200.0f, &sp5C); - Matrix_Pop(); - sp5C.x += thisx->world.pos.x; - sp5C.y += thisx->world.pos.y; - sp5C.z += thisx->world.pos.z; - EnInvadepoh_SetSysMatrix(&sp5C); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_RotateZS(this->unk304, MTXMODE_APPLY); - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->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++, gOwlStatueWhiteFlashDL); - if (func_80B456A8(play, &sp5C)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); - } - - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || - (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { - EnInvadepoh* this = THIS; - - rot->x += this->behaviorInfo.unk20.x; - rot->y += this->behaviorInfo.unk20.y; - rot->z += this->behaviorInfo.unk20.z; - } - - return false; -} - -void func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == DOG_LIMB_HEAD) { - Matrix_MultVecY(20.0f, &this->actor.focus.pos); - } -} - -void func_80B4E660(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E5B0, func_80B4E61C, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E6E4(PlayState* play, 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 false; -} - -void func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == 9) { - Matrix_MultZero(&this->actor.focus.pos); - } -} - -void func_80B4E7BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E6E4, func_80B4E784, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45980.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B459E8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A4C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A94.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45B1C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45BB8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45C04.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45CE0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45EC8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46118.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46184.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B461DC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4627C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46414.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46520.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B465CC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46644.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B468B4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B469C4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46A80.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Init.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BB0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BC0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C08.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C34.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C50.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C7C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C94.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CC0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CF4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46D28.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Destroy.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DA8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DC8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E20.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E44.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EC0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EE8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46F88.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46FA8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47064.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47084.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B470E0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47108.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471C0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471E0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47248.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47268.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47278.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47298.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47304.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47324.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Update.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47380.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B473E4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47478.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B474DC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47568.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47600.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4770C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B477B4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47830.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B478F4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47938.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B479E8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47BAC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47D30.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47FA8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48060.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B481C4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4827C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B482D4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48324.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48374.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B483CC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4843C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B484EC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48588.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48610.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48620.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4873C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B487B4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48848.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48948.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48AD4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48DE4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48E4C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48FB0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B490F0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B491EC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49228.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B492FC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4934C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49404.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49454.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49628.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49670.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497A4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497EC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49904.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4994C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B499BC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49A00.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49B1C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49BD0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49C38.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DA0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DFC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49F88.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A168.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A1B8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A2C0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A350.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A570.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A5E4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A614.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A67C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A7C0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A81C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A9C8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AB8C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ABDC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACDC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACF0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD3C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD60.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADB8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADCC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEC0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEDC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF80.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF94.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B024.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B048.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B0C4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B218.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B3DC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B430.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B484.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B510.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B564.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B724.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B768.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B820.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B864.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B8BC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA30.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA84.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BBE0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BC4C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BFFC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C058.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C1BC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C218.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C3A0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C568.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C5C0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C6C8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C730.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CAB0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CB0C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CC70.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CCCC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CE54.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CFFC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D054.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D15C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D290.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D3E4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D480.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D670.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D760.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D7B8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9B4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9D8.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9F4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4DB14.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E120.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E158.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E1B0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E200.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E2AC.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E324.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E3F0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E5B0.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E61C.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E660.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E6E4.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E784.s") + +#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E7BC.s") \ No newline at end of file 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 cafae5f23..4d846c9ad 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -1,157 +1,22 @@ #ifndef Z_EN_INVADEPOH_H #define Z_EN_INVADEPOH_H -#include "global.h" +#include struct EnInvadepoh; -typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, PlayState*); - -#define INVADEPOH_TYPE(thisx) (((thisx)->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_ALIEN_CARRYING_COW -} EnInvadepohType; - -typedef enum { - /* -1 */ DIRECTION_BACKWARD = -1, - /* 1 */ DIRECTION_FORWARD = 1, -} EnInvadepohDirection; - -typedef struct unkStruct80B50350 { - /* 0x0 */ s8 unk0; - /* 0x1 */ s8 unk1; - /* 0x2 */ u8 unk2; - /* 0x4 */ Vec3f unk4; -} unkStruct80B50350; // size = 0x10; - -typedef struct { - /* 0x0 */ s8* unk00; - /* 0x4 */ s8 unk04; -} unkstructInvadepoh0; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ f32 unk04; -} unkstructInvadepoh1; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ unkstructInvadepoh0* unk04; -} unkstructInvadepoh2; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk0; - /* 0x4 */ unkstructInvadepoh0* unk4; - /* 0x8 */ s8 unk8; - /* 0xC */ 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 { - /* 0x0 */ f32 unk00; - /* 0x4 */ s16 unk04; - /* 0x6 */ s16 unk06; -} unkstruct80B4EE0C; // size = 0x8 - -typedef struct EnInvadePohStruct { - /* 0x0 */ unkstructInvadepoh4* unk0; - /* 0x4 */ s8 unk4; - /* 0x8 */ unkstructInvadepoh4* unk8; - /* 0xC */ s16 unkC; - /* 0xE */ s8 unkE; - /* 0xF */ s8 unkF; -} EnInvadePohStruct; // size = 0x10; - -typedef struct AlienBehaviorInfo { - /* 0x00 */ EnInvadePohStruct unk0; - /* 0x10 */ EnInvadePohStruct unk10; - /* 0x20 */ Vec3s unk20; - /* 0x26 */ Vec3s unk26; - /* 0x2C */ s16 unk2C; - /* 0x2E */ u16 unk2E; - /* 0x30 */ f32 unk30; - /* 0x34 */ f32 unk34; - /* 0x38 */ f32 unk38; - /* 0x3C */ f32 unk3C; - /* 0x40 */ s16 unk40; - /* 0x42 */ s16 unk42; - /* 0x44 */ f32 unk44; - /* 0x48 */ s16 unk48; - /* 0x4A */ UNK_TYPE1 unk4A[0x2]; - /* 0x4C */ s16 unk4C; - /* 0x4E */ s16 unk4E; -} AlienBehaviorInfo; // size = 0x50 +typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh* this, PlayState* play); +typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh* this, PlayState* play); +typedef void (*EnInvadepohDestFunc)(struct EnInvadepoh* this, PlayState* play); typedef struct EnInvadepoh { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[23]; - /* 0x212 */ Vec3s morphTable[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 */ UNK_TYPE1 unk3AD[0xF]; - /* 0x3BC */ s8 unk3BC; + /* 0x144 */ char unk_144[0x15C]; + /* 0x2A0 */ ColliderCylinder unk_2A0; + /* 0x2EC */ EnInvadepohActionFunc unk_2EC; + /* 0x2F0 */ char unk_2F0[0xD0]; } EnInvadepoh; // size = 0x3C0 extern const ActorInit En_Invadepoh_InitVars; -#endif // Z_EN_INVADEPOH_H +#endif // Z_EN_INVADEPOH_H \ No newline at end of file diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 571812b3f..b2f1281a2 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -13735,9 +13735,9 @@ 0x80B43DD4:("func_80B43DD4",), 0x80B43E6C:("func_80B43E6C",), 0x80B43F0C:("func_80B43F0C",), - 0x80B43F70:("EnInvadepoh_GetTotalPathDistance",), + 0x80B43F70:("func_80B43F70",), 0x80B44024:("func_80B44024",), - 0x80B4407C:("EnInvadepoh_SetPathPointToWorldPos",), + 0x80B4407C:("func_80B4407C",), 0x80B440B8:("func_80B440B8",), 0x80B44234:("func_80B44234",), 0x80B442E4:("func_80B442E4",), @@ -13771,9 +13771,9 @@ 0x80B453F4:("func_80B453F4",), 0x80B45460:("func_80B45460",), 0x80B454BC:("func_80B454BC",), - 0x80B45518:("EnInvadepoh_SetSysMatrix",), + 0x80B45518:("func_80B45518",), 0x80B45550:("func_80B45550",), - 0x80B4560C:("EnInvadepoh_SetTextID",), + 0x80B4560C:("func_80B4560C",), 0x80B45648:("func_80B45648",), 0x80B456A8:("func_80B456A8",), 0x80B457A0:("func_80B457A0",), @@ -13791,13 +13791,13 @@ 0x80B46184:("func_80B46184",), 0x80B461DC:("func_80B461DC",), 0x80B4627C:("func_80B4627C",), - 0x80B46414:("EnInvadepoh_InitAlien",), - 0x80B46520:("EnInvadepoh_InitParentCow",), - 0x80B465CC:("EnInvadepoh_InitChildCow",), - 0x80B46644:("EnInvadepoh_InitRomani",), + 0x80B46414:("func_80B46414",), + 0x80B46520:("func_80B46520",), + 0x80B465CC:("func_80B465CC",), + 0x80B46644:("func_80B46644",), 0x80B468B4:("func_80B468B4",), - 0x80B469C4:("EnInvadepoh_InitDog",), - 0x80B46A80:("EnInvadepoh_InitCremia",), + 0x80B469C4:("func_80B469C4",), + 0x80B46A80:("func_80B46A80",), 0x80B46B74:("EnInvadepoh_Init",), 0x80B46BB0:("func_80B46BB0",), 0x80B46BC0:("func_80B46BC0",), From f035f12f1cfc93c176024c0a8c1b002093aac599 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Tue, 4 Oct 2022 17:26:15 -0500 Subject: [PATCH 02/10] newlines --- src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4d846c9ad..bd9ceb662 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -19,4 +19,4 @@ typedef struct EnInvadepoh { extern const ActorInit En_Invadepoh_InitVars; -#endif // Z_EN_INVADEPOH_H \ No newline at end of file +#endif // Z_EN_INVADEPOH_H From b7b4b09e4d329cdf71480d799f6dd3a237bb809a Mon Sep 17 00:00:00 2001 From: petrie911 Date: Fri, 7 Oct 2022 21:49:19 -0500 Subject: [PATCH 03/10] match --- spec | 5 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 4820 ++++++++++++++--- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 130 +- .../z_en_invadepoh_data.inc.c | 299 + 4 files changed, 4561 insertions(+), 693 deletions(-) create mode 100644 src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c diff --git a/spec b/spec index ce4254663..33f635b8f 100644 --- a/spec +++ b/spec @@ -3838,10 +3838,7 @@ beginseg name "ovl_En_Invadepoh" compress include "build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o" - include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.data.o" - include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.bss.o" - include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.reloc.o" - // include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" + include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" endseg beginseg 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 dd2ef30b2..0b658bc51 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,208 +1,80 @@ #include "z_en_invadepoh.h" -// #include "assets/objects/gameplay_keep/gameplay_keep.h" -// #include "assets/objects/object_uch/object_uch.h" -// #include "assets/objects/object_ma1/object_ma1.h" -// #include "assets/objects/object_ma2/object_ma2.h" -// #include "assets/objects/object_cow/object_cow.h" -// #include "assets/objects/object_dog/object_dog.h" +#include "overlays/actors/ovl_En_Door/z_en_door.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_uch/object_uch.h" +#include "assets/objects/object_ma1/object_ma1.h" +#include "assets/objects/object_ma2/object_ma2.h" +#include "assets/objects/object_cow/object_cow.h" +#include "assets/objects/object_dog/object_dog.h" #define FLAGS 0x00000010 #define THIS ((EnInvadepoh*)thisx) -typedef struct { - f32 unk0; - s16 unk4; - s16 unk6; -} EnInvadepohUnkStruct1; - -typedef struct { - u8* unk0; - u8 unk4; -} EnInvadepohUnkStruct2; - -typedef struct { - s32 unk0; - EnInvadepohUnkStruct2* unk4; -} EnInvadepohUnkStruct3; - -typedef struct { - u8 unk0; - f32 unk4; -} EnInvadepohUnkStruct4; - -typedef struct { - u8 unk0; - EnInvadepohUnkStruct2* unk4; - u8 unk8; - EnInvadepohUnkStruct4* unkC; -} EnInvadepohUnkStruct5; - -typedef struct { - u8 unk0; - EnInvadepohUnkStruct2* unk4; - u8 unk8; - EnInvadepohUnkStruct4* unkC; - s16 unk10; - s16 unk12; -} EnInvadepohUnkStruct6; - void EnInvadepoh_Init(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play); + void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); -void EnInvadepoh_Update(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2); -void func_80B4D9B4(Actor* thisx, PlayState* play); +void EnInvadepoh_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B490F0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B49B1C(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4A168(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4A1B8(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4AB8C(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4ABDC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4BA84(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4C5C0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2); -void func_80B4627C(EnInvadepoh* this, PlayState* play); -void func_80B46414(EnInvadepoh* this, PlayState* play); -void func_80B46520(EnInvadepoh* this, PlayState* play); -void func_80B465CC(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B468B4(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B469C4(EnInvadepoh* this, PlayState* play); -void func_80B46A80(EnInvadepoh* this, PlayState* play); -void func_80B46644(EnInvadepoh* this, PlayState* play); -void func_80B46414(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4E158(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play); -void func_80B46BB0(EnInvadepoh* this, PlayState* play); -void func_80B46BC0(EnInvadepoh* this, PlayState* play); -void func_80B46C08(EnInvadepoh* this, PlayState* play); -void func_80B46C34(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C7C(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C94(EnInvadepoh* this, PlayState* play); -void func_80B46CC0(EnInvadepoh* this, PlayState* play); -void func_80B46CF4(EnInvadepoh* this, PlayState* play); -void func_80B46D28(EnInvadepoh* this, PlayState* play); - -extern ColliderCylinderInit D_80B4E8B0; -extern ColliderCylinderInit D_80B4E8DC; -extern ColliderCylinderInit D_80B4E908; -extern Vec3f D_80B4E934; -extern s32 D_80B4E940; -extern TexturePtr sRomaniEyeTextures[]; -extern TexturePtr sRomaniMouthTextures[]; -extern s32 D_80B4E968; -extern TexturePtr sCremiaEyeTextures[]; -extern TexturePtr sCremiaMouthTextures[]; -extern s32 D_80B4E994; -extern s32 D_80B4E998; -extern u8 D_80B4E99C[]; -extern u8 D_80B4E9A0[]; -extern u8 D_80B4E9A4[]; -extern u8 D_80B4E9AC[]; -extern u8 D_80B4E9B4[]; -extern u8 D_80B4E9BC[]; -extern u8 D_80B4E9C0[]; -extern u8 D_80B4EAB0[]; -extern EnInvadepohUnkStruct2 D_80B4E9C4[]; -extern EnInvadepohUnkStruct2 D_80B4E9CC[]; -extern EnInvadepohUnkStruct2 D_80B4E9D4[]; -extern EnInvadepohUnkStruct2 D_80B4E9DC[]; -extern EnInvadepohUnkStruct2 D_80B4E9E4[]; -extern EnInvadepohUnkStruct2 D_80B4E9EC[]; -extern EnInvadepohUnkStruct2 D_80B4E9F4[]; -extern EnInvadepohUnkStruct3 D_80B4E9FC; -extern EnInvadepohUnkStruct4 D_80B4EA04[]; -extern EnInvadepohUnkStruct4 D_80B4EA24; -extern EnInvadepohUnkStruct6 D_80B4EA2C; -extern EnInvadepohUnkStruct5 D_80B4EA40; -extern EnInvadepohUnkStruct5 D_80B4EA50; -extern EnInvadepohUnkStruct5 D_80B4EA60; -extern EnInvadepohUnkStruct5 D_80B4EA70; -extern EnInvadepohUnkStruct3 D_80B4EA80; -extern EnInvadepohUnkStruct3 D_80B4EA88; -extern void* D_80B4EA90[]; -extern u8 D_80B4EAB0[]; -extern u8 D_80B4EAB4[]; -extern u8 D_80B4EAB8[]; -extern u8 D_80B4EABC[]; -extern EnInvadepohUnkStruct2 D_80B4EAC0; -extern EnInvadepohUnkStruct2 D_80B4EAC8; -extern EnInvadepohUnkStruct2 D_80B4EAD0; -extern EnInvadepohUnkStruct2 D_80B4EAD8; -extern EnInvadepohUnkStruct3 D_80B4EAE0; -extern EnInvadepohUnkStruct3 D_80B4EAE8; -extern EnInvadepohUnkStruct3 D_80B4EAF0; -extern EnInvadepohUnkStruct3 D_80B4EAF8; -extern EnInvadepohUnkStruct3* D_80B4EB00[]; -extern u8 D_80B4EB10[]; -extern u8 D_80B4EB14[]; -extern u8 D_80B4EB18[]; -extern u8 D_80B4EB20[]; -extern u8 D_80B4EB28[]; -extern EnInvadepohUnkStruct2 D_80B4EB30; -extern EnInvadepohUnkStruct2 D_80B4EB38; -extern EnInvadepohUnkStruct2 D_80B4EB40; -extern EnInvadepohUnkStruct2 D_80B4EB48; -extern EnInvadepohUnkStruct2 D_80B4EB50; -extern EnInvadepohUnkStruct2 D_80B4EB58; -extern EnInvadepohUnkStruct3 D_80B4EB5C; -extern EnInvadepohUnkStruct4 D_80B4EB60[]; -extern EnInvadepohUnkStruct4 D_80B4EB80; -extern EnInvadepohUnkStruct6 D_80B4EB88; -extern EnInvadepohUnkStruct5 D_80B4EB9C; -extern EnInvadepohUnkStruct5 D_80B4EBAC; -extern EnInvadepohUnkStruct5 D_80B4EBBC; -extern EnInvadepohUnkStruct5 D_80B4EBCC; -extern void* D_80B4EBDC[]; -extern u8 D_80B4EBF4[]; -extern EnInvadepohUnkStruct2 D_80B4EBF8; -extern EnInvadepohUnkStruct3 D_80B4EC00; -extern EnInvadepohUnkStruct3* D_80B4EC08; -extern void* D_80B4EC0C[]; -extern Color_RGBA8 D_80B4EC18; -extern Color_RGBA8 D_80B4EC1C; -extern void* D_80B4EC20; -extern InitChainEntry D_80B4EC24[]; -extern InitChainEntry D_80B4EC34[]; -extern InitChainEntry D_80B4EC44[]; -extern InitChainEntry D_80B4EC54[]; -extern InitChainEntry D_80B4EC68[]; -extern InitChainEntry D_80B4EC80[]; -extern InitChainEntry D_80B4EC98[]; -extern EnInvadepohInitFunc* D_80B4ECB0[]; -extern EnInvadepohDestFunc* D_80B4ECE8[]; -extern s16 D_80B4ED20[]; -extern Vec3f D_80B4ED30[]; -extern Vec3f D_80B4ED6C[]; -extern Vec3s D_80B4EDC0; -extern Vec3s D_80B4EDC8; -extern Vec3f D_80B4EDD0[]; -extern EnInvadepohUnkStruct1 D_80B4EE0C[]; -extern Vec3f D_80B4EE24; -extern Vec3f D_80B4EE30; - -extern MtxF D_80B502A0; -extern MtxF D_80B502E0; -extern Actor *D_80B50320; -extern s32 D_80B50324; -extern s32 D_80B50328; -extern s32 D_80B5032C; -extern u8 D_80B50340; -extern s8 D_80B50348; -extern s32 D_80B50350[]; -extern Actor *D_80B503F0; -extern EnInvadepoh *D_80B503F4; -extern EnInvadepoh *D_80B503F8; -extern AnimatedMaterial *sAlienEmptyTexAnim; -extern AnimatedMaterial *sAlienEyeBeamTexAnim; -extern s16 D_80B50404; -extern s16 D_80B50406; -extern s16 D_80B5040A; -extern Actor *D_80B5040C; - - -/* -const ActorInit En_Invadepoh_InitVars = { +ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, FLAGS, @@ -213,492 +85,4076 @@ const ActorInit En_Invadepoh_InitVars = { (ActorFunc)EnInvadepoh_Update, (ActorFunc)NULL, }; -*/ -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B439B0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A24.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A74.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A9C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AB0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AF0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43B80.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43BC8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43DD4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43E6C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F0C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F70.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44024.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4407C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B440B8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44234.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B442E4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B443A0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444BC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444F4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44514.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44540.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44570.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44620.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44640.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44664.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44690.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B446D0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44700.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B447C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44A90.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B78.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B84.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C24.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C80.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44E90.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44EFC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44F58.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44FEC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45080.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B450C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4516C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B451A0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B452EC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B453F4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45460.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B454BC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45518.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45550.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4560C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45648.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B456A8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B457A0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B458D8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45980.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B459E8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A4C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A94.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45B1C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45BB8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45C04.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45CE0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45EC8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46118.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46184.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B461DC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4627C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46414.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46520.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B465CC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46644.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B468B4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B469C4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46A80.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Init.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BB0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BC0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C08.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C34.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C50.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C7C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C94.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CC0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CF4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46D28.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Destroy.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DA8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DC8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E20.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E44.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EC0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EE8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46F88.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46FA8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47064.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47084.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B470E0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47108.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471E0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47248.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47268.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47278.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47298.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47304.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47324.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Update.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47380.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B473E4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47478.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B474DC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47568.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47600.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4770C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B477B4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47830.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B478F4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47938.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B479E8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47BAC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47D30.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47FA8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48060.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B481C4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4827C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B482D4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48324.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48374.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B483CC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4843C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B484EC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48588.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48610.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48620.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4873C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B487B4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48848.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48948.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48AD4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48DE4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48E4C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48FB0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B490F0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B491EC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49228.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B492FC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4934C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49404.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49454.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49628.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49670.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497A4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497EC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49904.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4994C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B499BC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49A00.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49B1C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49BD0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49C38.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DA0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DFC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49F88.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A168.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A1B8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A2C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A350.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A570.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A5E4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A614.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A67C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A7C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A81C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A9C8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AB8C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ABDC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACDC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACF0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD3C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD60.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADB8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADCC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEC0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEDC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF80.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF94.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B024.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B048.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B0C4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B218.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B3DC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B430.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B484.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B510.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B564.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B724.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B768.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B820.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B864.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B8BC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA30.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA84.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BBE0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BC4C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BFFC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C058.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C1BC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C218.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C3A0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C568.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C5C0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C6C8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C730.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CAB0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CB0C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CC70.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CCCC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CE54.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CFFC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D054.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D15C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D290.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D3E4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D480.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D670.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D760.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D7B8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9B4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9D8.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9F4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4DB14.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E120.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E158.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E1B0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E200.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E2AC.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E324.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E3F0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E5B0.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E61C.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E660.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E6E4.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E784.s") - -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E7BC.s") +#include "z_en_invadepoh_data.inc.c" + +void EnInvadepoh_func_80B457A0(EnInvadepoh* this); +void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this); +void EnInvadepoh_func_80B442E4(EnInvadepoh* this); +void EnInvadepoh_func_80B43F0C(EnInvadepoh* this); +void EnInvadepoh_func_80B443A0(EnInvadepoh* this); +void EnInvadepoh_func_80B44514(EnInvadepoh* this); +void EnInvadepoh_func_80B44570(EnInvadepoh* this); +void EnInvadepoh_func_80B44640(EnInvadepoh* this); +void EnInvadepoh_func_80B44690(EnInvadepoh* this); +void EnInvadepoh_func_80B44700(EnInvadepoh* this); +void EnInvadepoh_func_80B44B78(EnInvadepoh* this); +void EnInvadepoh_func_80B47380(EnInvadepoh* this); +void EnInvadepoh_func_80B47478(EnInvadepoh* this); +void EnInvadepoh_func_80B482D4(EnInvadepoh* this); +void EnInvadepoh_func_80B48DE4(EnInvadepoh* this); +void EnInvadepoh_func_80B497A4(EnInvadepoh* this); +void EnInvadepoh_func_80B49DA0(EnInvadepoh* this); +void EnInvadepoh_func_80B4A7C0(EnInvadepoh* this); +void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this); +void EnInvadepoh_func_80B4B820(EnInvadepoh* this); +void EnInvadepoh_func_80B4BFFC(EnInvadepoh* this); +void EnInvadepoh_func_80B4CAB0(EnInvadepoh* this); +void EnInvadepoh_func_80B4D15C(EnInvadepoh* this); +void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this); +void EnInvadepoh_func_80B47568(EnInvadepoh* this); +void EnInvadepoh_func_80B4770C(EnInvadepoh* this); +void EnInvadepoh_func_80B487B4(EnInvadepoh* this); +void EnInvadepoh_func_80B48948(EnInvadepoh* this); +void EnInvadepoh_func_80B49904(EnInvadepoh* this); +void EnInvadepoh_func_80B49BD0(EnInvadepoh* this); +void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this); +void EnInvadepoh_func_80B4A614(EnInvadepoh* this); +void EnInvadepoh_func_80B4B510(EnInvadepoh* this); +void EnInvadepoh_func_80B4B430(EnInvadepoh* this); +void EnInvadepoh_func_80B4B724(EnInvadepoh* this); +void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this); +void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this); +void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this); +void EnInvadepoh_func_80B4CC70(EnInvadepoh* this); +void EnInvadepoh_func_80B47830(EnInvadepoh* this); +void EnInvadepoh_func_80B47938(EnInvadepoh* this); +void EnInvadepoh_func_80B48374(EnInvadepoh* this); +void EnInvadepoh_func_80B492FC(EnInvadepoh* this); +void EnInvadepoh_func_80B499BC(EnInvadepoh* this); +void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this); +void EnInvadepoh_func_80B4B024(EnInvadepoh* this); +void EnInvadepoh_func_80B4AF80(EnInvadepoh* this); +void EnInvadepoh_func_80B49404(EnInvadepoh* this); +void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this); +void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this); +void EnInvadepoh_func_80B4843C(EnInvadepoh* this); +void EnInvadepoh_func_80B4A570(EnInvadepoh* this); +void EnInvadepoh_func_80B48588(EnInvadepoh* this); +void EnInvadepoh_func_80B491EC(EnInvadepoh* this); +void EnInvadepoh_func_80B49628(EnInvadepoh* this); +void EnInvadepoh_func_80B45648(EnInvadepoh* this); +void EnInvadepoh_func_80B46DA8(EnInvadepoh* this); +void EnInvadepoh_func_80B46F88(EnInvadepoh* this); +void EnInvadepoh_func_80B471C0(EnInvadepoh* this); +void EnInvadepoh_func_80B47248(EnInvadepoh* this); +void EnInvadepoh_func_80B47304(EnInvadepoh* this); +void EnInvadepoh_func_80B46E20(EnInvadepoh* this); +void EnInvadepoh_func_80B46EC0(EnInvadepoh* this); +void EnInvadepoh_func_80B47064(EnInvadepoh* this); +void EnInvadepoh_func_80B47278(EnInvadepoh* this); +void EnInvadepoh_func_80B470E0(EnInvadepoh* this); +void EnInvadepoh_func_80B47248(EnInvadepoh* this); + +void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44A90(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44C24(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44E90(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44EFC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44024(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B444BC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B444F4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44540(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44620(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B44664(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play); + +s32 EnInvadepoh_func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx); +void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx); +s32 EnInvadepoh_func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); +s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnInvadepoh_func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); +s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnInvadepoh_func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); + +void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0); +void EnInvadepoh_func_80B45BB8(EnInvadePohUnkStruct_324_1* arg0); +s8 EnInvadepoh_func_80B45980(EnInvadepohUnkStruct4* arg0, s32 arg1); +void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); +void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); +void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); + +s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this); +void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2); +s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2); +s32 EnInvadepoh_func_80B44B84(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3); +void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2); +s32 EnInvadepoh_func_80B45550(EnInvadepoh* this, PlayState* play, f32 arg2, s32 arg3); +s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4560C(EnInvadepoh* this, PlayState* play, u16 arg2); +void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2); +s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1); +void EnInvadepoh_func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2); +void EnInvadepoh_func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3); +f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this); +void EnInvadepoh_func_80B4407C(EnInvadepoh* this, s32 arg1); +s32 EnInvadepoh_func_80B43B80(EnInvadepoh* this); + +void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0); +s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); +s32 EnInvadepoh_func_80B461DC(void); +s32 EnInvadepoh_func_80B43A24(s32); +void EnInvadepoh_func_80B4D7B8(PlayState* play); +void EnInvadepoh_func_80B44F58(void); +void EnInvadepoh_func_80B44FEC(void); +void EnInvadepoh_func_80B45080(void); +EnInvadepoh* EnInvadepoh_func_80B458D8(void); +s32 EnInvadepoh_func_80B46118(Vec3f* arg0); +void EnInvadepoh_func_80B43A74(s32 arg0); +s32 EnInvadepoh_func_80B43A9C(void); +s32 EnInvadepoh_func_80B43AB0(void); +void EnInvadepoh_func_80B43AF0(s32 arg0); +void EnInvadepoh_func_80B45518(Vec3f* arg0); +s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1); + +void EnInvadepoh_func_80B439B0(s32 arg0, s32 arg1) { + arg1 -= CLOCK_TIME(2, 30); + arg1 = CLAMP_MIN(arg1, 0); + + if (!(arg0 & 1)) { + gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); + } else { + gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((u16)arg1 << 0x10); + } +} + +s32 EnInvadepoh_func_80B43A24(s32 arg0) { + u32 var_v1; + + if ((arg0 % 2) == 0) { + var_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; + } else { + var_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; + } + return var_v1 + CLOCK_TIME(2, 30); +} + +void EnInvadepoh_func_80B43A74(s32 arg0) { + gSaveContext.save.unk_E88[4] = (gSaveContext.save.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); +} + +s32 EnInvadepoh_func_80B43A9C(void) { + return gSaveContext.save.unk_E88[4] & 0xFF; +} + +s32 EnInvadepoh_func_80B43AB0(void) { + s32 sp1C = EnInvadepoh_func_80B43A9C(); + + if (sp1C < 12) { + sp1C++; + EnInvadepoh_func_80B43A74(sp1C); + } + return sp1C; +} + +void EnInvadepoh_func_80B43AF0(s32 arg0) { + s32 sp1C = gSaveContext.save.time; + + if (((gSaveContext.save.day % 5) == 1) && (sp1C >= CLOCK_TIME(2, 30)) && (sp1C < CLOCK_TIME(5, 15))) { + s32 sp18 = (12 - EnInvadepoh_func_80B43A9C()) * 25.0f; + + EnInvadepoh_func_80B439B0(arg0, sp1C + sp18); + } +} + +s32 EnInvadepoh_func_80B43B80(EnInvadepoh* this) { + s32 var_v1; + s32 var_v0 = this->unk_308 - 1; + + for (var_v1 = 0; var_v1 < var_v0; var_v1++) { + if (this->unk_320 < this->unk_37C[var_v1]) { + break; + } + } + return var_v1; +} + +void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { + f32 var_fs0 = 0.0f; + f32 var_fs2 = 0.0f; + f32 temp_fs1 = 1.0f / this->unk_310; + s32 temp_s5 = this->unk_308; + s32 var_s2; + Vec3f sp70; + Vec3s* var_s0 = this->unk_30C; + Vec3s* var_s1 = var_s0 + 1; + f32 temp_fa0; + f32 temp_fa1; + f32 temp_fv0; + f32 temp_fv0_2; + + for (var_s2 = 0; var_s2 < temp_s5; var_s2++) { + sp70.x = var_s1->x - var_s0->x; + sp70.y = var_s1->y - var_s0->y; + sp70.z = var_s1->z - var_s0->z; + temp_fv0_2 = Math3D_Vec3fMagnitude(&sp70); + temp_fa1 = var_fs0 + temp_fv0_2; + temp_fa0 = temp_fa1 * temp_fs1; + if (this->unk_320 <= temp_fa0) { + *arg1 = var_s2; + temp_fv0 = (this->unk_320 - var_fs2) / (temp_fa0 - var_fs2); + arg2->x = (temp_fv0 * sp70.x) + var_s0->x; + arg2->y = (temp_fv0 * sp70.y) + var_s0->y; + arg2->z = (temp_fv0 * sp70.z) + var_s0->z; + return; + } + var_s0 = var_s1++; + var_fs0 = temp_fa1; + var_fs2 = temp_fa0; + } + *arg1 = temp_s5; + arg2->x = this->unk_30C[temp_s5].x; + arg2->y = this->unk_30C[temp_s5].y; + arg2->z = this->unk_30C[temp_s5].z; +} + +void EnInvadepoh_func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { + s32 pad; + Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp3C = sp40 + 1; + Vec3f sp30; + Vec3f sp24; + + if (this->unk_309 != this->unk_308) { + Math_Vec3s_ToVec3f(&sp30, sp40); + Math_Vec3s_ToVec3f(&sp24, sp3C); + Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); + } +} + +void EnInvadepoh_func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { + s32 pad; + Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp3C = sp40 + 1; + Vec3f sp30; + Vec3f sp24; + + if (this->unk_309 != this->unk_308) { + Math_Vec3s_ToVec3f(&sp30, sp40); + Math_Vec3s_ToVec3f(&sp24, sp3C); + Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24), arg1, arg2, arg3); + } +} + +void EnInvadepoh_func_80B43F0C(EnInvadepoh* this) { + s32 pad; + Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp3C = sp40 + 1; + Vec3f sp30; + Vec3f sp24; + + Math_Vec3s_ToVec3f(&sp30, sp40); + Math_Vec3s_ToVec3f(&sp24, sp3C); + this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp30, &sp24); +} + +f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this) { + s32 temp_s4 = this->unk_308 + 1; + s32 var_s1; + Vec3f sp54; + Vec3f sp48; + Vec3s* var_s0 = this->unk_30C; + f32 var_fs0 = 0.0f; + + Math_Vec3s_ToVec3f(&sp48, var_s0); + var_s0++; + for (var_s1 = 1; var_s1 < temp_s4; var_s1++, var_s0++) { + Math_Vec3f_Copy(&sp54, &sp48); + Math_Vec3s_ToVec3f(&sp48, var_s0); + var_fs0 += Math3D_Distance(&sp54, &sp48); + } + return var_fs0; +} + +void EnInvadepoh_func_80B44024(EnInvadepoh* this, PlayState* play) { + Path* temp_v0 = &play->setupPathList[(this->actor.params >> 8) & 0x7F]; + + this->unk_308 = temp_v0->count - 1; + this->unk_30C = Lib_SegmentedToVirtual(temp_v0->points); +} + +void EnInvadepoh_func_80B4407C(EnInvadepoh* this, s32 arg1) { + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->unk_30C[arg1]); +} + +s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2) { + EnInvadepoh* this = thisx; // TODO: why recast? + Vec3s* sp48 = &this->unk_30C[this->unk_309]; + Vec3s* sp44 = &this->unk_30C[this->unk_309] + 1; + f32 sp40; + f32 sp3C; + f32 sp38; + f32 sp34; + f32 sp30; + f32 sp2C; + f32 temp_fa0_2; + f32 temp_fv0_2; + s32 pad2; + s16 sp1E; + + if (this->unk_309 >= this->unk_308) { + return 0; + } + sp40 = (sp44->x - sp48->x); + sp3C = (sp44->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 0; + } + temp_fv0_2 = Math3D_XZLength(sp40, sp3C); + temp_fa0_2 = (sp2C * sp38) + (sp30 * sp34); + + if ((temp_fa0_2 < 0.0f) || (temp_fv0_2 < temp_fa0_2)) { + return 0; + } + return 1; +} + +s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { + s32 var_s0; + s32 temp_s3 = this->unk_308; + Vec3s* var_s1; + Vec3f sp48; + f32 var_fs0 = FLT_MAX; + s32 var_s4 = 0; + f32 temp_fv0; + + for (var_s0 = 0, var_s1 = this->unk_30C; var_s0 < temp_s3; var_s0++, var_s1++) { + Math_Vec3s_ToVec3f(&sp48, var_s1); + temp_fv0 = Math3D_Vec3fDistSq(&sp48, arg1); + if (temp_fv0 < var_fs0) { + var_fs0 = temp_fv0; + var_s4 = var_s0; + } + } + return var_s4; +} + +void EnInvadepoh_func_80B442E4(EnInvadepoh* this) { + s32 pad; + s32 sp18 = gSaveContext.save.time; + s32 temp_v0 = EnInvadepoh_func_80B43A24(this->actor.params & 7); + + if (D_80B4E940 == 1) { + this->unk_320 = 0.0f; + } else if (D_80B4E940 == 2) { + if ((sp18 - temp_v0) < 0) { + this->unk_320 = 0.0f; + } else { + this->unk_320 = (sp18 - temp_v0) * (1.0f / 3600.0f); + if (this->unk_320 > 1.0f) { + this->unk_320 = 1.0f; + } + } + } + this->unk_309 = EnInvadepoh_func_80B43B80(this); +} + +void EnInvadepoh_func_80B443A0(EnInvadepoh* this) { + f32 temp_fs3 = 1.0f / this->unk_310; + s32 temp_s4 = this->unk_308; + s32 var_s1; + Vec3f sp54; + Vec3f sp48; + Vec3s* var_s0 = this->unk_30C; + f32 var_fs0 = 0.0f; + f32* var_s2; + + Math_Vec3s_ToVec3f(&sp48, var_s0); + var_s0++; + var_s2 = this->unk_37C; + for (var_s1 = 1; var_s1 < temp_s4; var_s1++, var_s0++, var_s2++) { + Math_Vec3f_Copy(&sp54, &sp48); + Math_Vec3s_ToVec3f(&sp48, var_s0); + var_fs0 += Math3D_Distance(&sp54, &sp48); + *var_s2 = var_fs0 * temp_fs3; + if (*var_s2 < 0.0f) { + *var_s2 = 0.0f; + } else if (*var_s2 > 1.0f) { + *var_s2 = 1.0f; + } + } +} + +void EnInvadepoh_func_80B444BC(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); + this->unk_310 = EnInvadepoh_func_80B43F70(this); + EnInvadepoh_func_80B443A0(this); +} + +void EnInvadepoh_func_80B444F4(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); +} + +void EnInvadepoh_func_80B44514(EnInvadepoh* this) { + this->unk_309++; + if (this->unk_309 >= this->unk_308) { + this->unk_309 = 0; + } +} + +void EnInvadepoh_func_80B44540(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); + this->unk_310 = EnInvadepoh_func_80B43F70(this); +} + +void EnInvadepoh_func_80B44570(EnInvadepoh* this) { + if ((gSaveContext.save.time < 0x1555) || (gSaveContext.save.time >= 0x4000)) { + this->unk_320 = 0.0f; + } else if ((gSaveContext.save.time >= 0x1800) && (gSaveContext.save.time < 0x4000)) { + this->unk_320 = 1.0f; + } else { + f32 temp = (gSaveContext.save.time - 0x1555) * (1.0f / 683.0f); + + this->unk_320 = temp; + this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); + } +} + +void EnInvadepoh_func_80B44620(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); +} + +void EnInvadepoh_func_80B44640(EnInvadepoh* this) { + if (this->unk_309 < this->unk_308) { + this->unk_309++; + } +} + +void EnInvadepoh_func_80B44664(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); + this->unk_30A = 1; +} + +void EnInvadepoh_func_80B44690(EnInvadepoh* this) { + this->unk_309 += this->unk_30A; + if (this->unk_309 >= this->unk_308) { + this->unk_309 = 0; + } else if (this->unk_309 < 0) { + this->unk_309 = this->unk_308 - 1; + } +} + +void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44024(this, play); + this->unk_310 = EnInvadepoh_func_80B43F70(this); +} + +void EnInvadepoh_func_80B44700(EnInvadepoh* this) { + if ((gSaveContext.save.time < 0xD555) && (gSaveContext.save.time >= 0x4000)) { + this->unk_320 = 0.0f; + } else if ((gSaveContext.save.time >= 0xD7E1) || (gSaveContext.save.time < 0x4000)) { + this->unk_320 = 1.0f; + } else { + f32 temp = (gSaveContext.save.time - 0xD555) * (1.0f / 652.0f); + + this->unk_320 = temp; + this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); + } +} + +void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play) { + s32 pad; + Vec3s* sp60; + s32 pad2; + Vec3f sp50; + Vec3f sp44; + f32 sp40 = this->actor.world.pos.y; + f32 sp3C; + f32 sp38; + + sp60 = &this->unk_30C[this->unk_309]; + sp3C = (this->unk_309 < 1) ? 0.0f : this->unk_37C[this->unk_309 - 1]; + sp38 = (this->unk_309 < (this->unk_308 - 1)) ? this->unk_37C[this->unk_309] : 1.0f; + + if (sp38 - sp3C < 0.001f) { + Math_Vec3s_ToVec3f(&this->unk_314, sp60); + } else { + f32 sp34 = this->unk_320 - sp3C; + f32 sp30 = sp38 - this->unk_320; + f32 sp2C = 1.0f / (sp38 - sp3C); + s32 pad3; + + Math_Vec3s_ToVec3f(&sp50, sp60); + Math_Vec3s_ToVec3f(&sp44, sp60 + 1); + this->unk_314.x = ((sp50.x * sp30) + (sp44.x * sp34)) * sp2C; + this->unk_314.y = ((sp50.y * sp30) + (sp44.y * sp34)) * sp2C; + this->unk_314.z = ((sp50.z * sp30) + (sp44.z * sp34)) * sp2C; + } + Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_314); + func_800B4AEC(play, &this->actor, 0.0f); + if (this->actor.floorHeight > BGCHECK_Y_MIN + 1.0f) { + 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.floorHeight < this->actor.world.pos.y) { + 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 EnInvadepoh_func_80B44A90(EnInvadepoh* this, PlayState* play) { + 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_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); +} + +void EnInvadepoh_func_80B44B78(EnInvadepoh* this) { +} + +s32 EnInvadepoh_func_80B44B84(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3) { + s32 pad; // TODO: recast? + Vec3s* temp_v0_2 = &this->unk_30C[this->unk_309 + 1]; + s32 sp2C = + EnInvadepoh_func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, temp_v0_2->x, temp_v0_2->z, arg2); + + func_800B4AEC(play, &this->actor, arg3); + EnInvadepoh_func_80B4516C(this); + return sp2C; +} + +void EnInvadepoh_func_80B44C24(EnInvadepoh* this, PlayState* play) { + s32 pad; // TODO: recast? + f32 sp18 = this->actor.world.pos.y; + + EnInvadepoh_func_80B43BC8(this, &this->unk_309, &this->actor.world.pos); + this->actor.world.pos.y = sp18; + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); +} + +s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play) { + Vec3s* temp_a2 = &this->unk_30C[this->unk_309]; + Vec3s* temp_v0_2; + s32 var_v1; + u32 var_v0; + f32 temp_v0_2x; + f32 temp_v0_2z; + f32 temp_a2x; + f32 temp_a2z; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + Vec3f sp48; + f32 sp44; + s32 sp40 = 0; + + var_v1 = this->unk_309 + this->unk_30A; + + if (var_v1 >= this->unk_308) { + var_v1 = 0; + } else if (var_v1 < 0) { + var_v1 = this->unk_308 - 1; + } + + temp_v0_2 = &this->unk_30C[var_v1]; + + temp_a2x = temp_a2->x; + temp_a2z = temp_a2->z; + temp_v0_2x = temp_v0_2->x; + temp_v0_2z = temp_v0_2->z; + + sp6C.x = temp_v0_2x - temp_a2x; + sp6C.y = 0.0f; + sp6C.z = temp_v0_2z - temp_a2z; + + sp60.x = temp_v0_2x - this->actor.world.pos.x; + sp60.y = 0.0f; + sp60.z = temp_v0_2z - this->actor.world.pos.z; + + sp54.x = temp_a2x - this->actor.world.pos.x; + sp54.y = 0.0f; + sp54.z = temp_a2z - this->actor.world.pos.z; + + if (this->actor.speedXZ > 0.0f) { + if (Math3D_AngleBetweenVectors(&sp6C, &sp60, &sp44)) { + sp40 = 1; + } else if (sp44 <= 0.0f) { + sp40 = 1; + } + } + sp48.x = ((sp60.x + sp54.x) * 0.9f) + sp6C.x; + sp48.y = 0.0f; + sp48.z = ((sp60.z + sp54.z) * 0.9f) + sp6C.z; + + Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(sp48.z, sp48.x), 4, 0xFA0, 0x64); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, + EnInvadepoh_func_80B440B8(this, 50.0f, 15.0f) ? 4 : 5); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); + return sp40; +} + +void EnInvadepoh_func_80B44E90(EnInvadepoh* this, PlayState* play) { + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &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 EnInvadepoh_func_80B44EFC(EnInvadepoh* this, PlayState* play) { + s32 pad; // TODO: recast? + f32 sp18 = this->actor.world.pos.y; + + EnInvadepoh_func_80B43BC8(this, &this->unk_309, &this->actor.world.pos); + this->actor.world.pos.y = sp18; + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); +} + +void EnInvadepoh_func_80B44F58(void) { + TexturePtr* var_s0; + s32 i; + + if (D_80B4E968 == 0) { + D_80B4E968 = 1; + for (i = 0, var_s0 = sRomaniEyeTextures; i < 5; i++, var_s0++) { + *var_s0 = Lib_SegmentedToVirtual(*var_s0); + } + for (i = 0, var_s0 = sRomaniMouthTextures; i < 4; i++, var_s0++) { + *var_s0 = Lib_SegmentedToVirtual(*var_s0); + } + } +} + +void EnInvadepoh_func_80B44FEC(void) { + TexturePtr* var_s0; + s32 i; + + if (D_80B4E994 == 0) { + D_80B4E994 = 1; + for (i = 0, var_s0 = sCremiaEyeTextures; i < 6; i++, var_s0++) { + *var_s0 = Lib_SegmentedToVirtual(*var_s0); + } + for (i = 0, var_s0 = sCremiaMouthTextures; i < 4; i++, var_s0++) { + *var_s0 = Lib_SegmentedToVirtual(*var_s0); + } + } +} + +void EnInvadepoh_func_80B45080(void) { + sAlienEmptyTexAnim = Lib_SegmentedToVirtual(gAlienEmptyTexAnim); + sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); +} + +s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4) { + f32 sp1C = arg2 - *arg0; + f32 sp18 = arg3 - *arg1; + f32 temp_fv0 = Math3D_XZLength(sp1C, sp18); + + if (arg4 < temp_fv0) { + f32 temp_fv1 = arg4 / temp_fv0; + + *arg0 += temp_fv1 * sp1C; + *arg1 += temp_fv1 * sp18; + return 0; + } else { + *arg0 = arg2; + *arg1 = arg3; + return 1; + } +} + +s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this) { + if (this->actor.floorHeight > BGCHECK_Y_MIN + 1.0f) { + this->actor.world.pos.y = this->actor.floorHeight; + return 1; + } + return 0; +} + +void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play) { + if (D_80B4E940 == 0) { + if (gSaveContext.save.day % 5 <= 0) { + D_80B4E940 = 1; + } else if (gSaveContext.save.day % 5 == 1) { + s32 sp2C = gSaveContext.save.time; + + if ((sp2C < CLOCK_TIME(2, 30)) || (sp2C >= CLOCK_TIME(6, 00))) { + D_80B4E940 = 1; + } else if (sp2C < CLOCK_TIME(5, 15)) { + s32 var_s0; + s32 var_s1 = 0x3800; + + for (var_s0 = 0; var_s0 < this->unk_379; var_s0++) { + s32 temp_v0 = EnInvadepoh_func_80B43A24(var_s0); + + var_s1 = MIN(temp_v0, var_s1); + } + + if (sp2C < var_s1 + 0xE11) { + D_80B4E940 = 2; + } + } + } + if (D_80B4E940 == 0) { + if (gSaveContext.save.weekEventReg[0x16] & 1) { + D_80B4E940 = 3; + } else { + D_80B4E940 = 4; + } + } + } +} + +void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { + s32 var_s2 = (this->actor.params >> 8) & 0x7F; + s32 var_s3; + + for (var_s3 = 0; var_s3 < this->unk_379; var_s3++) { + D_80B50320[var_s3] = + (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, 0x200, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, (var_s3 & 7) | ((var_s2 << 8) & 0x7F00) | 0x10); + if (var_s2 != 0xFF) { + Path* temp_v0 = &play->setupPathList[var_s2]; + + var_s2 = temp_v0->unk1; + } + } +} + +void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); +} + +void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, 0, 0, 0, 0x40); +} + +void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play) { + D_80B503F0 = Actor_Spawn(&play->actorCtx, play, 0x200, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0x60); +} + +void EnInvadepoh_func_80B45518(Vec3f* arg0) { + MtxF* temp_v0 = Matrix_GetCurrent(); + + temp_v0->mf[3][0] = arg0->x; + temp_v0->mf[3][1] = arg0->y; + temp_v0->mf[3][2] = arg0->z; +} + +s32 EnInvadepoh_func_80B45550(EnInvadepoh* this, PlayState* play, f32 arg2, s32 arg3) { + Actor* var_s0 = play->actorCtx.actorLists[ACTORCAT_DOOR].first; + EnDoor* door; + s32 sp34 = 0; + + while (var_s0 != NULL) { + if ((var_s0->id == ACTOR_EN_DOOR) && (var_s0->update != NULL)) { + door = (EnDoor*)var_s0; + if ((door->dyna.actor.room == this->actor.room) && + (Math3D_Vec3fDistSq(&door->dyna.actor.world.pos, &this->actor.world.pos) < arg2)) { + + door->unk_1A7 = arg3; + sp34 = 1; + break; + } + } + var_s0 = var_s0->next; + } + return sp34; +} + +void EnInvadepoh_func_80B4560C(EnInvadepoh* this, PlayState* play, u16 arg2) { + this->unk_376 = arg2; + Message_StartTextbox(play, arg2, &this->actor); +} + +void EnInvadepoh_func_80B45648(EnInvadepoh* this) { + s16 var_s1 = this->actor.cutscene; + s32 i; + + for (i = 0; i < 3; i++) { + D_80B50404[i] = var_s1; + var_s1 = ActorCutscene_GetAdditionalCutscene(var_s1); + } +} + +s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1) { + Vec3f sp34; + f32 sp30; + + Actor_GetProjectedPos(play, arg1, &sp34, &sp30); + if (sp34.z > 1.0f) { + // temp_fv1 = sp34.x * sp30; + if (fabsf(sp34.x * sp30) < 1.0f) { + // temp_fa0 = sp34.y * sp30; + if (fabsf(sp34.y * sp30) < 1.0f) { + f32 sp2C = (sp34.x * sp30 * 160.0f) + 160.0f; + f32 sp28 = (sp34.y * sp30 * -120.0f) + 120.0f; + s32 sp24 = (s32)(sp34.z * sp30 * 16352.0f) + 16352; + + if (sp24 < func_80178A94(sp2C, sp28)) { + return 1; + } + } + } + } + return 0; +} + +void EnInvadepoh_func_80B457A0(EnInvadepoh* this) { + s32 var_s0; + f32 var_fs0 = FLT_MAX; + s32 var_s5 = -1; + + for (var_s0 = 0; var_s0 < this->unk_379; var_s0++) { + if ((D_80B50320[var_s0] != NULL) && (D_80B50320[var_s0]->unk_38B != 0)) { + f32 temp_fv0 = Math3D_Vec3fDistSq(&D_80B50320[var_s0]->actor.world.pos, &this->actor.world.pos); + + if (temp_fv0 < var_fs0) { + var_fs0 = temp_fv0; + var_s5 = var_s0; + } + } + D_80B50340[var_s0] &= ~2; + } + D_80B50348 = 0; + if (var_fs0 <= SQ(2000.0f)) { + D_80B50340[var_s5] |= 2; + if (var_fs0 <= SQ(340.0f)) { + D_80B50348 = 1; + } + } +} + +EnInvadepoh* EnInvadepoh_func_80B458D8(void) { + s32 var_v1; + + for (var_v1 = 0; var_v1 < 8; var_v1++) { + if (D_80B50340[var_v1] & 2) { + return D_80B50320[var_v1]; + } + } + return NULL; +} + +s8 EnInvadepoh_func_80B45980(EnInvadepohUnkStruct4* arg0, s32 arg1) { + f32 temp_fv0 = Rand_ZeroOne(); + EnInvadepohUnkStruct4* var_v0 = arg0; + s32 var_v1; + + arg1--; + for (var_v1 = 0; var_v1 < arg1; var_v1++, var_v0++) { + if (temp_fv0 <= var_v0->unk4) { + break; + } + } + return (arg0 + var_v1)->unk0; // TODO: fake? +} + +void EnInvadepoh_func_80B459E8(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion* arg1) { + arg0->unk_4 = arg1->unk3.unk0; + arg0->unk_8 = arg1; + arg0->unk_E = 0; + arg0->unk_F = *arg1->unk3.unk4->unk0; + if (arg0->unk_4 == 2) { + EnInvadepohUnkStruct6* temp = &arg1->unk6; + + arg0->unk_C = Rand_S16Offset(temp->unk10, temp->unk12); + } +} + +void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { + EnInvadepohUnkStruct3* temp_v0 = &arg0->unk_8->unk3; + EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; + + if (arg0->unk_E < (temp_v1->unk4 - 1)) { + arg0->unk_E++; + arg0->unk_F = temp_v1->unk0[arg0->unk_E]; + } +} + +void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { + EnInvadepohUnkStruct5* temp_v0 = &arg0->unk_8->unk5; + EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; + + if (arg0->unk_E < (temp_v1->unk4 - 1)) { + arg0->unk_E++; + arg0->unk_F = temp_v1->unk0[arg0->unk_E]; + } else { + s32 temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->unkC, temp_v0->unk8)]; + + EnInvadepoh_func_80B459E8(arg0, temp_a1); + } +} + +void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { + EnInvadepohUnkStruct6* temp_v0 = &arg0->unk_8->unk6; + EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; + + if (arg0->unk_E < (temp_v1->unk4 - 1)) { + arg0->unk_E++; + arg0->unk_F = temp_v1->unk0[arg0->unk_E]; + } else if (arg0->unk_C > 0) { + arg0->unk_C--; + } else { + s32 temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->unkC, temp_v0->unk8)]; + + EnInvadepoh_func_80B459E8(arg0, temp_a1); + } +} + +void EnInvadepoh_func_80B45BB8(EnInvadePohUnkStruct_324_1* arg0) { + if ((arg0->unk_0 != NULL) && (arg0->unk_8 != NULL)) { + D_80B4EC0C[arg0->unk_4](arg0, arg0->unk_0); + } +} + +void EnInvadepoh_func_80B45C04(EnInvadePohUnkStruct_324* arg0, EnInvadepohUnkUnion** arg1, s32 arg2, + EnInvadepohUnkUnion** arg3, s32 arg4, Vec3s* arg5, s16 arg6, f32 arg7, f32 arg8, + f32 arg9) { + Math_Vec3s_Copy(&arg0->unk_26, arg5); + arg0->unk_2C = arg6; + arg0->unk_30 = arg7; + arg0->unk_38 = arg8; + arg0->unk_3C = arg9; + if (arg1 != NULL) { + EnInvadepohUnkUnion* temp_v0 = arg1[arg2]; + + arg0->unk_00.unk_0 = arg1; + arg0->unk_00.unk_4 = temp_v0->unk3.unk0; + arg0->unk_00.unk_8 = temp_v0; + arg0->unk_00.unk_C = 0; + arg0->unk_00.unk_E = 0; + arg0->unk_00.unk_F = temp_v0->unk3.unk4->unk0[0]; + } + if (arg3 != NULL) { + EnInvadepohUnkUnion* temp_v0 = arg3[arg4]; + + arg0->unk_10.unk_0 = arg3; + arg0->unk_10.unk_4 = temp_v0->unk3.unk0; + arg0->unk_10.unk_8 = temp_v0; + arg0->unk_10.unk_C = 0; + arg0->unk_10.unk_E = 0; + arg0->unk_10.unk_F = temp_v0->unk3.unk4->unk0[0]; + } +} + +void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0) { + Vec3f sp3C; + Vec3s sp34; + + sp34.x = arg0->unk_26.x - arg0->unk_20.x; + sp34.y = arg0->unk_26.y - arg0->unk_20.y; + sp34.z = arg0->unk_26.z - arg0->unk_20.z; + Math_Vec3s_ToVec3f(&sp3C, &sp34); + Math_Vec3f_Scale(&sp3C, arg0->unk_30); + 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, arg0->unk_2C); + sp34.y = CLAMP_MAX(sp34.y, arg0->unk_2C); + sp34.z = CLAMP_MAX(sp34.z, arg0->unk_2C); + + Math_ScaledStepToS(&arg0->unk_20.x, arg0->unk_26.x, sp34.x); + Math_ScaledStepToS(&arg0->unk_20.y, arg0->unk_26.y, sp34.y); + Math_ScaledStepToS(&arg0->unk_20.z, arg0->unk_26.z, sp34.z); + Math_StepToF(&arg0->unk_34, arg0->unk_38, arg0->unk_3C); + + if (arg0->unk_40 != arg0->unk_42) { + s16 var_a2 = arg0->unk_42 - arg0->unk_40; + + var_a2 *= arg0->unk_44; + var_a2 = ABS(var_a2); + var_a2 = CLAMP(var_a2, 100, arg0->unk_48); + Math_ScaledStepToS(&arg0->unk_40, arg0->unk_42, var_a2); + } + EnInvadepoh_func_80B45BB8(&arg0->unk_00); + EnInvadepoh_func_80B45BB8(&arg0->unk_10); +} + +void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { + s32 var_s1; + Vec3f spA8; + Vec3f sp9C; + Vec3f sp90; + f32 temp_fs0; + s16 var_s0 = 0; + + for (var_s1 = 0; var_s1 < arg2; var_s1++) { + var_s0 += (s16)(65536.0f / arg2); + temp_fs0 = (Rand_ZeroOne() * 0.5f) + 0.5f; + + spA8.x = Math_SinS(var_s0) * temp_fs0; + spA8.z = Math_CosS(var_s0) * temp_fs0; + + 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(play, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); + } +} + +s32 EnInvadepoh_func_80B46118(Vec3f* arg0) { + EnInvadepohStructD_80B50350* var_v1 = D_80B50350; + s32 var_v0; + + for (var_v0 = 0; var_v0 < 10; var_v0++, var_v1++) { + if (var_v1->unk_1 <= 0) { + var_v1->unk_0 = 0; + var_v1->unk_1 = 40; + Math_Vec3f_Copy(&var_v1->unk_4, arg0); + var_v1->unk_2 = 0; + return 1; + } + } + return 0; +} + +void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0) { + if (arg0->unk_1 > 20) { + if (arg0->unk_2 < 125) { + arg0->unk_2 += 10; + } else { + arg0->unk_2 = 135; + } + } else { + if (arg0->unk_2 > 13) { + arg0->unk_2 -= 13; + } else { + arg0->unk_2 = 0; + } + } +} + +s32 EnInvadepoh_func_80B461DC(void) { + s32 var_s4 = 0; + s32 i; + EnInvadepohStructD_80B50350* var_s0; + + for (i = 0, var_s0 = D_80B50350; i < 10; i++, var_s0++) { + if (var_s0->unk_1 > 0) { + D_80B4EC20[var_s0->unk_0](var_s0); + var_s4 = 1; + var_s0->unk_1 -= 1; + } + } + return var_s4; +} + +void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 var_a2; + s32 var_v1; + + this->actor.flags |= 0x20; + var_v1 = (this->actor.params >> 8) & 0x7F; + + for (var_a2 = 1; var_a2 < 8; var_a2++) { + Path* path = &play->setupPathList[var_v1]; + + var_v1 = path->unk1; + if (var_v1 == 0xFF) { + break; + } + } + this->unk_379 = var_a2; + EnInvadepoh_func_80B451A0(this, play); + EnInvadepoh_func_80B45648(this); + func_800BC154(play, &play->actorCtx, &this->actor, 0); + if (D_80B4E940 == 1) { + EnInvadepoh_func_80B46DA8(this); + } else if (D_80B4E940 == 2) { + if (gSaveContext.save.time < 0x1AD8) { + EnInvadepoh_func_80B46DA8(this); + } else { + EnInvadepoh_func_80B454BC(this, play); + EnInvadepoh_func_80B452EC(this, play); + Audio_QueueSeqCmd(0x800D); + EnInvadepoh_func_80B46F88(this); + } + } else if (D_80B4E940 == 3) { + if (gSaveContext.save.entrance == 0x6460) { + EnInvadepoh_func_80B471C0(this); + } else if (gSaveContext.save.entrance == 0x6470) { + EnInvadepoh_func_80B47248(this); + } else { + EnInvadepoh_func_80B47248(this); + } + } else if (D_80B4E940 == 4) { + EnInvadepoh_func_80B47304(this); + } +} + +void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC24); + Collider_InitCylinder(play, &this->unk_2A0); + ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); + this->actor.shape.shadowAlpha = 140; + this->actor.flags = 0x80001010; + if (((this->actor.params >> 4) & 0xF) == 0xD) { + this->actor.update = EnInvadepoh_func_80B4D670; + this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; + } else { + this->actor.update = EnInvadepoh_func_80B47BAC; + Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8B0); + this->actor.colChkInfo.mass = 40; + } + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x23E); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC34); + this->actor.update = EnInvadepoh_func_80B47FA8; + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x146); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC44); + this->actor.update = EnInvadepoh_func_80B481C4; + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x146); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 temp_v1 = (this->actor.params >> 4) & 0xF; + + Actor_ProcessInitChain(&this->actor, D_80B4EC54); + if ((temp_v1 == 7) || (temp_v1 == 0xC)) { + this->actor.targetMode = 3; + } else { + this->actor.targetMode = 6; + } + func_800BC154(play, &play->actorCtx, &this->actor, 4); + Collider_InitCylinder(play, &this->unk_2A0); + if (temp_v1 != 4) { + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); + Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); + this->actor.colChkInfo.mass = 0xFF; + } + if (temp_v1 == 4) { + this->actor.update = EnInvadepoh_func_80B48620; + } else if (temp_v1 == 5) { + this->actor.update = EnInvadepoh_func_80B48FB0; + this->actor.flags = 0x19; + } else if (temp_v1 == 7) { + this->actor.update = EnInvadepoh_func_80B49F88; + } else if (temp_v1 == 8) { + this->actor.update = EnInvadepoh_func_80B4A9C8; + } else if (temp_v1 == 9) { + this->actor.update = EnInvadepoh_func_80B4B0C4; + } else { + this->actor.update = EnInvadepoh_func_80B4CE54; + } + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0xB7); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } + if (temp_v1 == 5) { + if (gSaveContext.save.weekEventReg[0x16] & 1) { + Actor_MarkForDeath(&this->actor); + } + } else if (temp_v1 == 7) { + if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { + Actor_MarkForDeath(&this->actor); + } + } else if (temp_v1 == 8) { + // nothing + } else if (temp_v1 == 9) { + if (gSaveContext.save.entrance != 0x6460) { + Actor_MarkForDeath(&this->actor); + } + } else if (temp_v1 == 0xC) { + if (!(gSaveContext.save.weekEventReg[0x16] & 1)) { + Actor_MarkForDeath(&this->actor); + } + D_80B503F4 = this; + } +} + +void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC68); + this->actor.update = EnInvadepoh_func_80B49B1C; + this->actor.draw = EnInvadepoh_func_80B4E3F0; + func_800BC154(play, &play->actorCtx, &this->actor, 4); + if ((D_80B4E940 == 1) || (gSaveContext.save.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; + EnInvadepoh_func_80B491EC(this); + } else if (D_80B4E940 == 2) { + this->actor.world.pos.y += 1500.0f; + EnInvadepoh_func_80B49628(this); + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC80); + this->actor.update = EnInvadepoh_func_80B4B8BC; + Collider_InitCylinder(play, &this->unk_2A0); + Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E908); + this->actor.colChkInfo.mass = 0x50; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x132); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Actor_ProcessInitChain(&this->actor, D_80B4EC98); + this->actor.update = EnInvadepoh_func_80B4C3A0; + func_800BC154(play, &play->actorCtx, &this->actor, 4); + Collider_InitCylinder(play, &this->unk_2A0); + Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); + this->actor.colChkInfo.mass = MASS_HEAVY; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0xA7); + if (this->unk_2F4 < 0) { + Actor_MarkForDeath(&this->actor); + } + if (!(gSaveContext.save.weekEventReg[0x16] & 1)) { + Actor_MarkForDeath(&this->actor); + } + D_80B503F8 = this; +} + +void EnInvadepoh_Init(Actor* thisx, PlayState* play) { + D_80B4ECB0[(thisx->params >> 4) & 0xF](thisx, play); +} + +void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play2) { +} + +void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp18 = this->actor.params & 7; + PlayState* play = play2; + + Collider_DestroyCylinder(play, &this->unk_2A0); + D_80B50320[sp18] = NULL; +} + +void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play2) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (this->actor.parent != NULL) { + this->actor.parent->child = NULL; + } + if (this->actor.child != NULL) { + this->actor.child->parent = NULL; + } +} + +void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play2) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (this->actor.parent != NULL) { + this->actor.parent->child = NULL; + } +} + +void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Collider_DestroyCylinder(play, &this->unk_2A0); +} + +void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play2) { + D_80B503F0 = NULL; +} + +void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Collider_DestroyCylinder(play, &this->unk_2A0); +} + +void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Collider_DestroyCylinder(play, &this->unk_2A0); + D_80B503F8 = NULL; +} + +void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Collider_DestroyCylinder(play, &this->unk_2A0); + D_80B503F4 = NULL; +} + +void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + Collider_DestroyCylinder(play, &this->unk_2A0); + if (this->actor.child != NULL) { + this->actor.child->parent = NULL; + } +} + +void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { + D_80B4ECE8[(thisx->params >> 4) & 0xF](thisx, play); +} + +void EnInvadepoh_func_80B46DA8(EnInvadepoh* this) { + D_80B4E940 = 1; + this->actionFunc = EnInvadepoh_func_80B46DC8; +} + +void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play) { + if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { + EnInvadepoh_func_80B454BC(this, play); + EnInvadepoh_func_80B452EC(this, play); + EnInvadepoh_func_80B46E20(this); + } +} + +void EnInvadepoh_func_80B46E20(EnInvadepoh* this) { + D_80B4E940 = 2; + this->unk_2F0 = 2; + this->actionFunc = EnInvadepoh_func_80B46E44; +} + +void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play) { + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else if (ActorCutscene_GetCanPlayNext(D_80B50404[0])) { + ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[0], &this->actor); + EnInvadepoh_func_80B46EC0(this); + } else { + ActorCutscene_SetIntentToPlay(D_80B50404[0]); + } +} + +void EnInvadepoh_func_80B46EC0(EnInvadepoh* this) { + D_80B4E940 = 2; + this->unk_2F0 = 0xA0; + this->actionFunc = EnInvadepoh_func_80B46EE8; +} + +void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play) { + s32 i; + + for (i = 0; i < 8; i++) { + if (this->unk_2F0 == D_80B4ED20[i]) { + D_80B50340[i] |= 1; + } + } + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + ActorCutscene_Stop(D_80B50404[0]); + Audio_QueueSeqCmd(0x800D); + EnInvadepoh_func_80B46F88(this); + } +} + +void EnInvadepoh_func_80B46F88(EnInvadepoh* this) { + D_80B4E940 = 2; + this->actionFunc = EnInvadepoh_func_80B46FA8; +} + +void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play) { + Actor** var_v1; + EnInvadepoh* temp_a0; + s32 var_v0; + s8 temp_a1; + u16 temp_v0; + s32 i; + + if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { + gSaveContext.save.weekEventReg[0x16] |= 1; + EnInvadepoh_func_80B47064(this); + } else { + EnInvadepoh_func_80B457A0(this); + for (i = 0; i < this->unk_379; i++) { + if ((D_80B50320[i] != NULL) && (D_80B50320[i]->unk_38A)) { + EnInvadepoh_func_80B47278(this); + break; + } + } + } +} + +void EnInvadepoh_func_80B47064(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = EnInvadepoh_func_80B47084; +} + +void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(D_80B50404[1])) { + ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[1], &this->actor); + EnInvadepoh_func_80B470E0(this); + } else { + ActorCutscene_SetIntentToPlay(D_80B50404[1]); + } +} + +void EnInvadepoh_func_80B470E0(EnInvadepoh* this) { + D_80B4E940 = 3; + this->unk_2F0 = 0x6E; + this->actionFunc = EnInvadepoh_func_80B47108; +} + +void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play) { + if (this->unk_2F0 == 0x64) { + Audio_PlayFanfare(0x19); + } + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + play->nextEntrance = 0x6460; + gSaveContext.nextCutsceneIndex = 0; + play->transitionTrigger = 0x14; + play->transitionType = 0x49; + gSaveContext.nextTransitionType = 0x48; + D_801BDAA0 = 1; + D_801BDA9C = 0; + EnInvadepoh_func_80B47248(this); + } +} + +void EnInvadepoh_func_80B471C0(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = EnInvadepoh_func_80B471E0; +} + +void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play) { + if (D_80B4E998 != 0) { + play->nextEntrance = 0x6470; + gSaveContext.nextCutsceneIndex = 0; + play->transitionTrigger = 0x14; + play->transitionType = 0x48; + gSaveContext.nextTransitionType = 0x48; + EnInvadepoh_func_80B47248(this); + } +} + +void EnInvadepoh_func_80B47248(EnInvadepoh* this) { + D_80B4E940 = 3; + this->actionFunc = EnInvadepoh_func_80B47268; +} + +void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play) { +} + +void EnInvadepoh_func_80B47278(EnInvadepoh* this) { + D_80B4E940 = 4; + this->actionFunc = EnInvadepoh_func_80B47298; +} + +void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play) { + play->nextEntrance = 0x6400; + gSaveContext.nextCutsceneIndex = 0xFFF3; + play->transitionTrigger = 0x14; + play->transitionType = 0x48; + gSaveContext.nextTransitionType = 0x48; + gSaveContext.save.weekEventReg[0x59] |= 0x10; + EnInvadepoh_func_80B47304(this); +} + +void EnInvadepoh_func_80B47304(EnInvadepoh* this) { + D_80B4E940 = 4; + this->actionFunc = EnInvadepoh_func_80B47324; +} + +void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play) { +} + +void EnInvadepoh_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + this->actionFunc(this, play); + + this->actor.draw = EnInvadepoh_func_80B461DC() ? EnInvadepoh_func_80B4D9B4 : NULL; +} + +void EnInvadepoh_func_80B47380(EnInvadepoh* this) { + this->unk_2A0.base.atFlags &= ~1; + this->unk_2A0.base.acFlags &= ~1; + this->unk_2A0.base.ocFlags1 &= ~1; + this->actor.flags &= ~0x80000000; + this->unk_389 = 0; + this->actor.draw = NULL; + this->unk_38B = 0; + this->unk_38C = 0; + this->unk_38D = 0; + this->actionFunc = EnInvadepoh_func_80B473E4; +} + +void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B442E4(this); + EnInvadepoh_func_80B447C0(this, play); + EnInvadepoh_func_80B43DD4(this, 0x320, 0); + if (D_80B50340[this->actor.params & 7] & 1) { + Actor_SetScale(&this->actor, 0.01f); + EnInvadepoh_func_80B4516C(this); + EnInvadepoh_func_80B46118(&this->actor.world.pos); + EnInvadepoh_func_80B47568(this); + } +} + +void EnInvadepoh_func_80B47478(EnInvadepoh* this) { + this->unk_2A0.base.atFlags &= ~1; + this->unk_2A0.base.acFlags &= ~1; + this->unk_2A0.base.ocFlags1 &= ~1; + this->actor.flags &= ~0x80000000; + this->unk_389 = 0; + this->actor.draw = NULL; + this->unk_38B = 0; + this->unk_38C = 0; + this->unk_38D = 0; + this->actionFunc = EnInvadepoh_func_80B474DC; +} + +void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B442E4(this); + EnInvadepoh_func_80B447C0(this, play); + EnInvadepoh_func_80B43DD4(this, 0x320, 0); + if (this->unk_320 > 0.0f) { + Actor_SetScale(&this->actor, 0.01f); + EnInvadepoh_func_80B4516C(this); + EnInvadepoh_func_80B46118(&this->actor.world.pos); + EnInvadepoh_func_80B47568(this); + } +} + +void EnInvadepoh_func_80B47568(EnInvadepoh* this) { + Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); + this->unk_2A0.base.atFlags &= ~1; + this->unk_2A0.base.acFlags &= ~1; + this->unk_2A0.base.ocFlags1 &= ~1; + this->unk_389 = 0; + this->actor.draw = EnInvadepoh_func_80B4DB14; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0; + this->actor.flags |= 0x80000000; + this->actionFunc = EnInvadepoh_func_80B47600; +} + +void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B442E4(this); + EnInvadepoh_func_80B447C0(this, play); + EnInvadepoh_func_80B43DD4(this, 0x320, 0); + func_800B9010(&this->actor, 0x320A); + if (this->unk_320 >= 0.9999f) { + this->unk_38A = 1; + } + if (this->unk_389 >= 249) { + this->unk_389 = 255; + } else { + this->unk_389 += 6; + } + if (this->unk_389 > 128) { + this->unk_2A0.base.atFlags |= 1; + this->unk_2A0.base.acFlags |= 1; + this->unk_2A0.base.ocFlags1 |= 1; + } + if (this->unk_389 == 255) { + if (this->unk_38D >= 245) { + this->unk_38D = 255; + EnInvadepoh_func_80B4770C(this); + } else { + this->unk_38D += 10; + } + } +} + +void EnInvadepoh_func_80B4770C(EnInvadepoh* this) { + if (this->skelAnime.animation != &gAlienFloatAnim) { + Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); + } + this->unk_2A0.base.atFlags |= 1; + this->unk_2A0.base.acFlags |= 1; + this->unk_2A0.base.ocFlags1 |= 1; + this->unk_389 = 0xFF; + this->actor.draw = EnInvadepoh_func_80B4DB14; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0xFF; + this->actor.flags |= 0x80000000; + this->actionFunc = EnInvadepoh_func_80B477B4; +} + +void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B442E4(this); + EnInvadepoh_func_80B447C0(this, play); + EnInvadepoh_func_80B43DD4(this, 0x320, 0); + func_800B9010(&this->actor, 0x320A); + if (this->unk_320 >= 0.9999f) { + this->unk_38A = 1; + } +} + +void EnInvadepoh_func_80B47830(EnInvadepoh* this) { + this->unk_2A0.base.atFlags &= ~1; + this->unk_2A0.base.acFlags &= ~1; + this->unk_2A0.base.ocFlags1 |= 1; + Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); + Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10); + this->unk_389 = 0xFF; + this->actor.draw = EnInvadepoh_func_80B4DB14; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0; + this->unk_2F0 = 8; + this->unk_2F2 = 0; + this->actor.flags |= 0x80000000; + this->actionFunc = EnInvadepoh_func_80B478F4; +} + +void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44A90(this, play); + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B47938(this); + } +} + +void EnInvadepoh_func_80B47938(EnInvadepoh* this) { + this->unk_2A0.base.atFlags &= ~1; + this->unk_2A0.base.acFlags &= ~1; + this->unk_2A0.base.ocFlags1 &= ~1; + Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); + this->actor.flags &= ~1; + this->unk_2F0 = 0xA; + this->unk_389 = 0xFF; + this->actor.draw = EnInvadepoh_func_80B4DB14; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0xFF; + this->actor.flags |= 0x80000000; + this->actionFunc = EnInvadepoh_func_80B479E8; +} + +void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { + Vec3f* temp; + + EnInvadepoh_func_80B44B78(this); + if (this->unk_2F2 < 5) { + temp = &D_80B4ED30[this->unk_2F2]; + if (temp->x > 0.0f) { + this->unk_38B = 1; + this->unk_38D = 0xFF; + Math_Vec3f_Copy(&this->actor.scale, temp); + } else { + this->unk_38B = 0; + this->unk_38D = 0; + } + } else { + this->unk_38B = 0; + this->unk_38D = 0; + } + if ((this->unk_2F2 >= 2) && (this->unk_2F2 < 9)) { + temp = &D_80B4ED6C[this->unk_2F2 - 2]; + if (temp->x > 0.0f) { + this->unk_38C = 1; + Math_Vec3f_Copy(&this->unk_390, temp); + } else { + this->unk_38C = 0; + } + } else { + this->unk_38C = 0; + } + this->unk_2F2++; + if (this->unk_2F0 == 8) { + Actor_Spawn(&play->actorCtx, play, 0xA2, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, + this->actor.world.pos.z, 0, 0, 3, 0xC8); + } + if (this->unk_2F0 == 8) { + Enemy_StartFinishingBlow(play, &this->actor); + } + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B43AF0(this->actor.params & 7); + EnInvadepoh_func_80B43AB0(); + Item_DropCollectible(play, &this->actor.world.pos, 8); + EnInvadepoh_func_80B47478(this); + } +} + +void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B45080(); + this->actor.update = EnInvadepoh_func_80B47D30; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, 14); + this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame / 8.0f; + EnInvadepoh_func_80B444BC(this, play); + EnInvadepoh_func_80B442E4(this); + EnInvadepoh_func_80B447C0(this, play); + EnInvadepoh_func_80B43F0C(this); + EnInvadepoh_func_80B4516C(this); + if ((D_80B4E940 == 1) || (gSaveContext.save.time < CLOCK_TIME(2, 31))) { + EnInvadepoh_func_80B47380(this); + } else if (D_80B4E940 == 2) { + if (this->unk_320 >= 0.0001f) { + EnInvadepoh_func_80B4770C(this); + } else { + EnInvadepoh_func_80B47568(this); + } + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (D_80B4E940 == 3) { + if ((this->actionFunc == EnInvadepoh_func_80B477B4) || (this->actionFunc == EnInvadepoh_func_80B47600)) { + thisx->speedXZ = 0.0f; + thisx->velocity.y = 0.0f; + thisx->gravity = 0.0f; + EnInvadepoh_func_80B47830(this); + } else if ((this->actionFunc == EnInvadepoh_func_80B474DC) || (this->actionFunc == EnInvadepoh_func_80B473E4)) { + Actor_MarkForDeath(thisx); + return; + } + } else if (this->unk_2A0.base.acFlags & 2) { + Actor* hitbox = this->unk_2A0.base.ac; + + thisx->speedXZ = hitbox->speedXZ * 0.5f; + thisx->speedXZ = CLAMP(thisx->speedXZ, -60.0f, 60.0f); + + thisx->world.rot.y = hitbox->world.rot.y; + thisx->gravity = 0.0f; + + thisx->velocity.y = hitbox->velocity.y * 0.5f; + thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); + + SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, 0x3A09); + EnInvadepoh_func_80B47830(this); + } + + this->actionFunc(this, play); + + if (thisx->draw != NULL) { + this->unk_29C = SkelAnime_Update(&this->skelAnime); + } + + Collider_UpdateCylinder(thisx, &this->unk_2A0); + + if (this->unk_2A0.base.atFlags & 1) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_2A0.base); + } else { + this->unk_2A0.base.atFlags &= ~2; + } + if (this->unk_2A0.base.acFlags & 1) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_2A0.base); + } else { + this->unk_2A0.base.acFlags &= ~2; + } + if (this->unk_2A0.base.ocFlags1 & 1) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } else { + this->unk_2A0.base.ocFlags1 &= ~2; + } +} + +void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + this->actor.update = EnInvadepoh_func_80B48060; + this->actor.draw = EnInvadepoh_func_80B4E158; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->unk_188, this->unk_212, 6); + Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); + } +} + +void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp6C; + + if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { + Actor_MarkForDeath(&this->actor); + return; + } + sp6C = this->actor.params & 7; + SkelAnime_Update(&this->skelAnime); + Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[sp6C], 0x32); + if (this->actor.child != NULL) { + s32 pad; + MtxF sp28; + + Matrix_Push(); + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + &this->actor.shape.rot); + Matrix_Translate(0.0f, 57.0f, -36.0f, MTXMODE_APPLY); + Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); + Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); + Matrix_MultZero(&this->actor.child->world.pos); + Matrix_Get(&sp28); + Matrix_MtxFToYXZRot(&sp28, &this->actor.child->shape.rot, 0); + Matrix_Pop(); + } +} + +void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + this->actor.update = EnInvadepoh_func_80B4827C; + this->actor.draw = EnInvadepoh_func_80B4E1B0; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, 6); + Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); + } +} + +void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { + Actor_MarkForDeath(&this->actor); + } else { + SkelAnime_Update(&this->skelAnime); + } +} + +void EnInvadepoh_func_80B482D4(EnInvadepoh* this) { + this->unk_2F0 = 40; + Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); + this->actor.draw = NULL; + this->actionFunc = EnInvadepoh_func_80B48324; +} + +void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play) { + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B4560C(this, play, 0x332F); + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B48374(this); + } +} + +void EnInvadepoh_func_80B48374(EnInvadepoh* this) { + this->unk_2F0 = 60; + Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); + this->actor.draw = EnInvadepoh_func_80B4E324; + this->actionFunc = EnInvadepoh_func_80B483CC; +} + +void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { + if (this->unk_2F0 == 20) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + + temp_s0->unk_26.x = 0x7D0; + temp_s0->unk_26.y = 0; + temp_s0->unk_26.z = 0; + temp_s0->unk_30 = 0.1f; + temp_s0->unk_2C = 0x3E8; + } + + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B4843C(this); + } +} + +void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { + this->unk_324.unk_26.x = 0xBB8; + this->unk_324.unk_26.y = 0; + this->unk_324.unk_26.z = 0; + this->unk_324.unk_30 = 0.24f; + this->unk_324.unk_2C = 0xBB8; + this->unk_324.unk_42 = 0x3A98; + this->unk_324.unk_44 = 0.1f; + this->unk_324.unk_48 = 0x7D0; + this->unk_2F0 = 50; + + Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, 0, -5.0f); + this->actor.draw = EnInvadepoh_func_80B4E324; + this->actionFunc = EnInvadepoh_func_80B484EC; +} + +void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { + if (this->unk_2F0 == 40) { + this->unk_324.unk_26.y = 0x1B58; + } else if (this->unk_2F0 == 30) { + this->unk_324.unk_26.y = -0x1B58; + } else if (this->unk_2F0 == 20) { + this->unk_324.unk_26.y = 0x1B58; + } else if (this->unk_2F0 == 10) { + this->unk_324.unk_26.y = 0; + } + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B48588(this); + } +} + +void EnInvadepoh_func_80B48588(EnInvadepoh* this) { + this->unk_324.unk_26.x = 0; + this->unk_324.unk_26.y = 0; + this->unk_324.unk_26.z = 0; + this->unk_324.unk_30 = 0.24f; + this->unk_324.unk_2C = 0x1388; + this->unk_324.unk_42 = 0; + this->unk_324.unk_44 = 0.28f; + this->unk_324.unk_48 = 0x1B58; + + Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->actor.draw = EnInvadepoh_func_80B4E324; + this->actionFunc = EnInvadepoh_func_80B48610; +} + +void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play) { +} + +void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 pad; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + this->actor.update = EnInvadepoh_func_80B4873C; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, 23); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, + 0.12f); + Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); + EnInvadepoh_func_80B482D4(this); + } +} + +void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; + + if (this->actor.parent == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + this->actionFunc(this, play); + SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if (temp_v1->unk_40 != 0) { + this->actor.shape.rot.x = -temp_v1->unk_40; + } +} + +void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; + + this->unk_2F0 = Rand_S16Offset(150, 250); + temp_v1->unk_26.x = D_80B4EDC8[Rand_Next() >> 0x1E]; + temp_v1->unk_26.y = 0; + temp_v1->unk_26.z = 0; + temp_v1->unk_30 = 0.1f; + temp_v1->unk_2C = 0x320; + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); + this->actionFunc = EnInvadepoh_func_80B48848; +} + +void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { + s32 pad; + + Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); + if (EnInvadepoh_func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { + EnInvadepoh_func_80B44514(this); + this->unk_370 = 200; + this->actor.speedXZ *= 0.25f; + } else { + Math_StepToS(&this->unk_370, 0x7D0, 0x46); + } + EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x46); + if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { + Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + } + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B48948(this); + } +} + +void EnInvadepoh_func_80B48948(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* sp24 = &this->unk_324; + f32 sp28 = Rand_ZeroOne(); + + this->unk_2F0 = Rand_S16Offset(0x96, 0x96); + if (sp28 < 0.5f) { + this->unk_374 = 0; + Math_Vec3s_Copy(&sp24->unk_26, &gZeroVec3s); + sp24->unk_30 = 0.1f; + sp24->unk_2C = 0x3E8; + } else if (sp28 < 0.75f) { + this->unk_374 = 1; + sp24->unk_26.x = Rand_S16Offset(0, 0x7D0); + sp24->unk_26.y = 0; + sp24->unk_26.z = 0; + sp24->unk_30 = 0.06f; + sp24->unk_2C = 0x3E8; + } else if (sp28 < 0.8f) { + this->unk_374 = 2; + sp24->unk_26.x = Rand_S16Offset(-0x7D0, 0x7D0); + sp24->unk_26.y = 0; + sp24->unk_26.z = 0; + sp24->unk_30 = 0.05f; + sp24->unk_2C = 0x3E8; + } else { + this->unk_374 = 3; + sp24->unk_26.x = 0; + sp24->unk_26.y = 0; + sp24->unk_26.z = Rand_S16Offset(-0x9C4, 0x1388); + sp24->unk_30 = 0.04f; + sp24->unk_2C = 0x3E8; + } + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->actionFunc = EnInvadepoh_func_80B48AD4; +} + +void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + if (EnInvadepoh_func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { + EnInvadepoh_func_80B44514(this); + } + if (this->unk_374 == 0) { + if ((this->actor.xzDistToPlayer < 350.0f) && (play->gameplayFrames & 0x60)) { + Player* player = GET_PLAYER(play); + s16 temp_v0 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + + temp_s0->unk_26.x = CLAMP((s16)(temp_v0 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v0 * 0.7f), -0x1F40, 0x1F40); + } + } else { + temp_s0->unk_26.x = 0; + temp_s0->unk_26.y = 0; + } + if (this->unk_2F0 > 0) { + s32 temp = (u32)this->unk_2F0 % 0x20; + + if ((temp == 0) && (Rand_ZeroOne() < 0.3f)) { + s32 temp_v1_3 = (s32)Rand_Next() % 4; + + if (temp_v1_3 != this->unk_374) { + this->unk_374 = temp_v1_3; + if (this->unk_374 == 0) { + Math_Vec3s_Copy(&temp_s0->unk_26, &gZeroVec3s); + temp_s0->unk_30 = 0.07f; + } else if (this->unk_374 == 1) { + temp_s0->unk_26.x = Rand_S16Offset(0x3E8, 0x3E8); + temp_s0->unk_26.y = Rand_S16Offset(-0x3E8, 0x7D0); + temp_s0->unk_26.z = Rand_S16Offset(-0x320, 0x640); + temp_s0->unk_30 = 0.06f; + } else if (this->unk_374 == 2) { + temp_s0->unk_26.x = Rand_S16Offset(-0x7D0, 0x3E8); + temp_s0->unk_26.y = Rand_S16Offset(-0x3E8, 0x7D0); + temp_s0->unk_26.z = Rand_S16Offset(-0x320, 0x640); + temp_s0->unk_30 = 0.05f; + } else { + temp_s0->unk_26.x = Rand_S16Offset(-0x3E8, 0x7D0); + temp_s0->unk_26.y = Rand_S16Offset(-0x7D0, 0xFA0); + temp_s0->unk_26.z = Rand_S16Offset(-0x7D0, 0xFA0); + temp_s0->unk_30 = 0.04f; + } + } + } + this->unk_2F0--; + return; + } + EnInvadepoh_func_80B487B4(this); +} + +void EnInvadepoh_func_80B48DE4(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + this->actor.speedXZ = 0.0f; + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->unk_370 = 0; + temp_v0->unk_30 = 0.05f; + temp_v0->unk_2C = 0x4B0; + this->actionFunc = EnInvadepoh_func_80B48E4C; +} + +void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + Player* player = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x7D0, 0x32); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x23); + + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_v0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_v0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + + if (Actor_TextboxIsClosing(&this->actor, play)) { + EnInvadepoh_func_80B48948(this); + } +} + +void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + this->actor.update = EnInvadepoh_func_80B490F0; + this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.textId = 0x3330; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, 23); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_func_80B444F4(this, play); + EnInvadepoh_func_80B4407C(this, 0); + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); + EnInvadepoh_func_80B487B4(this); + } +} + +void EnInvadepoh_func_80B490F0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + + if (sp28) { + func_80151BB4(play, 5); + EnInvadepoh_func_80B48DE4(this); + } + this->actionFunc(this, play); + if (sp2C) { + SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if ((this->actionFunc != EnInvadepoh_func_80B48E4C) && !sp28 && this->actor.isTargeted) { + func_800B8614(&this->actor, play, 100.0f); + } + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B491EC(EnInvadepoh* this) { + this->actor.gravity = -15.0f; + this->unk_39C = 0.0f; + this->unk_3A0 = 1.0f; + this->unk_3A4 = 0.0f; + this->unk_3AA = 0; + this->actionFunc = EnInvadepoh_func_80B49228; +} + +void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play) { + s32 pad; + f32 sp28; + + Actor_UpdateVelocityWithGravity(&this->actor); + this->actor.velocity.y *= 0.97f; + sp28 = 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, 0x217B); + if (fabsf(sp28) < 1.0f) { + EnInvadepoh_func_80B45EC8(this, play, 50); + EnInvadepoh_func_80B492FC(this); + } +} + +void EnInvadepoh_func_80B492FC(EnInvadepoh* this) { + this->actor.velocity.y *= 0.1f; + this->unk_2F0 = 20; + this->unk_3A0 = 0.3f; + this->unk_3A4 = 0.03f; + this->unk_3AA = 0xBB8; + this->actionFunc = EnInvadepoh_func_80B4934C; +} + +void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play) { + 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_MoveWithGravity(&this->actor); + func_800B9010(&this->actor, 0x217B); + this->unk_2F0--; + if (this->unk_2F0 <= 0) { + EnInvadepoh_func_80B49404(this); + } +} + +void EnInvadepoh_func_80B49404(EnInvadepoh* this) { + this->unk_2F0 = 120; + this->unk_3A0 = 0.2f; + this->unk_3A4 = 0.01f; + this->actor.gravity = 33.0f; + this->unk_3AA = 0xBB8; + this->unk_3AC = 0; + this->unk_2F2 = 0; + this->actionFunc = EnInvadepoh_func_80B49454; +} + +void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { + s32 pad; + Vec3f sp30; + s32 pad2; + + if (this->unk_2F2 < 25) { + this->unk_2F2++; + } else { + this->unk_2F2 = 0; + this->unk_3AC++; + this->unk_3AC = CLAMP_MAX(this->unk_3AC, 4); + this->actor.gravity = 33.0f; + EnInvadepoh_func_80B45EC8(this, play, 20); + } + Math_Vec3f_Sum(&D_80B4EDD0[this->unk_3AC], &this->actor.home.pos, &sp30); + if (Math3D_Vec3fDistSq(&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 (EnInvadepoh_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, 0x217B); + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B49628(this); + } +} + +void EnInvadepoh_func_80B49628(EnInvadepoh* this) { + this->unk_3A0 = 0.2f; + this->unk_3A4 = 0.01f; + this->unk_3AA = 0xBB8; + this->actor.velocity.y *= 0.8f; + this->actionFunc = EnInvadepoh_func_80B49670; +} + +void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play) { + 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 ((play->gameplayFrames % 0x40) < 14) { + Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); + } else { + this->actor.speedXZ *= 0.97f; + } + this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -0.5f : 2.0f; + this->actor.velocity.y *= 0.97f; + Actor_MoveWithGravity(&this->actor); + if (D_80B4E940 == 3) { + EnInvadepoh_func_80B499BC(this); + } +} + +void EnInvadepoh_func_80B497A4(EnInvadepoh* this) { + this->unk_3A0 = 0.2f; + this->unk_3A4 = 0.01f; + this->actor.gravity = -1.5f; + this->unk_3AA = 0xBB8; + this->unk_2F0 = 35; + this->actionFunc = EnInvadepoh_func_80B497EC; +} + +void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play) { + 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, (s16)0x64); + Math_StepToF(&this->actor.speedXZ, 70.0f, 3.0f); + this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -2.0f : 2.0f; + this->actor.velocity.y *= 0.97f; + Actor_MoveWithGravity(&this->actor); + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B49904(this); + } +} + +void EnInvadepoh_func_80B49904(EnInvadepoh* this) { + this->unk_3A0 = 0.2f; + this->unk_3A4 = 0.01f; + this->actor.gravity = 1.0f; + this->unk_3AA = 0xBB8; + this->unk_2F0 = 0x3C; + this->actionFunc = EnInvadepoh_func_80B4994C; +} + +void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 150.0f, 4.0f); + this->actor.velocity.y *= 0.95f; + Actor_MoveWithGravity(&this->actor); + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B499BC(EnInvadepoh* this) { + this->unk_2F0 = 40; + this->unk_3A0 = 0.2f; + this->unk_3A4 = 0.01f; + this->actor.speedXZ = 0.0f; + this->unk_3AA = 0xBB8; + this->actionFunc = EnInvadepoh_func_80B49A00; +} + +void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play) { + 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; + this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -0.5f : 2.0f; + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B497A4(this); + } +} + +void EnInvadepoh_func_80B49B1C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + f32 temp; + + this->actionFunc(this, play); + + this->unk_3A8 += this->unk_3AA; + Math_StepToF(&this->unk_39C, this->unk_3A0, this->unk_3A4); + + temp = 1.0f + (Math_SinS(this->unk_3A8) * this->unk_39C); + Actor_SetScale(&this->actor, 0.27f * temp); + Math_StepToS(&this->unk_306, 0x258, 8); + this->actor.world.rot.y += this->unk_306; + this->unk_304 += 0x258; +} + +void EnInvadepoh_func_80B49BD0(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x320; + this->actionFunc = EnInvadepoh_func_80B49C38; +} + +void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_func_80B44570(this); + EnInvadepoh_func_80B44C24(this, play); + EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); + + if ((this->unk_309 == 0) || (this->unk_309 + 1 == this->unk_308)) { + if (this->unk_378 == 0) { + s32 temp_v0_2 = func_800FE620(play); + s32 pad; + + if (temp_v0_2 > 0) { + temp_v0_2 = (gGameInfo->data[0xF] * -16.0f / temp_v0_2) - 0.5f; + this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); + } + } + this->actor.flags &= ~9; + } else { + this->unk_378 = 0; + this->actor.flags |= 9; + } + if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { + Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + } + if (this->unk_320 >= 0.9999f) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B49DA0(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0x7D0; + this->unk_370 = 0; + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->actionFunc = EnInvadepoh_func_80B49DFC; +} + +void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* player = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + + if (Actor_TextboxIsClosing(&this->actor, play)) { + if (this->actor.textId == 0x332D) { + gSaveContext.save.weekEventReg[0x36] |= 0x10; + this->actor.textId = 0x332E; + } + EnInvadepoh_func_80B49BD0(this); + } +} + +void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 pad; + s32 sp38; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + sp38 = gSaveContext.save.time; + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); + EnInvadepoh_func_80B44540(this, play); + EnInvadepoh_func_80B44570(this); + EnInvadepoh_func_80B44C24(this, play); + EnInvadepoh_func_80B43F0C(this); + EnInvadepoh_func_80B4516C(this); + if (gSaveContext.save.weekEventReg[0x15] & 0x20) { + if (gSaveContext.save.weekEventReg[0x36] & 0x10) { + this->actor.textId = 0x332E; + } else { + this->actor.textId = 0x332D; + } + } else { + this->actor.textId = 0x332C; + } + if ((sp38 >= CLOCK_TIME(18, 00)) || (sp38 < CLOCK_TIME(2, 00))) { + this->actor.update = EnInvadepoh_func_80B4A168; + this->actor.draw = NULL; + } else if ((sp38 < CLOCK_TIME(6, 00)) && (sp38 >= CLOCK_TIME(2, 00)) && (sp38 < CLOCK_TIME(2, 15))) { + this->actor.update = EnInvadepoh_func_80B4A1B8; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B49BD0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnInvadepoh_func_80B4A168(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 00))) { + this->actor.update = EnInvadepoh_func_80B4A1B8; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B49BD0(this); + } +} + +void EnInvadepoh_func_80B4A1B8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + + if (sp28) { + func_80151BB4(play, 5); + EnInvadepoh_func_80B49DA0(this); + } + this->actionFunc(this, play); + if (sp2C && (this->actor.update != NULL)) { + SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if ((this->actionFunc != EnInvadepoh_func_80B49DFC) && !sp28 && this->actor.isTargeted) { + func_800B8614(&this->actor, play, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x5DC; + + this->unk_2F0 = Rand_S16Offset(200, 200); + this->unk_304 = this->actor.shape.rot.y; + this->actor.flags |= 9; + this->actionFunc = EnInvadepoh_func_80B4A350; +} + +void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { + s32 pad; + EnInvadePohUnkStruct_324* sp30 = &this->unk_324; + + if ((play->gameplayFrames % 0x100) == 0) { + Vec3f sp44; + s16 sp42; + + Math_Vec3s_ToVec3f(&sp44, this->unk_30C); + sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); + this->unk_304 = Rand_S16Offset(-0x1F40, 0x3E80) + sp42; + this->unk_370 = 0; + } + Math_StepToS(&this->unk_370, 0x7D0, 0x28); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_304, 6, this->unk_370, 0x28); + if (this->actor.xzDistToPlayer < 300.0f) { + Player* player = GET_PLAYER(play); + s16 temp_v1; + + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + sp30->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + sp30->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + + if ((play->gameplayFrames % 0x100) == 0) { + sp30->unk_26.z = Rand_S16Offset(-0x5DC, 0xBB8); + } + } else { + sp30->unk_26.x = 0; + sp30->unk_26.y = 0; + sp30->unk_26.z = 0; + } + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B4A570(this); + } +} + +void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x320; + this->actor.flags |= 9; + this->actionFunc = EnInvadepoh_func_80B4A5E4; +} + +void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play) { + if (this->unk_29C != 0) { + EnInvadepoh_func_80B4A2C0(this); + } +} + +void EnInvadepoh_func_80B4A614(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x320; + this->actionFunc = EnInvadepoh_func_80B4A67C; +} + +void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { + s32 pad; + + Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); + if (EnInvadepoh_func_80B44B84(this, play, this->actor.speedXZ, 50.0f) != 0) { + EnInvadepoh_func_80B44640(this); + this->unk_370 = 0x5DC; + this->actor.speedXZ *= 0.5f; + } else { + Math_StepToS(&this->unk_370, 0x190, 0x32); + } + EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x32); + if (this->unk_309 == 0) { + if (this->unk_378 == 0) { + this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, -0xF); + } + this->actor.flags &= ~9; + } else { + this->unk_378 = 0; + this->actor.flags |= 9; + } + if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { + Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + } + if (this->unk_309 == this->unk_308) { + EnInvadepoh_func_80B4A2C0(this); + } +} + +void EnInvadepoh_func_80B4A7C0(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0x7D0; + this->unk_370 = 0; + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); + this->actionFunc = EnInvadepoh_func_80B4A81C; +} + +void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* player = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, (s16)0x28); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + if (Actor_TextboxIsClosing(&this->actor, play)) { + if (this->actor.textId == 0x332D) { + gSaveContext.save.weekEventReg[0x36] |= 0x10; + this->actor.textId = 0x332E; + } + if (this->unk_309 == this->unk_308) { + EnInvadepoh_func_80B4A2C0(this); + } else { + EnInvadepoh_func_80B4A614(this); + } + } +} + +void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 pad; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + s32 sp38 = gSaveContext.save.time; + + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_func_80B44620(this, play2); + if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 00))) { + this->unk_309 = 0; + this->actor.update = EnInvadepoh_func_80B4AB8C; + } else { + this->unk_309 = this->unk_308; + this->actor.update = EnInvadepoh_func_80B4ABDC; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B4A2C0(this); + } + EnInvadepoh_func_80B4407C(this, this->unk_309); + EnInvadepoh_func_80B43F0C(this); + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); + if (gSaveContext.save.weekEventReg[0x15] & 0x20) { + if (gSaveContext.save.weekEventReg[0x36] & 0x10) { + this->actor.textId = 0x332E; + } else { + this->actor.textId = 0x332D; + } + } else { + this->actor.textId = 0x332C; + } + } +} + +void EnInvadepoh_func_80B4AB8C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { + this->actor.update = EnInvadepoh_func_80B4ABDC; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B4A614(this); + } +} + +void EnInvadepoh_func_80B4ABDC(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + + if (sp28) { + func_80151BB4(play, 5); + EnInvadepoh_func_80B4A7C0(this); + } + this->actionFunc(this, play); + if (sp2C) { + this->unk_29C = SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if ((this->actionFunc != EnInvadepoh_func_80B4A81C) && !sp28 && this->actor.isTargeted) { + func_800B8614(&this->actor, play, 100.0f); + } + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_func_80B4ACF0; +} + +void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play) { + if (gSaveContext.save.weekEventReg[0x16] & 1) { + this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.flags |= 9; + EnInvadepoh_func_80B4AD3C(this); + } +} + +void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this) { + this->actor.flags |= 0x10000; + this->actionFunc = EnInvadepoh_func_80B4AD60; +} + +void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnInvadepoh_func_80B4560C(this, play, 0x3331); + EnInvadepoh_func_80B4ADB8(this); + } else { + func_800B8614(&this->actor, play, 2000.0f); + } +} + +void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_func_80B4ADCC; +} + +void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if (this->unk_376 == 0x3331) { + if (gSaveContext.save.weekEventReg[0x16] & 2) { + EnInvadepoh_func_80B4560C(this, play, 0x3334); + func_80151BB4(play, 0x1D); + func_80151BB4(play, 5); + } else { + EnInvadepoh_func_80B4560C(this, play, 0x3333); + } + } else if (this->unk_376 == 0x3333) { + EnInvadepoh_func_80B4AEC0(this); + } else if (this->unk_376 == 0x3334) { + func_801477B4(play); + EnInvadepoh_func_80B4B024(this); + } + } +} + +void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this) { + this->unk_2F0 = 2; + this->actionFunc = EnInvadepoh_func_80B4AEDC; +} + +void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play) { + if (this->unk_2F0 > 0) { + this->unk_2F0--; + if (this->unk_2F0 == 0) { + func_801477B4(play); + } + } + if (Actor_HasParent(&this->actor, play)) { + this->actor.parent = NULL; + gSaveContext.save.weekEventReg[0x16] |= 2; + EnInvadepoh_func_80B4AF80(this); + } else { + Actor_PickUp(&this->actor, play, 0x60, 2000.0f, 2000.0f); + } +} + +void EnInvadepoh_func_80B4AF80(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_func_80B4AF94; +} + +void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnInvadepoh_func_80B4560C(this, play, 0x3334); + func_80151BB4(play, 0x1E); + func_80151BB4(play, 0x1D); + func_80151BB4(play, 5); + EnInvadepoh_func_80B4ADB8(this); + } else { + func_800B85E0(&this->actor, play, 2000.0f, PLAYER_AP_MINUS1); + } +} + +void EnInvadepoh_func_80B4B024(EnInvadepoh* this) { + this->actor.flags &= ~9; + this->actionFunc = EnInvadepoh_func_80B4B048; +} + +void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play) { + if (play->msgCtx.unk120B1 == 0) { + if (play->msgCtx.msgMode == 0) { + D_80B4E998 = 1; + } else if ((Message_GetState(&play->msgCtx) == 6) || (Message_GetState(&play->msgCtx) == 5)) { + D_80B4E998 = 1; + } + } +} + +void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + + if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + this->actor.update = EnInvadepoh_func_80B4B218; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); + temp_s0->unk_30 = 0.08f; + temp_s0->unk_2C = 0x7D0; + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); + EnInvadepoh_func_80B4ACDC(this); + } +} + +void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, 0x40); + + this->actionFunc(this, play); + + if (sp38 && (this->actor.update != NULL)) { + Player* player; + s16 temp_v1; + + SkelAnime_Update(&this->skelAnime); + player = GET_PLAYER(play); + Math_StepToS(&this->unk_370, 0x7D0, 0x28); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + EnInvadepoh_func_80B45CE0(&this->unk_324); + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this) { + s32 pad; + + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { + Actor_PlaySfxAtPos(&this->actor, 0x28EF); + } +} + +void EnInvadepoh_func_80B4B430(EnInvadepoh* this) { + Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); + this->unk_2F0 = Rand_S16Offset(50, 80); + this->actionFunc = EnInvadepoh_func_80B4B484; +} + +void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 1.1f, 0.5f); + if (EnInvadepoh_func_80B44C80(this, play)) { + EnInvadepoh_func_80B44690(this); + } + EnInvadepoh_func_80B4B3DC(this); + if (this->unk_3BC >= 0) { + this->unk_2F0 = 0; + } + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else { + EnInvadepoh_func_80B4B510(this); + } +} + +void EnInvadepoh_func_80B4B510(EnInvadepoh* this) { + Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); + this->unk_2F0 = Rand_S16Offset(50, 200); + this->actionFunc = EnInvadepoh_func_80B4B564; +} + +void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 3.8f, 0.45f); + if (this->unk_3BC >= 0) { + f32 temp_fv0; + Vec3f sp28; + + Math_Vec3s_ToVec3f(&sp28, &this->unk_30C[this->unk_3BC]); + temp_fv0 = Math3D_Vec3fDistSq(&this->actor.world.pos, &sp28); + if (temp_fv0 < SQ(80.0f)) { + this->actor.speedXZ *= 0.85f; + } else if (temp_fv0 < SQ(150.0f)) { + this->actor.speedXZ *= 0.93f; + } else if (temp_fv0 < SQ(250.0f)) { + this->actor.speedXZ *= 0.96f; + } + if ((this->unk_309 == this->unk_3BC) || (temp_fv0 < SQ(50.0f))) { + this->unk_2F0 = 0; + } + } + EnInvadepoh_func_80B4B3DC(this); + if (EnInvadepoh_func_80B44C80(this, play)) { + EnInvadepoh_func_80B44690(this); + } + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } else if (this->unk_3BC >= 0) { + if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { + Actor_PlaySfxAtPos(&this->actor, 0x290B); + } + EnInvadepoh_func_80B4B724(this); + } else { + EnInvadepoh_func_80B4B430(this); + } +} + +void EnInvadepoh_func_80B4B724(EnInvadepoh* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gDogBarkAnim, -6.0f); + this->actionFunc = EnInvadepoh_func_80B4B768; +} + +void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play) { + 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, + (s16)0x64); + EnInvadepoh_func_80B44E90(this, play); + if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { + Actor_PlaySfxAtPos(&this->actor, 0x2910); + } + if (this->unk_29C != 0) { + EnInvadepoh_func_80B4B510(this); + } +} + +void EnInvadepoh_func_80B4B820(EnInvadepoh* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gDogJumpAnim, -6.0f); + this->actionFunc = EnInvadepoh_func_80B4B864; +} + +void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 0.5f, 1.0f); + EnInvadepoh_func_80B44E90(this, play); + if (this->unk_29C != 0) { + EnInvadepoh_func_80B4B510(this); + } +} + +void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4) && 1) { + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, 13); + EnInvadepoh_func_80B45C04(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); + EnInvadepoh_func_80B44664(this, play); + EnInvadepoh_func_80B4407C(this, 0); + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); + Math_Vec3f_Copy(&this->unk_314, &this->actor.world.pos); + if (D_80B4E940 == 2) { + this->actor.update = EnInvadepoh_func_80B4BA84; + this->actor.draw = EnInvadepoh_func_80B4E660; + this->actor.flags |= 1; + EnInvadepoh_func_80B4B430(this); + } else if (D_80B4E940 == 1) { + this->actor.update = EnInvadepoh_func_80B4BA30; + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (D_80B4E940 == 2) { + this->actor.update = EnInvadepoh_func_80B4BA84; + this->actor.draw = EnInvadepoh_func_80B4E660; + this->actor.flags |= 1; + EnInvadepoh_func_80B4B430(this); + } +} + +void EnInvadepoh_func_80B4BA84(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 temp; + s32 sp2C; + s32 temp_v1_2; + s32 var_v0; + + D_80B5040C = EnInvadepoh_func_80B458D8(); + if (D_80B5040C == NULL) { + temp = (this->unk_3BC < 0) ^ 1; + this->unk_3BC = -1; + if (temp) { + EnInvadepoh_func_80B4B820(this); + } + } else { + sp2C = this->unk_3BC; + this->unk_3BC = EnInvadepoh_func_80B44234(this, &D_80B5040C->actor.world.pos); + if (sp2C != this->unk_3BC) { + var_v0 = this->unk_3BC - this->unk_309; + if (var_v0 < 0) { + var_v0 += this->unk_308; + } + temp_v1_2 = this->unk_308 >> 1; + if (temp_v1_2 < var_v0) { + this->unk_30A = -1; + } else if (var_v0 < temp_v1_2) { + this->unk_30A = 1; + } + } + } + this->actionFunc(this, play); + this->unk_29C = SkelAnime_Update(&this->skelAnime); + if (sp34 && (this->actor.update != NULL)) { + EnInvadepoh_func_80B45CE0(&this->unk_324); + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x320; + + this->unk_370 = 0; + this->actionFunc = EnInvadepoh_func_80B4BC4C; +} + +void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadepoh* sp50 = D_80B503F4; + s32 pad; + s32 sp48; + s32 pad2; + s16 sp42; + s16 sp40; + s16 temp_v1; + + if (sp50 != NULL) { + if (sp50->unk_309 == 0) { + this->unk_2F8 = 40.0f; + this->unk_304 = -0x8000; + this->actor.flags &= ~9; + } else if (sp50->unk_309 < (sp50->unk_308 - 1)) { + this->unk_2F8 = 40.0f; + Math_ScaledStepToS(&this->unk_304, -0x4800, 0xC8); + this->actor.flags |= 9; + } else { + Math_StepToF(&this->unk_2F8, 5.0f, 3.0f); + Math_ScaledStepToS(&this->unk_304, -0x8000, 0x12C); + this->actor.flags &= ~9; + } + sp42 = this->unk_304 + sp50->actor.world.rot.y; + this->actor.world.pos.x = (Math_SinS(sp42) * this->unk_2F8) + sp50->actor.world.pos.x; + this->actor.world.pos.y = sp50->actor.world.pos.y; + this->actor.world.pos.z = (Math_CosS(sp42) * this->unk_2F8) + sp50->actor.world.pos.z; + func_800B4AEC(play, &this->actor, 50.0f); + EnInvadepoh_func_80B4516C(this); + Math_StepToS(&this->unk_370, 0xBB8, 0x1F5); + if (Math3D_Vec3fDistSq(&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->unk_370, 0x1F4); + } + sp48 = (play->gameplayFrames + 20) % 0x80; + if (sp48 & 0x40) { + sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp50->actor.world.pos); + if (sp48 == 0x40) { + this->unk_370 = 0; + } + Math_StepToS(&this->unk_370, 0x7D0, 0x28); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->unk_370, 0x28); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp50->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = sp40 - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + } + } + + if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { + Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + } + if (gSaveContext.save.time >= 0xD801) { + Actor_MarkForDeath(&this->actor); + } else if ((sp50 != NULL) && (sp50->actionFunc == EnInvadepoh_func_80B4CB0C)) { + EnInvadepoh_func_80B4C1BC(this); + } +} + +void EnInvadepoh_func_80B4BFFC(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0x7D0; + Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); + this->unk_370 = 0; + this->actionFunc = EnInvadepoh_func_80B4C058; +} + +void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* sp28 = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x9C4, 0x1C2); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + if (Actor_TextboxIsClosing(&this->actor, play)) { + EnInvadepoh_func_80B4BBE0(this); + } +} + +void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0x7D0; + Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); + this->unk_370 = 0; + this->actionFunc = EnInvadepoh_func_80B4C218; +} + +void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* sp28 = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x7D0, 0xC8); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x28); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + if (D_80B503F4 == NULL) { + EnInvadepoh_func_80B4BBE0(this); + } else if ((D_80B503F4 != NULL) && (D_80B503F4->actionFunc != EnInvadepoh_func_80B4CB0C)) { + EnInvadepoh_func_80B4BBE0(this); + } +} + +void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 pad; + + if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { + s32 sp38 = gSaveContext.save.time; + + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44FEC(); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, 22); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + this->actor.textId = 0x33CD; + if (sp38 < 0xD5A0) { + this->unk_304 = -0x8000; + this->unk_2F8 = 40.0f; + } else if (sp38 >= 0xD7D4) { + this->unk_304 = -0x4800; + this->unk_2F8 = 20.0f; + } else { + this->unk_304 = -0x8000; + this->unk_2F8 = 40.0f; + } + if ((sp38 >= 0x4000) && (sp38 < 0xD573)) { + this->actor.update = EnInvadepoh_func_80B4C568; + this->actor.draw = NULL; + } else if ((sp38 >= 0xD573) && (sp38 < 0xD800)) { + this->actor.update = EnInvadepoh_func_80B4C5C0; + this->actor.draw = EnInvadepoh_func_80B4E7BC; + EnInvadepoh_func_80B4BBE0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < 0xD800)) { + this->actor.update = EnInvadepoh_func_80B4C5C0; + this->actor.draw = EnInvadepoh_func_80B4E7BC; + EnInvadepoh_func_80B4BBE0(this); + } +} + +void EnInvadepoh_func_80B4C5C0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + + if (sp28) { + func_80151BB4(play, 6); + EnInvadepoh_func_80B4BFFC(this); + } + this->actionFunc(this, play2); + if (sp2C && (this->actor.update != NULL)) { + SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if ((this->actionFunc != EnInvadepoh_func_80B4C058) && !sp28 && this->actor.isTargeted) { + func_800B8614(&this->actor, play, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this) { + EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); + temp_v0->unk_26.x = 0; + temp_v0->unk_26.y = 0; + temp_v0->unk_26.z = 0; + temp_v0->unk_30 = 0.1f; + temp_v0->unk_2C = 0x320; + this->actionFunc = EnInvadepoh_func_80B4C730; +} + +void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadepoh* sp68 = D_80B503F8; + s32 var_a2; + s32 sp60; + s32 pad; + s16 temp_v2; + Vec3f sp4C; + Vec3f sp40; + + EnInvadepoh_func_80B44700(this); + EnInvadepoh_func_80B44EFC(this, play); + EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); + + var_a2 = (this->unk_309 < this->unk_308) ? this->unk_309 : this->unk_308 - 1; + + Math_Vec3s_ToVec3f(&sp4C, &this->unk_30C[var_a2]); + Math_Vec3s_ToVec3f(&sp40, &this->unk_30C[var_a2 + 1]); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40) + 0, 5, 0x7D0, 100); + if ((this->unk_309 == 0) || (this->unk_309 + 1 == this->unk_308)) { + if (this->unk_378 == 0) { + s32 temp_v0_2 = func_800FE620(play); + + if (temp_v0_2 > 0) { + temp_v0_2 = (gGameInfo->data[0xF] * -23.0f / temp_v0_2) - 0.5f; + this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); + } + } + this->actor.flags &= ~9; + } else { + this->unk_378 = 0; + this->actor.flags |= 9; + } + sp60 = play->gameplayFrames % 0x80; + if (sp60 & 0x40) { + s16 sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); + s16 temp_v1; + if (sp60 == 0x40) { + this->unk_370 = 0; + } + Math_StepToS(&this->unk_370, 0x7D0, 0x28); + Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->unk_370, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = sp3A - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + } + if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { + Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + } + if (this->unk_320 >= 0.9999f) { + Actor_MarkForDeath(&this->actor); + } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_func_80B4C058)) { + EnInvadepoh_func_80B4CC70(this); + } +} + +void EnInvadepoh_func_80B4CAB0(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0xFA0; + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->unk_370 = 0; + this->actionFunc = EnInvadepoh_func_80B4CB0C; +} + +void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* player = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0xBB8, 0x1F4); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + if (Actor_TextboxIsClosing(&this->actor, play)) { + EnInvadepoh_func_80B4C6C8(this); + } +} + +void EnInvadepoh_func_80B4CC70(EnInvadepoh* this) { + this->unk_324.unk_30 = 0.08f; + this->unk_324.unk_2C = 0x7D0; + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); + this->unk_370 = 0; + this->actionFunc = EnInvadepoh_func_80B4CCCC; +} + +void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play) { + EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + Player* player = GET_PLAYER(play); + s16 temp_v1; + + Math_StepToS(&this->unk_370, 0x7D0, 0xC8); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + if (D_80B503F8 == NULL) { + EnInvadepoh_func_80B4C6C8(this); + } else if ((D_80B503F8 != NULL) && (D_80B503F8->actionFunc != EnInvadepoh_func_80B4C058)) { + EnInvadepoh_func_80B4C6C8(this); + } +} + +void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 pad; + + if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { + s32 sp38 = gSaveContext.save.time; + + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B44F58(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_func_80B446D0(this, play); + this->actor.world.rot.y = this->actor.shape.rot.y; + EnInvadepoh_func_80B44700(this); + EnInvadepoh_func_80B44EFC(this, play); + EnInvadepoh_func_80B43F0C(this); + EnInvadepoh_func_80B4516C(this); + this->actor.textId = 0x33CE; + if ((sp38 >= 0x4000) && (sp38 < 0xD555)) { + this->actor.update = EnInvadepoh_func_80B4CFFC; + this->actor.draw = NULL; + } else if ((sp38 >= 0xD555) && (sp38 < 0xD7E1)) { + this->actor.update = EnInvadepoh_func_80B4D054; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B4C6C8(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((gSaveContext.save.time >= 0xD555) && (gSaveContext.save.time < 0xD7E1)) { + this->actor.update = EnInvadepoh_func_80B4D054; + this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_func_80B4C6C8(this); + } +} + +void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + + if (sp28 != 0) { + func_80151BB4(play, 5); + EnInvadepoh_func_80B4CAB0(this); + } + this->actionFunc(this, play); + if (sp2C && (this->actor.update != NULL)) { + SkelAnime_Update(&this->skelAnime); + EnInvadepoh_func_80B45CE0(&this->unk_324); + if ((this->actionFunc != EnInvadepoh_func_80B4CB0C) && !sp28 && this->actor.isTargeted) { + func_800B8614(&this->actor, play, 350.0f); + } + Collider_UpdateCylinder(&this->actor, &this->unk_2A0); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + } +} + +void EnInvadepoh_func_80B4D15C(EnInvadepoh* this) { + s32 pad; + s32 sp28 = this->actor.params & 7; + s32 pad2; + + Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); + this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; + this->unk_389 = 0xFF; + this->actor.draw = EnInvadepoh_func_80B4DB14; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0xFF; + this->unk_300 = D_80B4EE0C[sp28].unk0; + this->unk_304 = sp28 * 0x5555; + this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; + this->actor.world.pos.y = this->actor.home.pos.y; + this->actor.world.pos.z = Math_CosS(this->unk_304) * 80.0f + this->actor.home.pos.z; + this->actor.shape.rot.y = this->unk_304 + 0x4000; + this->unk_370 = D_80B4EE0C[sp28].unk4; + this->unk_372 = D_80B4EE0C[sp28].unk6; + this->actionFunc = EnInvadepoh_func_80B4D290; + this->actor.velocity.y = 0.0f; +} + +void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { + Actor* sp2C; + f32 sp28; + + if (D_80B503F0 == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } + Math_StepToF(&this->actor.velocity.y, 15.0f, this->unk_300); + sp28 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, this->actor.velocity.y, + 0.01f); + this->unk_304 += 0x2BC; + this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; + this->actor.world.pos.z = Math_CosS(this->unk_304) * 80.0f + this->actor.home.pos.z; + this->unk_370 += this->unk_372; + this->actor.shape.rot.y += this->unk_370; + + if (this->actor.child != NULL) { + sp2C = this->actor.child; + sp2C->world.pos.x = this->actor.world.pos.x; + sp2C->world.pos.y = this->actor.world.pos.y - 38.0f; + sp2C->world.pos.z = this->actor.world.pos.z; + sp2C->shape.rot.y = this->actor.shape.rot.y; + } + if (sp28 < 5.0f) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { + Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); + this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; + this->unk_389 = 0xFF; + this->actor.draw = NULL; + this->unk_38B = 1; + this->unk_38C = 0; + this->unk_38D = 0xFF; + this->unk_306 = 0x190; + this->unk_304 = 0; + this->unk_2F0 = 200; + this->actionFunc = EnInvadepoh_func_80B4D480; + this->actor.velocity.y = 0.0f; +} + +void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { + s32 pad; + f32 pad2; + s32 sp2C = 0; + + if (this->unk_2F0 > 0) { + this->unk_2F0--; + } + if (this->unk_2F0 > 160) { + this->actor.draw = NULL; + } else { + this->actor.draw = EnInvadepoh_func_80B4DB14; + pad = (sp2C ? 0 : this->unk_2F0); //! fake + if ((105 > pad) && (pad >= 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->unk_2F0 > 80) { + this->actor.world.pos.y += this->actor.velocity.y; + } else { + f32 pad3 = this->actor.home.pos.y + 850.0f; + + sp2C = Math_StepToF(&this->actor.world.pos.y, pad3, fabsf(this->actor.velocity.y)); + } + pad2 = (this->unk_304 * -0.06f) + this->unk_306; + pad2 *= 0.98f; + this->unk_306 = pad2; + this->actor.shape.rot.y += this->unk_306; + if (this->actor.child != NULL) { + Actor* pad1 = this->actor.child; + + pad1->world.pos.x = this->actor.world.pos.x; + pad1->world.pos.y = this->actor.world.pos.y - 30.0f; + pad1->world.pos.z = this->actor.world.pos.z; + pad1->shape.rot.y = this->actor.shape.rot.y; + } + } + if ((this->unk_2F0 <= 0) || sp2C) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + s32 sp34; + + if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + sp34 = this->actor.params & 7; + this->actor.objBankIndex = this->unk_2F4; + Actor_SetObjectDependency(play, &this->actor); + EnInvadepoh_func_80B45080(); + this->actor.update = EnInvadepoh_func_80B4D760; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->unk_188, this->unk_212, + 14); + if (sp34 < 3) { + EnInvadepoh_func_80B453F4(this, play, sp34); + EnInvadepoh_func_80B4D15C(this); + } else { + EnInvadepoh_func_80B45460(this, play); + EnInvadepoh_func_80B4D3E4(this); + } + } +} + +void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + this->actionFunc(this, play); + + if (this->actor.update != NULL) { + SkelAnime_Update(&this->skelAnime); + func_800B9010(&this->actor, 0x320A); + } +} + +void EnInvadepoh_func_80B4D7B8(PlayState* play) { + s32 i; + EnInvadepohStructD_80B50350* var_s2; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + for (i = 0, var_s2 = D_80B50350; i < 10; i++, var_s2++) { + if (var_s2->unk_1 > 0) { + u32 temp_s5 = (play->gameplayFrames + (u8)(i * 0x10)) % 0x80; + u32 temp_s6 = (play->gameplayFrames * -0xF) % 0x100; + + Matrix_Translate(var_s2->unk_4.x, var_s2->unk_4.y, var_s2->unk_4.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, var_s2->unk_2); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); + gSPSegment(POLY_XLU_DISP++, 0x8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_02E510); + } + } + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play) { + EnInvadepoh_func_80B4D7B8(play); +} + +s32 EnInvadepoh_func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + return 0; +} + +void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if ((limbIndex == 12) && (this->unk_38D != 0)) { + Matrix_Push(); + Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); + Matrix_RotateYS(-0x3830, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + Matrix_Get(&D_80B502A0); + Matrix_Pop(); + } else if ((limbIndex == 13) && (this->unk_38D != 0)) { + Matrix_Push(); + Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); + Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + Matrix_Get(&D_80B502E0); + Matrix_Pop(); + } + if (limbIndex == 11) { + Matrix_MultVec3f(&D_80B4EE24, &this->actor.focus.pos); + } +} + +void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + Matrix_Push(); + if (this->unk_38B != 0) { + if (this->unk_389 == 0xFF) { + func_8012C28C(play->state.gfxCtx); + AnimatedMat_Draw(play, sAlienEmptyTexAnim); + Scene_SetRenderModeXlu(play, 0, 1); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnInvadepoh_func_80B4D9D8, + EnInvadepoh_func_80B4D9F4, &this->actor, POLY_OPA_DISP); + } else { + AnimatedMat_Draw(play, sAlienEmptyTexAnim); + Scene_SetRenderModeXlu(play, 1, 2); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_389); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnInvadepoh_func_80B4D9D8, + EnInvadepoh_func_80B4D9F4, &this->actor, POLY_XLU_DISP); + } + if (this->unk_38D != 0) { + Gfx* ptr; + + AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); + OPEN_DISPS(play->state.gfxCtx); + ptr = POLY_XLU_DISP; + gDPPipeSync(ptr++); + gDPSetPrimColor(ptr++, 0, 0xFF, 240, 180, 100, 60); + gDPSetEnvColor(ptr++, 255, 255, 255, 100.0f / 170.0f * this->unk_38D); + + Matrix_Mult(&D_80B502A0, MTXMODE_NEW); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPDisplayList(ptr++, gAlienEyeBeamDL); + + Matrix_Mult(&D_80B502E0, MTXMODE_NEW); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPDisplayList(ptr++, gAlienEyeBeamDL); + + POLY_XLU_DISP = ptr; + CLOSE_DISPS(play->state.gfxCtx); + } + } + if (this->unk_38C != 0) { + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f, this->actor.world.pos.z, + &this->actor.shape.rot); + Matrix_Scale(this->unk_390.x, this->unk_390.y, this->unk_390.z, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPDisplayList(POLY_XLU_DISP++, gAlienDeathFlashDL); + } + if (this->unk_38B != 0) { + Gfx* ptr; + Vec3f sp80; + Vec3f sp74; + s32 temp; + + OPEN_DISPS(play->state.gfxCtx); + ptr = POLY_XLU_DISP; + ptr = func_8012C868(ptr); + gDPSetDither(ptr++, G_CD_NOISE); + gDPSetCombineLERP(ptr++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, + 0); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); + Matrix_MultVecZ(60.0f, &sp80); + sp74.x = this->actor.world.pos.x + sp80.x; + sp74.y = this->actor.world.pos.y + sp80.y + 68.0f; + sp74.z = this->actor.world.pos.z + sp80.z; + Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); + Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); + temp = 100.0f / 255.0f * this->unk_389; + gSPDisplayList(ptr++, gameplay_keep_DL_029CB0); + gDPSetPrimColor(ptr++, 0, 0, 240, 180, 100, temp); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPDisplayList(ptr++, gameplay_keep_DL_029CF0); + POLY_XLU_DISP = ptr; + + if ((this->unk_389 > 0x80) && EnInvadepoh_func_80B456A8(play, &sp74)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); + } + CLOSE_DISPS(play->state.gfxCtx); + } + Matrix_Pop(); + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnInvadepoh_func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + if (limbIndex == 5) { + rot->x -= this->actor.shape.rot.x; + } + return 0; +} + +void EnInvadepoh_func_80B4E158(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount, + EnInvadepoh_func_80B4E120, NULL, &this->actor); +} + +void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); +} + +s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if (limbIndex == 14) { + EnInvadepoh* this = ((EnInvadepoh*)thisx); + + rot->x += this->unk_324.unk_20.y; + rot->y += this->unk_324.unk_20.z; + rot->z += this->unk_324.unk_20.x; + } else if (limbIndex == 13) { + EnInvadepoh* this = ((EnInvadepoh*)thisx); + + rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); + rot->z += this->unk_324.unk_40; + } + return 0; +} + +void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (limbIndex == 19) { + OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); + CLOSE_DISPS(play->state.gfxCtx); + } else if (limbIndex == 14) { + Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); + } +} + +void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.unk_10.unk_F]); + gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.unk_00.unk_F]); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnInvadepoh_func_80B4E200, EnInvadepoh_func_80B4E2AC, &this->actor); + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnInvadepoh* this = (EnInvadepoh*)thisx; + Vec3f sp5C; + + Matrix_Push(); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); + Matrix_MultVecZ(200.0f, &sp5C); + Matrix_Pop(); + sp5C.x += this->actor.world.pos.x; + sp5C.y += this->actor.world.pos.y; + sp5C.z += this->actor.world.pos.z; + EnInvadepoh_func_80B45518(&sp5C); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateZS(this->unk_304, MTXMODE_APPLY); + + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); + gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); + + if (EnInvadepoh_func_80B456A8(play, &sp5C)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); + } + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7)) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + rot->x += this->unk_324.unk_20.x; + rot->y += this->unk_324.unk_20.y; + rot->z += this->unk_324.unk_20.z; + } + return 0; +} + +void EnInvadepoh_func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (limbIndex == 5) { + Matrix_MultVecY(20.0f, &this->actor.focus.pos); + } +} + +void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnInvadepoh_func_80B4E5B0, EnInvadepoh_func_80B4E61C, &this->actor); + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + if (limbIndex == 9) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + rot->x += this->unk_324.unk_20.y; + rot->y += this->unk_324.unk_20.z; + rot->z += this->unk_324.unk_20.x; + } else if (limbIndex == 2) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); + } + return 0; +} + +void EnInvadepoh_func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + if (limbIndex == 9) { + Matrix_MultZero(&this->actor.focus.pos); + } +} + +void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.unk_10.unk_F]); + gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.unk_00.unk_F]); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnInvadepoh_func_80B4E6E4, EnInvadepoh_func_80B4E784, &this->actor); + CLOSE_DISPS(play->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 bd9ceb662..18d7d8809 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -1,22 +1,138 @@ #ifndef Z_EN_INVADEPOH_H #define Z_EN_INVADEPOH_H -#include +#include "global.h" struct EnInvadepoh; typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh* this, PlayState* play); -typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh* this, PlayState* play); -typedef void (*EnInvadepohDestFunc)(struct EnInvadepoh* this, PlayState* play); + +typedef struct { + f32 unk0; + s16 unk4; + s16 unk6; +} EnInvadepohUnkStruct1; + +typedef struct { + s8* unk0; + s8 unk4; +} EnInvadepohUnkStruct2; + +typedef struct { + s8 unk0; + EnInvadepohUnkStruct2* unk4; +} EnInvadepohUnkStruct3; + +typedef struct { + s8 unk0; + f32 unk4; +} EnInvadepohUnkStruct4; + +typedef struct { + s8 unk0; + EnInvadepohUnkStruct2* unk4; + s8 unk8; + EnInvadepohUnkStruct4* unkC; +} EnInvadepohUnkStruct5; + +typedef struct { + s8 unk0; + EnInvadepohUnkStruct2* unk4; + s8 unk8; + EnInvadepohUnkStruct4* unkC; + s16 unk10; + s16 unk12; +} EnInvadepohUnkStruct6; + +typedef union { + EnInvadepohUnkStruct3 unk3; + EnInvadepohUnkStruct5 unk5; + EnInvadepohUnkStruct6 unk6; +} EnInvadepohUnkUnion; + +typedef struct { + s8 unk_0; + s8 unk_1; + u8 unk_2; + Vec3f unk_4; +} EnInvadepohStructD_80B50350; + +typedef struct { + EnInvadepohUnkUnion** unk_0; + s8 unk_4; + EnInvadepohUnkUnion* unk_8; + s16 unk_C; + s8 unk_E; + s8 unk_F; +} EnInvadePohUnkStruct_324_1; + +typedef struct { + EnInvadePohUnkStruct_324_1 unk_00; + EnInvadePohUnkStruct_324_1 unk_10; + Vec3s unk_20; + Vec3s unk_26; + s16 unk_2C; + f32 unk_30; + f32 unk_34; + f32 unk_38; + f32 unk_3C; + s16 unk_40; + s16 unk_42; + f32 unk_44; + s16 unk_48; +} EnInvadePohUnkStruct_324; + +typedef void (*EnInvadepohUnkFunc) (EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); typedef struct EnInvadepoh { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x15C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s unk_188[23]; + /* 0x212 */ Vec3s unk_212[23]; + /* 0x29C */ s8 unk_29C; /* 0x2A0 */ ColliderCylinder unk_2A0; - /* 0x2EC */ EnInvadepohActionFunc unk_2EC; - /* 0x2F0 */ char unk_2F0[0xD0]; + /* 0x2EC */ EnInvadepohActionFunc actionFunc; + /* 0x2F0 */ s16 unk_2F0; + /* 0x2F2 */ s16 unk_2F2; + /* 0x2F4 */ s8 unk_2F4; + /* 0x2F8 */ f32 unk_2F8; + /* 0x2FC */ char unk_2FC[4]; // unused? f32? + /* 0x300 */ f32 unk_300; + /* 0x304 */ s16 unk_304; + /* 0x306 */ s16 unk_306; + /* 0x308 */ s8 unk_308; + /* 0x309 */ s8 unk_309; + /* 0x30A */ s8 unk_30A; + /* 0x30C */ Vec3s *unk_30C; + /* 0x310 */ f32 unk_310; + /* 0x314 */ Vec3f unk_314; + /* 0x320 */ f32 unk_320; + /* 0x324 */ EnInvadePohUnkStruct_324 unk_324; + /* 0x370 */ s16 unk_370; + /* 0x372 */ s16 unk_372; + /* 0x374 */ s8 unk_374; + /* 0x376 */ u16 unk_376; + /* 0x378 */ s8 unk_378; + /* 0x379 */ s8 unk_379; + /* 0x37C */ f32 unk_37C[3]; + /* 0x388 */ char unk_388; // unused? + /* 0x389 */ u8 unk_389; + /* 0x38A */ s8 unk_38A; + /* 0x38B */ s8 unk_38B; + /* 0x38C */ s8 unk_38C; + /* 0x38D */ u8 unk_38D; + /* 0x390 */ Vec3f unk_390; + /* 0x39C */ f32 unk_39C; + /* 0x3A0 */ f32 unk_3A0; + /* 0x3A4 */ f32 unk_3A4; + /* 0x3A8 */ s16 unk_3A8; + /* 0x3AA */ s16 unk_3AA; + /* 0x3AC */ s8 unk_3AC; + /* 0x3AD */ char pad3AD[3]; + /* 0x3B0 */ char pad3B0[0xC]; // unused? Vec3f? + /* 0x3BC */ s8 unk_3BC; } EnInvadepoh; // size = 0x3C0 -extern const ActorInit En_Invadepoh_InitVars; +extern ActorInit En_Invadepoh_InitVars; #endif // Z_EN_INVADEPOH_H diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c new file mode 100644 index 000000000..5545668c8 --- /dev/null +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c @@ -0,0 +1,299 @@ +#include "global.h" +#include "z_en_invadepoh.h" +#include "assets/objects/object_ma1/object_ma1.h" +#include "assets/objects/object_ma2/object_ma2.h" + +void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play); + +void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play); +void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2); +void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2); + +void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); +void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); +void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); + +void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0); + +ColliderCylinderInit D_80B4E8B0 = { + { + 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 } }, +}; +ColliderCylinderInit D_80B4E8DC = { + { + 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 } }, +}; +ColliderCylinderInit D_80B4E908 = { + { + 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 } }, +}; +Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; +s32 D_80B4E940 = 0; +TexturePtr sRomaniEyeTextures[5] = { + gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, +}; +TexturePtr sRomaniMouthTextures[4] = { + gRomaniMouthHappyTex, + gRomaniMouthFrownTex, + gRomaniMouthHangingOpenTex, + gRomaniMouthSmileTex, +}; +s8 D_80B4E968 = 0; +TexturePtr sCremiaEyeTextures[6] = { + gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, +}; +TexturePtr sCremiaMouthTextures[4] = { + gCremiaMouthNormalTex, + gCremiaMouthSlightSmileTex, + gCremiaMouthFrownTex, + gCremiaMouthHangingOpenTex, +}; +s8 D_80B4E994 = 0; +s8 D_80B4E998 = 0; +s8 D_80B4E99C[1] = { 0 }; +s8 D_80B4E9A0[4] = { 0, 1, 2, 0 }; +s8 D_80B4E9A4[5] = { 0, 1, 2, 1, 0 }; +s8 D_80B4E9AC[6] = { 0, 1, 2, 2, 1, 0 }; +s8 D_80B4E9B4[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +s8 D_80B4E9BC[1] = { 1 }; +s8 D_80B4E9C0[1] = { 3 }; +EnInvadepohUnkStruct2 D_80B4E9C4 = { D_80B4E99C, 1 }; +EnInvadepohUnkStruct2 D_80B4E9CC = { D_80B4E9A0, 4 }; +EnInvadepohUnkStruct2 D_80B4E9D4 = { D_80B4E9A4, 5 }; +EnInvadepohUnkStruct2 D_80B4E9DC = { D_80B4E9AC, 6 }; +EnInvadepohUnkStruct2 D_80B4E9E4 = { D_80B4E9B4, 8 }; +EnInvadepohUnkStruct2 D_80B4E9EC = { D_80B4E9BC, 1 }; +EnInvadepohUnkStruct2 D_80B4E9F4 = { D_80B4E9C0, 1 }; +EnInvadepohUnkStruct3 D_80B4E9FC = { 0, &D_80B4E9C4 }; +EnInvadepohUnkStruct4 D_80B4EA04[4] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.97f }, + { 5, 1.0f }, +}; +EnInvadepohUnkStruct4 D_80B4EA24[1] = { 1, 1.0f }; +EnInvadepohUnkStruct6 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 40, 60 }; +EnInvadepohUnkStruct5 D_80B4EA40 = { 1, &D_80B4E9CC, 1, D_80B4EA24 }; +EnInvadepohUnkStruct5 D_80B4EA50 = { 1, &D_80B4E9D4, 1, D_80B4EA24 }; +EnInvadepohUnkStruct5 D_80B4EA60 = { 1, &D_80B4E9DC, 1, D_80B4EA24 }; +EnInvadepohUnkStruct5 D_80B4EA70 = { 1, &D_80B4E9E4, 1, D_80B4EA24 }; +EnInvadepohUnkStruct3 D_80B4EA80 = { 0, &D_80B4E9EC }; +EnInvadepohUnkStruct3 D_80B4EA88 = { 0, &D_80B4E9F4 }; +EnInvadepohUnkUnion* D_80B4EA90[8] = { + (EnInvadepohUnkUnion*)&D_80B4E9FC, (EnInvadepohUnkUnion*)&D_80B4EA2C, (EnInvadepohUnkUnion*)&D_80B4EA40, + (EnInvadepohUnkUnion*)&D_80B4EA50, (EnInvadepohUnkUnion*)&D_80B4EA60, (EnInvadepohUnkUnion*)&D_80B4EA70, + (EnInvadepohUnkUnion*)&D_80B4EA80, (EnInvadepohUnkUnion*)&D_80B4EA88, +}; +s8 D_80B4EAB0[1] = { 0 }; +s8 D_80B4EAB4[1] = { 1 }; +s8 D_80B4EAB8[1] = { 2 }; +s8 D_80B4EABC[1] = { 3 }; +EnInvadepohUnkStruct2 D_80B4EAC0 = { D_80B4EAB0, 1 }; +EnInvadepohUnkStruct2 D_80B4EAC8 = { D_80B4EAB4, 1 }; +EnInvadepohUnkStruct2 D_80B4EAD0 = { D_80B4EAB8, 1 }; +EnInvadepohUnkStruct2 D_80B4EAD8 = { D_80B4EABC, 1 }; +EnInvadepohUnkStruct3 D_80B4EAE0 = { 0, &D_80B4EAC0 }; +EnInvadepohUnkStruct3 D_80B4EAE8 = { 0, &D_80B4EAC8 }; +EnInvadepohUnkStruct3 D_80B4EAF0 = { 0, &D_80B4EAD0 }; +EnInvadepohUnkStruct3 D_80B4EAF8 = { 0, &D_80B4EAD8 }; +EnInvadepohUnkUnion* D_80B4EB00[4] = { + (EnInvadepohUnkUnion*)&D_80B4EAE0, + (EnInvadepohUnkUnion*)&D_80B4EAE8, + (EnInvadepohUnkUnion*)&D_80B4EAF0, + (EnInvadepohUnkUnion*)&D_80B4EAF8, +}; +s8 D_80B4EB10[1] = { 0 }; +s8 D_80B4EB14[4] = { 0, 1, 2, 0 }; +s8 D_80B4EB18[5] = { 0, 1, 2, 1, 0 }; +s8 D_80B4EB20[6] = { 0, 1, 2, 2, 1, 0 }; +s8 D_80B4EB28[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +EnInvadepohUnkStruct2 D_80B4EB30 = { D_80B4EB10, 1 }; +EnInvadepohUnkStruct2 D_80B4EB38 = { D_80B4EB14, 4 }; +EnInvadepohUnkStruct2 D_80B4EB40 = { D_80B4EB18, 5 }; +EnInvadepohUnkStruct2 D_80B4EB48 = { D_80B4EB20, 6 }; +EnInvadepohUnkStruct2 D_80B4EB50 = { D_80B4EB28, 8 }; +EnInvadepohUnkStruct3 D_80B4EB58 = { 0, &D_80B4EB30 }; +EnInvadepohUnkStruct4 D_80B4EB60[4] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.95f }, + { 5, 1.0f }, +}; +EnInvadepohUnkStruct4 D_80B4EB80[1] = { 1, 1.0f }; +EnInvadepohUnkStruct6 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 40, 60 }; +EnInvadepohUnkStruct5 D_80B4EB9C = { 1, &D_80B4EB38, 1, D_80B4EB80 }; +EnInvadepohUnkStruct5 D_80B4EBAC = { 1, &D_80B4EB40, 1, D_80B4EB80 }; +EnInvadepohUnkStruct5 D_80B4EBBC = { 1, &D_80B4EB48, 1, D_80B4EB80 }; +EnInvadepohUnkStruct5 D_80B4EBCC = { 1, &D_80B4EB50, 1, D_80B4EB80 }; +EnInvadepohUnkUnion* D_80B4EBDC[6] = { + (EnInvadepohUnkUnion*)&D_80B4EB58, (EnInvadepohUnkUnion*)&D_80B4EB88, (EnInvadepohUnkUnion*)&D_80B4EB9C, + (EnInvadepohUnkUnion*)&D_80B4EBAC, (EnInvadepohUnkUnion*)&D_80B4EBBC, (EnInvadepohUnkUnion*)&D_80B4EBCC, +}; +s8 D_80B4EBF4[1] = { 0 }; +EnInvadepohUnkStruct2 D_80B4EBF8 = { D_80B4EBF4, 1 }; +EnInvadepohUnkStruct3 D_80B4EC00 = { 0, &D_80B4EBF8 }; +EnInvadepohUnkUnion* D_80B4EC08[1] = { (EnInvadepohUnkUnion*)&D_80B4EC00 }; +EnInvadepohUnkFunc D_80B4EC0C[3] = { + EnInvadepoh_func_80B45A4C, + EnInvadepoh_func_80B45A94, + EnInvadepoh_func_80B45B1C, +}; + +Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; +Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; +void (*D_80B4EC20[1])(EnInvadepohStructD_80B50350*) = { EnInvadepoh_func_80B46184 }; +InitChainEntry D_80B4EC24[4] = { + 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), +}; +InitChainEntry D_80B4EC34[4] = { + 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), +}; +InitChainEntry D_80B4EC44[4] = { + 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), +}; +InitChainEntry D_80B4EC54[5] = { + 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), +}; +InitChainEntry D_80B4EC68[6] = { + 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(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), +}; +InitChainEntry D_80B4EC80[6] = { + 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), +}; +InitChainEntry D_80B4EC98[6] = { + 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), +}; +ActorFunc D_80B4ECB0[14] = { + EnInvadepoh_func_80B4627C, EnInvadepoh_func_80B46414, EnInvadepoh_func_80B46520, EnInvadepoh_func_80B465CC, + EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46644, EnInvadepoh_func_80B468B4, EnInvadepoh_func_80B46644, + EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46644, EnInvadepoh_func_80B469C4, EnInvadepoh_func_80B46A80, + EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46414, +}; +ActorFunc D_80B4ECE8[14] = { + EnInvadepoh_func_80B46BB0, EnInvadepoh_func_80B46BC0, EnInvadepoh_func_80B46C08, EnInvadepoh_func_80B46C34, + EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C7C, EnInvadepoh_func_80B46C50, + EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C94, EnInvadepoh_func_80B46CC0, + EnInvadepoh_func_80B46CF4, EnInvadepoh_func_80B46D28, +}; +s16 D_80B4ED20[8] = { + 130, 125, 115, 100, 80, 78, 76, 74, +}; +Vec3f D_80B4ED30[5] = { + { 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 }, +}; +Vec3f D_80B4ED6C[7] = { + { 0.0005f, 0.027999999f, 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 }, +}; +s16 D_80B4EDC0[3] = { -0x1F40, -0x1770, -0x2AF8 }; +s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; +Vec3f D_80B4EDD0[5] = { + { -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 }, +}; +EnInvadepohUnkStruct1 D_80B4EE0C[3] = { + { 0.08f, 0x2BC, -0xA }, + { 0.09f, 0x12C, -5 }, + { 0.05f, 0x190, 0 }, +}; +Vec3f D_80B4EE24 = { 2000.0f, 1000.0f, 0.0f }; +Vec3f D_80B4EE30 = { 400.0f, 270.0f, 0.0f }; + +MtxF D_80B502A0; +MtxF D_80B502E0; +EnInvadepoh* D_80B50320[8]; +u8 D_80B50340[8]; +s8 D_80B50348; +EnInvadepohStructD_80B50350 D_80B50350[10]; +Actor* D_80B503F0; +EnInvadepoh* D_80B503F4; +EnInvadepoh* D_80B503F8; +AnimatedMaterial* sAlienEyeBeamTexAnim; +AnimatedMaterial* sAlienEmptyTexAnim; +s16 D_80B50404[3]; +s16 D_80B5040A; +EnInvadepoh* D_80B5040C; From 8a7a731668cedd7a41a75527efafc493859c75a0 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Mon, 10 Oct 2022 11:14:51 -0500 Subject: [PATCH 04/10] data import --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 1289 ++++++++++------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 129 +- .../z_en_invadepoh_data.inc.c | 299 ---- 3 files changed, 808 insertions(+), 909 deletions(-) delete mode 100644 src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c 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 0b658bc51..3562484de 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,39 +1,17 @@ #include "z_en_invadepoh.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#include "assets/objects/object_uch/object_uch.h" -#include "assets/objects/object_ma1/object_ma1.h" -#include "assets/objects/object_ma2/object_ma2.h" -#include "assets/objects/object_cow/object_cow.h" -#include "assets/objects/object_dog/object_dog.h" #define FLAGS 0x00000010 #define THIS ((EnInvadepoh*)thisx) +#if 1 // function prototypes void EnInvadepoh_Init(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play); - void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2); - void EnInvadepoh_Update(Actor* thisx, PlayState* play2); + +// Update functions void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2); @@ -64,6 +42,7 @@ void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2); +// Draw functions void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play); void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2); @@ -74,6 +53,99 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2); void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play); void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play); +// Action functions +void EnInvadepoh_func_80B46DA8(EnInvadepoh* this); +void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46E20(EnInvadepoh* this); +void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46EC0(EnInvadepoh* this); +void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B46F88(EnInvadepoh* this); +void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47064(EnInvadepoh* this); +void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B470E0(EnInvadepoh* this); +void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B471C0(EnInvadepoh* this); +void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47248(EnInvadepoh* this); +void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47278(EnInvadepoh* this); +void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47304(EnInvadepoh* this); +void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47568(EnInvadepoh* this); +void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4770C(EnInvadepoh* this); +void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B47938(EnInvadepoh* this); +void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48374(EnInvadepoh* this); +void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4843C(EnInvadepoh* this); +void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48588(EnInvadepoh* this); +void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48948(EnInvadepoh* this); +void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B491EC(EnInvadepoh* this); +void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B492FC(EnInvadepoh* this); +void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49404(EnInvadepoh* this); +void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49628(EnInvadepoh* this); +void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49904(EnInvadepoh* this); +void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B499BC(EnInvadepoh* this); +void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A570(EnInvadepoh* this); +void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this); +void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this); +void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this); +void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4AF80(EnInvadepoh* this); +void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B024(EnInvadepoh* this); +void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B510(EnInvadepoh* this); +void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B724(EnInvadepoh* this); +void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this); +void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4CC70(EnInvadepoh* this); +void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play); + +s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this); +s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); +#endif + ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, @@ -86,206 +158,111 @@ ActorInit En_Invadepoh_InitVars = { (ActorFunc)NULL, }; -#include "z_en_invadepoh_data.inc.c" +ColliderCylinderInit D_80B4E8B0 = { + { + 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 } }, +}; +ColliderCylinderInit D_80B4E8DC = { + { + 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 } }, +}; +ColliderCylinderInit D_80B4E908 = { + { + 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 } }, +}; +Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; +s32 D_80B4E940 = 0; +TexturePtr sRomaniEyeTextures[5] = { + gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, +}; +TexturePtr sRomaniMouthTextures[4] = { + gRomaniMouthHappyTex, + gRomaniMouthFrownTex, + gRomaniMouthHangingOpenTex, + gRomaniMouthSmileTex, +}; +s8 D_80B4E968 = 0; +TexturePtr sCremiaEyeTextures[6] = { + gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, +}; -void EnInvadepoh_func_80B457A0(EnInvadepoh* this); -void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this); -void EnInvadepoh_func_80B442E4(EnInvadepoh* this); -void EnInvadepoh_func_80B43F0C(EnInvadepoh* this); -void EnInvadepoh_func_80B443A0(EnInvadepoh* this); -void EnInvadepoh_func_80B44514(EnInvadepoh* this); -void EnInvadepoh_func_80B44570(EnInvadepoh* this); -void EnInvadepoh_func_80B44640(EnInvadepoh* this); -void EnInvadepoh_func_80B44690(EnInvadepoh* this); -void EnInvadepoh_func_80B44700(EnInvadepoh* this); -void EnInvadepoh_func_80B44B78(EnInvadepoh* this); -void EnInvadepoh_func_80B47380(EnInvadepoh* this); -void EnInvadepoh_func_80B47478(EnInvadepoh* this); -void EnInvadepoh_func_80B482D4(EnInvadepoh* this); -void EnInvadepoh_func_80B48DE4(EnInvadepoh* this); -void EnInvadepoh_func_80B497A4(EnInvadepoh* this); -void EnInvadepoh_func_80B49DA0(EnInvadepoh* this); -void EnInvadepoh_func_80B4A7C0(EnInvadepoh* this); -void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this); -void EnInvadepoh_func_80B4B820(EnInvadepoh* this); -void EnInvadepoh_func_80B4BFFC(EnInvadepoh* this); -void EnInvadepoh_func_80B4CAB0(EnInvadepoh* this); -void EnInvadepoh_func_80B4D15C(EnInvadepoh* this); -void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this); -void EnInvadepoh_func_80B47568(EnInvadepoh* this); -void EnInvadepoh_func_80B4770C(EnInvadepoh* this); -void EnInvadepoh_func_80B487B4(EnInvadepoh* this); -void EnInvadepoh_func_80B48948(EnInvadepoh* this); -void EnInvadepoh_func_80B49904(EnInvadepoh* this); -void EnInvadepoh_func_80B49BD0(EnInvadepoh* this); -void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this); -void EnInvadepoh_func_80B4A614(EnInvadepoh* this); -void EnInvadepoh_func_80B4B510(EnInvadepoh* this); -void EnInvadepoh_func_80B4B430(EnInvadepoh* this); -void EnInvadepoh_func_80B4B724(EnInvadepoh* this); -void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this); -void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this); -void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this); -void EnInvadepoh_func_80B4CC70(EnInvadepoh* this); -void EnInvadepoh_func_80B47830(EnInvadepoh* this); -void EnInvadepoh_func_80B47938(EnInvadepoh* this); -void EnInvadepoh_func_80B48374(EnInvadepoh* this); -void EnInvadepoh_func_80B492FC(EnInvadepoh* this); -void EnInvadepoh_func_80B499BC(EnInvadepoh* this); -void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this); -void EnInvadepoh_func_80B4B024(EnInvadepoh* this); -void EnInvadepoh_func_80B4AF80(EnInvadepoh* this); -void EnInvadepoh_func_80B49404(EnInvadepoh* this); -void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this); -void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this); -void EnInvadepoh_func_80B4843C(EnInvadepoh* this); -void EnInvadepoh_func_80B4A570(EnInvadepoh* this); -void EnInvadepoh_func_80B48588(EnInvadepoh* this); -void EnInvadepoh_func_80B491EC(EnInvadepoh* this); -void EnInvadepoh_func_80B49628(EnInvadepoh* this); -void EnInvadepoh_func_80B45648(EnInvadepoh* this); -void EnInvadepoh_func_80B46DA8(EnInvadepoh* this); -void EnInvadepoh_func_80B46F88(EnInvadepoh* this); -void EnInvadepoh_func_80B471C0(EnInvadepoh* this); -void EnInvadepoh_func_80B47248(EnInvadepoh* this); -void EnInvadepoh_func_80B47304(EnInvadepoh* this); -void EnInvadepoh_func_80B46E20(EnInvadepoh* this); -void EnInvadepoh_func_80B46EC0(EnInvadepoh* this); -void EnInvadepoh_func_80B47064(EnInvadepoh* this); -void EnInvadepoh_func_80B47278(EnInvadepoh* this); -void EnInvadepoh_func_80B470E0(EnInvadepoh* this); -void EnInvadepoh_func_80B47248(EnInvadepoh* this); +TexturePtr sCremiaMouthTextures[4] = { + gCremiaMouthNormalTex, + gCremiaMouthSlightSmileTex, + gCremiaMouthFrownTex, + gCremiaMouthHangingOpenTex, +}; +s8 D_80B4E994 = 0; +s8 D_80B4E998 = 0; -void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44A90(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44C24(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44E90(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44EFC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44024(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B444BC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B444F4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44540(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44620(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B44664(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play); - -s32 EnInvadepoh_func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx); -void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx); -s32 EnInvadepoh_func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); -s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnInvadepoh_func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); -s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnInvadepoh_func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); - -void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0); -void EnInvadepoh_func_80B45BB8(EnInvadePohUnkStruct_324_1* arg0); -s8 EnInvadepoh_func_80B45980(EnInvadepohUnkStruct4* arg0, s32 arg1); -void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); -void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); -void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); - -s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this); -void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2); -s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2); -s32 EnInvadepoh_func_80B44B84(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3); -void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2); -s32 EnInvadepoh_func_80B45550(EnInvadepoh* this, PlayState* play, f32 arg2, s32 arg3); -s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4560C(EnInvadepoh* this, PlayState* play, u16 arg2); -void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2); -s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1); -void EnInvadepoh_func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2); -void EnInvadepoh_func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3); -f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this); -void EnInvadepoh_func_80B4407C(EnInvadepoh* this, s32 arg1); -s32 EnInvadepoh_func_80B43B80(EnInvadepoh* this); - -void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0); -s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); -s32 EnInvadepoh_func_80B461DC(void); -s32 EnInvadepoh_func_80B43A24(s32); -void EnInvadepoh_func_80B4D7B8(PlayState* play); -void EnInvadepoh_func_80B44F58(void); -void EnInvadepoh_func_80B44FEC(void); -void EnInvadepoh_func_80B45080(void); -EnInvadepoh* EnInvadepoh_func_80B458D8(void); -s32 EnInvadepoh_func_80B46118(Vec3f* arg0); -void EnInvadepoh_func_80B43A74(s32 arg0); -s32 EnInvadepoh_func_80B43A9C(void); -s32 EnInvadepoh_func_80B43AB0(void); -void EnInvadepoh_func_80B43AF0(s32 arg0); -void EnInvadepoh_func_80B45518(Vec3f* arg0); -s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1); +MtxF D_80B502A0; +MtxF D_80B502E0; +EnInvadepoh* D_80B50320[8]; +u8 D_80B50340[8]; +s8 D_80B50348; +EnInvadepohWarpEffect D_80B50350[10]; +Actor* D_80B503F0; +EnInvadepoh* D_80B503F4; +EnInvadepoh* D_80B503F8; +AnimatedMaterial* sAlienEyeBeamTexAnim; +AnimatedMaterial* sAlienEmptyTexAnim; +s16 D_80B50404[3]; +s16 D_80B5040A; +EnInvadepoh* D_80B5040C; void EnInvadepoh_func_80B439B0(s32 arg0, s32 arg1) { arg1 -= CLOCK_TIME(2, 30); arg1 = CLAMP_MIN(arg1, 0); - if (!(arg0 & 1)) { + if ((arg0 % 2) == 0) { gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); } else { - gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((u16)arg1 << 0x10); + gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); } } @@ -321,7 +298,7 @@ s32 EnInvadepoh_func_80B43AB0(void) { void EnInvadepoh_func_80B43AF0(s32 arg0) { s32 sp1C = gSaveContext.save.time; - if (((gSaveContext.save.day % 5) == 1) && (sp1C >= CLOCK_TIME(2, 30)) && (sp1C < CLOCK_TIME(5, 15))) { + if ((CURRENT_DAY == 1) && (sp1C >= CLOCK_TIME(2, 30)) && (sp1C < CLOCK_TIME(5, 15))) { s32 sp18 = (12 - EnInvadepoh_func_80B43A9C()) * 25.0f; EnInvadepoh_func_80B439B0(arg0, sp1C + sp18); @@ -438,7 +415,7 @@ f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this) { } void EnInvadepoh_func_80B44024(EnInvadepoh* this, PlayState* play) { - Path* temp_v0 = &play->setupPathList[(this->actor.params >> 8) & 0x7F]; + Path* temp_v0 = &play->setupPathList[ENINVADEPOH_GET_PARAM_7F00(&this->actor)]; this->unk_308 = temp_v0->count - 1; this->unk_30C = Lib_SegmentedToVirtual(temp_v0->points); @@ -464,7 +441,7 @@ s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2) { s16 sp1E; if (this->unk_309 >= this->unk_308) { - return 0; + return false; } sp40 = (sp44->x - sp48->x); sp3C = (sp44->z - sp48->z); @@ -474,15 +451,15 @@ s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2) { 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 0; + return false; } temp_fv0_2 = Math3D_XZLength(sp40, sp3C); temp_fa0_2 = (sp2C * sp38) + (sp30 * sp34); if ((temp_fa0_2 < 0.0f) || (temp_fv0_2 < temp_fa0_2)) { - return 0; + return false; } - return 1; + return true; } s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { @@ -508,7 +485,7 @@ s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { void EnInvadepoh_func_80B442E4(EnInvadepoh* this) { s32 pad; s32 sp18 = gSaveContext.save.time; - s32 temp_v0 = EnInvadepoh_func_80B43A24(this->actor.params & 7); + s32 temp_v0 = EnInvadepoh_func_80B43A24(ENINVADEPOH_GET_PARAM_7(&this->actor)); if (D_80B4E940 == 1) { this->unk_320 = 0.0f; @@ -574,12 +551,12 @@ void EnInvadepoh_func_80B44540(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B44570(EnInvadepoh* this) { - if ((gSaveContext.save.time < 0x1555) || (gSaveContext.save.time >= 0x4000)) { + if ((gSaveContext.save.time < CLOCK_TIME(2, 00)) || (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { this->unk_320 = 0.0f; - } else if ((gSaveContext.save.time >= 0x1800) && (gSaveContext.save.time < 0x4000)) { + } else if ((gSaveContext.save.time >= CLOCK_TIME(2, 15)) && (gSaveContext.save.time < CLOCK_TIME(6, 00))) { this->unk_320 = 1.0f; } else { - f32 temp = (gSaveContext.save.time - 0x1555) * (1.0f / 683.0f); + f32 temp = (gSaveContext.save.time - CLOCK_TIME(2, 00)) * (1.0f / (CLOCK_TIME(2, 15) - CLOCK_TIME(2, 00))); this->unk_320 = temp; this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); @@ -616,12 +593,12 @@ void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B44700(EnInvadepoh* this) { - if ((gSaveContext.save.time < 0xD555) && (gSaveContext.save.time >= 0x4000)) { + if ((gSaveContext.save.time < CLOCK_TIME(20, 00)) && (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { this->unk_320 = 0.0f; - } else if ((gSaveContext.save.time >= 0xD7E1) || (gSaveContext.save.time < 0x4000)) { + } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 14) + 15) || (gSaveContext.save.time < CLOCK_TIME(6, 00))) { this->unk_320 = 1.0f; } else { - f32 temp = (gSaveContext.save.time - 0xD555) * (1.0f / 652.0f); + f32 temp = (gSaveContext.save.time - CLOCK_TIME(20, 00)) * (1.0f / (CLOCK_TIME(20, 14) + 15 - CLOCK_TIME(20, 00))); this->unk_320 = temp; this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); @@ -849,34 +826,34 @@ s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4 *arg0 += temp_fv1 * sp1C; *arg1 += temp_fv1 * sp18; - return 0; + return false; } else { *arg0 = arg2; *arg1 = arg3; - return 1; + return true; } } s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this) { if (this->actor.floorHeight > BGCHECK_Y_MIN + 1.0f) { this->actor.world.pos.y = this->actor.floorHeight; - return 1; + return true; } - return 0; + return false; } void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play) { if (D_80B4E940 == 0) { - if (gSaveContext.save.day % 5 <= 0) { + if (CURRENT_DAY < 1) { D_80B4E940 = 1; - } else if (gSaveContext.save.day % 5 == 1) { + } else if (CURRENT_DAY == 1) { s32 sp2C = gSaveContext.save.time; if ((sp2C < CLOCK_TIME(2, 30)) || (sp2C >= CLOCK_TIME(6, 00))) { D_80B4E940 = 1; } else if (sp2C < CLOCK_TIME(5, 15)) { s32 var_s0; - s32 var_s1 = 0x3800; + s32 var_s1 = CLOCK_TIME(5, 15); for (var_s0 = 0; var_s0 < this->unk_379; var_s0++) { s32 temp_v0 = EnInvadepoh_func_80B43A24(var_s0); @@ -884,13 +861,13 @@ void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play) { var_s1 = MIN(temp_v0, var_s1); } - if (sp2C < var_s1 + 0xE11) { + if (sp2C < var_s1 + CLOCK_TIME(1, 19) + 6) { D_80B4E940 = 2; } } } if (D_80B4E940 == 0) { - if (gSaveContext.save.weekEventReg[0x16] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { D_80B4E940 = 3; } else { D_80B4E940 = 4; @@ -900,13 +877,13 @@ void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { - s32 var_s2 = (this->actor.params >> 8) & 0x7F; + s32 var_s2 = ENINVADEPOH_GET_PARAM_7F00(&this->actor); s32 var_s3; for (var_s3 = 0; var_s3 < this->unk_379; var_s3++) { D_80B50320[var_s3] = - (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, 0x200, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, (var_s3 & 7) | ((var_s2 << 8) & 0x7F00) | 0x10); + (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(var_s2, ENINVADEPOH_ALIEN_INVADER, var_s3)); if (var_s2 != 0xFF) { Path* temp_v0 = &play->setupPathList[var_s2]; @@ -916,18 +893,18 @@ void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, arg2)); } void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, 0x40); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_ROMANI_ABDUCTED, 0)); } void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = Actor_Spawn(&play->actorCtx, play, 0x200, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, 0x60); + D_80B503F0 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); } void EnInvadepoh_func_80B45518(Vec3f* arg0) { @@ -979,22 +956,16 @@ s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1) { f32 sp30; Actor_GetProjectedPos(play, arg1, &sp34, &sp30); - if (sp34.z > 1.0f) { - // temp_fv1 = sp34.x * sp30; - if (fabsf(sp34.x * sp30) < 1.0f) { - // temp_fa0 = sp34.y * sp30; - if (fabsf(sp34.y * sp30) < 1.0f) { - f32 sp2C = (sp34.x * sp30 * 160.0f) + 160.0f; - f32 sp28 = (sp34.y * sp30 * -120.0f) + 120.0f; - s32 sp24 = (s32)(sp34.z * sp30 * 16352.0f) + 16352; + if ((sp34.z > 1.0f) && (fabsf(sp34.x * sp30) < 1.0f) && (fabsf(sp34.y * sp30) < 1.0f)) { + f32 sp2C = (sp34.x * sp30 * 160.0f) + 160.0f; + f32 sp28 = (sp34.y * sp30 * -120.0f) + 120.0f; + s32 sp24 = (s32)(sp34.z * sp30 * 16352.0f) + 16352; - if (sp24 < func_80178A94(sp2C, sp28)) { - return 1; - } - } + if (sp24 < func_80178A94(sp2C, sp28)) { + return true; } } - return 0; + return false; } void EnInvadepoh_func_80B457A0(EnInvadepoh* this) { @@ -1033,80 +1004,173 @@ EnInvadepoh* EnInvadepoh_func_80B458D8(void) { return NULL; } -s8 EnInvadepoh_func_80B45980(EnInvadepohUnkStruct4* arg0, s32 arg1) { +s8 EnInvadepoh_func_80B45980(EnInvadepohFaceAnimNext* arg0, s32 arg1) { f32 temp_fv0 = Rand_ZeroOne(); - EnInvadepohUnkStruct4* var_v0 = arg0; + EnInvadepohFaceAnimNext* var_v0 = arg0; s32 var_v1; arg1--; for (var_v1 = 0; var_v1 < arg1; var_v1++, var_v0++) { - if (temp_fv0 <= var_v0->unk4) { + if (temp_fv0 <= var_v0->chance) { break; } } - return (arg0 + var_v1)->unk0; // TODO: fake? + return (arg0 + var_v1)->index; // TODO: fake? } -void EnInvadepoh_func_80B459E8(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion* arg1) { - arg0->unk_4 = arg1->unk3.unk0; - arg0->unk_8 = arg1; - arg0->unk_E = 0; - arg0->unk_F = *arg1->unk3.unk4->unk0; - if (arg0->unk_4 == 2) { - EnInvadepohUnkStruct6* temp = &arg1->unk6; +void EnInvadepoh_func_80B459E8(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim* arg1) { + arg0->curAnimType = arg1->type; + arg0->curAnim = arg1; + arg0->curFrame = 0; + arg0->curIndex = arg1->frames->index[0]; + if (arg0->curAnimType == 2) { + EnInvadepohFaceAnimLoopDelayed* temp = (EnInvadepohFaceAnimLoopDelayed*) arg1; - arg0->unk_C = Rand_S16Offset(temp->unk10, temp->unk12); + arg0->delayTimer = Rand_S16Offset(temp->minDelay, temp->maxDelay); } } -void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { - EnInvadepohUnkStruct3* temp_v0 = &arg0->unk_8->unk3; - EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; +void EnInvadepoh_func_80B45A4C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { + EnInvadepohFaceAnim* temp_v0 = arg0->curAnim; + EnInvadepohFaceFrame* temp_v1 = temp_v0->frames; - if (arg0->unk_E < (temp_v1->unk4 - 1)) { - arg0->unk_E++; - arg0->unk_F = temp_v1->unk0[arg0->unk_E]; + if (arg0->curFrame < (temp_v1->count - 1)) { + arg0->curFrame++; + arg0->curIndex = temp_v1->index[arg0->curFrame]; } } -void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { - EnInvadepohUnkStruct5* temp_v0 = &arg0->unk_8->unk5; - EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; +void EnInvadepoh_func_80B45A94(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { + EnInvadepohFaceAnimLoop* temp_v0 = (EnInvadepohFaceAnimLoop*) arg0->curAnim; + EnInvadepohFaceFrame* temp_v1 = temp_v0->anim.frames; - if (arg0->unk_E < (temp_v1->unk4 - 1)) { - arg0->unk_E++; - arg0->unk_F = temp_v1->unk0[arg0->unk_E]; + if (arg0->curFrame < (temp_v1->count - 1)) { + arg0->curFrame++; + arg0->curIndex = temp_v1->index[arg0->curFrame]; } else { - s32 temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->unkC, temp_v0->unk8)]; + EnInvadepohFaceAnim* temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->nextAnims, temp_v0->nextCount)]; EnInvadepoh_func_80B459E8(arg0, temp_a1); } } -void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1* arg0, EnInvadepohUnkUnion** arg1) { - EnInvadepohUnkStruct6* temp_v0 = &arg0->unk_8->unk6; - EnInvadepohUnkStruct2* temp_v1 = temp_v0->unk4; +void EnInvadepoh_func_80B45B1C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { + EnInvadepohFaceAnimLoopDelayed* temp_v0 = (EnInvadepohFaceAnimLoopDelayed*) arg0->curAnim; + EnInvadepohFaceFrame* temp_v1 = temp_v0->loop.anim.frames; - if (arg0->unk_E < (temp_v1->unk4 - 1)) { - arg0->unk_E++; - arg0->unk_F = temp_v1->unk0[arg0->unk_E]; - } else if (arg0->unk_C > 0) { - arg0->unk_C--; + if (arg0->curFrame < (temp_v1->count - 1)) { + arg0->curFrame++; + arg0->curIndex = temp_v1->index[arg0->curFrame]; + } else if (arg0->delayTimer > 0) { + arg0->delayTimer--; } else { - s32 temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->unkC, temp_v0->unk8)]; + EnInvadepohFaceAnim* temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->loop.nextAnims, temp_v0->loop.nextCount)]; EnInvadepoh_func_80B459E8(arg0, temp_a1); } } -void EnInvadepoh_func_80B45BB8(EnInvadePohUnkStruct_324_1* arg0) { - if ((arg0->unk_0 != NULL) && (arg0->unk_8 != NULL)) { - D_80B4EC0C[arg0->unk_4](arg0, arg0->unk_0); +s8 D_80B4E99C[1] = { 0 }; +s8 D_80B4E9A0[4] = { 0, 1, 2, 0 }; +s8 D_80B4E9A4[5] = { 0, 1, 2, 1, 0 }; +s8 D_80B4E9AC[6] = { 0, 1, 2, 2, 1, 0 }; +s8 D_80B4E9B4[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +s8 D_80B4E9BC[1] = { 1 }; +s8 D_80B4E9C0[1] = { 3 }; +EnInvadepohFaceFrame D_80B4E9C4 = { D_80B4E99C, 1 }; +EnInvadepohFaceFrame D_80B4E9CC = { D_80B4E9A0, 4 }; +EnInvadepohFaceFrame D_80B4E9D4 = { D_80B4E9A4, 5 }; +EnInvadepohFaceFrame D_80B4E9DC = { D_80B4E9AC, 6 }; +EnInvadepohFaceFrame D_80B4E9E4 = { D_80B4E9B4, 8 }; +EnInvadepohFaceFrame D_80B4E9EC = { D_80B4E9BC, 1 }; +EnInvadepohFaceFrame D_80B4E9F4 = { D_80B4E9C0, 1 }; +EnInvadepohFaceAnim D_80B4E9FC = { 0, &D_80B4E9C4 }; +EnInvadepohFaceAnimNext D_80B4EA04[4] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.97f }, + { 5, 1.0f }, +}; +EnInvadepohFaceAnimNext D_80B4EA24[1] = { 1, 1.0f }; +EnInvadepohFaceAnimLoopDelayed D_80B4EA2C = { {{2, &D_80B4E9C4}, 4, D_80B4EA04}, 40, 60 }; +EnInvadepohFaceAnimLoop D_80B4EA40 = { {1, &D_80B4E9CC}, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA50 = { {1, &D_80B4E9D4}, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA60 = { {1, &D_80B4E9DC}, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA70 = { {1, &D_80B4E9E4}, 1, D_80B4EA24 }; +EnInvadepohFaceAnim D_80B4EA80 = { 0, &D_80B4E9EC }; +EnInvadepohFaceAnim D_80B4EA88 = { 0, &D_80B4E9F4 }; +EnInvadepohFaceAnim* D_80B4EA90[8] = { + &D_80B4E9FC, &D_80B4EA2C.loop.anim, &D_80B4EA40.anim, + &D_80B4EA50.anim, &D_80B4EA60.anim, &D_80B4EA70.anim, + &D_80B4EA80, &D_80B4EA88, +}; + +s8 D_80B4EAB0[1] = { 0 }; +s8 D_80B4EAB4[1] = { 1 }; +s8 D_80B4EAB8[1] = { 2 }; +s8 D_80B4EABC[1] = { 3 }; +EnInvadepohFaceFrame D_80B4EAC0 = { D_80B4EAB0, 1 }; +EnInvadepohFaceFrame D_80B4EAC8 = { D_80B4EAB4, 1 }; +EnInvadepohFaceFrame D_80B4EAD0 = { D_80B4EAB8, 1 }; +EnInvadepohFaceFrame D_80B4EAD8 = { D_80B4EABC, 1 }; +EnInvadepohFaceAnim D_80B4EAE0 = { 0, &D_80B4EAC0 }; +EnInvadepohFaceAnim D_80B4EAE8 = { 0, &D_80B4EAC8 }; +EnInvadepohFaceAnim D_80B4EAF0 = { 0, &D_80B4EAD0 }; +EnInvadepohFaceAnim D_80B4EAF8 = { 0, &D_80B4EAD8 }; +EnInvadepohFaceAnim* D_80B4EB00[4] = { + &D_80B4EAE0, + &D_80B4EAE8, + &D_80B4EAF0, + &D_80B4EAF8, +}; + +s8 D_80B4EB10[1] = { 0 }; +s8 D_80B4EB14[4] = { 0, 1, 2, 0 }; +s8 D_80B4EB18[5] = { 0, 1, 2, 1, 0 }; +s8 D_80B4EB20[6] = { 0, 1, 2, 2, 1, 0 }; +s8 D_80B4EB28[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +EnInvadepohFaceFrame D_80B4EB30 = { D_80B4EB10, 1 }; +EnInvadepohFaceFrame D_80B4EB38 = { D_80B4EB14, 4 }; +EnInvadepohFaceFrame D_80B4EB40 = { D_80B4EB18, 5 }; +EnInvadepohFaceFrame D_80B4EB48 = { D_80B4EB20, 6 }; +EnInvadepohFaceFrame D_80B4EB50 = { D_80B4EB28, 8 }; +EnInvadepohFaceAnim D_80B4EB58 = { 0, &D_80B4EB30 }; +EnInvadepohFaceAnimNext D_80B4EB60[4] = { + { 2, 0.5f }, + { 3, 0.9f }, + { 4, 0.95f }, + { 5, 1.0f }, +}; +EnInvadepohFaceAnimNext D_80B4EB80[1] = { 1, 1.0f }; +EnInvadepohFaceAnimLoopDelayed D_80B4EB88 = { {{2, &D_80B4EB30}, 4, D_80B4EB60}, 40, 60 }; +EnInvadepohFaceAnimLoop D_80B4EB9C = { {1, &D_80B4EB38}, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBAC = { {1, &D_80B4EB40}, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBBC = { {1, &D_80B4EB48}, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBCC = { {1, &D_80B4EB50}, 1, D_80B4EB80 }; +EnInvadepohFaceAnim* D_80B4EBDC[6] = { + &D_80B4EB58, &D_80B4EB88.loop.anim, &D_80B4EB9C.anim, + &D_80B4EBAC.anim, &D_80B4EBBC.anim, &D_80B4EBCC.anim, +}; + +s8 D_80B4EBF4[1] = { 0 }; +EnInvadepohFaceFrame D_80B4EBF8 = { D_80B4EBF4, 1 }; +EnInvadepohFaceAnim D_80B4EC00 = { 0, &D_80B4EBF8 }; +EnInvadepohFaceAnim* D_80B4EC08[1] = { &D_80B4EC00 }; + +void EnInvadepoh_func_80B45BB8(EnInvadePohFaceInfo* arg0) { + static EnInvadepohFaceFunc D_80B4EC0C[3] = { + EnInvadepoh_func_80B45A4C, + EnInvadepoh_func_80B45A94, + EnInvadepoh_func_80B45B1C, + }; + + if ((arg0->animSet != NULL) && (arg0->curAnim != NULL)) { + D_80B4EC0C[arg0->curAnimType](arg0, arg0->animSet); } } -void EnInvadepoh_func_80B45C04(EnInvadePohUnkStruct_324* arg0, EnInvadepohUnkUnion** arg1, s32 arg2, - EnInvadepohUnkUnion** arg3, s32 arg4, Vec3s* arg5, s16 arg6, f32 arg7, f32 arg8, +void EnInvadepoh_func_80B45C04(EnInvadePohUnkStruct_324* arg0, EnInvadepohFaceAnim** arg1, s32 arg2, + EnInvadepohFaceAnim** arg3, s32 arg4, Vec3s* arg5, s16 arg6, f32 arg7, f32 arg8, f32 arg9) { Math_Vec3s_Copy(&arg0->unk_26, arg5); arg0->unk_2C = arg6; @@ -1114,24 +1178,24 @@ void EnInvadepoh_func_80B45C04(EnInvadePohUnkStruct_324* arg0, EnInvadepohUnkUni arg0->unk_38 = arg8; arg0->unk_3C = arg9; if (arg1 != NULL) { - EnInvadepohUnkUnion* temp_v0 = arg1[arg2]; + EnInvadepohFaceAnim* temp_v0 = arg1[arg2]; - arg0->unk_00.unk_0 = arg1; - arg0->unk_00.unk_4 = temp_v0->unk3.unk0; - arg0->unk_00.unk_8 = temp_v0; - arg0->unk_00.unk_C = 0; - arg0->unk_00.unk_E = 0; - arg0->unk_00.unk_F = temp_v0->unk3.unk4->unk0[0]; + arg0->eyeAnim.animSet = arg1; + arg0->eyeAnim.curAnimType = temp_v0->type; + arg0->eyeAnim.curAnim = temp_v0; + arg0->eyeAnim.delayTimer = 0; + arg0->eyeAnim.curFrame = 0; + arg0->eyeAnim.curIndex = temp_v0->frames->index[0]; } if (arg3 != NULL) { - EnInvadepohUnkUnion* temp_v0 = arg3[arg4]; + EnInvadepohFaceAnim* temp_v0 = arg3[arg4]; - arg0->unk_10.unk_0 = arg3; - arg0->unk_10.unk_4 = temp_v0->unk3.unk0; - arg0->unk_10.unk_8 = temp_v0; - arg0->unk_10.unk_C = 0; - arg0->unk_10.unk_E = 0; - arg0->unk_10.unk_F = temp_v0->unk3.unk4->unk0[0]; + arg0->mouthAnim.animSet = arg3; + arg0->mouthAnim.curAnimType = temp_v0->type; + arg0->mouthAnim.curAnim = temp_v0; + arg0->mouthAnim.delayTimer = 0; + arg0->mouthAnim.curFrame = 0; + arg0->mouthAnim.curIndex = temp_v0->frames->index[0]; } } @@ -1165,11 +1229,13 @@ void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0) { var_a2 = CLAMP(var_a2, 100, arg0->unk_48); Math_ScaledStepToS(&arg0->unk_40, arg0->unk_42, var_a2); } - EnInvadepoh_func_80B45BB8(&arg0->unk_00); - EnInvadepoh_func_80B45BB8(&arg0->unk_10); + EnInvadepoh_func_80B45BB8(&arg0->eyeAnim); + EnInvadepoh_func_80B45BB8(&arg0->mouthAnim); } void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { + static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; + static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; s32 var_s1; Vec3f spA8; Vec3f sp9C; @@ -1178,7 +1244,7 @@ void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { s16 var_s0 = 0; for (var_s1 = 0; var_s1 < arg2; var_s1++) { - var_s0 += (s16)(65536.0f / arg2); + var_s0 += (s16)(0x10000 * 1.0f / arg2); temp_fs0 = (Rand_ZeroOne() * 0.5f) + 0.5f; spA8.x = Math_SinS(var_s0) * temp_fs0; @@ -1200,59 +1266,61 @@ void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { } s32 EnInvadepoh_func_80B46118(Vec3f* arg0) { - EnInvadepohStructD_80B50350* var_v1 = D_80B50350; - s32 var_v0; + EnInvadepohWarpEffect* warpEffect = D_80B50350; + s32 i; - for (var_v0 = 0; var_v0 < 10; var_v0++, var_v1++) { - if (var_v1->unk_1 <= 0) { - var_v1->unk_0 = 0; - var_v1->unk_1 = 40; - Math_Vec3f_Copy(&var_v1->unk_4, arg0); - var_v1->unk_2 = 0; - return 1; + for (i = 0; i < 10; i++, warpEffect++) { + if (warpEffect->timer <= 0) { + warpEffect->unk_0 = 0; + warpEffect->timer = 40; + Math_Vec3f_Copy(&warpEffect->pos, arg0); + warpEffect->alpha = 0; + return true; } } - return 0; + return false; } -void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0) { - if (arg0->unk_1 > 20) { - if (arg0->unk_2 < 125) { - arg0->unk_2 += 10; +void EnInvadepoh_func_80B46184(EnInvadepohWarpEffect* warpEffect) { + if (warpEffect->timer > 20) { + if (warpEffect->alpha < 125) { + warpEffect->alpha += 10; } else { - arg0->unk_2 = 135; + warpEffect->alpha = 135; } } else { - if (arg0->unk_2 > 13) { - arg0->unk_2 -= 13; + if (warpEffect->alpha > 13) { + warpEffect->alpha -= 13; } else { - arg0->unk_2 = 0; + warpEffect->alpha = 0; } } } s32 EnInvadepoh_func_80B461DC(void) { + static void (*D_80B4EC20[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_func_80B46184 }; s32 var_s4 = 0; s32 i; - EnInvadepohStructD_80B50350* var_s0; + EnInvadepohWarpEffect* warpEffect; - for (i = 0, var_s0 = D_80B50350; i < 10; i++, var_s0++) { - if (var_s0->unk_1 > 0) { - D_80B4EC20[var_s0->unk_0](var_s0); + for (i = 0, warpEffect = D_80B50350; i < 10; i++, warpEffect++) { + if (warpEffect->timer > 0) { + D_80B4EC20[warpEffect->unk_0](warpEffect); var_s4 = 1; - var_s0->unk_1 -= 1; + warpEffect->timer -= 1; } } return var_s4; } void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play) { + // PlayState* play = play2; Massive problems EnInvadepoh* this = (EnInvadepoh*)thisx; s32 var_a2; s32 var_v1; - this->actor.flags |= 0x20; - var_v1 = (this->actor.params >> 8) & 0x7F; + this->actor.flags |= ACTOR_FLAG_20; + var_v1 = ENINVADEPOH_GET_PARAM_7F00(&this->actor); for (var_a2 = 1; var_a2 < 8; var_a2++) { Path* path = &play->setupPathList[var_v1]; @@ -1269,18 +1337,18 @@ void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play) { if (D_80B4E940 == 1) { EnInvadepoh_func_80B46DA8(this); } else if (D_80B4E940 == 2) { - if (gSaveContext.save.time < 0x1AD8) { + if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { EnInvadepoh_func_80B46DA8(this); } else { EnInvadepoh_func_80B454BC(this, play); EnInvadepoh_func_80B452EC(this, play); - Audio_QueueSeqCmd(0x800D); + Audio_QueueSeqCmd(0x8000 | NA_BGM_ALIEN_INVASION); EnInvadepoh_func_80B46F88(this); } } else if (D_80B4E940 == 3) { - if (gSaveContext.save.entrance == 0x6460) { + if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { EnInvadepoh_func_80B471C0(this); - } else if (gSaveContext.save.entrance == 0x6470) { + } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { EnInvadepoh_func_80B47248(this); } else { EnInvadepoh_func_80B47248(this); @@ -1290,15 +1358,22 @@ void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play) { } } +InitChainEntry D_80B4EC24[4] = { + 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), +}; void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play) { + // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; Actor_ProcessInitChain(&this->actor, D_80B4EC24); Collider_InitCylinder(play, &this->unk_2A0); ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); this->actor.shape.shadowAlpha = 140; - this->actor.flags = 0x80001010; - if (((this->actor.params >> 4) & 0xF) == 0xD) { + this->actor.flags = ACTOR_FLAG_80000000 | ACTOR_FLAG_1000 | ACTOR_FLAG_10; + if (ENINVADEPOH_GET_PARAM_F0(&this->actor) == ENINVADEPOH_ALIEN_ABDUCTOR) { this->actor.update = EnInvadepoh_func_80B4D670; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; } else { @@ -1306,94 +1381,117 @@ void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8B0); this->actor.colChkInfo.mass = 40; } - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x23E); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_UCH); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } } +InitChainEntry D_80B4EC34[4] = { + 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), +}; void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; Actor_ProcessInitChain(&this->actor, D_80B4EC34); this->actor.update = EnInvadepoh_func_80B47FA8; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x200, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x146); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW_TAIL, 0)); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } } +InitChainEntry D_80B4EC44[4] = { + 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), +}; void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; Actor_ProcessInitChain(&this->actor, D_80B4EC44); this->actor.update = EnInvadepoh_func_80B481C4; - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x146); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } } +InitChainEntry D_80B4EC54[5] = { + 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), +}; void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play) { + // PlayState* play = play2; Stack management problems EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 temp_v1 = (this->actor.params >> 4) & 0xF; + s32 temp_v1 = ENINVADEPOH_GET_PARAM_F0(&this->actor); Actor_ProcessInitChain(&this->actor, D_80B4EC54); - if ((temp_v1 == 7) || (temp_v1 == 0xC)) { + if ((temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) || (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3)) { this->actor.targetMode = 3; } else { this->actor.targetMode = 6; } func_800BC154(play, &play->actorCtx, &this->actor, 4); Collider_InitCylinder(play, &this->unk_2A0); - if (temp_v1 != 4) { + if (temp_v1 != ENINVADEPOH_ROMANI_ABDUCTED) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); this->actor.colChkInfo.mass = 0xFF; } - if (temp_v1 == 4) { + if (temp_v1 == ENINVADEPOH_ROMANI_ABDUCTED) { this->actor.update = EnInvadepoh_func_80B48620; - } else if (temp_v1 == 5) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { this->actor.update = EnInvadepoh_func_80B48FB0; - this->actor.flags = 0x19; - } else if (temp_v1 == 7) { + this->actor.flags = ACTOR_FLAG_10 | ACTOR_FLAG_8 | ACTOR_FLAG_1; + } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { this->actor.update = EnInvadepoh_func_80B49F88; - } else if (temp_v1 == 8) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_UNKNOWN) { this->actor.update = EnInvadepoh_func_80B4A9C8; - } else if (temp_v1 == 9) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { this->actor.update = EnInvadepoh_func_80B4B0C4; } else { this->actor.update = EnInvadepoh_func_80B4CE54; } - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0xB7); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA1); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } - if (temp_v1 == 5) { - if (gSaveContext.save.weekEventReg[0x16] & 1) { + if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { + if (gSaveContext.save.weekEventReg[22] & 1) { Actor_MarkForDeath(&this->actor); } - } else if (temp_v1 == 7) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { Actor_MarkForDeath(&this->actor); } - } else if (temp_v1 == 8) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_UNKNOWN) { // nothing - } else if (temp_v1 == 9) { - if (gSaveContext.save.entrance != 0x6460) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { + if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { Actor_MarkForDeath(&this->actor); } - } else if (temp_v1 == 0xC) { - if (!(gSaveContext.save.weekEventReg[0x16] & 1)) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { Actor_MarkForDeath(&this->actor); } D_80B503F4 = this; } } +InitChainEntry D_80B4EC68[6] = { + 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(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), +}; void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -1415,7 +1513,16 @@ void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { } } +InitChainEntry D_80B4EC80[6] = { + 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), +}; void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play) { + // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; Actor_ProcessInitChain(&this->actor, D_80B4EC80); @@ -1424,13 +1531,22 @@ void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E908); this->actor.colChkInfo.mass = 0x50; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0x132); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_DOG); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } } +InitChainEntry D_80B4EC98[6] = { + 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), +}; void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play) { + // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; Actor_ProcessInitChain(&this->actor, D_80B4EC98); @@ -1440,18 +1556,35 @@ void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); this->actor.colChkInfo.mass = MASS_HEAVY; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, 0xA7); + this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA2); if (this->unk_2F4 < 0) { Actor_MarkForDeath(&this->actor); } - if (!(gSaveContext.save.weekEventReg[0x16] & 1)) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { Actor_MarkForDeath(&this->actor); } D_80B503F8 = this; } void EnInvadepoh_Init(Actor* thisx, PlayState* play) { - D_80B4ECB0[(thisx->params >> 4) & 0xF](thisx, play); + static ActorFunc D_80B4ECB0[14] = { + EnInvadepoh_func_80B4627C, // Event handler + EnInvadepoh_func_80B46414, // Alien invader + EnInvadepoh_func_80B46520, // Abducted cow + EnInvadepoh_func_80B465CC, // Cow tail + EnInvadepoh_func_80B46644, // Abducted Romani + EnInvadepoh_func_80B46644, // Confused Romani + EnInvadepoh_func_80B468B4, // Light ball + EnInvadepoh_func_80B46644, // Night 1 Romani + EnInvadepoh_func_80B46644, // Unknown Romani + EnInvadepoh_func_80B46644, // Reward Romani + EnInvadepoh_func_80B469C4, // Dog + EnInvadepoh_func_80B46A80, // Night 3 Cremia + EnInvadepoh_func_80B46644, // Night 3 Romani + EnInvadepoh_func_80B46414, // Alien abductor + }; + + D_80B4ECB0[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); } void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play2) { @@ -1459,7 +1592,7 @@ void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp18 = this->actor.params & 7; + s32 sp18 = ENINVADEPOH_GET_PARAM_7(&this->actor); PlayState* play = play2; Collider_DestroyCylinder(play, &this->unk_2A0); @@ -1486,7 +1619,7 @@ void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2) { - PlayState* play = play2; + PlayState* play = play2; // both or neither recast required EnInvadepoh* this = (EnInvadepoh*)thisx; Collider_DestroyCylinder(play, &this->unk_2A0); @@ -1497,7 +1630,7 @@ void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2) { - PlayState* play = play2; + PlayState* play = play2; // both or neither recast required EnInvadepoh* this = (EnInvadepoh*)thisx; Collider_DestroyCylinder(play, &this->unk_2A0); @@ -1521,7 +1654,7 @@ void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { PlayState* play = play2; - EnInvadepoh* this = (EnInvadepoh*)thisx; + EnInvadepoh* this = (EnInvadepoh*)thisx; // this recast required Collider_DestroyCylinder(play, &this->unk_2A0); if (this->actor.child != NULL) { @@ -1530,7 +1663,24 @@ void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { } void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { - D_80B4ECE8[(thisx->params >> 4) & 0xF](thisx, play); + static ActorFunc D_80B4ECE8[14] = { + EnInvadepoh_func_80B46BB0, // Event handler + EnInvadepoh_func_80B46BC0, // Alien invader + EnInvadepoh_func_80B46C08, // Abducted cow + EnInvadepoh_func_80B46C34, // Cow tail + EnInvadepoh_func_80B46C50, // Abducted Romani + EnInvadepoh_func_80B46C50, // Confused Romani + EnInvadepoh_func_80B46C7C, // Light ball + EnInvadepoh_func_80B46C50, // Night 1 Romani + EnInvadepoh_func_80B46C50, // Unknown Romani + EnInvadepoh_func_80B46C50, // Reward Romani + EnInvadepoh_func_80B46C94, // Dog + EnInvadepoh_func_80B46CC0, // Night 3 Cremia + EnInvadepoh_func_80B46CF4, // Night 3 Romani + EnInvadepoh_func_80B46D28, // Alien abductor + }; + + D_80B4ECE8[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); } void EnInvadepoh_func_80B46DA8(EnInvadepoh* this) { @@ -1565,11 +1715,14 @@ void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B46EC0(EnInvadepoh* this) { D_80B4E940 = 2; - this->unk_2F0 = 0xA0; + this->unk_2F0 = 160; this->actionFunc = EnInvadepoh_func_80B46EE8; } void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play) { + static s16 D_80B4ED20[8] = { + 130, 125, 115, 100, 80, 78, 76, 74, + }; s32 i; for (i = 0; i < 8; i++) { @@ -1580,7 +1733,7 @@ void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play) { this->unk_2F0--; if (this->unk_2F0 <= 0) { ActorCutscene_Stop(D_80B50404[0]); - Audio_QueueSeqCmd(0x800D); + Audio_QueueSeqCmd(0x8000 | NA_BGM_ALIEN_INVASION); EnInvadepoh_func_80B46F88(this); } } @@ -1599,7 +1752,7 @@ void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play) { s32 i; if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - gSaveContext.save.weekEventReg[0x16] |= 1; + gSaveContext.save.weekEventReg[22] |= 1; EnInvadepoh_func_80B47064(this); } else { EnInvadepoh_func_80B457A0(this); @@ -1628,21 +1781,21 @@ void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B470E0(EnInvadepoh* this) { D_80B4E940 = 3; - this->unk_2F0 = 0x6E; + this->unk_2F0 = 110; this->actionFunc = EnInvadepoh_func_80B47108; } void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 == 0x64) { - Audio_PlayFanfare(0x19); + if (this->unk_2F0 == 100) { + Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } this->unk_2F0--; if (this->unk_2F0 <= 0) { - play->nextEntrance = 0x6460; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->transitionType = 0x49; - gSaveContext.nextTransitionType = 0x48; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_73; + gSaveContext.nextTransitionType = TRANS_TYPE_72; D_801BDAA0 = 1; D_801BDA9C = 0; EnInvadepoh_func_80B47248(this); @@ -1656,11 +1809,11 @@ void EnInvadepoh_func_80B471C0(EnInvadepoh* this) { void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play) { if (D_80B4E998 != 0) { - play->nextEntrance = 0x6470; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->transitionType = 0x48; - gSaveContext.nextTransitionType = 0x48; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_72; + gSaveContext.nextTransitionType = TRANS_TYPE_72; EnInvadepoh_func_80B47248(this); } } @@ -1679,12 +1832,12 @@ void EnInvadepoh_func_80B47278(EnInvadepoh* this) { } void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play) { - play->nextEntrance = 0x6400; - gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = 0x14; - play->transitionType = 0x48; - gSaveContext.nextTransitionType = 0x48; - gSaveContext.save.weekEventReg[0x59] |= 0x10; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); + gSaveContext.nextCutsceneIndex = 0xFFF3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_72; + gSaveContext.nextTransitionType = TRANS_TYPE_72; + gSaveContext.save.weekEventReg[89] |= 0x10; EnInvadepoh_func_80B47304(this); } @@ -1706,10 +1859,10 @@ void EnInvadepoh_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B47380(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~1; - this->unk_2A0.base.acFlags &= ~1; - this->unk_2A0.base.ocFlags1 &= ~1; - this->actor.flags &= ~0x80000000; + this->unk_2A0.base.atFlags &= ~AT_ON; + this->unk_2A0.base.acFlags &= ~AC_ON; + this->unk_2A0.base.ocFlags1 &= ~OC1_ON; + this->actor.flags &= ~ACTOR_FLAG_80000000; this->unk_389 = 0; this->actor.draw = NULL; this->unk_38B = 0; @@ -1722,7 +1875,7 @@ void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play) { EnInvadepoh_func_80B442E4(this); EnInvadepoh_func_80B447C0(this, play); EnInvadepoh_func_80B43DD4(this, 0x320, 0); - if (D_80B50340[this->actor.params & 7] & 1) { + if (D_80B50340[ENINVADEPOH_GET_PARAM_7(&this->actor)] & 1) { Actor_SetScale(&this->actor, 0.01f); EnInvadepoh_func_80B4516C(this); EnInvadepoh_func_80B46118(&this->actor.world.pos); @@ -1731,10 +1884,10 @@ void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B47478(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~1; - this->unk_2A0.base.acFlags &= ~1; - this->unk_2A0.base.ocFlags1 &= ~1; - this->actor.flags &= ~0x80000000; + this->unk_2A0.base.atFlags &= ~AT_ON; + this->unk_2A0.base.acFlags &= ~AC_ON; + this->unk_2A0.base.ocFlags1 &= ~OC1_ON; + this->actor.flags &= ~ACTOR_FLAG_80000000; this->unk_389 = 0; this->actor.draw = NULL; this->unk_38B = 0; @@ -1757,15 +1910,15 @@ void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B47568(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - this->unk_2A0.base.atFlags &= ~1; - this->unk_2A0.base.acFlags &= ~1; - this->unk_2A0.base.ocFlags1 &= ~1; + this->unk_2A0.base.atFlags &= ~AT_ON; + this->unk_2A0.base.acFlags &= ~AC_ON; + this->unk_2A0.base.ocFlags1 &= ~OC1_ON; this->unk_389 = 0; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; this->unk_38D = 0; - this->actor.flags |= 0x80000000; + this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B47600; } @@ -1773,7 +1926,7 @@ void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play) { EnInvadepoh_func_80B442E4(this); EnInvadepoh_func_80B447C0(this, play); EnInvadepoh_func_80B43DD4(this, 0x320, 0); - func_800B9010(&this->actor, 0x320A); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->unk_320 >= 0.9999f) { this->unk_38A = 1; } @@ -1783,9 +1936,9 @@ void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play) { this->unk_389 += 6; } if (this->unk_389 > 128) { - this->unk_2A0.base.atFlags |= 1; - this->unk_2A0.base.acFlags |= 1; - this->unk_2A0.base.ocFlags1 |= 1; + this->unk_2A0.base.atFlags |= AT_ON; + this->unk_2A0.base.acFlags |= AC_ON; + this->unk_2A0.base.ocFlags1 |= OC1_ON; } if (this->unk_389 == 255) { if (this->unk_38D >= 245) { @@ -1801,15 +1954,15 @@ void EnInvadepoh_func_80B4770C(EnInvadepoh* this) { if (this->skelAnime.animation != &gAlienFloatAnim) { Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); } - this->unk_2A0.base.atFlags |= 1; - this->unk_2A0.base.acFlags |= 1; - this->unk_2A0.base.ocFlags1 |= 1; + this->unk_2A0.base.atFlags |= AT_ON; + this->unk_2A0.base.acFlags |= AC_ON; + this->unk_2A0.base.ocFlags1 |= OC1_ON; this->unk_389 = 0xFF; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; this->unk_38D = 0xFF; - this->actor.flags |= 0x80000000; + this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B477B4; } @@ -1817,16 +1970,16 @@ void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play) { EnInvadepoh_func_80B442E4(this); EnInvadepoh_func_80B447C0(this, play); EnInvadepoh_func_80B43DD4(this, 0x320, 0); - func_800B9010(&this->actor, 0x320A); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->unk_320 >= 0.9999f) { this->unk_38A = 1; } } void EnInvadepoh_func_80B47830(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~1; - this->unk_2A0.base.acFlags &= ~1; - this->unk_2A0.base.ocFlags1 |= 1; + this->unk_2A0.base.atFlags &= ~AT_ON; + this->unk_2A0.base.acFlags &= ~AC_ON; + this->unk_2A0.base.ocFlags1 |= OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10); this->unk_389 = 0xFF; @@ -1836,7 +1989,7 @@ void EnInvadepoh_func_80B47830(EnInvadepoh* this) { this->unk_38D = 0; this->unk_2F0 = 8; this->unk_2F2 = 0; - this->actor.flags |= 0x80000000; + this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B478F4; } @@ -1849,22 +2002,31 @@ void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B47938(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~1; - this->unk_2A0.base.acFlags &= ~1; - this->unk_2A0.base.ocFlags1 &= ~1; + this->unk_2A0.base.atFlags &= ~AT_ON; + this->unk_2A0.base.acFlags &= ~AC_ON; + this->unk_2A0.base.ocFlags1 &= ~OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); - this->actor.flags &= ~1; + this->actor.flags &= ~ACTOR_FLAG_1; this->unk_2F0 = 0xA; this->unk_389 = 0xFF; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; this->unk_38D = 0xFF; - this->actor.flags |= 0x80000000; + this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B479E8; } void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { + static Vec3f D_80B4ED30[5] = { + { 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[7] = { + { 0.0005f, 0.027999999f, 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 }, + }; Vec3f* temp; EnInvadepoh_func_80B44B78(this); @@ -1895,15 +2057,15 @@ void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { } this->unk_2F2++; if (this->unk_2F0 == 8) { - Actor_Spawn(&play->actorCtx, play, 0xA2, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, - this->actor.world.pos.z, 0, 0, 3, 0xC8); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, + this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); } if (this->unk_2F0 == 8) { Enemy_StartFinishingBlow(play, &this->actor); } this->unk_2F0--; if (this->unk_2F0 <= 0) { - EnInvadepoh_func_80B43AF0(this->actor.params & 7); + EnInvadepoh_func_80B43AF0(ENINVADEPOH_GET_PARAM_7(&this->actor)); EnInvadepoh_func_80B43AB0(); Item_DropCollectible(play, &this->actor.world.pos, 8); EnInvadepoh_func_80B47478(this); @@ -1919,8 +2081,8 @@ void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B45080(); this->actor.update = EnInvadepoh_func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, 14); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame / 8.0f; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, ALIEN_LIMB_MAX); + this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame / 8.0f; EnInvadepoh_func_80B444BC(this, play); EnInvadepoh_func_80B442E4(this); EnInvadepoh_func_80B447C0(this, play); @@ -1954,7 +2116,7 @@ void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { Actor_MarkForDeath(thisx); return; } - } else if (this->unk_2A0.base.acFlags & 2) { + } else if (this->unk_2A0.base.acFlags & AC_HIT) { Actor* hitbox = this->unk_2A0.base.ac; thisx->speedXZ = hitbox->speedXZ * 0.5f; @@ -1966,7 +2128,7 @@ void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { thisx->velocity.y = hitbox->velocity.y * 0.5f; thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); - SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, 0x3A09); + SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); EnInvadepoh_func_80B47830(this); } @@ -1978,20 +2140,20 @@ void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { Collider_UpdateCylinder(thisx, &this->unk_2A0); - if (this->unk_2A0.base.atFlags & 1) { + if (this->unk_2A0.base.atFlags & AT_ON) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_2A0.base); } else { - this->unk_2A0.base.atFlags &= ~2; + this->unk_2A0.base.atFlags &= ~AT_HIT; } - if (this->unk_2A0.base.acFlags & 1) { + if (this->unk_2A0.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_2A0.base); } else { - this->unk_2A0.base.acFlags &= ~2; + this->unk_2A0.base.acFlags &= ~AC_HIT; } - if (this->unk_2A0.base.ocFlags1 & 1) { + if (this->unk_2A0.base.ocFlags1 & OC1_ON) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); } else { - this->unk_2A0.base.ocFlags1 &= ~2; + this->unk_2A0.base.ocFlags1 &= ~OC1_HIT; } } @@ -2004,12 +2166,13 @@ void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnInvadepoh_func_80B48060; this->actor.draw = EnInvadepoh_func_80B4E158; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->unk_188, this->unk_212, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->unk_188, this->unk_212, COW_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); } } void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { + static s16 D_80B4EDC0[3] = { -0x1F40, -0x1770, -0x2AF8 }; PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 sp6C; @@ -2018,7 +2181,7 @@ void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { Actor_MarkForDeath(&this->actor); return; } - sp6C = this->actor.params & 7; + sp6C = ENINVADEPOH_GET_PARAM_7(&this->actor); SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[sp6C], 0x32); if (this->actor.child != NULL) { @@ -2047,7 +2210,7 @@ void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnInvadepoh_func_80B4827C; this->actor.draw = EnInvadepoh_func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, COW_TAIL_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); } } @@ -2073,7 +2236,7 @@ void EnInvadepoh_func_80B482D4(EnInvadepoh* this) { void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play) { this->unk_2F0--; if (this->unk_2F0 <= 0) { - EnInvadepoh_func_80B4560C(this, play, 0x332F); + EnInvadepoh_func_80B4560C(this, play, 0x332F); // Romani's scream when abducted this->actor.draw = EnInvadepoh_func_80B4E324; EnInvadepoh_func_80B48374(this); } @@ -2163,7 +2326,7 @@ void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); this->actor.update = EnInvadepoh_func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); @@ -2189,6 +2352,7 @@ void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { + static s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; this->unk_2F0 = Rand_S16Offset(150, 250); @@ -2207,15 +2371,15 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); if (EnInvadepoh_func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { EnInvadepoh_func_80B44514(this); - this->unk_370 = 200; + this->unk_370 = 0xC8; this->actor.speedXZ *= 0.25f; } else { Math_StepToS(&this->unk_370, 0x7D0, 0x46); } EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x46); - if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_2F0 > 0) { this->unk_2F0--; @@ -2356,8 +2520,8 @@ void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2) { EnInvadepoh_func_80B44F58(); this->actor.update = EnInvadepoh_func_80B490F0; this->actor.draw = EnInvadepoh_func_80B4E324; - this->actor.textId = 0x3330; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, 23); + this->actor.textId = 0x3330; // ........ + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B444F4(this, play); EnInvadepoh_func_80B4407C(this, 0); @@ -2370,7 +2534,7 @@ void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B490F0(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); if (sp28) { @@ -2406,7 +2570,7 @@ void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play) { this->actor.velocity.y *= 0.97f; sp28 = 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, 0x217B); + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); if (fabsf(sp28) < 1.0f) { EnInvadepoh_func_80B45EC8(this, play, 50); EnInvadepoh_func_80B492FC(this); @@ -2432,7 +2596,7 @@ void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play) { } this->actor.velocity.y *= 0.96f; Actor_MoveWithGravity(&this->actor); - func_800B9010(&this->actor, 0x217B); + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); this->unk_2F0--; if (this->unk_2F0 <= 0) { EnInvadepoh_func_80B49404(this); @@ -2451,6 +2615,10 @@ void EnInvadepoh_func_80B49404(EnInvadepoh* this) { } void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { + static Vec3f D_80B4EDD0[5] = { + { -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 }, + }; s32 pad; Vec3f sp30; s32 pad2; @@ -2483,7 +2651,7 @@ void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { 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, 0x217B); + func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); if (this->unk_2F0 > 0) { this->unk_2F0--; } else { @@ -2642,14 +2810,14 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); } } - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { this->unk_378 = 0; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_320 >= 0.9999f) { Actor_MarkForDeath(&this->actor); @@ -2678,9 +2846,9 @@ void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[0x36] |= 0x10; - this->actor.textId = 0x332E; + if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper... + gSaveContext.save.weekEventReg[54] |= 0x10; + this->actor.textId = 0x332E; // If you run out of arrows... } EnInvadepoh_func_80B49BD0(this); } @@ -2697,21 +2865,21 @@ void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B44540(this, play); EnInvadepoh_func_80B44570(this); EnInvadepoh_func_80B44C24(this, play); EnInvadepoh_func_80B43F0C(this); EnInvadepoh_func_80B4516C(this); - if (gSaveContext.save.weekEventReg[0x15] & 0x20) { - if (gSaveContext.save.weekEventReg[0x36] & 0x10) { - this->actor.textId = 0x332E; + if (gSaveContext.save.weekEventReg[21] & 0x20) { + if (gSaveContext.save.weekEventReg[54] & 0x10) { + this->actor.textId = 0x332E; // If you run out of arrows... } else { - this->actor.textId = 0x332D; + this->actor.textId = 0x332D; // It's almost time, Grasshopper... } } else { - this->actor.textId = 0x332C; + this->actor.textId = 0x332C; // ...It's almost time. } if ((sp38 >= CLOCK_TIME(18, 00)) || (sp38 < CLOCK_TIME(2, 00))) { this->actor.update = EnInvadepoh_func_80B4A168; @@ -2740,7 +2908,7 @@ void EnInvadepoh_func_80B4A168(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B4A1B8(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); if (sp28) { @@ -2771,7 +2939,7 @@ void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { this->unk_2F0 = Rand_S16Offset(200, 200); this->unk_304 = this->actor.shape.rot.y; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_func_80B4A350; } @@ -2824,7 +2992,7 @@ void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { temp_v0->unk_26.z = 0; temp_v0->unk_30 = 0.1f; temp_v0->unk_2C = 0x320; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_func_80B4A5E4; } @@ -2862,14 +3030,14 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { if (this->unk_378 == 0) { this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, -0xF); } - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { this->unk_378 = 0; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_309 == this->unk_308) { EnInvadepoh_func_80B4A2C0(this); @@ -2897,9 +3065,9 @@ void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[0x36] |= 0x10; - this->actor.textId = 0x332E; + if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper + gSaveContext.save.weekEventReg[54] |= 0x10; + this->actor.textId = 0x332E; // If you run out of arrows... } if (this->unk_309 == this->unk_308) { EnInvadepoh_func_80B4A2C0(this); @@ -2920,7 +3088,7 @@ void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B44620(this, play2); if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 00))) { @@ -2936,14 +3104,14 @@ void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { EnInvadepoh_func_80B43F0C(this); func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_func_80B4516C(this); - if (gSaveContext.save.weekEventReg[0x15] & 0x20) { - if (gSaveContext.save.weekEventReg[0x36] & 0x10) { - this->actor.textId = 0x332E; + if (gSaveContext.save.weekEventReg[21] & 0x20) { + if (gSaveContext.save.weekEventReg[54] & 0x10) { + this->actor.textId = 0x332E; // If you run out of arrows... } else { - this->actor.textId = 0x332D; + this->actor.textId = 0x332D; // It's almost time, Grasshopper... } } else { - this->actor.textId = 0x332C; + this->actor.textId = 0x332C; // ...It's almost time. } } } @@ -2962,7 +3130,7 @@ void EnInvadepoh_func_80B4AB8C(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B4ABDC(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); if (sp28) { @@ -2986,21 +3154,21 @@ void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this) { } void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[0x16] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { this->actor.draw = EnInvadepoh_func_80B4E324; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); EnInvadepoh_func_80B4AD3C(this); } } void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this) { - this->actor.flags |= 0x10000; + this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = EnInvadepoh_func_80B4AD60; } void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_func_80B4560C(this, play, 0x3331); + EnInvadepoh_func_80B4560C(this, play, 0x3331); // We did it...We won. EnInvadepoh_func_80B4ADB8(this); } else { func_800B8614(&this->actor, play, 2000.0f); @@ -3013,17 +3181,17 @@ void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this) { void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - if (this->unk_376 == 0x3331) { - if (gSaveContext.save.weekEventReg[0x16] & 2) { - EnInvadepoh_func_80B4560C(this, play, 0x3334); + if (this->unk_376 == 0x3331) { // We did it...We won. + if (gSaveContext.save.weekEventReg[22] & 2) { + EnInvadepoh_func_80B4560C(this, play, 0x3334); // I have to get back to bed... func_80151BB4(play, 0x1D); func_80151BB4(play, 5); } else { - EnInvadepoh_func_80B4560C(this, play, 0x3333); + EnInvadepoh_func_80B4560C(this, play, 0x3333); // Here's Romani's thanks } - } else if (this->unk_376 == 0x3333) { + } else if (this->unk_376 == 0x3333) { // Here's Romani's thanks EnInvadepoh_func_80B4AEC0(this); - } else if (this->unk_376 == 0x3334) { + } else if (this->unk_376 == 0x3334) { // I have to get back to bed... func_801477B4(play); EnInvadepoh_func_80B4B024(this); } @@ -3044,7 +3212,7 @@ void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play) { } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.weekEventReg[0x16] |= 2; + gSaveContext.save.weekEventReg[22] |= 2; EnInvadepoh_func_80B4AF80(this); } else { Actor_PickUp(&this->actor, play, 0x60, 2000.0f, 2000.0f); @@ -3057,7 +3225,7 @@ void EnInvadepoh_func_80B4AF80(EnInvadepoh* this) { void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_func_80B4560C(this, play, 0x3334); + EnInvadepoh_func_80B4560C(this, play, 0x3334); // I have to get back to bed.. func_80151BB4(play, 0x1E); func_80151BB4(play, 0x1D); func_80151BB4(play, 5); @@ -3068,7 +3236,7 @@ void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4B024(EnInvadepoh* this) { - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_func_80B4B048; } @@ -3092,7 +3260,7 @@ void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); this->actor.update = EnInvadepoh_func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); temp_s0->unk_30 = 0.08f; @@ -3107,7 +3275,7 @@ void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; - s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); this->actionFunc(this, play); @@ -3134,7 +3302,7 @@ void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this) { s32 pad; if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, 0x28EF); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); } } @@ -3193,7 +3361,7 @@ void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { this->unk_2F0--; } else if (this->unk_3BC >= 0) { if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { - Actor_PlaySfxAtPos(&this->actor, 0x290B); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } EnInvadepoh_func_80B4B724(this); } else { @@ -3214,7 +3382,7 @@ void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play) { (s16)0x64); EnInvadepoh_func_80B44E90(this, play); if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfxAtPos(&this->actor, 0x2910); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } if (this->unk_29C != 0) { EnInvadepoh_func_80B4B510(this); @@ -3241,7 +3409,7 @@ void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { if (Object_IsLoaded(&play->objectCtx, this->unk_2F4) && 1) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, 13); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, DOG_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); EnInvadepoh_func_80B44664(this, play); EnInvadepoh_func_80B4407C(this, 0); @@ -3251,7 +3419,7 @@ void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { if (D_80B4E940 == 2) { this->actor.update = EnInvadepoh_func_80B4BA84; this->actor.draw = EnInvadepoh_func_80B4E660; - this->actor.flags |= 1; + this->actor.flags |= ACTOR_FLAG_1; EnInvadepoh_func_80B4B430(this); } else if (D_80B4E940 == 1) { this->actor.update = EnInvadepoh_func_80B4BA30; @@ -3268,7 +3436,7 @@ void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2) { if (D_80B4E940 == 2) { this->actor.update = EnInvadepoh_func_80B4BA84; this->actor.draw = EnInvadepoh_func_80B4E660; - this->actor.flags |= 1; + this->actor.flags |= ACTOR_FLAG_1; EnInvadepoh_func_80B4B430(this); } } @@ -3276,7 +3444,7 @@ void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B4BA84(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 temp; s32 sp2C; s32 temp_v1_2; @@ -3342,15 +3510,15 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { if (sp50->unk_309 == 0) { this->unk_2F8 = 40.0f; this->unk_304 = -0x8000; - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else if (sp50->unk_309 < (sp50->unk_308 - 1)) { this->unk_2F8 = 40.0f; Math_ScaledStepToS(&this->unk_304, -0x4800, 0xC8); - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { Math_StepToF(&this->unk_2F8, 5.0f, 3.0f); Math_ScaledStepToS(&this->unk_304, -0x8000, 0x12C); - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } sp42 = this->unk_304 + sp50->actor.world.rot.y; this->actor.world.pos.x = (Math_SinS(sp42) * this->unk_2F8) + sp50->actor.world.pos.x; @@ -3379,11 +3547,11 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { } } - if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { - Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (gSaveContext.save.time >= 0xD801) { + if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { Actor_MarkForDeath(&this->actor); } else if ((sp50 != NULL) && (sp50->actionFunc == EnInvadepoh_func_80B4CB0C)) { EnInvadepoh_func_80B4C1BC(this); @@ -3453,23 +3621,23 @@ void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, CREMIA_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - this->actor.textId = 0x33CD; - if (sp38 < 0xD5A0) { + this->actor.textId = 0x33CD; // Good night... See you...tomorrow...OK? + if (sp38 < CLOCK_TIME(20, 01) + 30) { this->unk_304 = -0x8000; this->unk_2F8 = 40.0f; - } else if (sp38 >= 0xD7D4) { + } else if (sp38 > CLOCK_TIME(20, 14) + 1) { this->unk_304 = -0x4800; this->unk_2F8 = 20.0f; } else { this->unk_304 = -0x8000; this->unk_2F8 = 40.0f; } - if ((sp38 >= 0x4000) && (sp38 < 0xD573)) { + if ((CLOCK_TIME(6, 00) <= sp38) && (sp38 < CLOCK_TIME(20, 00) + 30)) { this->actor.update = EnInvadepoh_func_80B4C568; this->actor.draw = NULL; - } else if ((sp38 >= 0xD573) && (sp38 < 0xD800)) { + } else if ((CLOCK_TIME(20, 00) + 30 <= sp38) && (sp38 < CLOCK_TIME(20, 15))) { this->actor.update = EnInvadepoh_func_80B4C5C0; this->actor.draw = EnInvadepoh_func_80B4E7BC; EnInvadepoh_func_80B4BBE0(this); @@ -3483,7 +3651,7 @@ void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < 0xD800)) { + if ((gSaveContext.save.time >= CLOCK_TIME(20, 00) + 30) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { this->actor.update = EnInvadepoh_func_80B4C5C0; this->actor.draw = EnInvadepoh_func_80B4E7BC; EnInvadepoh_func_80B4BBE0(this); @@ -3493,7 +3661,7 @@ void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B4C5C0(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); if (sp28) { @@ -3552,10 +3720,10 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); } } - this->actor.flags &= ~9; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { this->unk_378 = 0; - this->actor.flags |= 9; + this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } sp60 = play->gameplayFrames % 0x80; if (sp60 & 0x40) { @@ -3572,9 +3740,9 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { temp_v1 = sp3A - this->actor.shape.rot.y; temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); } - if (CHECK_FLAG_ALL(this->actor.flags, 0x40) && + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, 0x3ABE); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_320 >= 0.9999f) { Actor_MarkForDeath(&this->actor); @@ -3646,7 +3814,7 @@ void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B446D0(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -3654,11 +3822,11 @@ void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { EnInvadepoh_func_80B44EFC(this, play); EnInvadepoh_func_80B43F0C(this); EnInvadepoh_func_80B4516C(this); - this->actor.textId = 0x33CE; - if ((sp38 >= 0x4000) && (sp38 < 0xD555)) { + this->actor.textId = 0x33CE; // See you tomorrow! + if ((sp38 >= CLOCK_TIME(6, 00)) && (sp38 < CLOCK_TIME(20, 00))) { this->actor.update = EnInvadepoh_func_80B4CFFC; this->actor.draw = NULL; - } else if ((sp38 >= 0xD555) && (sp38 < 0xD7E1)) { + } else if ((sp38 >= CLOCK_TIME(20, 00)) && (sp38 < CLOCK_TIME(20, 14) + 15)) { this->actor.update = EnInvadepoh_func_80B4D054; this->actor.draw = EnInvadepoh_func_80B4E324; EnInvadepoh_func_80B4C6C8(this); @@ -3672,7 +3840,7 @@ void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((gSaveContext.save.time >= 0xD555) && (gSaveContext.save.time < 0xD7E1)) { + if ((gSaveContext.save.time >= CLOCK_TIME(20, 00)) && (gSaveContext.save.time < CLOCK_TIME(20, 14) + 15)) { this->actor.update = EnInvadepoh_func_80B4D054; this->actor.draw = EnInvadepoh_func_80B4E324; EnInvadepoh_func_80B4C6C8(this); @@ -3682,7 +3850,7 @@ void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2) { void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, 0x40); + s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); if (sp28 != 0) { @@ -3702,12 +3870,17 @@ void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B4D15C(EnInvadepoh* this) { + static EnInvadepohUnkStruct1 D_80B4EE0C[3] = { + { 0.08f, 0x2BC, -0xA }, + { 0.09f, 0x12C, -5 }, + { 0.05f, 0x190, 0 }, + }; s32 pad; - s32 sp28 = this->actor.params & 7; + s32 sp28 = ENINVADEPOH_GET_PARAM_7(&this->actor); s32 pad2; Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; + this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; this->unk_389 = 0xFF; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; @@ -3756,7 +3929,7 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; + this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; this->unk_389 = 0xFF; this->actor.draw = NULL; this->unk_38B = 1; @@ -3823,13 +3996,13 @@ void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2) { s32 sp34; if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - sp34 = this->actor.params & 7; + sp34 = ENINVADEPOH_GET_PARAM_7(&this->actor); this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B45080(); this->actor.update = EnInvadepoh_func_80B4D760; SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->unk_188, this->unk_212, - 14); + ALIEN_LIMB_MAX); if (sp34 < 3) { EnInvadepoh_func_80B453F4(this, play, sp34); EnInvadepoh_func_80B4D15C(this); @@ -3848,27 +4021,27 @@ void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2) { if (this->actor.update != NULL) { SkelAnime_Update(&this->skelAnime); - func_800B9010(&this->actor, 0x320A); + func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); } } void EnInvadepoh_func_80B4D7B8(PlayState* play) { s32 i; - EnInvadepohStructD_80B50350* var_s2; + EnInvadepohWarpEffect* warpEffect; OPEN_DISPS(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - for (i = 0, var_s2 = D_80B50350; i < 10; i++, var_s2++) { - if (var_s2->unk_1 > 0) { + for (i = 0, warpEffect = D_80B50350; i < 10; i++, warpEffect++) { + if (warpEffect->timer > 0) { u32 temp_s5 = (play->gameplayFrames + (u8)(i * 0x10)) % 0x80; u32 temp_s6 = (play->gameplayFrames * -0xF) % 0x100; - Matrix_Translate(var_s2->unk_4.x, var_s2->unk_4.y, var_s2->unk_4.z, MTXMODE_NEW); + Matrix_Translate(warpEffect->pos.x, warpEffect->pos.y, warpEffect->pos.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, var_s2->unk_2); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, warpEffect->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); @@ -3885,10 +4058,11 @@ void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play) { s32 EnInvadepoh_func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { - return 0; + return false; } void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx) { + static Vec3f D_80B4EE24 = { 2000.0f, 1000.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; if ((limbIndex == 12) && (this->unk_38D != 0)) { @@ -4004,7 +4178,7 @@ s32 EnInvadepoh_func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f if (limbIndex == 5) { rot->x -= this->actor.shape.rot.x; } - return 0; + return false; } void EnInvadepoh_func_80B4E158(Actor* thisx, PlayState* play2) { @@ -4026,22 +4200,23 @@ void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2) { } s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 14) { + if (limbIndex == ROMANI_LIMB_HEAD) { EnInvadepoh* this = ((EnInvadepoh*)thisx); rot->x += this->unk_324.unk_20.y; rot->y += this->unk_324.unk_20.z; rot->z += this->unk_324.unk_20.x; - } else if (limbIndex == 13) { + } else if (limbIndex == ROMANI_LIMB_TORSO) { EnInvadepoh* this = ((EnInvadepoh*)thisx); rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); rot->z += this->unk_324.unk_40; } - return 0; + return false; } void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { + static Vec3f D_80B4EE30 = { 400.0f, 270.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; if (limbIndex == 19) { @@ -4058,8 +4233,8 @@ void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.unk_10.unk_F]); - gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.unk_00.unk_F]); + gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.mouthAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_func_80B4E200, EnInvadepoh_func_80B4E2AC, &this->actor); CLOSE_DISPS(play->state.gfxCtx); @@ -4095,14 +4270,14 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { } s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7)) { + if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = (EnInvadepoh*)thisx; rot->x += this->unk_324.unk_20.x; rot->y += this->unk_324.unk_20.y; rot->z += this->unk_324.unk_20.z; } - return 0; + return false; } void EnInvadepoh_func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { @@ -4125,18 +4300,18 @@ void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play) { } s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 9) { + if (limbIndex == CREMIA_LIMB_HEAD) { EnInvadepoh* this = (EnInvadepoh*)thisx; rot->x += this->unk_324.unk_20.y; rot->y += this->unk_324.unk_20.z; rot->z += this->unk_324.unk_20.x; - } else if (limbIndex == 2) { + } else if (limbIndex == CREMIA_LIMB_TORSO) { EnInvadepoh* this = (EnInvadepoh*)thisx; rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); } - return 0; + return false; } void EnInvadepoh_func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { @@ -4152,8 +4327,8 @@ void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.unk_10.unk_F]); - gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.unk_00.unk_F]); + gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.mouthAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_func_80B4E6E4, EnInvadepoh_func_80B4E784, &this->actor); CLOSE_DISPS(play->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 18d7d8809..efb6c611e 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -2,10 +2,16 @@ #define Z_EN_INVADEPOH_H #include "global.h" +#include "assets/objects/object_uch/object_uch.h" +#include "assets/objects/object_ma1/object_ma1.h" +#include "assets/objects/object_ma2/object_ma2.h" +#include "assets/objects/object_cow/object_cow.h" +#include "assets/objects/object_dog/object_dog.h" struct EnInvadepoh; typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh* this, PlayState* play); +typedef void (*EnInvadepohMainFunc)(Actor* thisx, PlayState* play); // PlayState, not GameState typedef struct { f32 unk0; @@ -13,62 +19,52 @@ typedef struct { s16 unk6; } EnInvadepohUnkStruct1; -typedef struct { - s8* unk0; - s8 unk4; -} EnInvadepohUnkStruct2; - -typedef struct { - s8 unk0; - EnInvadepohUnkStruct2* unk4; -} EnInvadepohUnkStruct3; - -typedef struct { - s8 unk0; - f32 unk4; -} EnInvadepohUnkStruct4; - -typedef struct { - s8 unk0; - EnInvadepohUnkStruct2* unk4; - s8 unk8; - EnInvadepohUnkStruct4* unkC; -} EnInvadepohUnkStruct5; - -typedef struct { - s8 unk0; - EnInvadepohUnkStruct2* unk4; - s8 unk8; - EnInvadepohUnkStruct4* unkC; - s16 unk10; - s16 unk12; -} EnInvadepohUnkStruct6; - -typedef union { - EnInvadepohUnkStruct3 unk3; - EnInvadepohUnkStruct5 unk5; - EnInvadepohUnkStruct6 unk6; -} EnInvadepohUnkUnion; - typedef struct { s8 unk_0; - s8 unk_1; - u8 unk_2; - Vec3f unk_4; -} EnInvadepohStructD_80B50350; + s8 timer; + u8 alpha; + Vec3f pos; +} EnInvadepohWarpEffect; typedef struct { - EnInvadepohUnkUnion** unk_0; - s8 unk_4; - EnInvadepohUnkUnion* unk_8; - s16 unk_C; - s8 unk_E; - s8 unk_F; -} EnInvadePohUnkStruct_324_1; + s8* index; + s8 count; +} EnInvadepohFaceFrame; typedef struct { - EnInvadePohUnkStruct_324_1 unk_00; - EnInvadePohUnkStruct_324_1 unk_10; + s8 type; + EnInvadepohFaceFrame* frames; +} EnInvadepohFaceAnim; + +typedef struct { + s8 index; + f32 chance; +} EnInvadepohFaceAnimNext; + +typedef struct { + EnInvadepohFaceAnim anim; + s8 nextCount; + EnInvadepohFaceAnimNext* nextAnims; +} EnInvadepohFaceAnimLoop; + +typedef struct { + EnInvadepohFaceAnimLoop loop; + s16 minDelay; + s16 maxDelay; +} EnInvadepohFaceAnimLoopDelayed; + +typedef struct { + EnInvadepohFaceAnim** animSet; + s8 curAnimType; + EnInvadepohFaceAnim* curAnim; + s16 delayTimer; + s8 curFrame; + s8 curIndex; +} EnInvadePohFaceInfo; + +typedef struct { + EnInvadePohFaceInfo eyeAnim; + EnInvadePohFaceInfo mouthAnim; Vec3s unk_20; Vec3s unk_26; s16 unk_2C; @@ -82,13 +78,16 @@ typedef struct { s16 unk_48; } EnInvadePohUnkStruct_324; -typedef void (*EnInvadepohUnkFunc) (EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); +typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnim**); + +#define EN_INVADEPOH_LIMB_MAX 23 +// #define EN_INVADEPOH_LIMB_MAX MAX(MAX(MAX(MAX(MAX(ALIEN_LIMB_MAX, ROMANI_LIMB_MAX), CREMIA_LIMB_MAX), DOG_LIMB_MAX), COW_LIMB_MAX), COW_TAIL_LIMB_MAX) typedef struct EnInvadepoh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s unk_188[23]; - /* 0x212 */ Vec3s unk_212[23]; + /* 0x188 */ Vec3s unk_188[EN_INVADEPOH_LIMB_MAX]; + /* 0x212 */ Vec3s unk_212[EN_INVADEPOH_LIMB_MAX]; /* 0x29C */ s8 unk_29C; /* 0x2A0 */ ColliderCylinder unk_2A0; /* 0x2EC */ EnInvadepohActionFunc actionFunc; @@ -133,6 +132,30 @@ typedef struct EnInvadepoh { /* 0x3BC */ s8 unk_3BC; } EnInvadepoh; // size = 0x3C0 +typedef enum { + ENINVADEPOH_HANDLER, // Invasion event handler + ENINVADEPOH_ALIEN_INVADER, // Alien invader + ENINVADEPOH_COW, // Abudcted cow, spawned by unused alien abductor + ENINVADEPOH_COW_TAIL, // Abducted cow tail, spawned by abducted cow + ENINVADEPOH_ROMANI_ABDUCTED, // Abducted Romani, spawned by unused alien abductor + ENINVADEPOH_ROMANI_CONFUSED, // Returned, confused Romani + ENINVADEPOH_LIGHT_BALL, // Light ball spaceship + ENINVADEPOH_ROMANI_NIGHT_1, // Romani running to barn on night 1 + ENINVADEPOH_ROMANI_UNKNOWN, // Unknown, possible duplicate of previous + ENINVADEPOH_ROMANI_REWARD, // Romani rewarding you for defeating invasion + ENINVADEPOH_DOG, // Dog during alien invasion + ENINVADEPOH_CREMIA_NIGHT_3, // Cremia walking from barn to house on night 3 + ENINVADEPOH_ROMANI_NIGHT_3, // Romnani walking from barn to house on night 3 + ENINVADEPOH_ALIEN_ABDUCTOR, // Alien abductor, unused, carries cow or Romani +} EnInvadepohParamsTypes; + +#define ENINVADEPOH_GET_PARAM_7(thisx) ((thisx)->params & 7) +#define ENINVADEPOH_GET_PARAM_F0(thisx) ((thisx)->params >> 4 & 0xF) +#define ENINVADEPOH_GET_PARAM_7F00(thisx) ((thisx)->params >> 8 & 0x7F) + +#define ENINVADEPOH_SET_PARAMS(p7F00, pF0, p7) (((p7) & 7) | (((p7F00) << 8) & 0x7F00) | (((pF0) << 4) & 0xF0)) + + extern ActorInit En_Invadepoh_InitVars; #endif // Z_EN_INVADEPOH_H diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c deleted file mode 100644 index 5545668c8..000000000 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_data.inc.c +++ /dev/null @@ -1,299 +0,0 @@ -#include "global.h" -#include "z_en_invadepoh.h" -#include "assets/objects/object_ma1/object_ma1.h" -#include "assets/objects/object_ma2/object_ma2.h" - -void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play); - -void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2); - -void EnInvadepoh_func_80B45A4C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); -void EnInvadepoh_func_80B45A94(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); -void EnInvadepoh_func_80B45B1C(EnInvadePohUnkStruct_324_1*, EnInvadepohUnkUnion**); - -void EnInvadepoh_func_80B46184(EnInvadepohStructD_80B50350* arg0); - -ColliderCylinderInit D_80B4E8B0 = { - { - 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 } }, -}; -ColliderCylinderInit D_80B4E8DC = { - { - 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 } }, -}; -ColliderCylinderInit D_80B4E908 = { - { - 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 } }, -}; -Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; -s32 D_80B4E940 = 0; -TexturePtr sRomaniEyeTextures[5] = { - gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, -}; -TexturePtr sRomaniMouthTextures[4] = { - gRomaniMouthHappyTex, - gRomaniMouthFrownTex, - gRomaniMouthHangingOpenTex, - gRomaniMouthSmileTex, -}; -s8 D_80B4E968 = 0; -TexturePtr sCremiaEyeTextures[6] = { - gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, -}; -TexturePtr sCremiaMouthTextures[4] = { - gCremiaMouthNormalTex, - gCremiaMouthSlightSmileTex, - gCremiaMouthFrownTex, - gCremiaMouthHangingOpenTex, -}; -s8 D_80B4E994 = 0; -s8 D_80B4E998 = 0; -s8 D_80B4E99C[1] = { 0 }; -s8 D_80B4E9A0[4] = { 0, 1, 2, 0 }; -s8 D_80B4E9A4[5] = { 0, 1, 2, 1, 0 }; -s8 D_80B4E9AC[6] = { 0, 1, 2, 2, 1, 0 }; -s8 D_80B4E9B4[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; -s8 D_80B4E9BC[1] = { 1 }; -s8 D_80B4E9C0[1] = { 3 }; -EnInvadepohUnkStruct2 D_80B4E9C4 = { D_80B4E99C, 1 }; -EnInvadepohUnkStruct2 D_80B4E9CC = { D_80B4E9A0, 4 }; -EnInvadepohUnkStruct2 D_80B4E9D4 = { D_80B4E9A4, 5 }; -EnInvadepohUnkStruct2 D_80B4E9DC = { D_80B4E9AC, 6 }; -EnInvadepohUnkStruct2 D_80B4E9E4 = { D_80B4E9B4, 8 }; -EnInvadepohUnkStruct2 D_80B4E9EC = { D_80B4E9BC, 1 }; -EnInvadepohUnkStruct2 D_80B4E9F4 = { D_80B4E9C0, 1 }; -EnInvadepohUnkStruct3 D_80B4E9FC = { 0, &D_80B4E9C4 }; -EnInvadepohUnkStruct4 D_80B4EA04[4] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.97f }, - { 5, 1.0f }, -}; -EnInvadepohUnkStruct4 D_80B4EA24[1] = { 1, 1.0f }; -EnInvadepohUnkStruct6 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 40, 60 }; -EnInvadepohUnkStruct5 D_80B4EA40 = { 1, &D_80B4E9CC, 1, D_80B4EA24 }; -EnInvadepohUnkStruct5 D_80B4EA50 = { 1, &D_80B4E9D4, 1, D_80B4EA24 }; -EnInvadepohUnkStruct5 D_80B4EA60 = { 1, &D_80B4E9DC, 1, D_80B4EA24 }; -EnInvadepohUnkStruct5 D_80B4EA70 = { 1, &D_80B4E9E4, 1, D_80B4EA24 }; -EnInvadepohUnkStruct3 D_80B4EA80 = { 0, &D_80B4E9EC }; -EnInvadepohUnkStruct3 D_80B4EA88 = { 0, &D_80B4E9F4 }; -EnInvadepohUnkUnion* D_80B4EA90[8] = { - (EnInvadepohUnkUnion*)&D_80B4E9FC, (EnInvadepohUnkUnion*)&D_80B4EA2C, (EnInvadepohUnkUnion*)&D_80B4EA40, - (EnInvadepohUnkUnion*)&D_80B4EA50, (EnInvadepohUnkUnion*)&D_80B4EA60, (EnInvadepohUnkUnion*)&D_80B4EA70, - (EnInvadepohUnkUnion*)&D_80B4EA80, (EnInvadepohUnkUnion*)&D_80B4EA88, -}; -s8 D_80B4EAB0[1] = { 0 }; -s8 D_80B4EAB4[1] = { 1 }; -s8 D_80B4EAB8[1] = { 2 }; -s8 D_80B4EABC[1] = { 3 }; -EnInvadepohUnkStruct2 D_80B4EAC0 = { D_80B4EAB0, 1 }; -EnInvadepohUnkStruct2 D_80B4EAC8 = { D_80B4EAB4, 1 }; -EnInvadepohUnkStruct2 D_80B4EAD0 = { D_80B4EAB8, 1 }; -EnInvadepohUnkStruct2 D_80B4EAD8 = { D_80B4EABC, 1 }; -EnInvadepohUnkStruct3 D_80B4EAE0 = { 0, &D_80B4EAC0 }; -EnInvadepohUnkStruct3 D_80B4EAE8 = { 0, &D_80B4EAC8 }; -EnInvadepohUnkStruct3 D_80B4EAF0 = { 0, &D_80B4EAD0 }; -EnInvadepohUnkStruct3 D_80B4EAF8 = { 0, &D_80B4EAD8 }; -EnInvadepohUnkUnion* D_80B4EB00[4] = { - (EnInvadepohUnkUnion*)&D_80B4EAE0, - (EnInvadepohUnkUnion*)&D_80B4EAE8, - (EnInvadepohUnkUnion*)&D_80B4EAF0, - (EnInvadepohUnkUnion*)&D_80B4EAF8, -}; -s8 D_80B4EB10[1] = { 0 }; -s8 D_80B4EB14[4] = { 0, 1, 2, 0 }; -s8 D_80B4EB18[5] = { 0, 1, 2, 1, 0 }; -s8 D_80B4EB20[6] = { 0, 1, 2, 2, 1, 0 }; -s8 D_80B4EB28[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; -EnInvadepohUnkStruct2 D_80B4EB30 = { D_80B4EB10, 1 }; -EnInvadepohUnkStruct2 D_80B4EB38 = { D_80B4EB14, 4 }; -EnInvadepohUnkStruct2 D_80B4EB40 = { D_80B4EB18, 5 }; -EnInvadepohUnkStruct2 D_80B4EB48 = { D_80B4EB20, 6 }; -EnInvadepohUnkStruct2 D_80B4EB50 = { D_80B4EB28, 8 }; -EnInvadepohUnkStruct3 D_80B4EB58 = { 0, &D_80B4EB30 }; -EnInvadepohUnkStruct4 D_80B4EB60[4] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.95f }, - { 5, 1.0f }, -}; -EnInvadepohUnkStruct4 D_80B4EB80[1] = { 1, 1.0f }; -EnInvadepohUnkStruct6 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 40, 60 }; -EnInvadepohUnkStruct5 D_80B4EB9C = { 1, &D_80B4EB38, 1, D_80B4EB80 }; -EnInvadepohUnkStruct5 D_80B4EBAC = { 1, &D_80B4EB40, 1, D_80B4EB80 }; -EnInvadepohUnkStruct5 D_80B4EBBC = { 1, &D_80B4EB48, 1, D_80B4EB80 }; -EnInvadepohUnkStruct5 D_80B4EBCC = { 1, &D_80B4EB50, 1, D_80B4EB80 }; -EnInvadepohUnkUnion* D_80B4EBDC[6] = { - (EnInvadepohUnkUnion*)&D_80B4EB58, (EnInvadepohUnkUnion*)&D_80B4EB88, (EnInvadepohUnkUnion*)&D_80B4EB9C, - (EnInvadepohUnkUnion*)&D_80B4EBAC, (EnInvadepohUnkUnion*)&D_80B4EBBC, (EnInvadepohUnkUnion*)&D_80B4EBCC, -}; -s8 D_80B4EBF4[1] = { 0 }; -EnInvadepohUnkStruct2 D_80B4EBF8 = { D_80B4EBF4, 1 }; -EnInvadepohUnkStruct3 D_80B4EC00 = { 0, &D_80B4EBF8 }; -EnInvadepohUnkUnion* D_80B4EC08[1] = { (EnInvadepohUnkUnion*)&D_80B4EC00 }; -EnInvadepohUnkFunc D_80B4EC0C[3] = { - EnInvadepoh_func_80B45A4C, - EnInvadepoh_func_80B45A94, - EnInvadepoh_func_80B45B1C, -}; - -Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; -Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; -void (*D_80B4EC20[1])(EnInvadepohStructD_80B50350*) = { EnInvadepoh_func_80B46184 }; -InitChainEntry D_80B4EC24[4] = { - 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), -}; -InitChainEntry D_80B4EC34[4] = { - 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), -}; -InitChainEntry D_80B4EC44[4] = { - 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), -}; -InitChainEntry D_80B4EC54[5] = { - 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), -}; -InitChainEntry D_80B4EC68[6] = { - 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(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), -}; -InitChainEntry D_80B4EC80[6] = { - 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), -}; -InitChainEntry D_80B4EC98[6] = { - 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), -}; -ActorFunc D_80B4ECB0[14] = { - EnInvadepoh_func_80B4627C, EnInvadepoh_func_80B46414, EnInvadepoh_func_80B46520, EnInvadepoh_func_80B465CC, - EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46644, EnInvadepoh_func_80B468B4, EnInvadepoh_func_80B46644, - EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46644, EnInvadepoh_func_80B469C4, EnInvadepoh_func_80B46A80, - EnInvadepoh_func_80B46644, EnInvadepoh_func_80B46414, -}; -ActorFunc D_80B4ECE8[14] = { - EnInvadepoh_func_80B46BB0, EnInvadepoh_func_80B46BC0, EnInvadepoh_func_80B46C08, EnInvadepoh_func_80B46C34, - EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C7C, EnInvadepoh_func_80B46C50, - EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C50, EnInvadepoh_func_80B46C94, EnInvadepoh_func_80B46CC0, - EnInvadepoh_func_80B46CF4, EnInvadepoh_func_80B46D28, -}; -s16 D_80B4ED20[8] = { - 130, 125, 115, 100, 80, 78, 76, 74, -}; -Vec3f D_80B4ED30[5] = { - { 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 }, -}; -Vec3f D_80B4ED6C[7] = { - { 0.0005f, 0.027999999f, 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 }, -}; -s16 D_80B4EDC0[3] = { -0x1F40, -0x1770, -0x2AF8 }; -s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; -Vec3f D_80B4EDD0[5] = { - { -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 }, -}; -EnInvadepohUnkStruct1 D_80B4EE0C[3] = { - { 0.08f, 0x2BC, -0xA }, - { 0.09f, 0x12C, -5 }, - { 0.05f, 0x190, 0 }, -}; -Vec3f D_80B4EE24 = { 2000.0f, 1000.0f, 0.0f }; -Vec3f D_80B4EE30 = { 400.0f, 270.0f, 0.0f }; - -MtxF D_80B502A0; -MtxF D_80B502E0; -EnInvadepoh* D_80B50320[8]; -u8 D_80B50340[8]; -s8 D_80B50348; -EnInvadepohStructD_80B50350 D_80B50350[10]; -Actor* D_80B503F0; -EnInvadepoh* D_80B503F4; -EnInvadepoh* D_80B503F8; -AnimatedMaterial* sAlienEyeBeamTexAnim; -AnimatedMaterial* sAlienEmptyTexAnim; -s16 D_80B50404[3]; -s16 D_80B5040A; -EnInvadepoh* D_80B5040C; From 60c1b09fbc563f5727e9e71c18f8f7c5e418ae0e Mon Sep 17 00:00:00 2001 From: petrie911 Date: Fri, 14 Apr 2023 12:28:09 -0500 Subject: [PATCH 05/10] back port cleanup changes --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 240 +++++++++++------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 97 ++++--- 2 files changed, 190 insertions(+), 147 deletions(-) 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 3562484de..326e196d5 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -109,7 +109,7 @@ void EnInvadepoh_func_80B499BC(EnInvadepoh* this); void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4A570(EnInvadepoh* this); void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play); @@ -177,6 +177,7 @@ ColliderCylinderInit D_80B4E8B0 = { }, { 40, 95, 10, { 0, 0, 0 } }, }; + ColliderCylinderInit D_80B4E8DC = { { COLTYPE_NONE, @@ -196,6 +197,7 @@ ColliderCylinderInit D_80B4E8DC = { }, { 18, 46, 0, { 0, 0, 0 } }, }; + ColliderCylinderInit D_80B4E908 = { { COLTYPE_NONE, @@ -215,8 +217,11 @@ ColliderCylinderInit D_80B4E908 = { }, { 13, 19, 0, { 0, 0, 0 } }, }; + Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; + s32 D_80B4E940 = 0; + TexturePtr sRomaniEyeTextures[5] = { gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, }; @@ -227,10 +232,10 @@ TexturePtr sRomaniMouthTextures[4] = { gRomaniMouthSmileTex, }; s8 D_80B4E968 = 0; + TexturePtr sCremiaEyeTextures[6] = { gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, }; - TexturePtr sCremiaMouthTextures[4] = { gCremiaMouthNormalTex, gCremiaMouthSlightSmileTex, @@ -238,6 +243,7 @@ TexturePtr sCremiaMouthTextures[4] = { gCremiaMouthHangingOpenTex, }; s8 D_80B4E994 = 0; + s8 D_80B4E998 = 0; MtxF D_80B502A0; @@ -262,7 +268,8 @@ void EnInvadepoh_func_80B439B0(s32 arg0, s32 arg1) { if ((arg0 % 2) == 0) { gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); } else { - gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); + gSaveContext.save.unk_E88[arg0 >> 1] = + (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); } } @@ -598,7 +605,8 @@ void EnInvadepoh_func_80B44700(EnInvadepoh* this) { } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 14) + 15) || (gSaveContext.save.time < CLOCK_TIME(6, 00))) { this->unk_320 = 1.0f; } else { - f32 temp = (gSaveContext.save.time - CLOCK_TIME(20, 00)) * (1.0f / (CLOCK_TIME(20, 14) + 15 - CLOCK_TIME(20, 00))); + f32 temp = + (gSaveContext.save.time - CLOCK_TIME(20, 00)) * (1.0f / (CLOCK_TIME(20, 14) + 15 - CLOCK_TIME(20, 00))); this->unk_320 = temp; this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); @@ -881,9 +889,9 @@ void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { s32 var_s3; for (var_s3 = 0; var_s3 < this->unk_379; var_s3++) { - D_80B50320[var_s3] = - (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(var_s2, ENINVADEPOH_ALIEN_INVADER, var_s3)); + D_80B50320[var_s3] = (EnInvadepoh*)Actor_Spawn( + &play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(var_s2, ENINVADEPOH_ALIEN_INVADER, var_s3)); if (var_s2 != 0xFF) { Path* temp_v0 = &play->setupPathList[var_s2]; @@ -893,18 +901,21 @@ void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, arg2)); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, + this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, + ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, arg2)); } void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_ROMANI_ABDUCTED, 0)); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, + this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, + ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_ROMANI_ABDUCTED, 0)); } void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); + D_80B503F0 = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); } void EnInvadepoh_func_80B45518(Vec3f* arg0) { @@ -1024,7 +1035,7 @@ void EnInvadepoh_func_80B459E8(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim* a arg0->curFrame = 0; arg0->curIndex = arg1->frames->index[0]; if (arg0->curAnimType == 2) { - EnInvadepohFaceAnimLoopDelayed* temp = (EnInvadepohFaceAnimLoopDelayed*) arg1; + EnInvadepohFaceAnimLoopDelayed* temp = (EnInvadepohFaceAnimLoopDelayed*)arg1; arg0->delayTimer = Rand_S16Offset(temp->minDelay, temp->maxDelay); } @@ -1041,7 +1052,7 @@ void EnInvadepoh_func_80B45A4C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** } void EnInvadepoh_func_80B45A94(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { - EnInvadepohFaceAnimLoop* temp_v0 = (EnInvadepohFaceAnimLoop*) arg0->curAnim; + EnInvadepohFaceAnimLoop* temp_v0 = (EnInvadepohFaceAnimLoop*)arg0->curAnim; EnInvadepohFaceFrame* temp_v1 = temp_v0->anim.frames; if (arg0->curFrame < (temp_v1->count - 1)) { @@ -1055,7 +1066,7 @@ void EnInvadepoh_func_80B45A94(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** } void EnInvadepoh_func_80B45B1C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { - EnInvadepohFaceAnimLoopDelayed* temp_v0 = (EnInvadepohFaceAnimLoopDelayed*) arg0->curAnim; + EnInvadepohFaceAnimLoopDelayed* temp_v0 = (EnInvadepohFaceAnimLoopDelayed*)arg0->curAnim; EnInvadepohFaceFrame* temp_v1 = temp_v0->loop.anim.frames; if (arg0->curFrame < (temp_v1->count - 1)) { @@ -1064,7 +1075,8 @@ void EnInvadepoh_func_80B45B1C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** } else if (arg0->delayTimer > 0) { arg0->delayTimer--; } else { - EnInvadepohFaceAnim* temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->loop.nextAnims, temp_v0->loop.nextCount)]; + EnInvadepohFaceAnim* temp_a1 = + arg1[EnInvadepoh_func_80B45980(temp_v0->loop.nextAnims, temp_v0->loop.nextCount)]; EnInvadepoh_func_80B459E8(arg0, temp_a1); } @@ -1092,17 +1104,16 @@ EnInvadepohFaceAnimNext D_80B4EA04[4] = { { 5, 1.0f }, }; EnInvadepohFaceAnimNext D_80B4EA24[1] = { 1, 1.0f }; -EnInvadepohFaceAnimLoopDelayed D_80B4EA2C = { {{2, &D_80B4E9C4}, 4, D_80B4EA04}, 40, 60 }; -EnInvadepohFaceAnimLoop D_80B4EA40 = { {1, &D_80B4E9CC}, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA50 = { {1, &D_80B4E9D4}, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA60 = { {1, &D_80B4E9DC}, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA70 = { {1, &D_80B4E9E4}, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoopDelayed D_80B4EA2C = { { { 2, &D_80B4E9C4 }, 4, D_80B4EA04 }, 40, 60 }; +EnInvadepohFaceAnimLoop D_80B4EA40 = { { 1, &D_80B4E9CC }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA50 = { { 1, &D_80B4E9D4 }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA60 = { { 1, &D_80B4E9DC }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimLoop D_80B4EA70 = { { 1, &D_80B4E9E4 }, 1, D_80B4EA24 }; EnInvadepohFaceAnim D_80B4EA80 = { 0, &D_80B4E9EC }; EnInvadepohFaceAnim D_80B4EA88 = { 0, &D_80B4E9F4 }; EnInvadepohFaceAnim* D_80B4EA90[8] = { - &D_80B4E9FC, &D_80B4EA2C.loop.anim, &D_80B4EA40.anim, - &D_80B4EA50.anim, &D_80B4EA60.anim, &D_80B4EA70.anim, - &D_80B4EA80, &D_80B4EA88, + &D_80B4E9FC, &D_80B4EA2C.loop.anim, &D_80B4EA40.anim, &D_80B4EA50.anim, + &D_80B4EA60.anim, &D_80B4EA70.anim, &D_80B4EA80, &D_80B4EA88, }; s8 D_80B4EAB0[1] = { 0 }; @@ -1142,14 +1153,13 @@ EnInvadepohFaceAnimNext D_80B4EB60[4] = { { 5, 1.0f }, }; EnInvadepohFaceAnimNext D_80B4EB80[1] = { 1, 1.0f }; -EnInvadepohFaceAnimLoopDelayed D_80B4EB88 = { {{2, &D_80B4EB30}, 4, D_80B4EB60}, 40, 60 }; -EnInvadepohFaceAnimLoop D_80B4EB9C = { {1, &D_80B4EB38}, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBAC = { {1, &D_80B4EB40}, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBBC = { {1, &D_80B4EB48}, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBCC = { {1, &D_80B4EB50}, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoopDelayed D_80B4EB88 = { { { 2, &D_80B4EB30 }, 4, D_80B4EB60 }, 40, 60 }; +EnInvadepohFaceAnimLoop D_80B4EB9C = { { 1, &D_80B4EB38 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBAC = { { 1, &D_80B4EB40 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBBC = { { 1, &D_80B4EB48 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimLoop D_80B4EBCC = { { 1, &D_80B4EB50 }, 1, D_80B4EB80 }; EnInvadepohFaceAnim* D_80B4EBDC[6] = { - &D_80B4EB58, &D_80B4EB88.loop.anim, &D_80B4EB9C.anim, - &D_80B4EBAC.anim, &D_80B4EBBC.anim, &D_80B4EBCC.anim, + &D_80B4EB58, &D_80B4EB88.loop.anim, &D_80B4EB9C.anim, &D_80B4EBAC.anim, &D_80B4EBBC.anim, &D_80B4EBCC.anim, }; s8 D_80B4EBF4[1] = { 0 }; @@ -1383,7 +1393,7 @@ void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play) { } this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_UCH); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -1399,10 +1409,11 @@ void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, D_80B4EC34); this->actor.update = EnInvadepoh_func_80B47FA8; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW_TAIL, 0)); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, + ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW_TAIL, 0)); this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -1420,7 +1431,7 @@ void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_func_80B481C4; this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -1430,7 +1441,7 @@ InitChainEntry D_80B4EC54[5] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play) { - // PlayState* play = play2; Stack management problems + // PlayState* play = play2; Stack management problems EnInvadepoh* this = (EnInvadepoh*)thisx; s32 temp_v1 = ENINVADEPOH_GET_PARAM_F0(&this->actor); @@ -1463,25 +1474,25 @@ void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play) { } this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA1); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { if (gSaveContext.save.weekEventReg[22] & 1) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } else if (temp_v1 == ENINVADEPOH_ROMANI_UNKNOWN) { // nothing } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3) { if (!(gSaveContext.save.weekEventReg[22] & 1)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } D_80B503F4 = this; } @@ -1509,7 +1520,7 @@ void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { this->actor.world.pos.y += 1500.0f; EnInvadepoh_func_80B49628(this); } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -1533,7 +1544,7 @@ void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_DOG); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -1558,10 +1569,10 @@ void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA2); if (this->unk_2F4 < 0) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } if (!(gSaveContext.save.weekEventReg[22] & 1)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } D_80B503F8 = this; } @@ -1665,18 +1676,18 @@ void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { static ActorFunc D_80B4ECE8[14] = { EnInvadepoh_func_80B46BB0, // Event handler - EnInvadepoh_func_80B46BC0, // Alien invader + EnInvadepoh_func_80B46BC0, // Alien invader EnInvadepoh_func_80B46C08, // Abducted cow EnInvadepoh_func_80B46C34, // Cow tail - EnInvadepoh_func_80B46C50, // Abducted Romani + EnInvadepoh_func_80B46C50, // Abducted Romani EnInvadepoh_func_80B46C50, // Confused Romani EnInvadepoh_func_80B46C7C, // Light ball EnInvadepoh_func_80B46C50, // Night 1 Romani - EnInvadepoh_func_80B46C50, // Unknown Romani + EnInvadepoh_func_80B46C50, // Unknown Romani EnInvadepoh_func_80B46C50, // Reward Romani EnInvadepoh_func_80B46C94, // Dog EnInvadepoh_func_80B46CC0, // Night 3 Cremia - EnInvadepoh_func_80B46CF4, // Night 3 Romani + EnInvadepoh_func_80B46CF4, // Night 3 Romani EnInvadepoh_func_80B46D28, // Alien abductor }; @@ -1833,7 +1844,7 @@ void EnInvadepoh_func_80B47278(EnInvadepoh* this) { void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play) { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); - gSaveContext.nextCutsceneIndex = 0xFFF3; + gSaveContext.nextCutsceneIndex = 0xFFF3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; gSaveContext.nextTransitionType = TRANS_TYPE_72; @@ -1957,11 +1968,11 @@ void EnInvadepoh_func_80B4770C(EnInvadepoh* this) { this->unk_2A0.base.atFlags |= AT_ON; this->unk_2A0.base.acFlags |= AC_ON; this->unk_2A0.base.ocFlags1 |= OC1_ON; - this->unk_389 = 0xFF; + this->unk_389 = 255; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; - this->unk_38D = 0xFF; + this->unk_38D = 255; this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B477B4; } @@ -1982,7 +1993,7 @@ void EnInvadepoh_func_80B47830(EnInvadepoh* this) { this->unk_2A0.base.ocFlags1 |= OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10); - this->unk_389 = 0xFF; + this->unk_389 = 255; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; @@ -2007,12 +2018,12 @@ void EnInvadepoh_func_80B47938(EnInvadepoh* this) { this->unk_2A0.base.ocFlags1 &= ~OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_2F0 = 0xA; - this->unk_389 = 0xFF; + this->unk_2F0 = 10; + this->unk_389 = 255; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; - this->unk_38D = 0xFF; + this->unk_38D = 255; this->actor.flags |= ACTOR_FLAG_80000000; this->actionFunc = EnInvadepoh_func_80B479E8; } @@ -2034,7 +2045,7 @@ void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { temp = &D_80B4ED30[this->unk_2F2]; if (temp->x > 0.0f) { this->unk_38B = 1; - this->unk_38D = 0xFF; + this->unk_38D = 255; Math_Vec3f_Copy(&this->actor.scale, temp); } else { this->unk_38B = 0; @@ -2081,7 +2092,8 @@ void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B45080(); this->actor.update = EnInvadepoh_func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, ALIEN_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, + ALIEN_LIMB_MAX); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame / 8.0f; EnInvadepoh_func_80B444BC(this, play); EnInvadepoh_func_80B442E4(this); @@ -2097,7 +2109,7 @@ void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { EnInvadepoh_func_80B47568(this); } } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } } @@ -2113,7 +2125,7 @@ void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { thisx->gravity = 0.0f; EnInvadepoh_func_80B47830(this); } else if ((this->actionFunc == EnInvadepoh_func_80B474DC) || (this->actionFunc == EnInvadepoh_func_80B473E4)) { - Actor_MarkForDeath(thisx); + Actor_Kill(thisx); return; } } else if (this->unk_2A0.base.acFlags & AC_HIT) { @@ -2178,7 +2190,7 @@ void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { s32 sp6C; if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); return; } sp6C = ENINVADEPOH_GET_PARAM_7(&this->actor); @@ -2210,7 +2222,8 @@ void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnInvadepoh_func_80B4827C; this->actor.draw = EnInvadepoh_func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, COW_TAIL_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, + COW_TAIL_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); } } @@ -2220,7 +2233,7 @@ void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } else { SkelAnime_Update(&this->skelAnime); } @@ -2326,7 +2339,8 @@ void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); this->actor.update = EnInvadepoh_func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); @@ -2340,7 +2354,7 @@ void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2) { EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; if (this->actor.parent == NULL) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); return; } this->actionFunc(this, play); @@ -2392,7 +2406,7 @@ void EnInvadepoh_func_80B48948(EnInvadepoh* this) { EnInvadePohUnkStruct_324* sp24 = &this->unk_324; f32 sp28 = Rand_ZeroOne(); - this->unk_2F0 = Rand_S16Offset(0x96, 0x96); + this->unk_2F0 = Rand_S16Offset(150, 150); if (sp28 < 0.5f) { this->unk_374 = 0; Math_Vec3s_Copy(&sp24->unk_26, &gZeroVec3s); @@ -2521,7 +2535,8 @@ void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_func_80B490F0; this->actor.draw = EnInvadepoh_func_80B4E324; this->actor.textId = 0x3330; // ........ - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B444F4(this, play); EnInvadepoh_func_80B4407C(this, 0); @@ -2721,7 +2736,7 @@ void EnInvadepoh_func_80B49904(EnInvadepoh* this) { this->unk_3A4 = 0.01f; this->actor.gravity = 1.0f; this->unk_3AA = 0xBB8; - this->unk_2F0 = 0x3C; + this->unk_2F0 = 60; this->actionFunc = EnInvadepoh_func_80B4994C; } @@ -2732,7 +2747,7 @@ void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play) { if (this->unk_2F0 > 0) { this->unk_2F0--; } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -2820,7 +2835,7 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_320 >= 0.9999f) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -2865,7 +2880,8 @@ void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B44540(this, play); EnInvadepoh_func_80B44570(this); @@ -2889,7 +2905,7 @@ void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { this->actor.draw = EnInvadepoh_func_80B4E324; EnInvadepoh_func_80B49BD0(this); } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } } @@ -3088,7 +3104,8 @@ void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B44620(this, play2); if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 00))) { @@ -3260,7 +3277,8 @@ void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); this->actor.update = EnInvadepoh_func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); temp_s0->unk_30 = 0.08f; @@ -3409,7 +3427,8 @@ void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { if (Object_IsLoaded(&play->objectCtx, this->unk_2F4) && 1) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, DOG_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, + DOG_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); EnInvadepoh_func_80B44664(this, play); EnInvadepoh_func_80B4407C(this, 0); @@ -3424,7 +3443,7 @@ void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { } else if (D_80B4E940 == 1) { this->actor.update = EnInvadepoh_func_80B4BA30; } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } } @@ -3552,7 +3571,7 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } else if ((sp50 != NULL) && (sp50->actionFunc == EnInvadepoh_func_80B4CB0C)) { EnInvadepoh_func_80B4C1BC(this); } @@ -3621,7 +3640,8 @@ void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, CREMIA_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, + CREMIA_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; // Good night... See you...tomorrow...OK? if (sp38 < CLOCK_TIME(20, 01) + 30) { @@ -3642,7 +3662,7 @@ void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { this->actor.draw = EnInvadepoh_func_80B4E7BC; EnInvadepoh_func_80B4BBE0(this); } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } } @@ -3745,7 +3765,7 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->unk_320 >= 0.9999f) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_func_80B4C058)) { EnInvadepoh_func_80B4CC70(this); } @@ -3814,7 +3834,8 @@ void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { this->actor.objBankIndex = this->unk_2F4; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, ROMANI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B446D0(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -3831,7 +3852,7 @@ void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { this->actor.draw = EnInvadepoh_func_80B4E324; EnInvadepoh_func_80B4C6C8(this); } else { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } } @@ -3881,11 +3902,11 @@ void EnInvadepoh_func_80B4D15C(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; - this->unk_389 = 0xFF; + this->unk_389 = 255; this->actor.draw = EnInvadepoh_func_80B4DB14; this->unk_38B = 1; this->unk_38C = 0; - this->unk_38D = 0xFF; + this->unk_38D = 255; this->unk_300 = D_80B4EE0C[sp28].unk0; this->unk_304 = sp28 * 0x5555; this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; @@ -3903,7 +3924,7 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { f32 sp28; if (D_80B503F0 == NULL) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); return; } Math_StepToF(&this->actor.velocity.y, 15.0f, this->unk_300); @@ -3923,18 +3944,18 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { sp2C->shape.rot.y = this->actor.shape.rot.y; } if (sp28 < 5.0f) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; - this->unk_389 = 0xFF; + this->unk_389 = 255; this->actor.draw = NULL; this->unk_38B = 1; this->unk_38C = 0; - this->unk_38D = 0xFF; + this->unk_38D = 255; this->unk_306 = 0x190; this->unk_304 = 0; this->unk_2F0 = 200; @@ -3986,7 +4007,7 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { } } if ((this->unk_2F0 <= 0) || sp2C) { - Actor_MarkForDeath(&this->actor); + Actor_Kill(&this->actor); } } @@ -4049,6 +4070,7 @@ void EnInvadepoh_func_80B4D7B8(PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_02E510); } } + CLOSE_DISPS(play->state.gfxCtx); } @@ -4065,14 +4087,14 @@ void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 static Vec3f D_80B4EE24 = { 2000.0f, 1000.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((limbIndex == 12) && (this->unk_38D != 0)) { + if ((limbIndex == ALIEN_LIMB_LEFT_EYE) && (this->unk_38D != 0)) { Matrix_Push(); Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x3830, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); Matrix_Get(&D_80B502A0); Matrix_Pop(); - } else if ((limbIndex == 13) && (this->unk_38D != 0)) { + } else if ((limbIndex == ALIEN_LIMB_RIGHT_EYE) && (this->unk_38D != 0)) { Matrix_Push(); Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); @@ -4090,10 +4112,11 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Push(); if (this->unk_38B != 0) { - if (this->unk_389 == 0xFF) { + if (this->unk_389 == 255) { func_8012C28C(play->state.gfxCtx); AnimatedMat_Draw(play, sAlienEmptyTexAnim); Scene_SetRenderModeXlu(play, 0, 1); @@ -4113,8 +4136,10 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { Gfx* ptr; AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); + OPEN_DISPS(play->state.gfxCtx); ptr = POLY_XLU_DISP; + gDPPipeSync(ptr++); gDPSetPrimColor(ptr++, 0, 0xFF, 240, 180, 100, 60); gDPSetEnvColor(ptr++, 255, 255, 255, 100.0f / 170.0f * this->unk_38D); @@ -4146,30 +4171,40 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); ptr = POLY_XLU_DISP; + ptr = func_8012C868(ptr); + gDPSetDither(ptr++, G_CD_NOISE); gDPSetCombineLERP(ptr++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); Matrix_MultVecZ(60.0f, &sp80); + sp74.x = this->actor.world.pos.x + sp80.x; sp74.y = this->actor.world.pos.y + sp80.y + 68.0f; sp74.z = this->actor.world.pos.z + sp80.z; + Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); + temp = 100.0f / 255.0f * this->unk_389; + gSPDisplayList(ptr++, gameplay_keep_DL_029CB0); gDPSetPrimColor(ptr++, 0, 0, 240, 180, 100, temp); gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); gSPDisplayList(ptr++, gameplay_keep_DL_029CF0); + POLY_XLU_DISP = ptr; - if ((this->unk_389 > 0x80) && EnInvadepoh_func_80B456A8(play, &sp74)) { + if ((this->unk_389 > 128) && EnInvadepoh_func_80B456A8(play, &sp74)) { func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); } + CLOSE_DISPS(play->state.gfxCtx); } Matrix_Pop(); + CLOSE_DISPS(play->state.gfxCtx); } @@ -4219,11 +4254,13 @@ void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 static Vec3f D_80B4EE30 = { 400.0f, 270.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == 19) { + if (limbIndex == ROMANI_LIMB_LEFT_HAND) { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); + CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 14) { + } else if (limbIndex == ROMANI_LIMB_HEAD) { Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); } } @@ -4232,11 +4269,13 @@ void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_func_80B4E200, EnInvadepoh_func_80B4E2AC, &this->actor); + CLOSE_DISPS(play->state.gfxCtx); } @@ -4257,6 +4296,7 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { Matrix_RotateZS(this->unk_304, MTXMODE_APPLY); OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); @@ -4266,11 +4306,13 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { if (EnInvadepoh_func_80B456A8(play, &sp5C)) { func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); } + CLOSE_DISPS(play->state.gfxCtx); } s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { + if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || + (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = (EnInvadepoh*)thisx; rot->x += this->unk_324.unk_20.x; @@ -4292,10 +4334,12 @@ void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_func_80B4E5B0, EnInvadepoh_func_80B4E61C, &this->actor); + CLOSE_DISPS(play->state.gfxCtx); } @@ -4326,10 +4370,12 @@ void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_func_80B4E6E4, EnInvadepoh_func_80B4E784, &this->actor); + CLOSE_DISPS(play->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 efb6c611e..12807d614 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -14,69 +14,69 @@ typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh* this, PlayState* play) typedef void (*EnInvadepohMainFunc)(Actor* thisx, PlayState* play); // PlayState, not GameState typedef struct { - f32 unk0; - s16 unk4; - s16 unk6; -} EnInvadepohUnkStruct1; + /* 0x0 */ f32 unk0; + /* 0x4 */ s16 unk4; + /* 0x6 */ s16 unk6; +} EnInvadepohUnkStruct1; // size = 0x8 typedef struct { - s8 unk_0; - s8 timer; - u8 alpha; - Vec3f pos; -} EnInvadepohWarpEffect; + /* 0x0 */ s8 unk_0; + /* 0x1 */ s8 timer; + /* 0x2 */ u8 alpha; + /* 0x4 */ Vec3f pos; +} EnInvadepohWarpEffect; // size = 0x10 typedef struct { - s8* index; - s8 count; -} EnInvadepohFaceFrame; + /* 0x0 */ s8* index; + /* 0x1 */ s8 count; +} EnInvadepohFaceFrame; // size = 0x2 typedef struct { - s8 type; - EnInvadepohFaceFrame* frames; -} EnInvadepohFaceAnim; + /* 0x0 */ s8 type; + /* 0x4 */ EnInvadepohFaceFrame* frames; +} EnInvadepohFaceAnim; // size = 0x8 typedef struct { - s8 index; - f32 chance; -} EnInvadepohFaceAnimNext; + /* 0x0 */ s8 index; + /* 0x4 */ f32 chance; +} EnInvadepohFaceAnimNext; // size = 0x8 typedef struct { - EnInvadepohFaceAnim anim; - s8 nextCount; - EnInvadepohFaceAnimNext* nextAnims; -} EnInvadepohFaceAnimLoop; + /* 0x0 */ EnInvadepohFaceAnim anim; + /* 0x8 */ s8 nextCount; + /* 0xC */ EnInvadepohFaceAnimNext* nextAnims; +} EnInvadepohFaceAnimLoop; // size = 0x10 typedef struct { - EnInvadepohFaceAnimLoop loop; - s16 minDelay; - s16 maxDelay; -} EnInvadepohFaceAnimLoopDelayed; + /* 0x00 */ EnInvadepohFaceAnimLoop loop; + /* 0x10 */ s16 minDelay; + /* 0x12 */ s16 maxDelay; +} EnInvadepohFaceAnimLoopDelayed; // size = 0x14 typedef struct { - EnInvadepohFaceAnim** animSet; - s8 curAnimType; - EnInvadepohFaceAnim* curAnim; - s16 delayTimer; - s8 curFrame; - s8 curIndex; -} EnInvadePohFaceInfo; + /* 0x0 */ EnInvadepohFaceAnim** animSet; + /* 0x4 */ s8 curAnimType; + /* 0x8 */ EnInvadepohFaceAnim* curAnim; + /* 0xC */ s16 delayTimer; + /* 0xE */ s8 curFrame; + /* 0xF */ s8 curIndex; +} EnInvadePohFaceInfo; // size = 0x10 typedef struct { - EnInvadePohFaceInfo eyeAnim; - EnInvadePohFaceInfo mouthAnim; - Vec3s unk_20; - Vec3s unk_26; - s16 unk_2C; - f32 unk_30; - f32 unk_34; - f32 unk_38; - f32 unk_3C; - s16 unk_40; - s16 unk_42; - f32 unk_44; - s16 unk_48; -} EnInvadePohUnkStruct_324; + /* 0x00 */ EnInvadePohFaceInfo eyeAnim; + /* 0x10 */ EnInvadePohFaceInfo mouthAnim; + /* 0x20 */ Vec3s unk_20; + /* 0x26 */ Vec3s unk_26; + /* 0x2C */ s16 unk_2C; + /* 0x30 */ f32 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; + /* 0x3c */ f32 unk_3C; + /* 0x40 */ s16 unk_40; + /* 0x42 */ s16 unk_42; + /* 0x44 */ f32 unk_44; + /* 0x48 */ s16 unk_48; +} EnInvadePohUnkStruct_324; // size = 0x4C typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnim**); @@ -155,7 +155,4 @@ typedef enum { #define ENINVADEPOH_SET_PARAMS(p7F00, pF0, p7) (((p7) & 7) | (((p7F00) << 8) & 0x7F00) | (((pF0) << 4) & 0xF0)) - -extern ActorInit En_Invadepoh_InitVars; - #endif // Z_EN_INVADEPOH_H From 690c773f5c1c3fc65f5fda86fb23cf80f4000c23 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Mon, 1 May 2023 09:56:28 -0500 Subject: [PATCH 06/10] stuff --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 2245 +++++++++-------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 86 +- 2 files changed, 1173 insertions(+), 1158 deletions(-) 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 d6069391b..35de783c4 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -6,83 +6,94 @@ #define THIS ((EnInvadepoh*)thisx) +#define ENINVADEPOH_INVADER_ACTIVE 1 +#define ENINVADEPOH_INVADER_CLOSEST 2 + +typedef enum { + ENINVADEPOH_EVENT_UNSET, + ENINVADEPOH_EVENT_WAIT, + ENINVADEPOH_EVENT_ACTIVE, + ENINVADEPOH_EVENT_CLEAR, + ENINVADEPOH_EVENT_FAILED +} EnInvadepohEventState; + #if 1 // function prototypes void EnInvadepoh_Init(Actor* thisx, PlayState* play); void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); -void EnInvadepoh_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Event_Update(Actor* thisx, PlayState* play2); // Update functions -void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B490F0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B49B1C(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4A168(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4A1B8(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4AB8C(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4ABDC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4BA84(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4C5C0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2); +void EnInvadepoh_Invader_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Invader_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cow_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cow_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_CowTail_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_CowTail_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_ConfusedRomani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_LightBall_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night1Romani_WaitForEvent(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_BarnRomani_WaitForEvent(Actor* thisx, PlayState* play2); +void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_RewardRomani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Dog_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Dog_WaitForEvent(Actor* thisx, PlayState* play2); +void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cremia_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cremia_WaitForEvent(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night3Romani_WaitForObject(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night3Romani_WaitForEvent(Actor* thisx, PlayState* play2); +void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Abuductor_WaitForObject(Actor* thisx, PlayState* play2); // Draw functions -void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4E158(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2); -void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play); -void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play); +void EnInvadepoh_Abductor_Update(Actor* thisx, PlayState* play2); +void EnInvadepoh_Event_Draw(Actor* thisx, PlayState* play); +void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2); +void EnInvadepoh_Cow_Draw(Actor* thisx, PlayState* play2); +void EnInvadepoh_CowTail_Draw(Actor* thisx, PlayState* play2); +void EnInvadepoh_Romani_Draw(Actor* thisx, PlayState* play); +void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2); +void EnInvadepoh_Dog_Draw(Actor* thisx, PlayState* play); +void EnInvadepoh_Cremia_Draw(Actor* thisx, PlayState* play); // Action functions -void EnInvadepoh_func_80B46DA8(EnInvadepoh* this); -void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46E20(EnInvadepoh* this); -void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46EC0(EnInvadepoh* this); -void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B46F88(EnInvadepoh* this); -void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47064(EnInvadepoh* this); -void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B470E0(EnInvadepoh* this); -void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B471C0(EnInvadepoh* this); -void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47248(EnInvadepoh* this); -void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47278(EnInvadepoh* this); -void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47304(EnInvadepoh* this); -void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47568(EnInvadepoh* this); -void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4770C(EnInvadepoh* this); -void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B47938(EnInvadepoh* this); -void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupWait(EnInvadepoh* this); +void EnInvadepoh_Event_Wait(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupQueueInvasionCs(EnInvadepoh* this); +void EnInvadepoh_Event_QueueInvasionCs(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupInvasionCs(EnInvadepoh* this); +void EnInvadepoh_Event_InvasionCs(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupInvasion(EnInvadepoh* this); +void EnInvadepoh_Event_Invasion(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupQueueVictoryCs(EnInvadepoh* this); +void EnInvadepoh_Event_QueueVictoryCs(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupVictoryCs(EnInvadepoh* this); +void EnInvadepoh_Event_VictoryCs(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupRomaniReward(EnInvadepoh* this); +void EnInvadepoh_Event_RomaniReward(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupGoodEnd(EnInvadepoh* this); +void EnInvadepoh_Event_GoodEnd(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupFailure(EnInvadepoh* this); +void EnInvadepoh_Event_Failure(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Event_SetupBadEnd(EnInvadepoh* this); +void EnInvadepoh_Event_BadEnd(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invader_WaitForEvent(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invade_WaitToRespawn(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invader_SetupWarpIn(EnInvadepoh* this); +void EnInvadepoh_Invader_WarpIn(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invader_SetupAttack(EnInvadepoh* this); +void EnInvadepoh_Invader_Attack(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invader_Hitstun(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Invader_SetupDeath(EnInvadepoh* this); +void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B48374(EnInvadepoh* this); void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play); @@ -142,7 +153,7 @@ void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play); -s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this); +s32 EnInvadepoh_SnapToFloor(EnInvadepoh* this); s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); #endif @@ -154,11 +165,11 @@ ActorInit En_Invadepoh_InitVars = { sizeof(EnInvadepoh), (ActorFunc)EnInvadepoh_Init, (ActorFunc)EnInvadepoh_Destroy, - (ActorFunc)EnInvadepoh_Update, + (ActorFunc)EnInvadepoh_Event_Update, (ActorFunc)NULL, }; -ColliderCylinderInit D_80B4E8B0 = { +ColliderCylinderInit sAlienCylinderInit = { { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, @@ -178,7 +189,7 @@ ColliderCylinderInit D_80B4E8B0 = { { 40, 95, 10, { 0, 0, 0 } }, }; -ColliderCylinderInit D_80B4E8DC = { +ColliderCylinderInit sHumanCylinderInit = { { COLTYPE_NONE, AT_NONE, @@ -198,7 +209,7 @@ ColliderCylinderInit D_80B4E8DC = { { 18, 46, 0, { 0, 0, 0 } }, }; -ColliderCylinderInit D_80B4E908 = { +ColliderCylinderInit sDogCylinderInit = { { COLTYPE_NONE, AT_NONE, @@ -220,7 +231,7 @@ ColliderCylinderInit D_80B4E908 = { Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; -s32 D_80B4E940 = 0; +s32 sEventState = ENINVADEPOH_EVENT_UNSET; TexturePtr sRomaniEyeTextures[5] = { gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, @@ -231,7 +242,7 @@ TexturePtr sRomaniMouthTextures[4] = { gRomaniMouthHangingOpenTex, gRomaniMouthSmileTex, }; -s8 D_80B4E968 = 0; +s8 sRomaniTexturesDesegmented = false; TexturePtr sCremiaEyeTextures[6] = { gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, @@ -242,31 +253,30 @@ TexturePtr sCremiaMouthTextures[4] = { gCremiaMouthFrownTex, gCremiaMouthHangingOpenTex, }; -s8 D_80B4E994 = 0; +s8 sCremiaTexturesDesegmented = false; -s8 D_80B4E998 = 0; +s8 sRewardFinished = false; -MtxF D_80B502A0; -MtxF D_80B502E0; -EnInvadepoh* D_80B50320[8]; -u8 D_80B50340[8]; -s8 D_80B50348; +MtxF sAlienLeftEyeBeam; +MtxF sAlienRightEyeBeam; +EnInvadepoh* sAlienInvaders[8]; +u8 sAlienStateFlags[8]; +s8 sAliensTooClose; EnInvadepohWarpEffect D_80B50350[10]; -Actor* D_80B503F0; -EnInvadepoh* D_80B503F4; -EnInvadepoh* D_80B503F8; +EnInvadepoh* sLightBall; +EnInvadepoh* sRomani; +EnInvadepoh* sCremia; AnimatedMaterial* sAlienEyeBeamTexAnim; AnimatedMaterial* sAlienEmptyTexAnim; -s16 D_80B50404[3]; -s16 D_80B5040A; -EnInvadepoh* D_80B5040C; +s16 sCutsceneIds[3]; +EnInvadepoh* sClosestAlien; -void EnInvadepoh_func_80B439B0(s32 arg0, s32 arg1) { +void EnInvadepoh_Invader_SetWarpInTime(s32 arg0, s32 arg1) { arg1 -= CLOCK_TIME(2, 30); arg1 = CLAMP_MIN(arg1, 0); if ((arg0 % 2) == 0) { - gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] = + gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] = (gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); } else { gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] = @@ -274,65 +284,65 @@ void EnInvadepoh_func_80B439B0(s32 arg0, s32 arg1) { } } -s32 EnInvadepoh_func_80B43A24(s32 arg0) { +s32 EnInvadepoh_Invader_GetWarpInTime(s32 invaderIndex) { u32 var_v1; - if ((arg0 % 2) == 0) { - var_v1 = gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF; + if ((invaderIndex % 2) == 0) { + var_v1 = gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF; } else { - var_v1 = (gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF0000) >> 0x10; + var_v1 = (gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF0000) >> 0x10; } return var_v1 + CLOCK_TIME(2, 30); } -void EnInvadepoh_func_80B43A74(s32 arg0) { +void EnInvadepoh_Invader_SetKillCount(s32 arg0) { gSaveContext.save.saveInfo.unk_E64[4] = (gSaveContext.save.saveInfo.unk_E64[4] & ~0xFF) | (arg0 & 0xFF); } -s32 EnInvadepoh_func_80B43A9C(void) { +s32 EnInvadepoh_Invader_GetKillCount(void) { return gSaveContext.save.saveInfo.unk_E64[4] & 0xFF; } -s32 EnInvadepoh_func_80B43AB0(void) { - s32 sp1C = EnInvadepoh_func_80B43A9C(); +s32 EnInvadepoh_Invader_AddKill(void) { + s32 sp1C = EnInvadepoh_Invader_GetKillCount(); if (sp1C < 12) { sp1C++; - EnInvadepoh_func_80B43A74(sp1C); + EnInvadepoh_Invader_SetKillCount(sp1C); } return sp1C; } -void EnInvadepoh_func_80B43AF0(s32 arg0) { +void EnInvadepoh_Invader_ResetWarpInTime(s32 arg0) { s32 sp1C = gSaveContext.save.time; if ((CURRENT_DAY == 1) && (sp1C >= CLOCK_TIME(2, 30)) && (sp1C < CLOCK_TIME(5, 15))) { - s32 sp18 = (12 - EnInvadepoh_func_80B43A9C()) * 25.0f; + s32 sp18 = (12 - EnInvadepoh_Invader_GetKillCount()) * 25.0f; - EnInvadepoh_func_80B439B0(arg0, sp1C + sp18); + EnInvadepoh_Invader_SetWarpInTime(arg0, sp1C + sp18); } } -s32 EnInvadepoh_func_80B43B80(EnInvadepoh* this) { - s32 var_v1; - s32 var_v0 = this->unk_308 - 1; +s32 EnInvadepoh_Invader_GetCurrentPoint(EnInvadepoh* this) { + s32 i; + s32 lastPoint = this->endPoint - 1; - for (var_v1 = 0; var_v1 < var_v0; var_v1++) { - if (this->unk_320 < this->unk_37C[var_v1]) { + for (i = 0; i < lastPoint; i++) { + if (this->progress < this->checkpoints[i]) { break; } } - return var_v1; + return i; } void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { f32 var_fs0 = 0.0f; f32 var_fs2 = 0.0f; - f32 temp_fs1 = 1.0f / this->unk_310; - s32 temp_s5 = this->unk_308; + f32 temp_fs1 = 1.0f / this->pathLength; + s32 temp_s5 = this->endPoint; s32 var_s2; Vec3f sp70; - Vec3s* var_s0 = this->unk_30C; + Vec3s* var_s0 = this->pathPoints; Vec3s* var_s1 = var_s0 + 1; f32 temp_fa0; f32 temp_fa1; @@ -346,9 +356,9 @@ void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { temp_fv0_2 = Math3D_Vec3fMagnitude(&sp70); temp_fa1 = var_fs0 + temp_fv0_2; temp_fa0 = temp_fa1 * temp_fs1; - if (this->unk_320 <= temp_fa0) { + if (this->progress <= temp_fa0) { *arg1 = var_s2; - temp_fv0 = (this->unk_320 - var_fs2) / (temp_fa0 - var_fs2); + temp_fv0 = (this->progress - var_fs2) / (temp_fa0 - var_fs2); arg2->x = (temp_fv0 * sp70.x) + var_s0->x; arg2->y = (temp_fv0 * sp70.y) + var_s0->y; arg2->z = (temp_fv0 * sp70.z) + var_s0->z; @@ -359,19 +369,19 @@ void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { var_fs2 = temp_fa0; } *arg1 = temp_s5; - arg2->x = this->unk_30C[temp_s5].x; - arg2->y = this->unk_30C[temp_s5].y; - arg2->z = this->unk_30C[temp_s5].z; + arg2->x = this->pathPoints[temp_s5].x; + arg2->y = this->pathPoints[temp_s5].y; + arg2->z = this->pathPoints[temp_s5].z; } -void EnInvadepoh_func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { +void EnInvadepoh_Invader_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2) { s32 pad; - Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp40 = &this->pathPoints[this->currentPoint]; Vec3s* sp3C = sp40 + 1; Vec3f sp30; Vec3f sp24; - if (this->unk_309 != this->unk_308) { + if (this->currentPoint != this->endPoint) { Math_Vec3s_ToVec3f(&sp30, sp40); Math_Vec3s_ToVec3f(&sp24, sp3C); Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); @@ -380,21 +390,21 @@ void EnInvadepoh_func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { void EnInvadepoh_func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { s32 pad; - Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp40 = &this->pathPoints[this->currentPoint]; Vec3s* sp3C = sp40 + 1; Vec3f sp30; Vec3f sp24; - if (this->unk_309 != this->unk_308) { + if (this->currentPoint != this->endPoint) { Math_Vec3s_ToVec3f(&sp30, sp40); Math_Vec3s_ToVec3f(&sp24, sp3C); Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24), arg1, arg2, arg3); } } -void EnInvadepoh_func_80B43F0C(EnInvadepoh* this) { +void EnInvadepoh_SetYawAlongPath(EnInvadepoh* this) { s32 pad; - Vec3s* sp40 = &this->unk_30C[this->unk_309]; + Vec3s* sp40 = &this->pathPoints[this->currentPoint]; Vec3s* sp3C = sp40 + 1; Vec3f sp30; Vec3f sp24; @@ -404,12 +414,12 @@ void EnInvadepoh_func_80B43F0C(EnInvadepoh* this) { this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp30, &sp24); } -f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this) { - s32 temp_s4 = this->unk_308 + 1; +f32 EnInvadepoh_GetPathLength(EnInvadepoh* this) { + s32 temp_s4 = this->endPoint + 1; s32 var_s1; Vec3f sp54; Vec3f sp48; - Vec3s* var_s0 = this->unk_30C; + Vec3s* var_s0 = this->pathPoints; f32 var_fs0 = 0.0f; Math_Vec3s_ToVec3f(&sp48, var_s0); @@ -422,49 +432,51 @@ f32 EnInvadepoh_func_80B43F70(EnInvadepoh* this) { return var_fs0; } -void EnInvadepoh_func_80B44024(EnInvadepoh* this, PlayState* play) { - Path* temp_v0 = &play->setupPathList[ENINVADEPOH_GET_PARAM_7F00(&this->actor)]; +void EnInvadepoh_SetPath(EnInvadepoh* this, PlayState* play) { + Path* path = &play->setupPathList[ENINVADEPOH_GET_PARAM_7F00(&this->actor)]; - this->unk_308 = temp_v0->count - 1; - this->unk_30C = Lib_SegmentedToVirtual(temp_v0->points); + this->endPoint = path->count - 1; + this->pathPoints = Lib_SegmentedToVirtual(path->points); } -void EnInvadepoh_func_80B4407C(EnInvadepoh* this, s32 arg1) { - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->unk_30C[arg1]); +void EnInvadepoh_SetPosToPathPoint(EnInvadepoh* this, s32 arg1) { + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[arg1]); } -s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2) { +s32 EnInvadepoh_Invader_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { EnInvadepoh* this = thisx; // TODO: why recast? - Vec3s* sp48 = &this->unk_30C[this->unk_309]; - Vec3s* sp44 = &this->unk_30C[this->unk_309] + 1; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 temp_fa0_2; - f32 temp_fv0_2; - s32 pad2; - s16 sp1E; + Vec3s* currentPoint = &this->pathPoints[this->currentPoint]; + Vec3s* nextPoint = &this->pathPoints[this->currentPoint] + 1; + f32 pathSegmentX; + f32 pathSegmentZ; + f32 pathUnitVecZ; + f32 pathUnitVecX; + f32 travelSegmentX; + f32 travelSegmentZ; + f32 distAlongPath; + f32 pathSegmentLength; + f32 distOffPath; + s16 pathYaw; - if (this->unk_309 >= this->unk_308) { + if (this->currentPoint >= this->endPoint) { return false; } - sp40 = (sp44->x - sp48->x); - sp3C = (sp44->z - sp48->z); - sp1E = Math_Atan2S_XY(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))) { + pathSegmentX = (nextPoint->x - currentPoint->x); + pathSegmentZ = (nextPoint->z - currentPoint->z); + pathYaw = Math_Atan2S_XY(pathSegmentZ, pathSegmentX); + pathUnitVecZ = Math_CosS(pathYaw); + pathUnitVecX = Math_SinS(pathYaw); + travelSegmentX = this->actor.world.pos.x - currentPoint->x; + travelSegmentZ = this->actor.world.pos.z - currentPoint->z; + + distOffPath = fabsf((travelSegmentX * pathUnitVecZ) - (travelSegmentZ * pathUnitVecX)); + if (distOffPath > (arg1 - arg2)) { return false; } - temp_fv0_2 = Math3D_XZLength(sp40, sp3C); - temp_fa0_2 = (sp2C * sp38) + (sp30 * sp34); - if ((temp_fa0_2 < 0.0f) || (temp_fv0_2 < temp_fa0_2)) { + pathSegmentLength = Math3D_XZLength(pathSegmentX, pathSegmentZ); + distAlongPath = (travelSegmentZ * pathUnitVecZ) + (travelSegmentX * pathUnitVecX); + if ((distAlongPath < 0.0f) || (pathSegmentLength < distAlongPath)) { return false; } return true; @@ -472,14 +484,14 @@ s32 EnInvadepoh_func_80B440B8(EnInvadepoh* thisx, f32 arg1, f32 arg2) { s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { s32 var_s0; - s32 temp_s3 = this->unk_308; + s32 temp_s3 = this->endPoint; Vec3s* var_s1; Vec3f sp48; f32 var_fs0 = FLT_MAX; s32 var_s4 = 0; f32 temp_fv0; - for (var_s0 = 0, var_s1 = this->unk_30C; var_s0 < temp_s3; var_s0++, var_s1++) { + for (var_s0 = 0, var_s1 = this->pathPoints; var_s0 < temp_s3; var_s0++, var_s1++) { Math_Vec3s_ToVec3f(&sp48, var_s1); temp_fv0 = Math3D_Vec3fDistSq(&sp48, arg1); if (temp_fv0 < var_fs0) { @@ -490,39 +502,39 @@ s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { return var_s4; } -void EnInvadepoh_func_80B442E4(EnInvadepoh* this) { +void EnInvadepoh_Invader_SetProgress(EnInvadepoh* this) { s32 pad; - s32 sp18 = gSaveContext.save.time; - s32 temp_v0 = EnInvadepoh_func_80B43A24(ENINVADEPOH_GET_PARAM_7(&this->actor)); + s32 currentTime = gSaveContext.save.time; + s32 warpInTime = EnInvadepoh_Invader_GetWarpInTime(ENINVADEPOH_GET_PARAM_7(&this->actor)); - if (D_80B4E940 == 1) { - this->unk_320 = 0.0f; - } else if (D_80B4E940 == 2) { - if ((sp18 - temp_v0) < 0) { - this->unk_320 = 0.0f; + if (sEventState == ENINVADEPOH_EVENT_WAIT) { + this->progress = 0.0f; + } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { + if ((currentTime - warpInTime) < 0) { + this->progress = 0.0f; } else { - this->unk_320 = (sp18 - temp_v0) * (1.0f / 3600.0f); - if (this->unk_320 > 1.0f) { - this->unk_320 = 1.0f; + this->progress = (currentTime - warpInTime) * (1.0f / 3600.0f); + if (this->progress > 1.0f) { + this->progress = 1.0f; } } } - this->unk_309 = EnInvadepoh_func_80B43B80(this); + this->currentPoint = EnInvadepoh_Invader_GetCurrentPoint(this); } -void EnInvadepoh_func_80B443A0(EnInvadepoh* this) { - f32 temp_fs3 = 1.0f / this->unk_310; - s32 temp_s4 = this->unk_308; +void EnInvadepoh_Invader_SetCheckpoints(EnInvadepoh* this) { + f32 temp_fs3 = 1.0f / this->pathLength; + s32 temp_s4 = this->endPoint; s32 var_s1; Vec3f sp54; Vec3f sp48; - Vec3s* var_s0 = this->unk_30C; + Vec3s* var_s0 = this->pathPoints; f32 var_fs0 = 0.0f; f32* var_s2; Math_Vec3s_ToVec3f(&sp48, var_s0); var_s0++; - var_s2 = this->unk_37C; + var_s2 = this->checkpoints; for (var_s1 = 1; var_s1 < temp_s4; var_s1++, var_s0++, var_s2++) { Math_Vec3f_Copy(&sp54, &sp48); Math_Vec3s_ToVec3f(&sp48, var_s0); @@ -536,85 +548,85 @@ void EnInvadepoh_func_80B443A0(EnInvadepoh* this) { } } -void EnInvadepoh_func_80B444BC(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); - this->unk_310 = EnInvadepoh_func_80B43F70(this); - EnInvadepoh_func_80B443A0(this); +void EnInvadepoh_Invader_SetupPath(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_SetPath(this, play); + this->pathLength = EnInvadepoh_GetPathLength(this); + EnInvadepoh_Invader_SetCheckpoints(this); } void EnInvadepoh_func_80B444F4(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); + EnInvadepoh_SetPath(this, play); } void EnInvadepoh_func_80B44514(EnInvadepoh* this) { - this->unk_309++; - if (this->unk_309 >= this->unk_308) { - this->unk_309 = 0; + this->currentPoint++; + if (this->currentPoint >= this->endPoint) { + this->currentPoint = 0; } } -void EnInvadepoh_func_80B44540(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); - this->unk_310 = EnInvadepoh_func_80B43F70(this); +void EnInvadepoh_Night1Romani_SetupPath(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_SetPath(this, play); + this->pathLength = EnInvadepoh_GetPathLength(this); } -void EnInvadepoh_func_80B44570(EnInvadepoh* this) { +void EnInvadepoh_Night1Romani_SetProgress(EnInvadepoh* this) { if ((gSaveContext.save.time < CLOCK_TIME(2, 00)) || (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { - this->unk_320 = 0.0f; + this->progress = 0.0f; } else if ((gSaveContext.save.time >= CLOCK_TIME(2, 15)) && (gSaveContext.save.time < CLOCK_TIME(6, 00))) { - this->unk_320 = 1.0f; + this->progress = 1.0f; } else { f32 temp = (gSaveContext.save.time - CLOCK_TIME(2, 00)) * (1.0f / (CLOCK_TIME(2, 15) - CLOCK_TIME(2, 00))); - this->unk_320 = temp; - this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); + this->progress = temp; + this->progress = CLAMP(this->progress, 0.0f, 1.0f); } } -void EnInvadepoh_func_80B44620(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); +void EnInvadepoh_BarnRomani_SetupPath(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_SetPath(this, play); } void EnInvadepoh_func_80B44640(EnInvadepoh* this) { - if (this->unk_309 < this->unk_308) { - this->unk_309++; + if (this->currentPoint < this->endPoint) { + this->currentPoint++; } } -void EnInvadepoh_func_80B44664(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); - this->unk_30A = 1; +void EnInvadepoh_Dog_SetupPath(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_SetPath(this, play); + this->pathStep = 1; } void EnInvadepoh_func_80B44690(EnInvadepoh* this) { - this->unk_309 += this->unk_30A; - if (this->unk_309 >= this->unk_308) { - this->unk_309 = 0; - } else if (this->unk_309 < 0) { - this->unk_309 = this->unk_308 - 1; + this->currentPoint += this->pathStep; + if (this->currentPoint >= this->endPoint) { + this->currentPoint = 0; + } else if (this->currentPoint < 0) { + this->currentPoint = this->endPoint - 1; } } void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44024(this, play); - this->unk_310 = EnInvadepoh_func_80B43F70(this); + EnInvadepoh_SetPath(this, play); + this->pathLength = EnInvadepoh_GetPathLength(this); } void EnInvadepoh_func_80B44700(EnInvadepoh* this) { if ((gSaveContext.save.time < CLOCK_TIME(20, 00)) && (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { - this->unk_320 = 0.0f; + this->progress = 0.0f; } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 14) + 15) || (gSaveContext.save.time < CLOCK_TIME(6, 00))) { - this->unk_320 = 1.0f; + this->progress = 1.0f; } else { f32 temp = (gSaveContext.save.time - CLOCK_TIME(20, 00)) * (1.0f / (CLOCK_TIME(20, 14) + 15 - CLOCK_TIME(20, 00))); - this->unk_320 = temp; - this->unk_320 = CLAMP(this->unk_320, 0.0f, 1.0f); + this->progress = temp; + this->progress = CLAMP(this->progress, 0.0f, 1.0f); } } -void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Invader_SetPositionAlongPath(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3s* sp60; s32 pad2; @@ -624,15 +636,15 @@ void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play) { f32 sp3C; f32 sp38; - sp60 = &this->unk_30C[this->unk_309]; - sp3C = (this->unk_309 < 1) ? 0.0f : this->unk_37C[this->unk_309 - 1]; - sp38 = (this->unk_309 < (this->unk_308 - 1)) ? this->unk_37C[this->unk_309] : 1.0f; + sp60 = &this->pathPoints[this->currentPoint]; + sp3C = (this->currentPoint < 1) ? 0.0f : this->checkpoints[this->currentPoint - 1]; + sp38 = (this->currentPoint < (this->endPoint - 1)) ? this->checkpoints[this->currentPoint] : 1.0f; if (sp38 - sp3C < 0.001f) { Math_Vec3s_ToVec3f(&this->unk_314, sp60); } else { - f32 sp34 = this->unk_320 - sp3C; - f32 sp30 = sp38 - this->unk_320; + f32 sp34 = this->progress - sp3C; + f32 sp30 = sp38 - this->progress; f32 sp2C = 1.0f / (sp38 - sp3C); s32 pad3; @@ -673,11 +685,11 @@ void EnInvadepoh_func_80B447C0(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B44A90(EnInvadepoh* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { +void EnInvadepoh_Invader_Knockback(EnInvadepoh* this, PlayState* play) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y *= 0.3f; this->actor.speed *= 0.8f; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y *= 0.8f; this->actor.speed *= 0.3f; } else { @@ -693,12 +705,12 @@ void EnInvadepoh_func_80B44B78(EnInvadepoh* this) { s32 EnInvadepoh_func_80B44B84(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3) { s32 pad; // TODO: recast? - Vec3s* temp_v0_2 = &this->unk_30C[this->unk_309 + 1]; + Vec3s* temp_v0_2 = &this->pathPoints[this->currentPoint + 1]; s32 sp2C = EnInvadepoh_func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, temp_v0_2->x, temp_v0_2->z, arg2); func_800B4AEC(play, &this->actor, arg3); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); return sp2C; } @@ -706,14 +718,14 @@ void EnInvadepoh_func_80B44C24(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? f32 sp18 = this->actor.world.pos.y; - EnInvadepoh_func_80B43BC8(this, &this->unk_309, &this->actor.world.pos); + EnInvadepoh_func_80B43BC8(this, &this->currentPoint, &this->actor.world.pos); this->actor.world.pos.y = sp18; func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); } s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play) { - Vec3s* temp_a2 = &this->unk_30C[this->unk_309]; + Vec3s* temp_a2 = &this->pathPoints[this->currentPoint]; Vec3s* temp_v0_2; s32 var_v1; u32 var_v0; @@ -728,15 +740,15 @@ s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play) { f32 sp44; s32 sp40 = 0; - var_v1 = this->unk_309 + this->unk_30A; + var_v1 = this->currentPoint + this->pathStep; - if (var_v1 >= this->unk_308) { + if (var_v1 >= this->endPoint) { var_v1 = 0; } else if (var_v1 < 0) { - var_v1 = this->unk_308 - 1; + var_v1 = this->endPoint - 1; } - temp_v0_2 = &this->unk_30C[var_v1]; + temp_v0_2 = &this->pathPoints[var_v1]; temp_a2x = temp_a2->x; temp_a2z = temp_a2->z; @@ -769,7 +781,7 @@ s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(sp48.z, sp48.x), 4, 0xFA0, 0x64); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, - EnInvadepoh_func_80B440B8(this, 50.0f, 15.0f) ? 4 : 5); + EnInvadepoh_Invader_IsOnPath(this, 50.0f, 15.0f) ? UPDBGCHECKINFO_FLAG_4 : UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_1); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); return sp40; } @@ -784,33 +796,33 @@ void EnInvadepoh_func_80B44EFC(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? f32 sp18 = this->actor.world.pos.y; - EnInvadepoh_func_80B43BC8(this, &this->unk_309, &this->actor.world.pos); + EnInvadepoh_func_80B43BC8(this, &this->currentPoint, &this->actor.world.pos); this->actor.world.pos.y = sp18; func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); } -void EnInvadepoh_func_80B44F58(void) { - TexturePtr* var_s0; +void EnInvadepoh_Romani_DesegmentTextures(void) { + TexturePtr* texPtr; s32 i; - if (D_80B4E968 == 0) { - D_80B4E968 = 1; - for (i = 0, var_s0 = sRomaniEyeTextures; i < 5; i++, var_s0++) { - *var_s0 = Lib_SegmentedToVirtual(*var_s0); + if (!sRomaniTexturesDesegmented) { + sRomaniTexturesDesegmented = true; + for (i = 0, texPtr = sRomaniEyeTextures; i < 5; i++, texPtr++) { + *texPtr = Lib_SegmentedToVirtual(*texPtr); } - for (i = 0, var_s0 = sRomaniMouthTextures; i < 4; i++, var_s0++) { - *var_s0 = Lib_SegmentedToVirtual(*var_s0); + for (i = 0, texPtr = sRomaniMouthTextures; i < 4; i++, texPtr++) { + *texPtr = Lib_SegmentedToVirtual(*texPtr); } } } -void EnInvadepoh_func_80B44FEC(void) { +void EnInvadepoh_Cremia_DesegmentTextures(void) { TexturePtr* var_s0; s32 i; - if (D_80B4E994 == 0) { - D_80B4E994 = 1; + if (!sCremiaTexturesDesegmented) { + sCremiaTexturesDesegmented = true; for (i = 0, var_s0 = sCremiaEyeTextures; i < 6; i++, var_s0++) { *var_s0 = Lib_SegmentedToVirtual(*var_s0); } @@ -820,7 +832,7 @@ void EnInvadepoh_func_80B44FEC(void) { } } -void EnInvadepoh_func_80B45080(void) { +void EnInvadepoh_Alien_SetTexAnim(void) { sAlienEmptyTexAnim = Lib_SegmentedToVirtual(gAlienEmptyTexAnim); sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); } @@ -843,7 +855,7 @@ s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4 } } -s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this) { +s32 EnInvadepoh_SnapToFloor(EnInvadepoh* this) { if (this->actor.floorHeight > BGCHECK_Y_MIN + 1.0f) { this->actor.world.pos.y = this->actor.floorHeight; return true; @@ -851,52 +863,52 @@ s32 EnInvadepoh_func_80B4516C(EnInvadepoh* this) { return false; } -void EnInvadepoh_func_80B451A0(EnInvadepoh* this, PlayState* play) { - if (D_80B4E940 == 0) { +void EnInvadepoh_Event_CheckState(EnInvadepoh* this, PlayState* play) { + if (sEventState == ENINVADEPOH_EVENT_UNSET) { if (CURRENT_DAY < 1) { - D_80B4E940 = 1; + sEventState = ENINVADEPOH_EVENT_WAIT; } else if (CURRENT_DAY == 1) { s32 sp2C = gSaveContext.save.time; if ((sp2C < CLOCK_TIME(2, 30)) || (sp2C >= CLOCK_TIME(6, 00))) { - D_80B4E940 = 1; + sEventState = ENINVADEPOH_EVENT_WAIT; } else if (sp2C < CLOCK_TIME(5, 15)) { s32 var_s0; s32 var_s1 = CLOCK_TIME(5, 15); + s32 temp; - for (var_s0 = 0; var_s0 < this->unk_379; var_s0++) { - s32 temp_v0 = EnInvadepoh_func_80B43A24(var_s0); + for (var_s0 = 0; var_s0 < this->spawnCount; var_s0++) { + s32 temp_v0 = EnInvadepoh_Invader_GetWarpInTime(var_s0); var_s1 = MIN(temp_v0, var_s1); } - - if (sp2C < var_s1 + CLOCK_TIME(1, 19) + 6) { - D_80B4E940 = 2; + if (sp2C < var_s1 + 3601) { // 79 in-game minutes + sEventState = ENINVADEPOH_EVENT_ACTIVE; } } } - if (D_80B4E940 == 0) { - if (gSaveContext.save.saveInfo.weekEventReg[22] & 1) { - D_80B4E940 = 3; + if (sEventState == ENINVADEPOH_EVENT_UNSET) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + sEventState = ENINVADEPOH_EVENT_CLEAR; } else { - D_80B4E940 = 4; + sEventState = ENINVADEPOH_EVENT_FAILED; } } } } -void EnInvadepoh_func_80B452EC(EnInvadepoh* this, PlayState* play) { - s32 var_s2 = ENINVADEPOH_GET_PARAM_7F00(&this->actor); - s32 var_s3; +void EnInvadepoh_Event_SpawnAliens(EnInvadepoh* this, PlayState* play) { + s32 pathIndex = ENINVADEPOH_GET_PARAM_7F00(&this->actor); + s32 i; - for (var_s3 = 0; var_s3 < this->unk_379; var_s3++) { - D_80B50320[var_s3] = (EnInvadepoh*)Actor_Spawn( + for (i = 0; i < this->spawnCount; i++) { + sAlienInvaders[i] = (EnInvadepoh*)Actor_Spawn( &play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(var_s2, ENINVADEPOH_ALIEN_INVADER, var_s3)); - if (var_s2 != 0xFF) { - Path* temp_v0 = &play->setupPathList[var_s2]; + this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(pathIndex, ENINVADEPOH_ALIEN_INVADER, i)); + if (pathIndex != 0xFF) { + Path* path = &play->setupPathList[pathIndex]; - var_s2 = temp_v0->unk1; + pathIndex = path->unk1; } } } @@ -913,9 +925,9 @@ void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play) { ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_ROMANI_ABDUCTED, 0)); } -void EnInvadepoh_func_80B454BC(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, +void EnInvadepoh_Event_SpawnLightBall(EnInvadepoh* this, PlayState* play) { + sLightBall = + (EnInvadepoh*) Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); } @@ -928,38 +940,38 @@ void EnInvadepoh_func_80B45518(Vec3f* arg0) { } s32 EnInvadepoh_func_80B45550(EnInvadepoh* this, PlayState* play, f32 arg2, s32 arg3) { - Actor* var_s0 = play->actorCtx.actorLists[ACTORCAT_DOOR].first; + Actor* doorActor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; EnDoor* door; - s32 sp34 = 0; + s32 sp34 = false; - while (var_s0 != NULL) { - if ((var_s0->id == ACTOR_EN_DOOR) && (var_s0->update != NULL)) { - door = (EnDoor*)var_s0; + while (doorActor != NULL) { + if ((doorActor->id == ACTOR_EN_DOOR) && (doorActor->update != NULL)) { + door = (EnDoor*)doorActor; if ((door->dyna.actor.room == this->actor.room) && (Math3D_Vec3fDistSq(&door->dyna.actor.world.pos, &this->actor.world.pos) < arg2)) { door->unk_1A7 = arg3; - sp34 = 1; + sp34 = true; break; } } - var_s0 = var_s0->next; + doorActor = doorActor->next; } return sp34; } -void EnInvadepoh_func_80B4560C(EnInvadepoh* this, PlayState* play, u16 arg2) { - this->unk_376 = arg2; - Message_StartTextbox(play, arg2, &this->actor); +void EnInvadepoh_Romani_SetTextId(EnInvadepoh* this, PlayState* play, u16 textId) { + this->textId = textId; + Message_StartTextbox(play, textId, &this->actor); } -void EnInvadepoh_func_80B45648(EnInvadepoh* this) { - s16 var_s1 = this->actor.csId; +void EnInvadepoh_Event_SetCutscenes(EnInvadepoh* this) { + s16 csId = this->actor.csId; s32 i; for (i = 0; i < 3; i++) { - D_80B50404[i] = var_s1; - var_s1 = CutsceneManager_GetAdditionalCsId(var_s1); + sCutsceneIds[i] = csId; + csId = CutsceneManager_GetAdditionalCsId(csId); } } @@ -980,37 +992,37 @@ s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1) { return false; } -void EnInvadepoh_func_80B457A0(EnInvadepoh* this) { - s32 var_s0; - f32 var_fs0 = FLT_MAX; - s32 var_s5 = -1; +void EnInvadepoh_Event_SetClosestAlien(EnInvadepoh* this) { + s32 i; + f32 minDistSqToBarn = FLT_MAX; + s32 closestAlienIndex = -1; - for (var_s0 = 0; var_s0 < this->unk_379; var_s0++) { - if ((D_80B50320[var_s0] != NULL) && (D_80B50320[var_s0]->unk_38B != 0)) { - f32 temp_fv0 = Math3D_Vec3fDistSq(&D_80B50320[var_s0]->actor.world.pos, &this->actor.world.pos); + for (i = 0; i < this->spawnCount; i++) { + if ((sAlienInvaders[i] != NULL) && sAlienInvaders[i]->present) { + f32 distSqToBarn = Math3D_Vec3fDistSq(&sAlienInvaders[i]->actor.world.pos, &this->actor.world.pos); - if (temp_fv0 < var_fs0) { - var_fs0 = temp_fv0; - var_s5 = var_s0; + if (distSqToBarn < minDistSqToBarn) { + minDistSqToBarn = distSqToBarn; + closestAlienIndex = i; } } - D_80B50340[var_s0] &= ~2; + sAlienStateFlags[i] &= ~ENINVADEPOH_INVADER_CLOSEST; } - D_80B50348 = 0; - if (var_fs0 <= SQ(2000.0f)) { - D_80B50340[var_s5] |= 2; - if (var_fs0 <= SQ(340.0f)) { - D_80B50348 = 1; + sAliensTooClose = false; + if (minDistSqToBarn <= SQ(2000.0f)) { + sAlienStateFlags[closestAlienIndex] |= ENINVADEPOH_INVADER_CLOSEST; + if (minDistSqToBarn <= SQ(340.0f)) { + sAliensTooClose = true; } } } -EnInvadepoh* EnInvadepoh_func_80B458D8(void) { - s32 var_v1; +EnInvadepoh* EnInvadepoh_Dog_GetClosestAlien(void) { + s32 i; - for (var_v1 = 0; var_v1 < 8; var_v1++) { - if (D_80B50340[var_v1] & 2) { - return D_80B50320[var_v1]; + for (i = 0; i < 8; i++) { + if (sAlienStateFlags[i] & ENINVADEPOH_INVADER_CLOSEST) { + return sAlienInvaders[i]; } } return NULL; @@ -1244,7 +1256,7 @@ void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0) { EnInvadepoh_func_80B45BB8(&arg0->mouthAnim); } -void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { +void EnInvadepoh_LightBall_SpawnSparkles(EnInvadepoh* this, PlayState* play, s32 arg2) { static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; s32 var_s1; @@ -1276,7 +1288,7 @@ void EnInvadepoh_func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { } } -s32 EnInvadepoh_func_80B46118(Vec3f* arg0) { +s32 EnInvadepoh_Invader_SpawnWarp(Vec3f* arg0) { EnInvadepohWarpEffect* warpEffect = D_80B50350; s32 i; @@ -1308,216 +1320,216 @@ void EnInvadepoh_func_80B46184(EnInvadepohWarpEffect* warpEffect) { } } -s32 EnInvadepoh_func_80B461DC(void) { +s32 EnInvadepoh_Event_UpdateWarps(void) { static void (*D_80B4EC20[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_func_80B46184 }; - s32 var_s4 = 0; + s32 var_s4 = false; s32 i; EnInvadepohWarpEffect* warpEffect; for (i = 0, warpEffect = D_80B50350; i < 10; i++, warpEffect++) { if (warpEffect->timer > 0) { D_80B4EC20[warpEffect->unk_0](warpEffect); - var_s4 = 1; - warpEffect->timer -= 1; + var_s4 = true; + warpEffect->timer--; } } return var_s4; } -void EnInvadepoh_func_80B4627C(Actor* thisx, PlayState* play) { +void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Massive problems EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 var_a2; - s32 var_v1; + s32 spawnCount; + s32 pathIndex; this->actor.flags |= ACTOR_FLAG_20; - var_v1 = ENINVADEPOH_GET_PARAM_7F00(&this->actor); + pathIndex = ENINVADEPOH_GET_PARAM_7F00(&this->actor); - for (var_a2 = 1; var_a2 < 8; var_a2++) { - Path* path = &play->setupPathList[var_v1]; + for (spawnCount = 1; spawnCount < 8; spawnCount++) { + Path* path = &play->setupPathList[pathIndex]; - var_v1 = path->unk1; - if (var_v1 == 0xFF) { + pathIndex = path->unk1; + if (pathIndex == 0xFF) { break; } } - this->unk_379 = var_a2; - EnInvadepoh_func_80B451A0(this, play); - EnInvadepoh_func_80B45648(this); + this->spawnCount = spawnCount; + EnInvadepoh_Event_CheckState(this, play); + EnInvadepoh_Event_SetCutscenes(this); func_800BC154(play, &play->actorCtx, &this->actor, 0); - if (D_80B4E940 == 1) { - EnInvadepoh_func_80B46DA8(this); - } else if (D_80B4E940 == 2) { + if (sEventState == ENINVADEPOH_EVENT_WAIT) { + EnInvadepoh_Event_SetupWait(this); + } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { - EnInvadepoh_func_80B46DA8(this); + EnInvadepoh_Event_SetupWait(this); } else { - EnInvadepoh_func_80B454BC(this, play); - EnInvadepoh_func_80B452EC(this, play); + EnInvadepoh_Event_SpawnLightBall(this, play); + EnInvadepoh_Event_SpawnAliens(this, play); AudioSeq_QueueSeqCmd(0x8000 | NA_BGM_ALIEN_INVASION); - EnInvadepoh_func_80B46F88(this); + EnInvadepoh_Event_SetupInvasion(this); } - } else if (D_80B4E940 == 3) { + } else if (sEventState == ENINVADEPOH_EVENT_CLEAR) { if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { - EnInvadepoh_func_80B471C0(this); + EnInvadepoh_Event_SetupRomaniReward(this); } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { - EnInvadepoh_func_80B47248(this); + EnInvadepoh_Event_SetupGoodEnd(this); } else { - EnInvadepoh_func_80B47248(this); + EnInvadepoh_Event_SetupGoodEnd(this); } - } else if (D_80B4E940 == 4) { - EnInvadepoh_func_80B47304(this); + } else if (sEventState == ENINVADEPOH_EVENT_FAILED) { + EnInvadepoh_Event_SetupBadEnd(this); } } -InitChainEntry D_80B4EC24[4] = { +InitChainEntry sAlienInitChain[4] = { 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), }; -void EnInvadepoh_func_80B46414(Actor* thisx, PlayState* play) { +void EnInvadepoh_Alien_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC24); - Collider_InitCylinder(play, &this->unk_2A0); + Actor_ProcessInitChain(&this->actor, sAlienInitChain); + Collider_InitCylinder(play, &this->collider); ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); this->actor.shape.shadowAlpha = 140; this->actor.flags = ACTOR_FLAG_80000000 | ACTOR_FLAG_1000 | ACTOR_FLAG_10; if (ENINVADEPOH_GET_PARAM_F0(&this->actor) == ENINVADEPOH_ALIEN_ABDUCTOR) { - this->actor.update = EnInvadepoh_func_80B4D670; + this->actor.update = EnInvadepoh_Abuductor_WaitForObject; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; } else { - this->actor.update = EnInvadepoh_func_80B47BAC; - Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8B0); + this->actor.update = EnInvadepoh_Invader_WaitForObject; + Collider_SetCylinder(play, &this->collider, &this->actor, &sAlienCylinderInit); this->actor.colChkInfo.mass = 40; } - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_UCH); - if (this->unk_2F4 < 0) { + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_UCH); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } } -InitChainEntry D_80B4EC34[4] = { +InitChainEntry sCowInitChain[4] = { 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), }; -void EnInvadepoh_func_80B46520(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cow_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC34); - this->actor.update = EnInvadepoh_func_80B47FA8; + Actor_ProcessInitChain(&this->actor, sCowInitChain); + this->actor.update = EnInvadepoh_Cow_WaitForObject; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW_TAIL, 0)); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->unk_2F4 < 0) { + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } } -InitChainEntry D_80B4EC44[4] = { +InitChainEntry sCowTailInitChain[4] = { 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), }; -void EnInvadepoh_func_80B465CC(Actor* thisx, PlayState* play2) { +void EnInvadepoh_CowTail_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC44); - this->actor.update = EnInvadepoh_func_80B481C4; - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->unk_2F4 < 0) { + Actor_ProcessInitChain(&this->actor, sCowTailInitChain); + this->actor.update = EnInvadepoh_CowTail_WaitForObject; + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } } -InitChainEntry D_80B4EC54[5] = { +InitChainEntry sRomaniInitChain[5] = { 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), }; -void EnInvadepoh_func_80B46644(Actor* thisx, PlayState* play) { +void EnInvadepoh_Romani_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Stack management problems EnInvadepoh* this = (EnInvadepoh*)thisx; s32 temp_v1 = ENINVADEPOH_GET_PARAM_F0(&this->actor); - Actor_ProcessInitChain(&this->actor, D_80B4EC54); + Actor_ProcessInitChain(&this->actor, sRomaniInitChain); if ((temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) || (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3)) { this->actor.targetMode = 3; } else { this->actor.targetMode = 6; } func_800BC154(play, &play->actorCtx, &this->actor, 4); - Collider_InitCylinder(play, &this->unk_2A0); + Collider_InitCylinder(play, &this->collider); if (temp_v1 != ENINVADEPOH_ROMANI_ABDUCTED) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); - this->actor.colChkInfo.mass = 0xFF; + Collider_SetCylinder(play, &this->collider, &this->actor, &sHumanCylinderInit); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; } if (temp_v1 == ENINVADEPOH_ROMANI_ABDUCTED) { - this->actor.update = EnInvadepoh_func_80B48620; + this->actor.update = EnInvadepoh_AbductedRomani_WaitForObject; } else if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { - this->actor.update = EnInvadepoh_func_80B48FB0; + this->actor.update = EnInvadepoh_ConfusedRomani_WaitForObject; this->actor.flags = ACTOR_FLAG_10 | ACTOR_FLAG_8 | ACTOR_FLAG_1; } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { - this->actor.update = EnInvadepoh_func_80B49F88; - } else if (temp_v1 == ENINVADEPOH_ROMANI_UNKNOWN) { - this->actor.update = EnInvadepoh_func_80B4A9C8; + this->actor.update = EnInvadepoh_Night1Romani_WaitForObject; + } else if (temp_v1 == ENINVADEPOH_ROMANI_BARN) { + this->actor.update = EnInvadepoh_BarnRomani_WaitForObject; } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { - this->actor.update = EnInvadepoh_func_80B4B0C4; + this->actor.update = EnInvadepoh_RewardRomani_WaitForObject; } else { - this->actor.update = EnInvadepoh_func_80B4CE54; + this->actor.update = EnInvadepoh_Night3Romani_WaitForObject; } - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA1); - if (this->unk_2F4 < 0) { + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA1); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { - if (gSaveContext.save.saveInfo.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { Actor_Kill(&this->actor); } - } else if (temp_v1 == ENINVADEPOH_ROMANI_UNKNOWN) { + } else if (temp_v1 == ENINVADEPOH_ROMANI_BARN) { // nothing } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { Actor_Kill(&this->actor); } } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3) { - if (!(gSaveContext.save.saveInfo.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } - D_80B503F4 = this; + sRomani = this; } } -InitChainEntry D_80B4EC68[6] = { +InitChainEntry sLightBallInitChain[6] = { 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(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { +void EnInvadepoh_LightBall_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC68); - this->actor.update = EnInvadepoh_func_80B49B1C; - this->actor.draw = EnInvadepoh_func_80B4E3F0; + Actor_ProcessInitChain(&this->actor, sLightBallInitChain); + this->actor.update = EnInvadepoh_LightBall_Update; + this->actor.draw = EnInvadepoh_LightBall_Draw; func_800BC154(play, &play->actorCtx, &this->actor, 4); - if ((D_80B4E940 == 1) || (gSaveContext.save.time < CLOCK_TIME(2, 31))) { + if ((sEventState == ENINVADEPOH_EVENT_WAIT) || (gSaveContext.save.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; EnInvadepoh_func_80B491EC(this); - } else if (D_80B4E940 == 2) { + } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { this->actor.world.pos.y += 1500.0f; EnInvadepoh_func_80B49628(this); } else { @@ -1525,7 +1537,7 @@ void EnInvadepoh_func_80B468B4(Actor* thisx, PlayState* play2) { } } -InitChainEntry D_80B4EC80[6] = { +InitChainEntry sDogInitChain[6] = { ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 50, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 50, ICHAIN_CONTINUE), @@ -1533,23 +1545,23 @@ InitChainEntry D_80B4EC80[6] = { ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_STOP), }; -void EnInvadepoh_func_80B469C4(Actor* thisx, PlayState* play) { +void EnInvadepoh_Dog_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC80); - this->actor.update = EnInvadepoh_func_80B4B8BC; - Collider_InitCylinder(play, &this->unk_2A0); - Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E908); - this->actor.colChkInfo.mass = 0x50; + Actor_ProcessInitChain(&this->actor, sDogInitChain); + this->actor.update = EnInvadepoh_Dog_WaitForObject; + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sDogCylinderInit); + this->actor.colChkInfo.mass = 80; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_DOG); - if (this->unk_2F4 < 0) { + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DOG); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } } -InitChainEntry D_80B4EC98[6] = { +InitChainEntry sCremiaInitChain[6] = { ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_CONTINUE), @@ -1557,61 +1569,61 @@ InitChainEntry D_80B4EC98[6] = { ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -void EnInvadepoh_func_80B46A80(Actor* thisx, PlayState* play) { +void EnInvadepoh_Cremia_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Stack size problems EnInvadepoh* this = (EnInvadepoh*)thisx; - Actor_ProcessInitChain(&this->actor, D_80B4EC98); - this->actor.update = EnInvadepoh_func_80B4C3A0; + Actor_ProcessInitChain(&this->actor, sCremiaInitChain); + this->actor.update = EnInvadepoh_Cremia_WaitForObject; func_800BC154(play, &play->actorCtx, &this->actor, 4); - Collider_InitCylinder(play, &this->unk_2A0); - Collider_SetCylinder(play, &this->unk_2A0, &this->actor, &D_80B4E8DC); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sHumanCylinderInit); this->actor.colChkInfo.mass = MASS_HEAVY; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - this->unk_2F4 = Object_GetIndex(&play->objectCtx, OBJECT_MA2); - if (this->unk_2F4 < 0) { + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA2); + if (this->bankIndex < 0) { Actor_Kill(&this->actor); } - if (!(gSaveContext.save.saveInfo.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } - D_80B503F8 = this; + sCremia = this; } void EnInvadepoh_Init(Actor* thisx, PlayState* play) { - static ActorFunc D_80B4ECB0[14] = { - EnInvadepoh_func_80B4627C, // Event handler - EnInvadepoh_func_80B46414, // Alien invader - EnInvadepoh_func_80B46520, // Abducted cow - EnInvadepoh_func_80B465CC, // Cow tail - EnInvadepoh_func_80B46644, // Abducted Romani - EnInvadepoh_func_80B46644, // Confused Romani - EnInvadepoh_func_80B468B4, // Light ball - EnInvadepoh_func_80B46644, // Night 1 Romani - EnInvadepoh_func_80B46644, // Unknown Romani - EnInvadepoh_func_80B46644, // Reward Romani - EnInvadepoh_func_80B469C4, // Dog - EnInvadepoh_func_80B46A80, // Night 3 Cremia - EnInvadepoh_func_80B46644, // Night 3 Romani - EnInvadepoh_func_80B46414, // Alien abductor + static ActorFunc sInitFuncs[14] = { + /* 0x0 */ EnInvadepoh_Event_Init, // Event handler + /* 0x1 */ EnInvadepoh_Alien_Init, // Alien invader + /* 0x2 */ EnInvadepoh_Cow_Init, // Abducted cow + /* 0x3 */ EnInvadepoh_CowTail_Init, // Cow tail + /* 0x4 */ EnInvadepoh_Romani_Init, // Abducted Romani + /* 0x5 */ EnInvadepoh_Romani_Init, // Confused Romani + /* 0x6 */ EnInvadepoh_LightBall_Init, // Light ball + /* 0x7 */ EnInvadepoh_Romani_Init, // Night 1 Romani + /* 0x8 */ EnInvadepoh_Romani_Init, // Unknown Romani + /* 0x9 */ EnInvadepoh_Romani_Init, // Reward Romani + /* 0xA */ EnInvadepoh_Dog_Init, // Dog + /* 0xB */ EnInvadepoh_Cremia_Init, // Night 3 Cremia + /* 0xC */ EnInvadepoh_Romani_Init, // Night 3 Romani + /* 0xD */ EnInvadepoh_Alien_Init, // Alien abductor }; - D_80B4ECB0[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); + sInitFuncs[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); } -void EnInvadepoh_func_80B46BB0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Event_Destroy(Actor* thisx, PlayState* play2) { } -void EnInvadepoh_func_80B46BC0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Invader_Destroy(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; s32 sp18 = ENINVADEPOH_GET_PARAM_7(&this->actor); PlayState* play = play2; - Collider_DestroyCylinder(play, &this->unk_2A0); - D_80B50320[sp18] = NULL; + Collider_DestroyCylinder(play, &this->collider); + sAlienInvaders[sp18] = NULL; } -void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cow_Destroy(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; if (this->actor.parent != NULL) { @@ -1622,7 +1634,7 @@ void EnInvadepoh_func_80B46C08(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play2) { +void EnInvadepoh_CowTail_Destroy(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; if (this->actor.parent != NULL) { @@ -1630,45 +1642,45 @@ void EnInvadepoh_func_80B46C34(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B46C50(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Romani_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; // both or neither recast required EnInvadepoh* this = (EnInvadepoh*)thisx; - Collider_DestroyCylinder(play, &this->unk_2A0); + Collider_DestroyCylinder(play, &this->collider); } -void EnInvadepoh_func_80B46C7C(Actor* thisx, PlayState* play2) { - D_80B503F0 = NULL; +void EnInvadepoh_LightBall_Destroy(Actor* thisx, PlayState* play2) { + sLightBall = NULL; } -void EnInvadepoh_func_80B46C94(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Dog_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; // both or neither recast required EnInvadepoh* this = (EnInvadepoh*)thisx; - Collider_DestroyCylinder(play, &this->unk_2A0); + Collider_DestroyCylinder(play, &this->collider); } -void EnInvadepoh_func_80B46CC0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cremia_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Collider_DestroyCylinder(play, &this->unk_2A0); - D_80B503F8 = NULL; + Collider_DestroyCylinder(play, &this->collider); + sCremia = NULL; } -void EnInvadepoh_func_80B46CF4(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Romani_Destroy2(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Collider_DestroyCylinder(play, &this->unk_2A0); - D_80B503F4 = NULL; + Collider_DestroyCylinder(play, &this->collider); + sRomani = NULL; } -void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Abductor_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; // this recast required - Collider_DestroyCylinder(play, &this->unk_2A0); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.child != NULL) { this->actor.child->parent = NULL; } @@ -1676,86 +1688,86 @@ void EnInvadepoh_func_80B46D28(Actor* thisx, PlayState* play2) { void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { static ActorFunc D_80B4ECE8[14] = { - EnInvadepoh_func_80B46BB0, // Event handler - EnInvadepoh_func_80B46BC0, // Alien invader - EnInvadepoh_func_80B46C08, // Abducted cow - EnInvadepoh_func_80B46C34, // Cow tail - EnInvadepoh_func_80B46C50, // Abducted Romani - EnInvadepoh_func_80B46C50, // Confused Romani - EnInvadepoh_func_80B46C7C, // Light ball - EnInvadepoh_func_80B46C50, // Night 1 Romani - EnInvadepoh_func_80B46C50, // Unknown Romani - EnInvadepoh_func_80B46C50, // Reward Romani - EnInvadepoh_func_80B46C94, // Dog - EnInvadepoh_func_80B46CC0, // Night 3 Cremia - EnInvadepoh_func_80B46CF4, // Night 3 Romani - EnInvadepoh_func_80B46D28, // Alien abductor + /* 0x0 */ EnInvadepoh_Event_Destroy, // Event handler + /* 0x1 */ EnInvadepoh_Invader_Destroy, // Alien invader + /* 0x2 */ EnInvadepoh_Cow_Destroy, // Abducted cow + /* 0x3 */ EnInvadepoh_CowTail_Destroy, // Cow tail + /* 0x4 */ EnInvadepoh_Romani_Destroy, // Abducted Romani + /* 0x5 */ EnInvadepoh_Romani_Destroy, // Confused Romani + /* 0x6 */ EnInvadepoh_LightBall_Destroy, // Light ball + /* 0x7 */ EnInvadepoh_Romani_Destroy, // Night 1 Romani + /* 0x8 */ EnInvadepoh_Romani_Destroy, // Unknown Romani + /* 0x9 */ EnInvadepoh_Romani_Destroy, // Reward Romani + /* 0xA */ EnInvadepoh_Dog_Destroy, // Dog + /* 0xB */ EnInvadepoh_Cremia_Destroy, // Night 3 Cremia + /* 0xC */ EnInvadepoh_Romani_Destroy2, // Night 3 Romani + /* 0xD */ EnInvadepoh_Abductor_Destroy, // Alien abductor }; D_80B4ECE8[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); } -void EnInvadepoh_func_80B46DA8(EnInvadepoh* this) { - D_80B4E940 = 1; - this->actionFunc = EnInvadepoh_func_80B46DC8; +void EnInvadepoh_Event_SetupWait(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_WAIT; + this->actionFunc = EnInvadepoh_Event_Wait; } -void EnInvadepoh_func_80B46DC8(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Event_Wait(EnInvadepoh* this, PlayState* play) { if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { - EnInvadepoh_func_80B454BC(this, play); - EnInvadepoh_func_80B452EC(this, play); - EnInvadepoh_func_80B46E20(this); + EnInvadepoh_Event_SpawnLightBall(this, play); + EnInvadepoh_Event_SpawnAliens(this, play); + EnInvadepoh_Event_SetupQueueInvasionCs(this); } } -void EnInvadepoh_func_80B46E20(EnInvadepoh* this) { - D_80B4E940 = 2; - this->unk_2F0 = 2; - this->actionFunc = EnInvadepoh_func_80B46E44; +void EnInvadepoh_Event_SetupQueueInvasionCs(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_ACTIVE; + this->actionTimer = 2; + this->actionFunc = EnInvadepoh_Event_QueueInvasionCs; } -void EnInvadepoh_func_80B46E44(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 > 0) { - this->unk_2F0--; - } else if (CutsceneManager_IsNext(D_80B50404[0])) { - CutsceneManager_StartWithPlayerCs(D_80B50404[0], &this->actor); - EnInvadepoh_func_80B46EC0(this); +void EnInvadepoh_Event_QueueInvasionCs(EnInvadepoh* this, PlayState* play) { + if (this->actionTimer > 0) { + this->actionTimer--; + } else if (CutsceneManager_IsNext(sCutsceneIds[0])) { + CutsceneManager_StartWithPlayerCs(sCutsceneIds[0], &this->actor); + EnInvadepoh_Event_SetupInvasionCs(this); } else { - CutsceneManager_Queue(D_80B50404[0]); + CutsceneManager_Queue(sCutsceneIds[0]); } } -void EnInvadepoh_func_80B46EC0(EnInvadepoh* this) { - D_80B4E940 = 2; - this->unk_2F0 = 160; - this->actionFunc = EnInvadepoh_func_80B46EE8; +void EnInvadepoh_Event_SetupInvasionCs(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_ACTIVE; + this->actionTimer = 160; + this->actionFunc = EnInvadepoh_Event_InvasionCs; } -void EnInvadepoh_func_80B46EE8(EnInvadepoh* this, PlayState* play) { - static s16 D_80B4ED20[8] = { +void EnInvadepoh_Event_InvasionCs(EnInvadepoh* this, PlayState* play) { + static s16 sAlienWarpTimes[8] = { 130, 125, 115, 100, 80, 78, 76, 74, }; s32 i; for (i = 0; i < 8; i++) { - if (this->unk_2F0 == D_80B4ED20[i]) { - D_80B50340[i] |= 1; + if (this->actionTimer == sAlienWarpTimes[i]) { + sAlienStateFlags[i] |= ENINVADEPOH_INVADER_ACTIVE; } } - this->unk_2F0--; - if (this->unk_2F0 <= 0) { - CutsceneManager_Stop(D_80B50404[0]); + this->actionTimer--; + if (this->actionTimer <= 0) { + CutsceneManager_Stop(sCutsceneIds[0]); AudioSeq_QueueSeqCmd(0x8000 | NA_BGM_ALIEN_INVASION); - EnInvadepoh_func_80B46F88(this); + EnInvadepoh_Event_SetupInvasion(this); } } -void EnInvadepoh_func_80B46F88(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionFunc = EnInvadepoh_func_80B46FA8; +void EnInvadepoh_Event_SetupInvasion(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_ACTIVE; + this->actionFunc = EnInvadepoh_Event_Invasion; } -void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Event_Invasion(EnInvadepoh* this, PlayState* play) { Actor** var_v1; EnInvadepoh* temp_a0; s32 var_v0; @@ -1764,45 +1776,45 @@ void EnInvadepoh_func_80B46FA8(EnInvadepoh* this, PlayState* play) { s32 i; if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - gSaveContext.save.saveInfo.weekEventReg[22] |= 1; - EnInvadepoh_func_80B47064(this); + SET_WEEKEVENTREG(WEEKEVENTREG_22_01); + EnInvadepoh_Event_SetupQueueVictoryCs(this); } else { - EnInvadepoh_func_80B457A0(this); - for (i = 0; i < this->unk_379; i++) { - if ((D_80B50320[i] != NULL) && (D_80B50320[i]->unk_38A)) { - EnInvadepoh_func_80B47278(this); + EnInvadepoh_Event_SetClosestAlien(this); + for (i = 0; i < this->spawnCount; i++) { + if ((sAlienInvaders[i] != NULL) && (sAlienInvaders[i]->atBarn)) { + EnInvadepoh_Event_SetupFailure(this); break; } } } } -void EnInvadepoh_func_80B47064(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = EnInvadepoh_func_80B47084; +void EnInvadepoh_Event_SetupQueueVictoryCs(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_CLEAR; + this->actionFunc = EnInvadepoh_Event_QueueVictoryCs; } -void EnInvadepoh_func_80B47084(EnInvadepoh* this, PlayState* play) { - if (CutsceneManager_IsNext(D_80B50404[1])) { - CutsceneManager_StartWithPlayerCs(D_80B50404[1], &this->actor); - EnInvadepoh_func_80B470E0(this); +void EnInvadepoh_Event_QueueVictoryCs(EnInvadepoh* this, PlayState* play) { + if (CutsceneManager_IsNext(sCutsceneIds[1])) { + CutsceneManager_StartWithPlayerCs(sCutsceneIds[1], &this->actor); + EnInvadepoh_Event_SetupVictoryCs(this); } else { - CutsceneManager_Queue(D_80B50404[1]); + CutsceneManager_Queue(sCutsceneIds[1]); } } -void EnInvadepoh_func_80B470E0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->unk_2F0 = 110; - this->actionFunc = EnInvadepoh_func_80B47108; +void EnInvadepoh_Event_SetupVictoryCs(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_CLEAR; + this->actionTimer = 110; + this->actionFunc = EnInvadepoh_Event_VictoryCs; } -void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 == 100) { +void EnInvadepoh_Event_VictoryCs(EnInvadepoh* this, PlayState* play) { + if (this->actionTimer == 100) { Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } - this->unk_2F0--; - if (this->unk_2F0 <= 0) { + this->actionTimer--; + if (this->actionTimer <= 0) { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1810,226 +1822,226 @@ void EnInvadepoh_func_80B47108(EnInvadepoh* this, PlayState* play) { gSaveContext.nextTransitionType = TRANS_TYPE_72; D_801BDAA0 = 1; D_801BDA9C = 0; - EnInvadepoh_func_80B47248(this); + EnInvadepoh_Event_SetupGoodEnd(this); } } -void EnInvadepoh_func_80B471C0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = EnInvadepoh_func_80B471E0; +void EnInvadepoh_Event_SetupRomaniReward(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_CLEAR; + this->actionFunc = EnInvadepoh_Event_RomaniReward; } -void EnInvadepoh_func_80B471E0(EnInvadepoh* this, PlayState* play) { - if (D_80B4E998 != 0) { +void EnInvadepoh_Event_RomaniReward(EnInvadepoh* this, PlayState* play) { + if (sRewardFinished) { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; gSaveContext.nextTransitionType = TRANS_TYPE_72; - EnInvadepoh_func_80B47248(this); + EnInvadepoh_Event_SetupGoodEnd(this); } } -void EnInvadepoh_func_80B47248(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = EnInvadepoh_func_80B47268; +void EnInvadepoh_Event_SetupGoodEnd(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_CLEAR; + this->actionFunc = EnInvadepoh_Event_GoodEnd; } -void EnInvadepoh_func_80B47268(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Event_GoodEnd(EnInvadepoh* this, PlayState* play) { } -void EnInvadepoh_func_80B47278(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = EnInvadepoh_func_80B47298; +void EnInvadepoh_Event_SetupFailure(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_FAILED; + this->actionFunc = EnInvadepoh_Event_Failure; } -void EnInvadepoh_func_80B47298(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Event_Failure(EnInvadepoh* this, PlayState* play) { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; gSaveContext.nextTransitionType = TRANS_TYPE_72; - gSaveContext.save.saveInfo.weekEventReg[89] |= 0x10; - EnInvadepoh_func_80B47304(this); + SET_WEEKEVENTREG(WEEKEVENTREG_89_10); + EnInvadepoh_Event_SetupBadEnd(this); } -void EnInvadepoh_func_80B47304(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = EnInvadepoh_func_80B47324; +void EnInvadepoh_Event_SetupBadEnd(EnInvadepoh* this) { + sEventState = ENINVADEPOH_EVENT_FAILED; + this->actionFunc = EnInvadepoh_Event_BadEnd; } -void EnInvadepoh_func_80B47324(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Event_BadEnd(EnInvadepoh* this, PlayState* play) { } -void EnInvadepoh_Update(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Event_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; this->actionFunc(this, play); - this->actor.draw = EnInvadepoh_func_80B461DC() ? EnInvadepoh_func_80B4D9B4 : NULL; + this->actor.draw = EnInvadepoh_Event_UpdateWarps() ? EnInvadepoh_Event_Draw : NULL; } -void EnInvadepoh_func_80B47380(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~AT_ON; - this->unk_2A0.base.acFlags &= ~AC_ON; - this->unk_2A0.base.ocFlags1 &= ~OC1_ON; +void EnInvadepoh_Invader_SetupWaitForEvent(EnInvadepoh* this) { + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; + this->collider.base.ocFlags1 &= ~OC1_ON; this->actor.flags &= ~ACTOR_FLAG_80000000; - this->unk_389 = 0; + this->alpha = 0; this->actor.draw = NULL; - this->unk_38B = 0; - this->unk_38C = 0; - this->unk_38D = 0; - this->actionFunc = EnInvadepoh_func_80B473E4; + this->present = false; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 0; + this->actionFunc = EnInvadepoh_Invader_WaitForEvent; } -void EnInvadepoh_func_80B473E4(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B442E4(this); - EnInvadepoh_func_80B447C0(this, play); - EnInvadepoh_func_80B43DD4(this, 0x320, 0); - if (D_80B50340[ENINVADEPOH_GET_PARAM_7(&this->actor)] & 1) { +void EnInvadepoh_Invader_WaitForEvent(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_Invader_SetProgress(this); + EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); + if (sAlienStateFlags[ENINVADEPOH_GET_PARAM_7(&this->actor)] & ENINVADEPOH_INVADER_ACTIVE) { Actor_SetScale(&this->actor, 0.01f); - EnInvadepoh_func_80B4516C(this); - EnInvadepoh_func_80B46118(&this->actor.world.pos); - EnInvadepoh_func_80B47568(this); + EnInvadepoh_SnapToFloor(this); + EnInvadepoh_Invader_SpawnWarp(&this->actor.world.pos); + EnInvadepoh_Invader_SetupWarpIn(this); } } -void EnInvadepoh_func_80B47478(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~AT_ON; - this->unk_2A0.base.acFlags &= ~AC_ON; - this->unk_2A0.base.ocFlags1 &= ~OC1_ON; +void EnInvadepoh_Invader_SetupWaitToRespawn(EnInvadepoh* this) { + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; + this->collider.base.ocFlags1 &= ~OC1_ON; this->actor.flags &= ~ACTOR_FLAG_80000000; - this->unk_389 = 0; + this->alpha = 0; this->actor.draw = NULL; - this->unk_38B = 0; - this->unk_38C = 0; - this->unk_38D = 0; - this->actionFunc = EnInvadepoh_func_80B474DC; + this->present = false; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 0; + this->actionFunc = EnInvadepoh_Invade_WaitToRespawn; } -void EnInvadepoh_func_80B474DC(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B442E4(this); - EnInvadepoh_func_80B447C0(this, play); - EnInvadepoh_func_80B43DD4(this, 0x320, 0); - if (this->unk_320 > 0.0f) { +void EnInvadepoh_Invade_WaitToRespawn(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_Invader_SetProgress(this); + EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); + if (this->progress > 0.0f) { Actor_SetScale(&this->actor, 0.01f); - EnInvadepoh_func_80B4516C(this); - EnInvadepoh_func_80B46118(&this->actor.world.pos); - EnInvadepoh_func_80B47568(this); + EnInvadepoh_SnapToFloor(this); + EnInvadepoh_Invader_SpawnWarp(&this->actor.world.pos); + EnInvadepoh_Invader_SetupWarpIn(this); } } -void EnInvadepoh_func_80B47568(EnInvadepoh* this) { +void EnInvadepoh_Invader_SetupWarpIn(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - this->unk_2A0.base.atFlags &= ~AT_ON; - this->unk_2A0.base.acFlags &= ~AC_ON; - this->unk_2A0.base.ocFlags1 &= ~OC1_ON; - this->unk_389 = 0; - this->actor.draw = EnInvadepoh_func_80B4DB14; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 0; + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; + this->collider.base.ocFlags1 &= ~OC1_ON; + this->alpha = 0; + this->actor.draw = EnInvadepoh_Alien_Draw; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 0; this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = EnInvadepoh_func_80B47600; + this->actionFunc = EnInvadepoh_Invader_WarpIn; } -void EnInvadepoh_func_80B47600(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B442E4(this); - EnInvadepoh_func_80B447C0(this, play); - EnInvadepoh_func_80B43DD4(this, 0x320, 0); +void EnInvadepoh_Invader_WarpIn(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_Invader_SetProgress(this); + EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->unk_320 >= 0.9999f) { - this->unk_38A = 1; + if (this->progress >= 0.9999f) { + this->atBarn = true; } - if (this->unk_389 >= 249) { - this->unk_389 = 255; + if (this->alpha >= 249) { + this->alpha = 255; } else { - this->unk_389 += 6; + this->alpha += 6; } - if (this->unk_389 > 128) { - this->unk_2A0.base.atFlags |= AT_ON; - this->unk_2A0.base.acFlags |= AC_ON; - this->unk_2A0.base.ocFlags1 |= OC1_ON; + if (this->alpha > 128) { + this->collider.base.atFlags |= AT_ON; + this->collider.base.acFlags |= AC_ON; + this->collider.base.ocFlags1 |= OC1_ON; } - if (this->unk_389 == 255) { - if (this->unk_38D >= 245) { - this->unk_38D = 255; - EnInvadepoh_func_80B4770C(this); + if (this->alpha == 255) { + if (this->eyeBeamAlpha >= 245) { + this->eyeBeamAlpha = 255; + EnInvadepoh_Invader_SetupAttack(this); } else { - this->unk_38D += 10; + this->eyeBeamAlpha += 10; } } } -void EnInvadepoh_func_80B4770C(EnInvadepoh* this) { +void EnInvadepoh_Invader_SetupAttack(EnInvadepoh* this) { if (this->skelAnime.animation != &gAlienFloatAnim) { Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); } - this->unk_2A0.base.atFlags |= AT_ON; - this->unk_2A0.base.acFlags |= AC_ON; - this->unk_2A0.base.ocFlags1 |= OC1_ON; - this->unk_389 = 255; - this->actor.draw = EnInvadepoh_func_80B4DB14; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 255; + this->collider.base.atFlags |= AT_ON; + this->collider.base.acFlags |= AC_ON; + this->collider.base.ocFlags1 |= OC1_ON; + this->alpha = 255; + this->actor.draw = EnInvadepoh_Alien_Draw; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 255; this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = EnInvadepoh_func_80B477B4; + this->actionFunc = EnInvadepoh_Invader_Attack; } -void EnInvadepoh_func_80B477B4(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B442E4(this); - EnInvadepoh_func_80B447C0(this, play); - EnInvadepoh_func_80B43DD4(this, 0x320, 0); +void EnInvadepoh_Invader_Attack(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_Invader_SetProgress(this); + EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->unk_320 >= 0.9999f) { - this->unk_38A = 1; + if (this->progress >= 0.9999f) { + this->atBarn = true; } } -void EnInvadepoh_func_80B47830(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~AT_ON; - this->unk_2A0.base.acFlags &= ~AC_ON; - this->unk_2A0.base.ocFlags1 |= OC1_ON; +void EnInvadepoh_Invader_SetupHitstun(EnInvadepoh* this) { + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; + this->collider.base.ocFlags1 |= OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10); - this->unk_389 = 255; - this->actor.draw = EnInvadepoh_func_80B4DB14; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 0; - this->unk_2F0 = 8; - this->unk_2F2 = 0; + this->alpha = 255; + this->actor.draw = EnInvadepoh_Alien_Draw; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 0; + this->actionTimer = 8; + this->stateTimer = 0; this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = EnInvadepoh_func_80B478F4; + this->actionFunc = EnInvadepoh_Invader_Hitstun; } -void EnInvadepoh_func_80B478F4(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44A90(this, play); - this->unk_2F0--; - if (this->unk_2F0 <= 0) { - EnInvadepoh_func_80B47938(this); +void EnInvadepoh_Invader_Hitstun(EnInvadepoh* this, PlayState* play) { + EnInvadepoh_Invader_Knockback(this, play); + this->actionTimer--; + if (this->actionTimer <= 0) { + EnInvadepoh_Invader_SetupDeath(this); } } -void EnInvadepoh_func_80B47938(EnInvadepoh* this) { - this->unk_2A0.base.atFlags &= ~AT_ON; - this->unk_2A0.base.acFlags &= ~AC_ON; - this->unk_2A0.base.ocFlags1 &= ~OC1_ON; +void EnInvadepoh_Invader_SetupDeath(EnInvadepoh* this) { + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; + this->collider.base.ocFlags1 &= ~OC1_ON; Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_2F0 = 10; - this->unk_389 = 255; - this->actor.draw = EnInvadepoh_func_80B4DB14; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 255; + this->actionTimer = 10; + this->alpha = 255; + this->actor.draw = EnInvadepoh_Alien_Draw; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 255; this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = EnInvadepoh_func_80B479E8; + this->actionFunc = EnInvadepoh_Invader_Death; } -void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play) { static Vec3f D_80B4ED30[5] = { { 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 }, @@ -2042,72 +2054,72 @@ void EnInvadepoh_func_80B479E8(EnInvadepoh* this, PlayState* play) { Vec3f* temp; EnInvadepoh_func_80B44B78(this); - if (this->unk_2F2 < 5) { - temp = &D_80B4ED30[this->unk_2F2]; + if (this->stateTimer < 5) { + temp = &D_80B4ED30[this->stateTimer]; if (temp->x > 0.0f) { - this->unk_38B = 1; - this->unk_38D = 255; + this->present = true; + this->eyeBeamAlpha = 255; Math_Vec3f_Copy(&this->actor.scale, temp); } else { - this->unk_38B = 0; - this->unk_38D = 0; + this->present = false; + this->eyeBeamAlpha = 0; } } else { - this->unk_38B = 0; - this->unk_38D = 0; + this->present = false; + this->eyeBeamAlpha = 0; } - if ((this->unk_2F2 >= 2) && (this->unk_2F2 < 9)) { - temp = &D_80B4ED6C[this->unk_2F2 - 2]; + if ((this->stateTimer >= 2) && (this->stateTimer < 9)) { + temp = &D_80B4ED6C[this->stateTimer - 2]; if (temp->x > 0.0f) { - this->unk_38C = 1; - Math_Vec3f_Copy(&this->unk_390, temp); + this->drawDeathFlash = true; + Math_Vec3f_Copy(&this->deathFlashScale, temp); } else { - this->unk_38C = 0; + this->drawDeathFlash = false; } } else { - this->unk_38C = 0; + this->drawDeathFlash = false; } - this->unk_2F2++; - if (this->unk_2F0 == 8) { + this->stateTimer++; + if (this->actionTimer == 8) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); } - if (this->unk_2F0 == 8) { + if (this->actionTimer == 8) { Enemy_StartFinishingBlow(play, &this->actor); } - this->unk_2F0--; - if (this->unk_2F0 <= 0) { - EnInvadepoh_func_80B43AF0(ENINVADEPOH_GET_PARAM_7(&this->actor)); - EnInvadepoh_func_80B43AB0(); + this->actionTimer--; + if (this->actionTimer <= 0) { + EnInvadepoh_Invader_ResetWarpInTime(ENINVADEPOH_GET_PARAM_7(&this->actor)); + EnInvadepoh_Invader_AddKill(); Item_DropCollectible(play, &this->actor.world.pos, 8); - EnInvadepoh_func_80B47478(this); + EnInvadepoh_Invader_SetupWaitToRespawn(this); } } -void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Invader_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B45080(); - this->actor.update = EnInvadepoh_func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->unk_188, this->unk_212, + EnInvadepoh_Alien_SetTexAnim(); + this->actor.update = EnInvadepoh_Invader_Update; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, ALIEN_LIMB_MAX); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame / 8.0f; - EnInvadepoh_func_80B444BC(this, play); - EnInvadepoh_func_80B442E4(this); - EnInvadepoh_func_80B447C0(this, play); - EnInvadepoh_func_80B43F0C(this); - EnInvadepoh_func_80B4516C(this); - if ((D_80B4E940 == 1) || (gSaveContext.save.time < CLOCK_TIME(2, 31))) { - EnInvadepoh_func_80B47380(this); - } else if (D_80B4E940 == 2) { - if (this->unk_320 >= 0.0001f) { - EnInvadepoh_func_80B4770C(this); + EnInvadepoh_Invader_SetupPath(this, play); + EnInvadepoh_Invader_SetProgress(this); + EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_SetYawAlongPath(this); + EnInvadepoh_SnapToFloor(this); + if ((sEventState == ENINVADEPOH_EVENT_WAIT) || (gSaveContext.save.time < CLOCK_TIME(2, 31))) { + EnInvadepoh_Invader_SetupWaitForEvent(this); + } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { + if (this->progress >= 0.0001f) { + EnInvadepoh_Invader_SetupAttack(this); } else { - EnInvadepoh_func_80B47568(this); + EnInvadepoh_Invader_SetupWarpIn(this); } } else { Actor_Kill(&this->actor); @@ -2115,22 +2127,22 @@ void EnInvadepoh_func_80B47BAC(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Invader_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (D_80B4E940 == 3) { - if ((this->actionFunc == EnInvadepoh_func_80B477B4) || (this->actionFunc == EnInvadepoh_func_80B47600)) { + if (sEventState == ENINVADEPOH_EVENT_CLEAR) { + if ((this->actionFunc == EnInvadepoh_Invader_Attack) || (this->actionFunc == EnInvadepoh_Invader_WarpIn)) { thisx->speed = 0.0f; thisx->velocity.y = 0.0f; thisx->gravity = 0.0f; - EnInvadepoh_func_80B47830(this); - } else if ((this->actionFunc == EnInvadepoh_func_80B474DC) || (this->actionFunc == EnInvadepoh_func_80B473E4)) { + EnInvadepoh_Invader_SetupHitstun(this); + } else if ((this->actionFunc == EnInvadepoh_Invade_WaitToRespawn) || (this->actionFunc == EnInvadepoh_Invader_WaitForEvent)) { Actor_Kill(thisx); return; } - } else if (this->unk_2A0.base.acFlags & AC_HIT) { - Actor* hitbox = this->unk_2A0.base.ac; + } else if (this->collider.base.acFlags & AC_HIT) { + Actor* hitbox = this->collider.base.ac; thisx->speed = hitbox->speed * 0.5f; thisx->speed = CLAMP(thisx->speed, -60.0f, 60.0f); @@ -2142,55 +2154,55 @@ void EnInvadepoh_func_80B47D30(Actor* thisx, PlayState* play2) { thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); - EnInvadepoh_func_80B47830(this); + EnInvadepoh_Invader_SetupHitstun(this); } this->actionFunc(this, play); if (thisx->draw != NULL) { - this->unk_29C = SkelAnime_Update(&this->skelAnime); + this->finishedAnim = SkelAnime_Update(&this->skelAnime); } - Collider_UpdateCylinder(thisx, &this->unk_2A0); + Collider_UpdateCylinder(thisx, &this->collider); - if (this->unk_2A0.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_2A0.base); + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { - this->unk_2A0.base.atFlags &= ~AT_HIT; + this->collider.base.atFlags &= ~AT_HIT; } - if (this->unk_2A0.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_2A0.base); + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } else { - this->unk_2A0.base.acFlags &= ~AC_HIT; + this->collider.base.acFlags &= ~AC_HIT; } - if (this->unk_2A0.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + if (this->collider.base.ocFlags1 & OC1_ON) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { - this->unk_2A0.base.ocFlags1 &= ~OC1_HIT; + this->collider.base.ocFlags1 &= ~OC1_HIT; } } -void EnInvadepoh_func_80B47FA8(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cow_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - this->actor.update = EnInvadepoh_func_80B48060; - this->actor.draw = EnInvadepoh_func_80B4E158; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->unk_188, this->unk_212, COW_LIMB_MAX); + this->actor.update = EnInvadepoh_Cow_Update; + this->actor.draw = EnInvadepoh_Cow_Draw; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); } } -void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cow_Update(Actor* thisx, PlayState* play2) { static s16 D_80B4EDC0[3] = { -0x1F40, -0x1770, -0x2AF8 }; PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 sp6C; - if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { + if ((sLightBall == NULL) || (this->actor.parent == NULL)) { Actor_Kill(&this->actor); return; } @@ -2214,26 +2226,26 @@ void EnInvadepoh_func_80B48060(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B481C4(Actor* thisx, PlayState* play2) { +void EnInvadepoh_CowTail_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - this->actor.update = EnInvadepoh_func_80B4827C; - this->actor.draw = EnInvadepoh_func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->unk_188, this->unk_212, + this->actor.update = EnInvadepoh_CowTail_Update; + this->actor.draw = EnInvadepoh_CowTail_Draw; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, COW_TAIL_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); } } -void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2) { +void EnInvadepoh_CowTail_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((D_80B503F0 == NULL) || (this->actor.parent == NULL)) { + if ((sLightBall == NULL) || (this->actor.parent == NULL)) { Actor_Kill(&this->actor); } else { SkelAnime_Update(&this->skelAnime); @@ -2241,30 +2253,30 @@ void EnInvadepoh_func_80B4827C(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B482D4(EnInvadepoh* this) { - this->unk_2F0 = 40; + this->actionTimer = 40; Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); this->actor.draw = NULL; this->actionFunc = EnInvadepoh_func_80B48324; } void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play) { - this->unk_2F0--; - if (this->unk_2F0 <= 0) { - EnInvadepoh_func_80B4560C(this, play, 0x332F); // Romani's scream when abducted - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actionTimer--; + if (this->actionTimer <= 0) { + EnInvadepoh_Romani_SetTextId(this, play, 0x332F); // Romani's scream when abducted + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B48374(this); } } void EnInvadepoh_func_80B48374(EnInvadepoh* this) { - this->unk_2F0 = 60; + this->actionTimer = 60; Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.draw = EnInvadepoh_Romani_Draw; this->actionFunc = EnInvadepoh_func_80B483CC; } void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 == 20) { + if (this->actionTimer == 20) { EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; temp_s0->unk_26.x = 0x7D0; @@ -2274,8 +2286,8 @@ void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { temp_s0->unk_2C = 0x3E8; } - this->unk_2F0--; - if (this->unk_2F0 <= 0) { + this->actionTimer--; + if (this->actionTimer <= 0) { EnInvadepoh_func_80B4843C(this); } } @@ -2289,25 +2301,25 @@ void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { this->unk_324.unk_42 = 0x3A98; this->unk_324.unk_44 = 0.1f; this->unk_324.unk_48 = 0x7D0; - this->unk_2F0 = 50; + this->actionTimer = 50; Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, 0, -5.0f); - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.draw = EnInvadepoh_Romani_Draw; this->actionFunc = EnInvadepoh_func_80B484EC; } void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 == 40) { + if (this->actionTimer == 40) { this->unk_324.unk_26.y = 0x1B58; - } else if (this->unk_2F0 == 30) { + } else if (this->actionTimer == 30) { this->unk_324.unk_26.y = -0x1B58; - } else if (this->unk_2F0 == 20) { + } else if (this->actionTimer == 20) { this->unk_324.unk_26.y = 0x1B58; - } else if (this->unk_2F0 == 10) { + } else if (this->actionTimer == 10) { this->unk_324.unk_26.y = 0; } - this->unk_2F0--; - if (this->unk_2F0 <= 0) { + this->actionTimer--; + if (this->actionTimer <= 0) { EnInvadepoh_func_80B48588(this); } } @@ -2323,24 +2335,24 @@ void EnInvadepoh_func_80B48588(EnInvadepoh* this) { this->unk_324.unk_48 = 0x1B58; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.draw = EnInvadepoh_Romani_Draw; this->actionFunc = EnInvadepoh_func_80B48610; } void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play) { } -void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2) { +void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - this->actor.update = EnInvadepoh_func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, + EnInvadepoh_Romani_DesegmentTextures(); + this->actor.update = EnInvadepoh_AbductedRomani_Update; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); @@ -2349,7 +2361,7 @@ void EnInvadepoh_func_80B48620(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4873C(Actor* thisx, PlayState* play2) { +void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; @@ -2370,7 +2382,7 @@ void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { static s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; - this->unk_2F0 = Rand_S16Offset(150, 250); + this->actionTimer = Rand_S16Offset(150, 250); temp_v1->unk_26.x = D_80B4EDC8[Rand_Next() >> 0x1E]; temp_v1->unk_26.y = 0; temp_v1->unk_26.z = 0; @@ -2396,8 +2408,8 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B48948(this); } @@ -2407,7 +2419,7 @@ void EnInvadepoh_func_80B48948(EnInvadepoh* this) { EnInvadePohUnkStruct_324* sp24 = &this->unk_324; f32 sp28 = Rand_ZeroOne(); - this->unk_2F0 = Rand_S16Offset(150, 150); + this->actionTimer = Rand_S16Offset(150, 150); if (sp28 < 0.5f) { this->unk_374 = 0; Math_Vec3s_Copy(&sp24->unk_26, &gZeroVec3s); @@ -2460,8 +2472,8 @@ void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { temp_s0->unk_26.x = 0; temp_s0->unk_26.y = 0; } - if (this->unk_2F0 > 0) { - s32 temp = (u32)this->unk_2F0 % 0x20; + if (this->actionTimer > 0) { + s32 temp = (u32)this->actionTimer % 0x20; if ((temp == 0) && (Rand_ZeroOne() < 0.3f)) { s32 temp_v1_3 = (s32)Rand_Next() % 4; @@ -2489,7 +2501,7 @@ void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { } } } - this->unk_2F0--; + this->actionTimer--; return; } EnInvadepoh_func_80B487B4(this); @@ -2525,56 +2537,56 @@ void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B48FB0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_ConfusedRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - this->actor.update = EnInvadepoh_func_80B490F0; - this->actor.draw = EnInvadepoh_func_80B4E324; + EnInvadepoh_Romani_DesegmentTextures(); + this->actor.update = EnInvadepoh_ConfusedRomani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; this->actor.textId = 0x3330; // ........ - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->unk_188, this->unk_212, + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B444F4(this, play); - EnInvadepoh_func_80B4407C(this, 0); + EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); EnInvadepoh_func_80B487B4(this); } } -void EnInvadepoh_func_80B490F0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); - if (sp28) { + if (talkRequested) { func_80151BB4(play, 5); EnInvadepoh_func_80B48DE4(this); } this->actionFunc(this, play); - if (sp2C) { + if (inUncullRange) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_func_80B45CE0(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B48E4C) && !sp28 && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_func_80B48E4C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } void EnInvadepoh_func_80B491EC(EnInvadepoh* this) { this->actor.gravity = -15.0f; - this->unk_39C = 0.0f; - this->unk_3A0 = 1.0f; - this->unk_3A4 = 0.0f; - this->unk_3AA = 0; + this->pulseScale = 0.0f; + this->pulseScaleTarget = 1.0f; + this->pulseScaleRate = 0.0f; + this->pulseRate = 0; this->actionFunc = EnInvadepoh_func_80B49228; } @@ -2588,17 +2600,17 @@ void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play) { fabsf(this->actor.velocity.y), 1.0f); func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); if (fabsf(sp28) < 1.0f) { - EnInvadepoh_func_80B45EC8(this, play, 50); + EnInvadepoh_LightBall_SpawnSparkles(this, play, 50); EnInvadepoh_func_80B492FC(this); } } void EnInvadepoh_func_80B492FC(EnInvadepoh* this) { this->actor.velocity.y *= 0.1f; - this->unk_2F0 = 20; - this->unk_3A0 = 0.3f; - this->unk_3A4 = 0.03f; - this->unk_3AA = 0xBB8; + this->actionTimer = 20; + this->pulseScaleTarget = 0.3f; + this->pulseScaleRate = 0.03f; + this->pulseRate = 0xBB8; this->actionFunc = EnInvadepoh_func_80B4934C; } @@ -2613,25 +2625,25 @@ void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play) { this->actor.velocity.y *= 0.96f; Actor_MoveWithGravity(&this->actor); func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - this->unk_2F0--; - if (this->unk_2F0 <= 0) { + this->actionTimer--; + if (this->actionTimer <= 0) { EnInvadepoh_func_80B49404(this); } } void EnInvadepoh_func_80B49404(EnInvadepoh* this) { - this->unk_2F0 = 120; - this->unk_3A0 = 0.2f; - this->unk_3A4 = 0.01f; + this->actionTimer = 120; + this->pulseScaleTarget = 0.2f; + this->pulseScaleRate = 0.01f; this->actor.gravity = 33.0f; - this->unk_3AA = 0xBB8; - this->unk_3AC = 0; - this->unk_2F2 = 0; + this->pulseRate = 0xBB8; + this->lightBallTarget = 0; + this->stateTimer = 0; this->actionFunc = EnInvadepoh_func_80B49454; } void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { - static Vec3f D_80B4EDD0[5] = { + static Vec3f sLightBallTargets[5] = { { -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 }, }; @@ -2639,16 +2651,16 @@ void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { Vec3f sp30; s32 pad2; - if (this->unk_2F2 < 25) { - this->unk_2F2++; + if (this->stateTimer < 25) { + this->stateTimer++; } else { - this->unk_2F2 = 0; - this->unk_3AC++; - this->unk_3AC = CLAMP_MAX(this->unk_3AC, 4); + this->stateTimer = 0; + this->lightBallTarget++; + this->lightBallTarget = CLAMP_MAX(this->lightBallTarget, ARRAY_COUNT(sLightBallTargets) - 1); this->actor.gravity = 33.0f; - EnInvadepoh_func_80B45EC8(this, play, 20); + EnInvadepoh_LightBall_SpawnSparkles(this, play, 20); } - Math_Vec3f_Sum(&D_80B4EDD0[this->unk_3AC], &this->actor.home.pos, &sp30); + Math_Vec3f_Sum(&sLightBallTargets[this->lightBallTarget], &this->actor.home.pos, &sp30); if (Math3D_Vec3fDistSq(&this->actor.world.pos, &sp30) < SQ(400.0f)) { this->actor.speed *= 0.8f; } else { @@ -2668,17 +2680,17 @@ void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { 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->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B49628(this); } } void EnInvadepoh_func_80B49628(EnInvadepoh* this) { - this->unk_3A0 = 0.2f; - this->unk_3A4 = 0.01f; - this->unk_3AA = 0xBB8; + this->pulseScaleTarget = 0.2f; + this->pulseScaleRate = 0.01f; + this->pulseRate = 0xBB8; this->actor.velocity.y *= 0.8f; this->actionFunc = EnInvadepoh_func_80B49670; } @@ -2699,17 +2711,17 @@ void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play) { this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -0.5f : 2.0f; this->actor.velocity.y *= 0.97f; Actor_MoveWithGravity(&this->actor); - if (D_80B4E940 == 3) { + if (sEventState == ENINVADEPOH_EVENT_CLEAR) { EnInvadepoh_func_80B499BC(this); } } void EnInvadepoh_func_80B497A4(EnInvadepoh* this) { - this->unk_3A0 = 0.2f; - this->unk_3A4 = 0.01f; + this->pulseScaleTarget = 0.2f; + this->pulseScaleRate = 0.01f; this->actor.gravity = -1.5f; - this->unk_3AA = 0xBB8; - this->unk_2F0 = 35; + this->pulseRate = 0xBB8; + this->actionTimer = 35; this->actionFunc = EnInvadepoh_func_80B497EC; } @@ -2725,19 +2737,19 @@ void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play) { this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -2.0f : 2.0f; this->actor.velocity.y *= 0.97f; Actor_MoveWithGravity(&this->actor); - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B49904(this); } } void EnInvadepoh_func_80B49904(EnInvadepoh* this) { - this->unk_3A0 = 0.2f; - this->unk_3A4 = 0.01f; + this->pulseScaleTarget = 0.2f; + this->pulseScaleRate = 0.01f; this->actor.gravity = 1.0f; - this->unk_3AA = 0xBB8; - this->unk_2F0 = 60; + this->pulseRate = 0xBB8; + this->actionTimer = 60; this->actionFunc = EnInvadepoh_func_80B4994C; } @@ -2745,19 +2757,19 @@ void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 150.0f, 4.0f); this->actor.velocity.y *= 0.95f; Actor_MoveWithGravity(&this->actor); - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { Actor_Kill(&this->actor); } } void EnInvadepoh_func_80B499BC(EnInvadepoh* this) { - this->unk_2F0 = 40; - this->unk_3A0 = 0.2f; - this->unk_3A4 = 0.01f; + this->actionTimer = 40; + this->pulseScaleTarget = 0.2f; + this->pulseScaleRate = 0.01f; this->actor.speed = 0.0f; - this->unk_3AA = 0xBB8; + this->pulseRate = 0xBB8; this->actionFunc = EnInvadepoh_func_80B49A00; } @@ -2775,24 +2787,24 @@ void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B497A4(this); } } -void EnInvadepoh_func_80B49B1C(Actor* thisx, PlayState* play2) { +void EnInvadepoh_LightBall_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; f32 temp; this->actionFunc(this, play); - this->unk_3A8 += this->unk_3AA; - Math_StepToF(&this->unk_39C, this->unk_3A0, this->unk_3A4); + this->pulsePhase += this->pulseRate; + Math_StepToF(&this->pulseScale, this->pulseScaleTarget, this->pulseScaleRate); - temp = 1.0f + (Math_SinS(this->unk_3A8) * this->unk_39C); + temp = 1.0f + (Math_SinS(this->pulsePhase) * this->pulseScale); Actor_SetScale(&this->actor, 0.27f * temp); Math_StepToS(&this->unk_306, 0x258, 8); this->actor.world.rot.y += this->unk_306; @@ -2812,18 +2824,18 @@ void EnInvadepoh_func_80B49BD0(EnInvadepoh* this) { } void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { - EnInvadepoh_func_80B44570(this); + EnInvadepoh_Night1Romani_SetProgress(this); EnInvadepoh_func_80B44C24(this, play); EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); - if ((this->unk_309 == 0) || (this->unk_309 + 1 == this->unk_308)) { + if ((this->currentPoint == 0) || (this->currentPoint + 1 == this->endPoint)) { if (this->unk_378 == 0) { s32 temp_v0_2 = func_800FE620(play); s32 pad; if (temp_v0_2 > 0) { temp_v0_2 = (gRegEditor->data[0xF] * -16.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); + this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), temp_v0_2); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -2835,7 +2847,7 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (this->unk_320 >= 0.9999f) { + if (this->progress >= 0.9999f) { Actor_Kill(&this->actor); } } @@ -2863,34 +2875,34 @@ void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper... - gSaveContext.save.saveInfo.weekEventReg[54] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_54_10); this->actor.textId = 0x332E; // If you run out of arrows... } EnInvadepoh_func_80B49BD0(this); } } -void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; s32 sp38; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->unk_2F4; + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + EnInvadepoh_Romani_DesegmentTextures(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); - EnInvadepoh_func_80B44540(this, play); - EnInvadepoh_func_80B44570(this); + EnInvadepoh_Night1Romani_SetupPath(this, play); + EnInvadepoh_Night1Romani_SetProgress(this); EnInvadepoh_func_80B44C24(this, play); - EnInvadepoh_func_80B43F0C(this); - EnInvadepoh_func_80B4516C(this); - if (gSaveContext.save.saveInfo.weekEventReg[21] & 0x20) { - if (gSaveContext.save.saveInfo.weekEventReg[54] & 0x10) { + EnInvadepoh_SetYawAlongPath(this); + EnInvadepoh_SnapToFloor(this); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; // If you run out of arrows... } else { this->actor.textId = 0x332D; // It's almost time, Grasshopper... @@ -2899,11 +2911,11 @@ void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { this->actor.textId = 0x332C; // ...It's almost time. } if ((sp38 >= CLOCK_TIME(18, 00)) || (sp38 < CLOCK_TIME(2, 00))) { - this->actor.update = EnInvadepoh_func_80B4A168; + this->actor.update = EnInvadepoh_Night1Romani_WaitForEvent; this->actor.draw = NULL; } else if ((sp38 < CLOCK_TIME(6, 00)) && (sp38 >= CLOCK_TIME(2, 00)) && (sp38 < CLOCK_TIME(2, 15))) { - this->actor.update = EnInvadepoh_func_80B4A1B8; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.update = EnInvadepoh_Night1Romani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B49BD0(this); } else { Actor_Kill(&this->actor); @@ -2911,36 +2923,36 @@ void EnInvadepoh_func_80B49F88(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4A168(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night1Romani_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 00))) { - this->actor.update = EnInvadepoh_func_80B4A1B8; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.update = EnInvadepoh_Night1Romani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B49BD0(this); } } -void EnInvadepoh_func_80B4A1B8(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); - if (sp28) { + if (talkRequested) { func_80151BB4(play, 5); EnInvadepoh_func_80B49DA0(this); } this->actionFunc(this, play); - if (sp2C && (this->actor.update != NULL)) { + if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_func_80B45CE0(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B49DFC) && !sp28 && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_func_80B49DFC) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -2954,7 +2966,7 @@ void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { temp_v0->unk_30 = 0.1f; temp_v0->unk_2C = 0x5DC; - this->unk_2F0 = Rand_S16Offset(200, 200); + this->actionTimer = Rand_S16Offset(200, 200); this->unk_304 = this->actor.shape.rot.y; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_func_80B4A350; @@ -2968,7 +2980,7 @@ void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { Vec3f sp44; s16 sp42; - Math_Vec3s_ToVec3f(&sp44, this->unk_30C); + Math_Vec3s_ToVec3f(&sp44, this->pathPoints); sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); this->unk_304 = Rand_S16Offset(-0x1F40, 0x3E80) + sp42; this->unk_370 = 0; @@ -2993,8 +3005,8 @@ void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { sp30->unk_26.y = 0; sp30->unk_26.z = 0; } - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B4A570(this); } @@ -3014,7 +3026,7 @@ void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { } void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play) { - if (this->unk_29C != 0) { + if (this->finishedAnim) { EnInvadepoh_func_80B4A2C0(this); } } @@ -3043,9 +3055,9 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { Math_StepToS(&this->unk_370, 0x190, 0x32); } EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x32); - if (this->unk_309 == 0) { + if (this->currentPoint == 0) { if (this->unk_378 == 0) { - this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, -0xF); + this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), -15); } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { @@ -3056,7 +3068,7 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (this->unk_309 == this->unk_308) { + if (this->currentPoint == this->endPoint) { EnInvadepoh_func_80B4A2C0(this); } } @@ -3083,10 +3095,10 @@ void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper - gSaveContext.save.saveInfo.weekEventReg[54] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_54_10); this->actor.textId = 0x332E; // If you run out of arrows... } - if (this->unk_309 == this->unk_308) { + if (this->currentPoint == this->endPoint) { EnInvadepoh_func_80B4A2C0(this); } else { EnInvadepoh_func_80B4A614(this); @@ -3094,36 +3106,36 @@ void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { +void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { s32 sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->unk_2F4; + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + EnInvadepoh_Romani_DesegmentTextures(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - EnInvadepoh_func_80B44620(this, play2); + EnInvadepoh_BarnRomani_SetupPath(this, play2); if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 00))) { - this->unk_309 = 0; - this->actor.update = EnInvadepoh_func_80B4AB8C; + this->currentPoint = 0; + this->actor.update = EnInvadepoh_BarnRomani_WaitForEvent; } else { - this->unk_309 = this->unk_308; - this->actor.update = EnInvadepoh_func_80B4ABDC; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->currentPoint = this->endPoint; + this->actor.update = EnInvadepoh_BarnRomani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B4A2C0(this); } - EnInvadepoh_func_80B4407C(this, this->unk_309); - EnInvadepoh_func_80B43F0C(this); + EnInvadepoh_SetPosToPathPoint(this, this->currentPoint); + EnInvadepoh_SetYawAlongPath(this); func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); - if (gSaveContext.save.saveInfo.weekEventReg[21] & 0x20) { - if (gSaveContext.save.saveInfo.weekEventReg[54] & 0x10) { + EnInvadepoh_SnapToFloor(this); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; // If you run out of arrows... } else { this->actor.textId = 0x332D; // It's almost time, Grasshopper... @@ -3134,36 +3146,36 @@ void EnInvadepoh_func_80B4A9C8(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4AB8C(Actor* thisx, PlayState* play2) { +void EnInvadepoh_BarnRomani_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { - this->actor.update = EnInvadepoh_func_80B4ABDC; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.update = EnInvadepoh_BarnRomani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B4A614(this); } } -void EnInvadepoh_func_80B4ABDC(Actor* thisx, PlayState* play2) { +void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); - if (sp28) { + if (talkRequested) { func_80151BB4(play, 5); EnInvadepoh_func_80B4A7C0(this); } this->actionFunc(this, play); - if (sp2C) { - this->unk_29C = SkelAnime_Update(&this->skelAnime); + if (inUncullRange) { + this->finishedAnim = SkelAnime_Update(&this->skelAnime); EnInvadepoh_func_80B45CE0(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4A81C) && !sp28 && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_func_80B4A81C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3172,8 +3184,8 @@ void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this) { } void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (gSaveContext.save.saveInfo.weekEventReg[22] & 1) { - this->actor.draw = EnInvadepoh_func_80B4E324; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + this->actor.draw = EnInvadepoh_Romani_Draw; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); EnInvadepoh_func_80B4AD3C(this); } @@ -3186,7 +3198,7 @@ void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this) { void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_func_80B4560C(this, play, 0x3331); // We did it...We won. + EnInvadepoh_Romani_SetTextId(this, play, 0x3331); // We did it...We won. EnInvadepoh_func_80B4ADB8(this); } else { func_800B8614(&this->actor, play, 2000.0f); @@ -3199,17 +3211,17 @@ void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this) { void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - if (this->unk_376 == 0x3331) { // We did it...We won. - if (gSaveContext.save.saveInfo.weekEventReg[22] & 2) { - EnInvadepoh_func_80B4560C(this, play, 0x3334); // I have to get back to bed... + if (this->textId == 0x3331) { // We did it...We won. + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { + EnInvadepoh_Romani_SetTextId(this, play, 0x3334); // I have to get back to bed... func_80151BB4(play, 0x1D); func_80151BB4(play, 5); } else { - EnInvadepoh_func_80B4560C(this, play, 0x3333); // Here's Romani's thanks + EnInvadepoh_Romani_SetTextId(this, play, 0x3333); // Here's Romani's thanks } - } else if (this->unk_376 == 0x3333) { // Here's Romani's thanks + } else if (this->textId == 0x3333) { // Here's Romani's thanks EnInvadepoh_func_80B4AEC0(this); - } else if (this->unk_376 == 0x3334) { // I have to get back to bed... + } else if (this->textId == 0x3334) { // I have to get back to bed... Message_CloseTextbox(play); EnInvadepoh_func_80B4B024(this); } @@ -3217,20 +3229,20 @@ void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this) { - this->unk_2F0 = 2; + this->actionTimer = 2; this->actionFunc = EnInvadepoh_func_80B4AEDC; } void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play) { - if (this->unk_2F0 > 0) { - this->unk_2F0--; - if (this->unk_2F0 == 0) { + if (this->actionTimer > 0) { + this->actionTimer--; + if (this->actionTimer == 0) { Message_CloseTextbox(play); } } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.saveInfo.weekEventReg[22] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_22_02); EnInvadepoh_func_80B4AF80(this); } else { Actor_OfferGetItem(&this->actor, play, 0x60, 2000.0f, 2000.0f); @@ -3243,7 +3255,7 @@ void EnInvadepoh_func_80B4AF80(EnInvadepoh* this) { void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_func_80B4560C(this, play, 0x3334); // I have to get back to bed.. + EnInvadepoh_Romani_SetTextId(this, play, 0x3334); // I have to get back to bed.. func_80151BB4(play, 0x1E); func_80151BB4(play, 0x1D); func_80151BB4(play, 5); @@ -3261,44 +3273,44 @@ void EnInvadepoh_func_80B4B024(EnInvadepoh* this) { void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play) { if (play->msgCtx.unk120B1 == 0) { if (play->msgCtx.msgMode == 0) { - D_80B4E998 = 1; - } else if ((Message_GetState(&play->msgCtx) == 6) || (Message_GetState(&play->msgCtx) == 5)) { - D_80B4E998 = 1; + sRewardFinished = true; + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { + sRewardFinished = true; } } } -void EnInvadepoh_func_80B4B0C4(Actor* thisx, PlayState* play2) { +void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; - if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - this->actor.update = EnInvadepoh_func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + EnInvadepoh_Romani_DesegmentTextures(); + this->actor.update = EnInvadepoh_RewardRomani_Update; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); temp_s0->unk_30 = 0.08f; temp_s0->unk_2C = 0x7D0; func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); EnInvadepoh_func_80B4ACDC(this); } } -void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2) { +void EnInvadepoh_RewardRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; - s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); this->actionFunc(this, play); - if (sp38 && (this->actor.update != NULL)) { + if (inUncullRange && (this->actor.update != NULL)) { Player* player; s16 temp_v1; @@ -3312,8 +3324,8 @@ void EnInvadepoh_func_80B4B218(Actor* thisx, PlayState* play2) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); EnInvadepoh_func_80B45CE0(&this->unk_324); - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3327,7 +3339,7 @@ void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this) { void EnInvadepoh_func_80B4B430(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); - this->unk_2F0 = Rand_S16Offset(50, 80); + this->actionTimer = Rand_S16Offset(50, 80); this->actionFunc = EnInvadepoh_func_80B4B484; } @@ -3337,11 +3349,11 @@ void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play) { EnInvadepoh_func_80B44690(this); } EnInvadepoh_func_80B4B3DC(this); - if (this->unk_3BC >= 0) { - this->unk_2F0 = 0; + if (this->dogTargetPoint >= 0) { + this->actionTimer = 0; } - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } else { EnInvadepoh_func_80B4B510(this); } @@ -3349,17 +3361,17 @@ void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B4B510(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); - this->unk_2F0 = Rand_S16Offset(50, 200); + this->actionTimer = Rand_S16Offset(50, 200); this->actionFunc = EnInvadepoh_func_80B4B564; } void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 3.8f, 0.45f); - if (this->unk_3BC >= 0) { + if (this->dogTargetPoint >= 0) { f32 temp_fv0; Vec3f sp28; - Math_Vec3s_ToVec3f(&sp28, &this->unk_30C[this->unk_3BC]); + Math_Vec3s_ToVec3f(&sp28, &this->pathPoints[this->dogTargetPoint]); temp_fv0 = Math3D_Vec3fDistSq(&this->actor.world.pos, &sp28); if (temp_fv0 < SQ(80.0f)) { this->actor.speed *= 0.85f; @@ -3368,18 +3380,18 @@ void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { } else if (temp_fv0 < SQ(250.0f)) { this->actor.speed *= 0.96f; } - if ((this->unk_309 == this->unk_3BC) || (temp_fv0 < SQ(50.0f))) { - this->unk_2F0 = 0; + if ((this->currentPoint == this->dogTargetPoint) || (temp_fv0 < SQ(50.0f))) { + this->actionTimer = 0; } } EnInvadepoh_func_80B4B3DC(this); if (EnInvadepoh_func_80B44C80(this, play)) { EnInvadepoh_func_80B44690(this); } - if (this->unk_2F0 > 0) { - this->unk_2F0--; - } else if (this->unk_3BC >= 0) { - if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { + if (this->actionTimer > 0) { + this->actionTimer--; + } else if (this->dogTargetPoint >= 0) { + if (!sAliensTooClose && (Rand_ZeroOne() < 0.4f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } EnInvadepoh_func_80B4B724(this); @@ -3397,13 +3409,13 @@ void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 0.0f, 1.0f); - Math_SmoothStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &D_80B5040C->actor), 5, 0x1388, + Math_SmoothStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &sClosestAlien->actor), 5, 0x1388, (s16)0x64); EnInvadepoh_func_80B44E90(this, play); if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } - if (this->unk_29C != 0) { + if (this->finishedAnim) { EnInvadepoh_func_80B4B510(this); } } @@ -3416,89 +3428,91 @@ void EnInvadepoh_func_80B4B820(EnInvadepoh* this) { void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.5f, 1.0f); EnInvadepoh_func_80B44E90(this, play); - if (this->unk_29C != 0) { + if (this->finishedAnim) { EnInvadepoh_func_80B4B510(this); } } -void EnInvadepoh_func_80B4B8BC(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Dog_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4) && 1) { - this->actor.objBankIndex = this->unk_2F4; + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + if(1) {} + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->unk_188, this->unk_212, + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, DOG_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); - EnInvadepoh_func_80B44664(this, play); - EnInvadepoh_func_80B4407C(this, 0); + EnInvadepoh_Dog_SetupPath(this, play); + EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); Math_Vec3f_Copy(&this->unk_314, &this->actor.world.pos); - if (D_80B4E940 == 2) { - this->actor.update = EnInvadepoh_func_80B4BA84; - this->actor.draw = EnInvadepoh_func_80B4E660; + if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { + this->actor.update = EnInvadepoh_Dog_Update; + this->actor.draw = EnInvadepoh_Dog_Draw; this->actor.flags |= ACTOR_FLAG_1; EnInvadepoh_func_80B4B430(this); - } else if (D_80B4E940 == 1) { - this->actor.update = EnInvadepoh_func_80B4BA30; + } else if (sEventState == ENINVADEPOH_EVENT_WAIT) { + this->actor.update = EnInvadepoh_Dog_WaitForEvent; } else { Actor_Kill(&this->actor); } } } -void EnInvadepoh_func_80B4BA30(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Dog_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if (D_80B4E940 == 2) { - this->actor.update = EnInvadepoh_func_80B4BA84; - this->actor.draw = EnInvadepoh_func_80B4E660; + if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { + this->actor.update = EnInvadepoh_Dog_Update; + this->actor.draw = EnInvadepoh_Dog_Draw; this->actor.flags |= ACTOR_FLAG_1; EnInvadepoh_func_80B4B430(this); } } -void EnInvadepoh_func_80B4BA84(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 temp; - s32 sp2C; - s32 temp_v1_2; - s32 var_v0; + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - D_80B5040C = EnInvadepoh_func_80B458D8(); - if (D_80B5040C == NULL) { - temp = (this->unk_3BC < 0) ^ 1; - this->unk_3BC = -1; - if (temp) { + sClosestAlien = EnInvadepoh_Dog_GetClosestAlien(); + if (sClosestAlien == NULL) { + s32 hadTarget = (this->dogTargetPoint >= 0); + + this->dogTargetPoint = -1; + if (hadTarget) { EnInvadepoh_func_80B4B820(this); } } else { - sp2C = this->unk_3BC; - this->unk_3BC = EnInvadepoh_func_80B44234(this, &D_80B5040C->actor.world.pos); - if (sp2C != this->unk_3BC) { - var_v0 = this->unk_3BC - this->unk_309; - if (var_v0 < 0) { - var_v0 += this->unk_308; + s32 lastTargetPoint = this->dogTargetPoint; + s32 pointsToTarget; + s32 halfwayPoint; + + this->dogTargetPoint = EnInvadepoh_func_80B44234(this, &sClosestAlien->actor.world.pos); + if (lastTargetPoint != this->dogTargetPoint) { + pointsToTarget = this->dogTargetPoint - this->currentPoint; + if (pointsToTarget < 0) { + pointsToTarget += this->endPoint; } - temp_v1_2 = this->unk_308 >> 1; - if (temp_v1_2 < var_v0) { - this->unk_30A = -1; - } else if (var_v0 < temp_v1_2) { - this->unk_30A = 1; + + halfwayPoint = this->endPoint >> 1; + if (halfwayPoint < pointsToTarget) { + this->pathStep = -1; + } else if (pointsToTarget < halfwayPoint) { + this->pathStep = 1; } } } this->actionFunc(this, play); - this->unk_29C = SkelAnime_Update(&this->skelAnime); - if (sp34 && (this->actor.update != NULL)) { + this->finishedAnim = SkelAnime_Update(&this->skelAnime); + if (inUncullRange && (this->actor.update != NULL)) { EnInvadepoh_func_80B45CE0(&this->unk_324); - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3518,7 +3532,7 @@ void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this) { void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; - EnInvadepoh* sp50 = D_80B503F4; + EnInvadepoh* romani = sRomani; s32 pad; s32 sp48; s32 pad2; @@ -3526,12 +3540,12 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { s16 sp40; s16 temp_v1; - if (sp50 != NULL) { - if (sp50->unk_309 == 0) { + if (romani != NULL) { + if (romani->currentPoint == 0) { this->unk_2F8 = 40.0f; this->unk_304 = -0x8000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else if (sp50->unk_309 < (sp50->unk_308 - 1)) { + } else if (romani->currentPoint < (romani->endPoint - 1)) { this->unk_2F8 = 40.0f; Math_ScaledStepToS(&this->unk_304, -0x4800, 0xC8); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3540,12 +3554,12 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { Math_ScaledStepToS(&this->unk_304, -0x8000, 0x12C); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } - sp42 = this->unk_304 + sp50->actor.world.rot.y; - this->actor.world.pos.x = (Math_SinS(sp42) * this->unk_2F8) + sp50->actor.world.pos.x; - this->actor.world.pos.y = sp50->actor.world.pos.y; - this->actor.world.pos.z = (Math_CosS(sp42) * this->unk_2F8) + sp50->actor.world.pos.z; + sp42 = this->unk_304 + romani->actor.world.rot.y; + this->actor.world.pos.x = (Math_SinS(sp42) * this->unk_2F8) + romani->actor.world.pos.x; + this->actor.world.pos.y = romani->actor.world.pos.y; + this->actor.world.pos.z = (Math_CosS(sp42) * this->unk_2F8) + romani->actor.world.pos.z; func_800B4AEC(play, &this->actor, 50.0f); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SnapToFloor(this); Math_StepToS(&this->unk_370, 0xBB8, 0x1F5); if (Math3D_Vec3fDistSq(&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), @@ -3553,13 +3567,13 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { } sp48 = (play->gameplayFrames + 20) % 0x80; if (sp48 & 0x40) { - sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp50->actor.world.pos); + sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &romani->actor.world.pos); if (sp48 == 0x40) { this->unk_370 = 0; } Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->unk_370, 0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp50->actor.focus.pos) * 0.85f; + temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &romani->actor.focus.pos) * 0.85f; temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = sp40 - this->actor.shape.rot.y; @@ -3573,7 +3587,7 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { } if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { Actor_Kill(&this->actor); - } else if ((sp50 != NULL) && (sp50->actionFunc == EnInvadepoh_func_80B4CB0C)) { + } else if ((romani != NULL) && (romani->actionFunc == EnInvadepoh_func_80B4CB0C)) { EnInvadepoh_func_80B4C1BC(this); } } @@ -3623,25 +3637,25 @@ void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); - if (D_80B503F4 == NULL) { + if (sRomani == NULL) { EnInvadepoh_func_80B4BBE0(this); - } else if ((D_80B503F4 != NULL) && (D_80B503F4->actionFunc != EnInvadepoh_func_80B4CB0C)) { + } else if ((sRomani != NULL) && (sRomani->actionFunc != EnInvadepoh_func_80B4CB0C)) { EnInvadepoh_func_80B4BBE0(this); } } -void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cremia_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; - if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { + if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { s32 sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->unk_2F4; + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->unk_188, this->unk_212, + EnInvadepoh_Cremia_DesegmentTextures(); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, CREMIA_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; // Good night... See you...tomorrow...OK? @@ -3656,11 +3670,11 @@ void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { this->unk_2F8 = 40.0f; } if ((CLOCK_TIME(6, 00) <= sp38) && (sp38 < CLOCK_TIME(20, 00) + 30)) { - this->actor.update = EnInvadepoh_func_80B4C568; + this->actor.update = EnInvadepoh_Cremia_WaitForEvent; this->actor.draw = NULL; } else if ((CLOCK_TIME(20, 00) + 30 <= sp38) && (sp38 < CLOCK_TIME(20, 15))) { - this->actor.update = EnInvadepoh_func_80B4C5C0; - this->actor.draw = EnInvadepoh_func_80B4E7BC; + this->actor.update = EnInvadepoh_Cremia_Update; + this->actor.draw = EnInvadepoh_Cremia_Draw; EnInvadepoh_func_80B4BBE0(this); } else { Actor_Kill(&this->actor); @@ -3668,36 +3682,36 @@ void EnInvadepoh_func_80B4C3A0(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4C568(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cremia_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; if ((gSaveContext.save.time >= CLOCK_TIME(20, 00) + 30) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { - this->actor.update = EnInvadepoh_func_80B4C5C0; - this->actor.draw = EnInvadepoh_func_80B4E7BC; + this->actor.update = EnInvadepoh_Cremia_Update; + this->actor.draw = EnInvadepoh_Cremia_Draw; EnInvadepoh_func_80B4BBE0(this); } } -void EnInvadepoh_func_80B4C5C0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); - if (sp28) { + if (talkRequested) { func_80151BB4(play, 6); EnInvadepoh_func_80B4BFFC(this); } this->actionFunc(this, play2); - if (sp2C && (this->actor.update != NULL)) { + if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_func_80B45CE0(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4C058) && !sp28 && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_func_80B4C058) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3715,7 +3729,7 @@ void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this) { void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; - EnInvadepoh* sp68 = D_80B503F8; + EnInvadepoh* sp68 = sCremia; s32 var_a2; s32 sp60; s32 pad; @@ -3727,18 +3741,18 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { EnInvadepoh_func_80B44EFC(this, play); EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); - var_a2 = (this->unk_309 < this->unk_308) ? this->unk_309 : this->unk_308 - 1; + var_a2 = (this->currentPoint < this->endPoint) ? this->currentPoint : this->endPoint - 1; - Math_Vec3s_ToVec3f(&sp4C, &this->unk_30C[var_a2]); - Math_Vec3s_ToVec3f(&sp40, &this->unk_30C[var_a2 + 1]); + Math_Vec3s_ToVec3f(&sp4C, &this->pathPoints[var_a2]); + Math_Vec3s_ToVec3f(&sp40, &this->pathPoints[var_a2 + 1]); Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40) + 0, 5, 0x7D0, 100); - if ((this->unk_309 == 0) || (this->unk_309 + 1 == this->unk_308)) { + if ((this->currentPoint == 0) || (this->currentPoint + 1 == this->endPoint)) { if (this->unk_378 == 0) { s32 temp_v0_2 = func_800FE620(play); if (temp_v0_2 > 0) { temp_v0_2 = (gRegEditor->data[0xF] * -23.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_func_80B45550(this, play, 6400.0f, temp_v0_2); + this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), temp_v0_2); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3750,6 +3764,7 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { if (sp60 & 0x40) { s16 sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); s16 temp_v1; + if (sp60 == 0x40) { this->unk_370 = 0; } @@ -3765,7 +3780,7 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (this->unk_320 >= 0.9999f) { + if (this->progress >= 0.9999f) { Actor_Kill(&this->actor); } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_func_80B4C058)) { EnInvadepoh_func_80B4CC70(this); @@ -3817,40 +3832,40 @@ void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); - if (D_80B503F8 == NULL) { + if (sCremia == NULL) { EnInvadepoh_func_80B4C6C8(this); - } else if ((D_80B503F8 != NULL) && (D_80B503F8->actionFunc != EnInvadepoh_func_80B4C058)) { + } else if ((sCremia != NULL) && (sCremia->actionFunc != EnInvadepoh_func_80B4C058)) { EnInvadepoh_func_80B4C6C8(this); } } -void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night3Romani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; - if (Object_IsLoaded(&play2->objectCtx, this->unk_2F4)) { + if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { s32 sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->unk_2F4; + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->unk_188, this->unk_212, + EnInvadepoh_Romani_DesegmentTextures(); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_func_80B446D0(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; EnInvadepoh_func_80B44700(this); EnInvadepoh_func_80B44EFC(this, play); - EnInvadepoh_func_80B43F0C(this); - EnInvadepoh_func_80B4516C(this); + EnInvadepoh_SetYawAlongPath(this); + EnInvadepoh_SnapToFloor(this); this->actor.textId = 0x33CE; // See you tomorrow! if ((sp38 >= CLOCK_TIME(6, 00)) && (sp38 < CLOCK_TIME(20, 00))) { - this->actor.update = EnInvadepoh_func_80B4CFFC; + this->actor.update = EnInvadepoh_Night3Romani_WaitForEvent; this->actor.draw = NULL; } else if ((sp38 >= CLOCK_TIME(20, 00)) && (sp38 < CLOCK_TIME(20, 14) + 15)) { - this->actor.update = EnInvadepoh_func_80B4D054; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.update = EnInvadepoh_Night3Romani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B4C6C8(this); } else { Actor_Kill(&this->actor); @@ -3858,36 +3873,36 @@ void EnInvadepoh_func_80B4CE54(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4CFFC(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night3Romani_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; if ((gSaveContext.save.time >= CLOCK_TIME(20, 00)) && (gSaveContext.save.time < CLOCK_TIME(20, 14) + 15)) { - this->actor.update = EnInvadepoh_func_80B4D054; - this->actor.draw = EnInvadepoh_func_80B4E324; + this->actor.update = EnInvadepoh_Night3Romani_Update; + this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B4C6C8(this); } } -void EnInvadepoh_func_80B4D054(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 sp28 = Actor_ProcessTalkRequest(&this->actor, &play->state); + s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); + s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); - if (sp28 != 0) { + if (talkRequested) { func_80151BB4(play, 5); EnInvadepoh_func_80B4CAB0(this); } this->actionFunc(this, play); - if (sp2C && (this->actor.update != NULL)) { + if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_func_80B45CE0(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4CB0C) && !sp28 && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_func_80B4CB0C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } - Collider_UpdateCylinder(&this->actor, &this->unk_2A0); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_2A0.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3903,11 +3918,11 @@ void EnInvadepoh_func_80B4D15C(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; - this->unk_389 = 255; - this->actor.draw = EnInvadepoh_func_80B4DB14; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 255; + this->alpha = 255; + this->actor.draw = EnInvadepoh_Alien_Draw; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 255; this->unk_300 = D_80B4EE0C[sp28].unk0; this->unk_304 = sp28 * 0x5555; this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; @@ -3924,7 +3939,7 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { Actor* sp2C; f32 sp28; - if (D_80B503F0 == NULL) { + if (sLightBall == NULL) { Actor_Kill(&this->actor); return; } @@ -3952,14 +3967,14 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; - this->unk_389 = 255; + this->alpha = 255; this->actor.draw = NULL; - this->unk_38B = 1; - this->unk_38C = 0; - this->unk_38D = 255; + this->present = true; + this->drawDeathFlash = false; + this->eyeBeamAlpha = 255; this->unk_306 = 0x190; this->unk_304 = 0; - this->unk_2F0 = 200; + this->actionTimer = 200; this->actionFunc = EnInvadepoh_func_80B4D480; this->actor.velocity.y = 0.0f; } @@ -3969,14 +3984,14 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { f32 pad2; s32 sp2C = 0; - if (this->unk_2F0 > 0) { - this->unk_2F0--; + if (this->actionTimer > 0) { + this->actionTimer--; } - if (this->unk_2F0 > 160) { + if (this->actionTimer > 160) { this->actor.draw = NULL; } else { - this->actor.draw = EnInvadepoh_func_80B4DB14; - pad = (sp2C ? 0 : this->unk_2F0); //! fake + this->actor.draw = EnInvadepoh_Alien_Draw; + pad = (sp2C ? 0 : this->actionTimer); //! fake if ((105 > pad) && (pad >= 100)) { this->actor.gravity = -1.0f; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); @@ -3987,7 +4002,7 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { this->actor.velocity.y += this->actor.gravity; this->actor.velocity.y *= 0.92f; - if (this->unk_2F0 > 80) { + if (this->actionTimer > 80) { this->actor.world.pos.y += this->actor.velocity.y; } else { f32 pad3 = this->actor.home.pos.y + 850.0f; @@ -4007,23 +4022,23 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { pad1->shape.rot.y = this->actor.shape.rot.y; } } - if ((this->unk_2F0 <= 0) || sp2C) { + if ((this->actionTimer <= 0) || sp2C) { Actor_Kill(&this->actor); } } -void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Abuductor_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 sp34; - if (Object_IsLoaded(&play->objectCtx, this->unk_2F4)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { sp34 = ENINVADEPOH_GET_PARAM_7(&this->actor); - this->actor.objBankIndex = this->unk_2F4; + this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); - EnInvadepoh_func_80B45080(); - this->actor.update = EnInvadepoh_func_80B4D760; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->unk_188, this->unk_212, + EnInvadepoh_Alien_SetTexAnim(); + this->actor.update = EnInvadepoh_Abductor_Update; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, this->morphTable, ALIEN_LIMB_MAX); if (sp34 < 3) { EnInvadepoh_func_80B453F4(this, play, sp34); @@ -4035,7 +4050,7 @@ void EnInvadepoh_func_80B4D670(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Abductor_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -4047,7 +4062,7 @@ void EnInvadepoh_func_80B4D760(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4D7B8(PlayState* play) { +void EnInvadepoh_Event_DrawWarps(PlayState* play) { s32 i; EnInvadepohWarpEffect* warpEffect; @@ -4067,7 +4082,7 @@ void EnInvadepoh_func_80B4D7B8(PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_02E510); } } @@ -4075,40 +4090,40 @@ void EnInvadepoh_func_80B4D7B8(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void EnInvadepoh_func_80B4D9B4(Actor* thisx, PlayState* play) { - EnInvadepoh_func_80B4D7B8(play); +void EnInvadepoh_Event_Draw(Actor* thisx, PlayState* play) { + EnInvadepoh_Event_DrawWarps(play); } -s32 EnInvadepoh_func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnInvadepoh_Alien_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { return false; } -void EnInvadepoh_func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx) { - static Vec3f D_80B4EE24 = { 2000.0f, 1000.0f, 0.0f }; +void EnInvadepoh_Alien_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx, Gfx** gfx) { + static Vec3f sFocusOffset = { 2000.0f, 1000.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((limbIndex == ALIEN_LIMB_LEFT_EYE) && (this->unk_38D != 0)) { + if ((limbIndex == ALIEN_LIMB_LEFT_EYE) && (this->eyeBeamAlpha != 0)) { Matrix_Push(); Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x3830, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502A0); + Matrix_Get(&sAlienLeftEyeBeam); Matrix_Pop(); - } else if ((limbIndex == ALIEN_LIMB_RIGHT_EYE) && (this->unk_38D != 0)) { + } else if ((limbIndex == ALIEN_LIMB_RIGHT_EYE) && (this->eyeBeamAlpha != 0)) { Matrix_Push(); Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502E0); + Matrix_Get(&sAlienRightEyeBeam); Matrix_Pop(); } - if (limbIndex == 11) { - Matrix_MultVec3f(&D_80B4EE24, &this->actor.focus.pos); + if (limbIndex == ALIEN_LIMB_HEAD) { + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } -void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -4116,24 +4131,24 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { func_8012C2DC(play->state.gfxCtx); Matrix_Push(); - if (this->unk_38B != 0) { - if (this->unk_389 == 255) { + if (this->present) { + if (this->alpha == 255) { func_8012C28C(play->state.gfxCtx); AnimatedMat_Draw(play, sAlienEmptyTexAnim); Scene_SetRenderModeXlu(play, 0, 1); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnInvadepoh_func_80B4D9D8, - EnInvadepoh_func_80B4D9F4, &this->actor, POLY_OPA_DISP); + this->skelAnime.dListCount, EnInvadepoh_Alien_OverrideLimbDraw, + EnInvadepoh_Alien_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { AnimatedMat_Draw(play, sAlienEmptyTexAnim); Scene_SetRenderModeXlu(play, 1, 2); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_389); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnInvadepoh_func_80B4D9D8, - EnInvadepoh_func_80B4D9F4, &this->actor, POLY_XLU_DISP); + this->skelAnime.dListCount, EnInvadepoh_Alien_OverrideLimbDraw, + EnInvadepoh_Alien_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - if (this->unk_38D != 0) { + if (this->eyeBeamAlpha != 0) { Gfx* ptr; AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); @@ -4143,28 +4158,28 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { gDPPipeSync(ptr++); gDPSetPrimColor(ptr++, 0, 0xFF, 240, 180, 100, 60); - gDPSetEnvColor(ptr++, 255, 255, 255, 100.0f / 170.0f * this->unk_38D); + gDPSetEnvColor(ptr++, 255, 255, 255, 100.0f / 170.0f * this->eyeBeamAlpha); - Matrix_Mult(&D_80B502A0, MTXMODE_NEW); - gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + Matrix_Mult(&sAlienLeftEyeBeam, MTXMODE_NEW); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gAlienEyeBeamDL); - Matrix_Mult(&D_80B502E0, MTXMODE_NEW); - gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + Matrix_Mult(&sAlienRightEyeBeam, MTXMODE_NEW); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gAlienEyeBeamDL); POLY_XLU_DISP = ptr; CLOSE_DISPS(play->state.gfxCtx); } } - if (this->unk_38C != 0) { + if (this->drawDeathFlash) { Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f, this->actor.world.pos.z, &this->actor.shape.rot); - Matrix_Scale(this->unk_390.x, this->unk_390.y, this->unk_390.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + Matrix_Scale(this->deathFlashScale.x, this->deathFlashScale.y, this->deathFlashScale.z, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gAlienDeathFlashDL); } - if (this->unk_38B != 0) { + if (this->present) { Gfx* ptr; Vec3f sp80; Vec3f sp74; @@ -4189,16 +4204,16 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); - temp = 100.0f / 255.0f * this->unk_389; + temp = 100.0f / 255.0f * this->alpha; gSPDisplayList(ptr++, gameplay_keep_DL_029CB0); gDPSetPrimColor(ptr++, 0, 0, 240, 180, 100, temp); - gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gameplay_keep_DL_029CF0); POLY_XLU_DISP = ptr; - if ((this->unk_389 > 128) && EnInvadepoh_func_80B456A8(play, &sp74)) { + if ((this->alpha > 128) && EnInvadepoh_func_80B456A8(play, &sp74)) { func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); } @@ -4209,24 +4224,24 @@ void EnInvadepoh_func_80B4DB14(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Cow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == 5) { + if (limbIndex == COW_LIMB_NOSE_RING) { rot->x -= this->actor.shape.rot.x; } return false; } -void EnInvadepoh_func_80B4E158(Actor* thisx, PlayState* play2) { +void EnInvadepoh_Cow_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; func_8012C5B0(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount, - EnInvadepoh_func_80B4E120, NULL, &this->actor); + EnInvadepoh_Cow_OverrideLimbDraw, NULL, &this->actor); } -void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_CowTail_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -4235,7 +4250,7 @@ void EnInvadepoh_func_80B4E1B0(Actor* thisx, PlayState* play2) { NULL, &this->actor); } -s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Romani_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == ROMANI_LIMB_HEAD) { EnInvadepoh* this = ((EnInvadepoh*)thisx); @@ -4251,8 +4266,8 @@ s32 EnInvadepoh_func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } -void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { - static Vec3f D_80B4EE30 = { 400.0f, 270.0f, 0.0f }; +void EnInvadepoh_Romani_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { + static Vec3f sFocusOffset = { 400.0f, 270.0f, 0.0f }; EnInvadepoh* this = (EnInvadepoh*)thisx; if (limbIndex == ROMANI_LIMB_LEFT_HAND) { @@ -4262,11 +4277,11 @@ void EnInvadepoh_func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == ROMANI_LIMB_HEAD) { - Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } -void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play) { +void EnInvadepoh_Romani_Draw(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); @@ -4275,12 +4290,12 @@ void EnInvadepoh_func_80B4E324(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnInvadepoh_func_80B4E200, EnInvadepoh_func_80B4E2AC, &this->actor); + EnInvadepoh_Romani_OverrideLimbDraw, EnInvadepoh_Romani_PostLimbDraw, &this->actor); CLOSE_DISPS(play->state.gfxCtx); } -void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { +void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; Vec3f sp5C; @@ -4299,7 +4314,7 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 2); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->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++, gEffFlash1DL); @@ -4311,7 +4326,7 @@ void EnInvadepoh_func_80B4E3F0(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Dog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -4323,15 +4338,15 @@ s32 EnInvadepoh_func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } -void EnInvadepoh_func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { +void EnInvadepoh_Dog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == 5) { + if (limbIndex == DOG_LIMB_HEAD) { Matrix_MultVecY(20.0f, &this->actor.focus.pos); } } -void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play) { +void EnInvadepoh_Dog_Draw(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); @@ -4339,12 +4354,12 @@ void EnInvadepoh_func_80B4E660(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnInvadepoh_func_80B4E5B0, EnInvadepoh_func_80B4E61C, &this->actor); + EnInvadepoh_Dog_OverrideLimbDraw, EnInvadepoh_Dog_PostLimbDraw, &this->actor); CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Cremia_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == CREMIA_LIMB_HEAD) { EnInvadepoh* this = (EnInvadepoh*)thisx; @@ -4359,15 +4374,15 @@ s32 EnInvadepoh_func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } -void EnInvadepoh_func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { +void EnInvadepoh_Cremia_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == 9) { + if (limbIndex == CREMIA_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); } } -void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play) { +void EnInvadepoh_Cremia_Draw(Actor* thisx, PlayState* play) { EnInvadepoh* this = (EnInvadepoh*)thisx; OPEN_DISPS(play->state.gfxCtx); @@ -4376,7 +4391,7 @@ void EnInvadepoh_func_80B4E7BC(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnInvadepoh_func_80B4E6E4, EnInvadepoh_func_80B4E784, &this->actor); + EnInvadepoh_Cremia_OverrideLimbDraw, EnInvadepoh_Cremia_PostLimbDraw, &this->actor); CLOSE_DISPS(play->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 12807d614..5a219fd69 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -86,67 +86,67 @@ typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnim** typedef struct EnInvadepoh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s unk_188[EN_INVADEPOH_LIMB_MAX]; - /* 0x212 */ Vec3s unk_212[EN_INVADEPOH_LIMB_MAX]; - /* 0x29C */ s8 unk_29C; - /* 0x2A0 */ ColliderCylinder unk_2A0; + /* 0x188 */ Vec3s jointTable[EN_INVADEPOH_LIMB_MAX]; + /* 0x212 */ Vec3s morphTable[EN_INVADEPOH_LIMB_MAX]; + /* 0x29C */ s8 finishedAnim; + /* 0x2A0 */ ColliderCylinder collider; /* 0x2EC */ EnInvadepohActionFunc actionFunc; - /* 0x2F0 */ s16 unk_2F0; - /* 0x2F2 */ s16 unk_2F2; - /* 0x2F4 */ s8 unk_2F4; + /* 0x2F0 */ s16 actionTimer; + /* 0x2F2 */ s16 stateTimer; + /* 0x2F4 */ s8 bankIndex; /* 0x2F8 */ f32 unk_2F8; /* 0x2FC */ char unk_2FC[4]; // unused? f32? /* 0x300 */ f32 unk_300; /* 0x304 */ s16 unk_304; /* 0x306 */ s16 unk_306; - /* 0x308 */ s8 unk_308; - /* 0x309 */ s8 unk_309; - /* 0x30A */ s8 unk_30A; - /* 0x30C */ Vec3s *unk_30C; - /* 0x310 */ f32 unk_310; + /* 0x308 */ s8 endPoint; + /* 0x309 */ s8 currentPoint; + /* 0x30A */ s8 pathStep; + /* 0x30C */ Vec3s *pathPoints; + /* 0x310 */ f32 pathLength; /* 0x314 */ Vec3f unk_314; - /* 0x320 */ f32 unk_320; + /* 0x320 */ f32 progress; /* 0x324 */ EnInvadePohUnkStruct_324 unk_324; /* 0x370 */ s16 unk_370; /* 0x372 */ s16 unk_372; /* 0x374 */ s8 unk_374; - /* 0x376 */ u16 unk_376; + /* 0x376 */ u16 textId; /* 0x378 */ s8 unk_378; - /* 0x379 */ s8 unk_379; - /* 0x37C */ f32 unk_37C[3]; + /* 0x379 */ s8 spawnCount; + /* 0x37C */ f32 checkpoints[3]; /* 0x388 */ char unk_388; // unused? - /* 0x389 */ u8 unk_389; - /* 0x38A */ s8 unk_38A; - /* 0x38B */ s8 unk_38B; - /* 0x38C */ s8 unk_38C; - /* 0x38D */ u8 unk_38D; - /* 0x390 */ Vec3f unk_390; - /* 0x39C */ f32 unk_39C; - /* 0x3A0 */ f32 unk_3A0; - /* 0x3A4 */ f32 unk_3A4; - /* 0x3A8 */ s16 unk_3A8; - /* 0x3AA */ s16 unk_3AA; - /* 0x3AC */ s8 unk_3AC; + /* 0x389 */ u8 alpha; + /* 0x38A */ s8 atBarn; + /* 0x38B */ s8 present; + /* 0x38C */ s8 drawDeathFlash; + /* 0x38D */ u8 eyeBeamAlpha; + /* 0x390 */ Vec3f deathFlashScale; + /* 0x39C */ f32 pulseScale; + /* 0x3A0 */ f32 pulseScaleTarget; + /* 0x3A4 */ f32 pulseScaleRate; + /* 0x3A8 */ s16 pulsePhase; + /* 0x3AA */ s16 pulseRate; + /* 0x3AC */ s8 lightBallTarget; /* 0x3AD */ char pad3AD[3]; /* 0x3B0 */ char pad3B0[0xC]; // unused? Vec3f? - /* 0x3BC */ s8 unk_3BC; + /* 0x3BC */ s8 dogTargetPoint; } EnInvadepoh; // size = 0x3C0 typedef enum { - ENINVADEPOH_HANDLER, // Invasion event handler - ENINVADEPOH_ALIEN_INVADER, // Alien invader - ENINVADEPOH_COW, // Abudcted cow, spawned by unused alien abductor - ENINVADEPOH_COW_TAIL, // Abducted cow tail, spawned by abducted cow - ENINVADEPOH_ROMANI_ABDUCTED, // Abducted Romani, spawned by unused alien abductor - ENINVADEPOH_ROMANI_CONFUSED, // Returned, confused Romani - ENINVADEPOH_LIGHT_BALL, // Light ball spaceship - ENINVADEPOH_ROMANI_NIGHT_1, // Romani running to barn on night 1 - ENINVADEPOH_ROMANI_UNKNOWN, // Unknown, possible duplicate of previous - ENINVADEPOH_ROMANI_REWARD, // Romani rewarding you for defeating invasion - ENINVADEPOH_DOG, // Dog during alien invasion - ENINVADEPOH_CREMIA_NIGHT_3, // Cremia walking from barn to house on night 3 - ENINVADEPOH_ROMANI_NIGHT_3, // Romnani walking from barn to house on night 3 - ENINVADEPOH_ALIEN_ABDUCTOR, // Alien abductor, unused, carries cow or Romani + /* 0x0 */ ENINVADEPOH_HANDLER, // Invasion event handler + /* 0x1 */ ENINVADEPOH_ALIEN_INVADER, // Alien invader + /* 0x2 */ ENINVADEPOH_COW, // Abudcted cow, spawned by unused alien abductor + /* 0x3 */ ENINVADEPOH_COW_TAIL, // Abducted cow tail, spawned by abducted cow + /* 0x4 */ ENINVADEPOH_ROMANI_ABDUCTED, // Abducted Romani, spawned by unused alien abductor + /* 0x5 */ ENINVADEPOH_ROMANI_CONFUSED, // Returned, confused Romani + /* 0x6 */ ENINVADEPOH_LIGHT_BALL, // Light ball spaceship + /* 0x7 */ ENINVADEPOH_ROMANI_NIGHT_1, // Romani running to barn on night 1 + /* 0x8 */ ENINVADEPOH_ROMANI_BARN, // Romani in the barn on night 1 + /* 0x9 */ ENINVADEPOH_ROMANI_REWARD, // Romani rewarding you for defeating invasion + /* 0xA */ ENINVADEPOH_DOG, // Dog during alien invasion + /* 0xB */ ENINVADEPOH_CREMIA_NIGHT_3, // Cremia walking from barn to house on night 3 + /* 0xC */ ENINVADEPOH_ROMANI_NIGHT_3, // Romnani walking from barn to house on night 3 + /* 0xD */ ENINVADEPOH_ALIEN_ABDUCTOR, // Alien abductor, unused, carries cow or Romani } EnInvadepohParamsTypes; #define ENINVADEPOH_GET_PARAM_7(thisx) ((thisx)->params & 7) From fe86fa941207b59d3594ae36bd4574c7892f6634 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Wed, 3 May 2023 09:08:34 -0500 Subject: [PATCH 07/10] naming and such --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 1594 +++++++++-------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 54 +- 2 files changed, 844 insertions(+), 804 deletions(-) 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 35de783c4..355be9d76 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -6,8 +6,16 @@ #define THIS ((EnInvadepoh*)thisx) -#define ENINVADEPOH_INVADER_ACTIVE 1 -#define ENINVADEPOH_INVADER_CLOSEST 2 +#define ENINVADEPOH_INVADER_ACTIVE (1 << 0) +#define ENINVADEPOH_INVADER_CLOSEST (1 << 1) + +#define BARN_X_POSITION -409 +#define BARN_Y_POSITION 265 +#define BARN_Z_POSITION -1829 + +#define SPAWN_X_POSITION -193 +#define SPAWN_Y_POSITION 235 +#define SPAWN_Z_POSITION -434 typedef enum { ENINVADEPOH_EVENT_UNSET, @@ -105,19 +113,19 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B48948(EnInvadepoh* this); void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B491EC(EnInvadepoh* this); -void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B492FC(EnInvadepoh* this); -void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49404(EnInvadepoh* this); -void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49628(EnInvadepoh* this); -void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49904(EnInvadepoh* this); -void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B499BC(EnInvadepoh* this); -void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupDescend(EnInvadepoh* this); +void EnInvadepoh_LightBall_Descend(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupHover(EnInvadepoh* this); +void EnInvadepoh_LightBall_Hover(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupSpawnInvaders(EnInvadepoh* this); +void EnInvadepoh_LightBall_SpawnInvaders(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupAboveBarn(EnInvadepoh* this); +void EnInvadepoh_LightBall_AboveBarn(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_Circle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupFlee(EnInvadepoh* this); +void EnInvadepoh_LightBall_Flee(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_LightBall_SetupLeaveBarn(EnInvadepoh* this); +void EnInvadepoh_LightBall_LeaveBarn(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); @@ -136,12 +144,12 @@ void EnInvadepoh_func_80B4AF80(EnInvadepoh* this); void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4B024(EnInvadepoh* this); void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B510(EnInvadepoh* this); -void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B724(EnInvadepoh* this); -void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Dog_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Dog_SetupRun(EnInvadepoh* this); +void EnInvadepoh_Dog_Run(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Dog_SetupBark(EnInvadepoh* this); +void EnInvadepoh_Dog_Bark(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Dog_Jump(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this); @@ -150,11 +158,11 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play); void EnInvadepoh_func_80B4CC70(EnInvadepoh* this); void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Abductor_Cow(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play); s32 EnInvadepoh_SnapToFloor(EnInvadepoh* this); -s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); +s32 EnInvadepoh_StepTowardXZ(f32* pxValue, f32* pzValue, f32 xTarget, f32 zTarget, f32 speed); #endif ActorInit En_Invadepoh_InitVars = { @@ -229,7 +237,7 @@ ColliderCylinderInit sDogCylinderInit = { { 13, 19, 0, { 0, 0, 0 } }, }; -Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; +Vec3f sLightBallSpawnOffset = { 216.0f, -20.0f, 1395.0f }; s32 sEventState = ENINVADEPOH_EVENT_UNSET; @@ -257,12 +265,12 @@ s8 sCremiaTexturesDesegmented = false; s8 sRewardFinished = false; -MtxF sAlienLeftEyeBeam; -MtxF sAlienRightEyeBeam; +MtxF sAlienLeftEyeBeamMtxF; +MtxF sAlienRightEyeBeamMtxF; EnInvadepoh* sAlienInvaders[8]; u8 sAlienStateFlags[8]; s8 sAliensTooClose; -EnInvadepohWarpEffect D_80B50350[10]; +EnInvadepohWarpEffect sWarpEffects[10]; EnInvadepoh* sLightBall; EnInvadepoh* sRomani; EnInvadepoh* sCremia; @@ -271,28 +279,48 @@ AnimatedMaterial* sAlienEmptyTexAnim; s16 sCutsceneIds[3]; EnInvadepoh* sClosestAlien; -void EnInvadepoh_Invader_SetWarpInTime(s32 arg0, s32 arg1) { - arg1 -= CLOCK_TIME(2, 30); - arg1 = CLAMP_MIN(arg1, 0); +#define BITPACK(field, value, width, offset) \ + (((field) & ~(((1 << (width)) - 1) << (offset))) | (((value) & ((1 << (width)) - 1)) << (offset))) +#define BITUNPACK(field, width, offset) (((field) & (((1 << width) - 1) << (offset))) >> (offset)) - if ((arg0 % 2) == 0) { - gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] = - (gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); +#define PACK_U16_INTO_U32_ARRAY(u32array, index, value) \ + if (((index) % 2) == 0) { \ + u32array[(index) >> 1] = BITPACK(u32array[(index) >> 1], value, 16, 0); \ + } else { \ + u32array[(index) >> 1] = BITPACK(u32array[(index) >> 1], value, 16, 16); \ + } \ + (void)0 + +#define UNPACK_U16_FROM_U32_ARRAY(var, u32array, index) \ + if (((index) % 2) == 0) { \ + var = BITUNPACK(u32array[(index) >> 1], 16, 0); \ + } else { \ + var = BITUNPACK(u32array[(index) >> 1], 16, 16); \ + } \ + (void)0 + +void EnInvadepoh_Invader_SetSpawnTime(s32 invaderIndex, s32 warpTime) { + warpTime -= CLOCK_TIME(2, 30); + warpTime = CLAMP_MIN(warpTime, 0); + + if ((invaderIndex % 2) == 0) { + gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] = + (gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & ~0xFFFF) | (warpTime & 0xFFFF); } else { - gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] = - (gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); + gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] = + (gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF) | ((warpTime & 0xFFFF) << 0x10); } } -s32 EnInvadepoh_Invader_GetWarpInTime(s32 invaderIndex) { - u32 var_v1; +s32 EnInvadepoh_Invader_GetSpawnTime(s32 invaderIndex) { + u32 warpTime; if ((invaderIndex % 2) == 0) { - var_v1 = gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF; + warpTime = gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF; } else { - var_v1 = (gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & 0xFFFF0000) >> 0x10; + warpTime = (gSaveContext.save.saveInfo.unk_E64[invaderIndex >> 1] & ~0xFFFF) >> 0x10; } - return var_v1 + CLOCK_TIME(2, 30); + return warpTime + CLOCK_TIME(2, 30); } void EnInvadepoh_Invader_SetKillCount(s32 arg0) { @@ -313,13 +341,13 @@ s32 EnInvadepoh_Invader_AddKill(void) { return sp1C; } -void EnInvadepoh_Invader_ResetWarpInTime(s32 arg0) { - s32 sp1C = gSaveContext.save.time; +void EnInvadepoh_Invader_SetRespawnTime(s32 arg0) { + s32 currentTime = gSaveContext.save.time; - if ((CURRENT_DAY == 1) && (sp1C >= CLOCK_TIME(2, 30)) && (sp1C < CLOCK_TIME(5, 15))) { - s32 sp18 = (12 - EnInvadepoh_Invader_GetKillCount()) * 25.0f; + if ((CURRENT_DAY == 1) && (CLOCK_TIME(2, 30) <= currentTime) && (currentTime < CLOCK_TIME(5, 15))) { + s32 warpDelay = (12 - EnInvadepoh_Invader_GetKillCount()) * 25.0f; - EnInvadepoh_Invader_SetWarpInTime(arg0, sp1C + sp18); + EnInvadepoh_Invader_SetSpawnTime(arg0, currentTime + warpDelay); } } @@ -335,43 +363,43 @@ s32 EnInvadepoh_Invader_GetCurrentPoint(EnInvadepoh* this) { return i; } -void EnInvadepoh_func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { - f32 var_fs0 = 0.0f; - f32 var_fs2 = 0.0f; - f32 temp_fs1 = 1.0f / this->pathLength; - s32 temp_s5 = this->endPoint; - s32 var_s2; - Vec3f sp70; - Vec3s* var_s0 = this->pathPoints; - Vec3s* var_s1 = var_s0 + 1; - f32 temp_fa0; - f32 temp_fa1; - f32 temp_fv0; - f32 temp_fv0_2; +void EnInvadepoh_Romani_SetPositionAlongPath(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { + f32 curPathLength = 0.0f; + f32 curCheckpoint = 0.0f; + f32 invPathLength = 1.0f / this->pathLength; + s32 endPoint = this->endPoint; + s32 i; + Vec3f curToNext; + Vec3s* curPathPoint = this->pathPoints; + Vec3s* nextPathPoint = curPathPoint + 1; + f32 nextCheckpoint; + f32 nextPathLength; + f32 segmentProgress; + f32 pathSegLength; - for (var_s2 = 0; var_s2 < temp_s5; var_s2++) { - sp70.x = var_s1->x - var_s0->x; - sp70.y = var_s1->y - var_s0->y; - sp70.z = var_s1->z - var_s0->z; - temp_fv0_2 = Math3D_Vec3fMagnitude(&sp70); - temp_fa1 = var_fs0 + temp_fv0_2; - temp_fa0 = temp_fa1 * temp_fs1; - if (this->progress <= temp_fa0) { - *arg1 = var_s2; - temp_fv0 = (this->progress - var_fs2) / (temp_fa0 - var_fs2); - arg2->x = (temp_fv0 * sp70.x) + var_s0->x; - arg2->y = (temp_fv0 * sp70.y) + var_s0->y; - arg2->z = (temp_fv0 * sp70.z) + var_s0->z; + for (i = 0; i < endPoint; i++) { + curToNext.x = nextPathPoint->x - curPathPoint->x; + curToNext.y = nextPathPoint->y - curPathPoint->y; + curToNext.z = nextPathPoint->z - curPathPoint->z; + pathSegLength = Math3D_Vec3fMagnitude(&curToNext); + nextPathLength = curPathLength + pathSegLength; + nextCheckpoint = nextPathLength * invPathLength; + if (this->progress <= nextCheckpoint) { + *arg1 = i; + segmentProgress = (this->progress - curCheckpoint) / (nextCheckpoint - curCheckpoint); + arg2->x = (segmentProgress * curToNext.x) + curPathPoint->x; + arg2->y = (segmentProgress * curToNext.y) + curPathPoint->y; + arg2->z = (segmentProgress * curToNext.z) + curPathPoint->z; return; } - var_s0 = var_s1++; - var_fs0 = temp_fa1; - var_fs2 = temp_fa0; + curPathPoint = nextPathPoint++; + curPathLength = nextPathLength; + curCheckpoint = nextCheckpoint; } - *arg1 = temp_s5; - arg2->x = this->pathPoints[temp_s5].x; - arg2->y = this->pathPoints[temp_s5].y; - arg2->z = this->pathPoints[temp_s5].z; + *arg1 = endPoint; + arg2->x = this->pathPoints[endPoint].x; + arg2->y = this->pathPoints[endPoint].y; + arg2->z = this->pathPoints[endPoint].z; } void EnInvadepoh_Invader_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2) { @@ -388,7 +416,7 @@ void EnInvadepoh_Invader_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2) { } } -void EnInvadepoh_func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { +void EnInvadepoh_Romani_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { s32 pad; Vec3s* sp40 = &this->pathPoints[this->currentPoint]; Vec3s* sp3C = sp40 + 1; @@ -433,7 +461,7 @@ f32 EnInvadepoh_GetPathLength(EnInvadepoh* this) { } void EnInvadepoh_SetPath(EnInvadepoh* this, PlayState* play) { - Path* path = &play->setupPathList[ENINVADEPOH_GET_PARAM_7F00(&this->actor)]; + Path* path = &play->setupPathList[ENINVADEPOH_GET_PATH(&this->actor)]; this->endPoint = path->count - 1; this->pathPoints = Lib_SegmentedToVirtual(path->points); @@ -443,7 +471,7 @@ void EnInvadepoh_SetPosToPathPoint(EnInvadepoh* this, s32 arg1) { Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[arg1]); } -s32 EnInvadepoh_Invader_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { +s32 EnInvadepoh_Dog_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { EnInvadepoh* this = thisx; // TODO: why recast? Vec3s* currentPoint = &this->pathPoints[this->currentPoint]; Vec3s* nextPoint = &this->pathPoints[this->currentPoint] + 1; @@ -482,30 +510,30 @@ s32 EnInvadepoh_Invader_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { return true; } -s32 EnInvadepoh_func_80B44234(EnInvadepoh* this, Vec3f* arg1) { - s32 var_s0; - s32 temp_s3 = this->endPoint; - Vec3s* var_s1; - Vec3f sp48; - f32 var_fs0 = FLT_MAX; - s32 var_s4 = 0; - f32 temp_fv0; +s32 EnInvadepoh_Dog_FindClosestWaypoint(EnInvadepoh* this, Vec3f* pos) { + s32 waypoint; + s32 endPoint = this->endPoint; + Vec3s* pathPoint; + Vec3f pathPoint3f; + f32 minDist = FLT_MAX; + s32 closestPoint = 0; + f32 pointToPos; - for (var_s0 = 0, var_s1 = this->pathPoints; var_s0 < temp_s3; var_s0++, var_s1++) { - Math_Vec3s_ToVec3f(&sp48, var_s1); - temp_fv0 = Math3D_Vec3fDistSq(&sp48, arg1); - if (temp_fv0 < var_fs0) { - var_fs0 = temp_fv0; - var_s4 = var_s0; + for (waypoint = 0, pathPoint = this->pathPoints; waypoint < endPoint; waypoint++, pathPoint++) { + Math_Vec3s_ToVec3f(&pathPoint3f, pathPoint); + pointToPos = Math3D_Vec3fDistSq(&pathPoint3f, pos); + if (pointToPos < minDist) { + minDist = pointToPos; + closestPoint = waypoint; } } - return var_s4; + return closestPoint; } void EnInvadepoh_Invader_SetProgress(EnInvadepoh* this) { s32 pad; s32 currentTime = gSaveContext.save.time; - s32 warpInTime = EnInvadepoh_Invader_GetWarpInTime(ENINVADEPOH_GET_PARAM_7(&this->actor)); + s32 warpInTime = EnInvadepoh_Invader_GetSpawnTime(ENINVADEPOH_GET_INDEX(&this->actor)); if (sEventState == ENINVADEPOH_EVENT_WAIT) { this->progress = 0.0f; @@ -554,11 +582,11 @@ void EnInvadepoh_Invader_SetupPath(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetCheckpoints(this); } -void EnInvadepoh_func_80B444F4(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_ConfusedRomani_SetupPath(EnInvadepoh* this, PlayState* play) { EnInvadepoh_SetPath(this, play); } -void EnInvadepoh_func_80B44514(EnInvadepoh* this) { +void EnInvadepoh_ConfusedRomani_SetNextPathPoint(EnInvadepoh* this) { this->currentPoint++; if (this->currentPoint >= this->endPoint) { this->currentPoint = 0; @@ -587,7 +615,7 @@ void EnInvadepoh_BarnRomani_SetupPath(EnInvadepoh* this, PlayState* play) { EnInvadepoh_SetPath(this, play); } -void EnInvadepoh_func_80B44640(EnInvadepoh* this) { +void EnInvadepoh_BarnRomani_SetNextPathPoint(EnInvadepoh* this) { if (this->currentPoint < this->endPoint) { this->currentPoint++; } @@ -598,7 +626,7 @@ void EnInvadepoh_Dog_SetupPath(EnInvadepoh* this, PlayState* play) { this->pathStep = 1; } -void EnInvadepoh_func_80B44690(EnInvadepoh* this) { +void EnInvadepoh_Dog_SetNextPathPoint(EnInvadepoh* this) { this->currentPoint += this->pathStep; if (this->currentPoint >= this->endPoint) { this->currentPoint = 0; @@ -607,21 +635,21 @@ void EnInvadepoh_func_80B44690(EnInvadepoh* this) { } } -void EnInvadepoh_func_80B446D0(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night3Romani_SetupPath(EnInvadepoh* this, PlayState* play) { EnInvadepoh_SetPath(this, play); this->pathLength = EnInvadepoh_GetPathLength(this); } -void EnInvadepoh_func_80B44700(EnInvadepoh* this) { +void EnInvadepoh_Night3Romani_SetProgress(EnInvadepoh* this) { if ((gSaveContext.save.time < CLOCK_TIME(20, 00)) && (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { this->progress = 0.0f; } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 14) + 15) || (gSaveContext.save.time < CLOCK_TIME(6, 00))) { this->progress = 1.0f; } else { - f32 temp = + f32 progress = (gSaveContext.save.time - CLOCK_TIME(20, 00)) * (1.0f / (CLOCK_TIME(20, 14) + 15 - CLOCK_TIME(20, 00))); - this->progress = temp; + this->progress = progress; this->progress = CLAMP(this->progress, 0.0f, 1.0f); } } @@ -700,103 +728,106 @@ void EnInvadepoh_Invader_Knockback(EnInvadepoh* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); } -void EnInvadepoh_func_80B44B78(EnInvadepoh* this) { +void EnInvadepoh_Invader_EmptyFunc(EnInvadepoh* this) { } -s32 EnInvadepoh_func_80B44B84(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3) { +s32 EnInvadepoh_Romani_MoveAlongPath(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3) { s32 pad; // TODO: recast? - Vec3s* temp_v0_2 = &this->pathPoints[this->currentPoint + 1]; - s32 sp2C = - EnInvadepoh_func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, temp_v0_2->x, temp_v0_2->z, arg2); + Vec3s* nextPathPoint = &this->pathPoints[this->currentPoint + 1]; + s32 reachedNextPoint = EnInvadepoh_StepTowardXZ(&this->actor.world.pos.x, &this->actor.world.pos.z, + nextPathPoint->x, nextPathPoint->z, arg2); func_800B4AEC(play, &this->actor, arg3); EnInvadepoh_SnapToFloor(this); - return sp2C; + return reachedNextPoint; } -void EnInvadepoh_func_80B44C24(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night1Romani_MoveAlongPathTimed(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? f32 sp18 = this->actor.world.pos.y; - EnInvadepoh_func_80B43BC8(this, &this->currentPoint, &this->actor.world.pos); + EnInvadepoh_Romani_SetPositionAlongPath(this, &this->currentPoint, &this->actor.world.pos); this->actor.world.pos.y = sp18; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); } -s32 EnInvadepoh_func_80B44C80(EnInvadepoh* this, PlayState* play) { - Vec3s* temp_a2 = &this->pathPoints[this->currentPoint]; - Vec3s* temp_v0_2; - s32 var_v1; +s32 EnInvadepoh_Dog_MoveAlongPath(EnInvadepoh* this, PlayState* play) { + Vec3s* currentPathPoint = &this->pathPoints[this->currentPoint]; + Vec3s* nextPathPoint; + s32 nextPoint; u32 var_v0; - f32 temp_v0_2x; - f32 temp_v0_2z; - f32 temp_a2x; - f32 temp_a2z; - Vec3f sp6C; - Vec3f sp60; - Vec3f sp54; + f32 nextPathPointX; + f32 nextPathPointZ; + f32 curPathPointX; + f32 curPathPointZ; + Vec3f currentToNext; + Vec3f worldToNext; + Vec3f worldToCurrent; Vec3f sp48; f32 sp44; - s32 sp40 = 0; + s32 reachedNext = false; - var_v1 = this->currentPoint + this->pathStep; + nextPoint = this->currentPoint + this->pathStep; - if (var_v1 >= this->endPoint) { - var_v1 = 0; - } else if (var_v1 < 0) { - var_v1 = this->endPoint - 1; + if (nextPoint >= this->endPoint) { + nextPoint = 0; + } else if (nextPoint < 0) { + nextPoint = this->endPoint - 1; } - temp_v0_2 = &this->pathPoints[var_v1]; + nextPathPoint = &this->pathPoints[nextPoint]; - temp_a2x = temp_a2->x; - temp_a2z = temp_a2->z; - temp_v0_2x = temp_v0_2->x; - temp_v0_2z = temp_v0_2->z; + curPathPointX = currentPathPoint->x; + curPathPointZ = currentPathPoint->z; + nextPathPointX = nextPathPoint->x; + nextPathPointZ = nextPathPoint->z; - sp6C.x = temp_v0_2x - temp_a2x; - sp6C.y = 0.0f; - sp6C.z = temp_v0_2z - temp_a2z; + currentToNext.x = nextPathPointX - curPathPointX; + currentToNext.y = 0.0f; + currentToNext.z = nextPathPointZ - curPathPointZ; - sp60.x = temp_v0_2x - this->actor.world.pos.x; - sp60.y = 0.0f; - sp60.z = temp_v0_2z - this->actor.world.pos.z; + worldToNext.x = nextPathPointX - this->actor.world.pos.x; + worldToNext.y = 0.0f; + worldToNext.z = nextPathPointZ - this->actor.world.pos.z; - sp54.x = temp_a2x - this->actor.world.pos.x; - sp54.y = 0.0f; - sp54.z = temp_a2z - this->actor.world.pos.z; + worldToCurrent.x = curPathPointX - this->actor.world.pos.x; + worldToCurrent.y = 0.0f; + worldToCurrent.z = curPathPointZ - this->actor.world.pos.z; if (this->actor.speed > 0.0f) { - if (Math3D_AngleBetweenVectors(&sp6C, &sp60, &sp44)) { - sp40 = 1; + if (Math3D_AngleBetweenVectors(¤tToNext, &worldToNext, &sp44)) { + reachedNext = true; } else if (sp44 <= 0.0f) { - sp40 = 1; + reachedNext = true; } } - sp48.x = ((sp60.x + sp54.x) * 0.9f) + sp6C.x; + sp48.x = ((worldToNext.x + worldToCurrent.x) * 0.9f) + currentToNext.x; sp48.y = 0.0f; - sp48.z = ((sp60.z + sp54.z) * 0.9f) + sp6C.z; + sp48.z = ((worldToNext.z + worldToCurrent.z) * 0.9f) + currentToNext.z; Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(sp48.z, sp48.x), 4, 0xFA0, 0x64); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, - EnInvadepoh_Invader_IsOnPath(this, 50.0f, 15.0f) ? UPDBGCHECKINFO_FLAG_4 : UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_1); + EnInvadepoh_Dog_IsOnPath(this, 50.0f, 15.0f) + ? UPDBGCHECKINFO_FLAG_4 + : UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_1); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); - return sp40; + + return reachedNext; } -void EnInvadepoh_func_80B44E90(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Dog_Move(EnInvadepoh* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &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 EnInvadepoh_func_80B44EFC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night3Romani_MoveAlongPathTimed(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? f32 sp18 = this->actor.world.pos.y; - EnInvadepoh_func_80B43BC8(this, &this->currentPoint, &this->actor.world.pos); + EnInvadepoh_Romani_SetPositionAlongPath(this, &this->currentPoint, &this->actor.world.pos); this->actor.world.pos.y = sp18; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); @@ -837,20 +868,20 @@ void EnInvadepoh_Alien_SetTexAnim(void) { sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); } -s32 EnInvadepoh_func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4) { - f32 sp1C = arg2 - *arg0; - f32 sp18 = arg3 - *arg1; - f32 temp_fv0 = Math3D_XZLength(sp1C, sp18); +s32 EnInvadepoh_StepTowardXZ(f32* pxValue, f32* pzValue, f32 xTarget, f32 zTarget, f32 speed) { + f32 xDiff = xTarget - *pxValue; + f32 zDiff = zTarget - *pzValue; + f32 distToTarget = Math3D_XZLength(xDiff, zDiff); - if (arg4 < temp_fv0) { - f32 temp_fv1 = arg4 / temp_fv0; + if (speed < distToTarget) { + f32 progressStep = speed / distToTarget; - *arg0 += temp_fv1 * sp1C; - *arg1 += temp_fv1 * sp18; + *pxValue += progressStep * xDiff; + *pzValue += progressStep * zDiff; return false; } else { - *arg0 = arg2; - *arg1 = arg3; + *pxValue = xTarget; + *pzValue = zTarget; return true; } } @@ -868,21 +899,21 @@ void EnInvadepoh_Event_CheckState(EnInvadepoh* this, PlayState* play) { if (CURRENT_DAY < 1) { sEventState = ENINVADEPOH_EVENT_WAIT; } else if (CURRENT_DAY == 1) { - s32 sp2C = gSaveContext.save.time; + s32 currentTime = gSaveContext.save.time; - if ((sp2C < CLOCK_TIME(2, 30)) || (sp2C >= CLOCK_TIME(6, 00))) { + if (!((CLOCK_TIME(2, 30) <= currentTime) && (currentTime < CLOCK_TIME(6, 00)))) { sEventState = ENINVADEPOH_EVENT_WAIT; - } else if (sp2C < CLOCK_TIME(5, 15)) { - s32 var_s0; - s32 var_s1 = CLOCK_TIME(5, 15); + } else if (currentTime < CLOCK_TIME(5, 15)) { + s32 i; + s32 firstSpawn = CLOCK_TIME(5, 15); s32 temp; - for (var_s0 = 0; var_s0 < this->spawnCount; var_s0++) { - s32 temp_v0 = EnInvadepoh_Invader_GetWarpInTime(var_s0); + for (i = 0; i < this->spawnCount; i++) { + s32 spawnTime = EnInvadepoh_Invader_GetSpawnTime(i); - var_s1 = MIN(temp_v0, var_s1); + firstSpawn = MIN(spawnTime, firstSpawn); } - if (sp2C < var_s1 + 3601) { // 79 in-game minutes + if (currentTime < firstSpawn + 3601) { // 79 in-game minutes sEventState = ENINVADEPOH_EVENT_ACTIVE; } } @@ -897,8 +928,8 @@ void EnInvadepoh_Event_CheckState(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_Event_SpawnAliens(EnInvadepoh* this, PlayState* play) { - s32 pathIndex = ENINVADEPOH_GET_PARAM_7F00(&this->actor); +void EnInvadepoh_Event_SpawnInvaders(EnInvadepoh* this, PlayState* play) { + s32 pathIndex = ENINVADEPOH_GET_PATH(&this->actor); s32 i; for (i = 0; i < this->spawnCount; i++) { @@ -913,51 +944,51 @@ void EnInvadepoh_Event_SpawnAliens(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { +void EnInvadepoh_Abductor_SpawnCow(EnInvadepoh* this, PlayState* play, s32 arg2) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, arg2)); } -void EnInvadepoh_func_80B45460(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Abductor_SpawnRomani(EnInvadepoh* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_ROMANI_ABDUCTED, 0)); } void EnInvadepoh_Event_SpawnLightBall(EnInvadepoh* this, PlayState* play) { - sLightBall = - (EnInvadepoh*) Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); + sLightBall = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); } -void EnInvadepoh_func_80B45518(Vec3f* arg0) { - MtxF* temp_v0 = Matrix_GetCurrent(); +void EnInvadepoh_LightBall_ReplaceTranslation(Vec3f* newTrans) { + MtxF* curMtxF = Matrix_GetCurrent(); - temp_v0->mf[3][0] = arg0->x; - temp_v0->mf[3][1] = arg0->y; - temp_v0->mf[3][2] = arg0->z; + curMtxF->mf[3][0] = newTrans->x; + curMtxF->mf[3][1] = newTrans->y; + curMtxF->mf[3][2] = newTrans->z; } -s32 EnInvadepoh_func_80B45550(EnInvadepoh* this, PlayState* play, f32 arg2, s32 arg3) { +s32 EnInvadepoh_Romani_OpenDoor(EnInvadepoh* this, PlayState* play, f32 range, s32 doorTimer) { Actor* doorActor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; EnDoor* door; - s32 sp34 = false; + s32 doorOpened = false; while (doorActor != NULL) { if ((doorActor->id == ACTOR_EN_DOOR) && (doorActor->update != NULL)) { door = (EnDoor*)doorActor; if ((door->dyna.actor.room == this->actor.room) && - (Math3D_Vec3fDistSq(&door->dyna.actor.world.pos, &this->actor.world.pos) < arg2)) { + (Math3D_Vec3fDistSq(&door->dyna.actor.world.pos, &this->actor.world.pos) < range)) { - door->unk_1A7 = arg3; - sp34 = true; + door->unk_1A7 = doorTimer; + doorOpened = true; break; } } doorActor = doorActor->next; } - return sp34; + return doorOpened; } void EnInvadepoh_Romani_SetTextId(EnInvadepoh* this, PlayState* play, u16 textId) { @@ -975,17 +1006,17 @@ void EnInvadepoh_Event_SetCutscenes(EnInvadepoh* this) { } } -s32 EnInvadepoh_func_80B456A8(PlayState* play, Vec3f* arg1) { - Vec3f sp34; - f32 sp30; +s32 EnInvadepoh_Alien_LensFlareDepthCheck(PlayState* play, Vec3f* pos) { + Vec3f projectedPos; + f32 invW; - Actor_GetProjectedPos(play, arg1, &sp34, &sp30); - if ((sp34.z > 1.0f) && (fabsf(sp34.x * sp30) < 1.0f) && (fabsf(sp34.y * sp30) < 1.0f)) { - f32 sp2C = (sp34.x * sp30 * 160.0f) + 160.0f; - f32 sp28 = (sp34.y * sp30 * -120.0f) + 120.0f; - s32 sp24 = (s32)(sp34.z * sp30 * 16352.0f) + 16352; + Actor_GetProjectedPos(play, pos, &projectedPos, &invW); + if ((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f) && (fabsf(projectedPos.y * invW) < 1.0f)) { + f32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + f32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; - if (sp24 < func_80178A94(sp2C, sp28)) { + if (wZ < func_80178A94(screenPosX, screenPosY)) { return true; } } @@ -1028,70 +1059,71 @@ EnInvadepoh* EnInvadepoh_Dog_GetClosestAlien(void) { return NULL; } -s8 EnInvadepoh_func_80B45980(EnInvadepohFaceAnimNext* arg0, s32 arg1) { - f32 temp_fv0 = Rand_ZeroOne(); - EnInvadepohFaceAnimNext* var_v0 = arg0; - s32 var_v1; +s8 EnInvadepoh_Interact_GetNextAnim(EnInvadepohFaceAnimNext* nextAnims, s32 nextAnimCount) { + f32 rand = Rand_ZeroOne(); + EnInvadepohFaceAnimNext* nextAnim = nextAnims; + s32 nextIndex; - arg1--; - for (var_v1 = 0; var_v1 < arg1; var_v1++, var_v0++) { - if (temp_fv0 <= var_v0->chance) { + nextAnimCount--; + for (nextIndex = 0; nextIndex < nextAnimCount; nextIndex++, nextAnim++) { + if (rand <= nextAnim->chance) { break; } } - return (arg0 + var_v1)->index; // TODO: fake? + return (nextAnims + nextIndex)->index; // TODO: fake? } -void EnInvadepoh_func_80B459E8(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim* arg1) { - arg0->curAnimType = arg1->type; - arg0->curAnim = arg1; - arg0->curFrame = 0; - arg0->curIndex = arg1->frames->index[0]; - if (arg0->curAnimType == 2) { - EnInvadepohFaceAnimLoopDelayed* temp = (EnInvadepohFaceAnimLoopDelayed*)arg1; +void EnInvadepoh_Interact_SetNextAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed* faceAnim) { + faceInfo->curAnimType = faceAnim->type; + faceInfo->curAnim = faceAnim; + faceInfo->curFrame = 0; + faceInfo->curIndex = faceAnim->frames->texIndex[0]; + if (faceInfo->curAnimType == 2) { + EnInvadepohFaceAnimLoopDelayed* faceDelayedLoopAnim = (EnInvadepohFaceAnimLoopDelayed*)faceAnim; - arg0->delayTimer = Rand_S16Offset(temp->minDelay, temp->maxDelay); + faceInfo->delayTimer = Rand_S16Offset(faceDelayedLoopAnim->minDelay, faceDelayedLoopAnim->maxDelay); } } -void EnInvadepoh_func_80B45A4C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { - EnInvadepohFaceAnim* temp_v0 = arg0->curAnim; - EnInvadepohFaceFrame* temp_v1 = temp_v0->frames; +void EnInvadepoh_Interact_UpdateFixedAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { + EnInvadepohFaceAnimFixed* faceAnim = faceInfo->curAnim; + EnInvadepohFaceAnim* faceFrames = faceAnim->frames; - if (arg0->curFrame < (temp_v1->count - 1)) { - arg0->curFrame++; - arg0->curIndex = temp_v1->index[arg0->curFrame]; + if (faceInfo->curFrame < (faceFrames->count - 1)) { + faceInfo->curFrame++; + faceInfo->curIndex = faceFrames->texIndex[faceInfo->curFrame]; } } -void EnInvadepoh_func_80B45A94(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { - EnInvadepohFaceAnimLoop* temp_v0 = (EnInvadepohFaceAnimLoop*)arg0->curAnim; - EnInvadepohFaceFrame* temp_v1 = temp_v0->anim.frames; +void EnInvadepoh_Interact_UpdateLoopedAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { + EnInvadepohFaceAnimLoop* faceAnimLoop = (EnInvadepohFaceAnimLoop*)faceInfo->curAnim; + EnInvadepohFaceAnim* faceFrames = faceAnimLoop->anim.frames; - if (arg0->curFrame < (temp_v1->count - 1)) { - arg0->curFrame++; - arg0->curIndex = temp_v1->index[arg0->curFrame]; + if (faceInfo->curFrame < (faceFrames->count - 1)) { + faceInfo->curFrame++; + faceInfo->curIndex = faceFrames->texIndex[faceInfo->curFrame]; } else { - EnInvadepohFaceAnim* temp_a1 = arg1[EnInvadepoh_func_80B45980(temp_v0->nextAnims, temp_v0->nextCount)]; + EnInvadepohFaceAnimFixed* nextAnim = + animSet[EnInvadepoh_Interact_GetNextAnim(faceAnimLoop->nextAnims, faceAnimLoop->nextCount)]; - EnInvadepoh_func_80B459E8(arg0, temp_a1); + EnInvadepoh_Interact_SetNextAnim(faceInfo, nextAnim); } } -void EnInvadepoh_func_80B45B1C(EnInvadePohFaceInfo* arg0, EnInvadepohFaceAnim** arg1) { - EnInvadepohFaceAnimLoopDelayed* temp_v0 = (EnInvadepohFaceAnimLoopDelayed*)arg0->curAnim; - EnInvadepohFaceFrame* temp_v1 = temp_v0->loop.anim.frames; +void EnInvadepoh_Interact_UpdateDelayedLoopAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { + EnInvadepohFaceAnimLoopDelayed* faceAnimLoopDelayed = (EnInvadepohFaceAnimLoopDelayed*)faceInfo->curAnim; + EnInvadepohFaceAnim* faceFrames = faceAnimLoopDelayed->loop.anim.frames; - if (arg0->curFrame < (temp_v1->count - 1)) { - arg0->curFrame++; - arg0->curIndex = temp_v1->index[arg0->curFrame]; - } else if (arg0->delayTimer > 0) { - arg0->delayTimer--; + if (faceInfo->curFrame < (faceFrames->count - 1)) { + faceInfo->curFrame++; + faceInfo->curIndex = faceFrames->texIndex[faceInfo->curFrame]; + } else if (faceInfo->delayTimer > 0) { + faceInfo->delayTimer--; } else { - EnInvadepohFaceAnim* temp_a1 = - arg1[EnInvadepoh_func_80B45980(temp_v0->loop.nextAnims, temp_v0->loop.nextCount)]; + EnInvadepohFaceAnimFixed* nextAnim = animSet[EnInvadepoh_Interact_GetNextAnim( + faceAnimLoopDelayed->loop.nextAnims, faceAnimLoopDelayed->loop.nextCount)]; - EnInvadepoh_func_80B459E8(arg0, temp_a1); + EnInvadepoh_Interact_SetNextAnim(faceInfo, nextAnim); } } @@ -1102,14 +1134,14 @@ s8 D_80B4E9AC[6] = { 0, 1, 2, 2, 1, 0 }; s8 D_80B4E9B4[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; s8 D_80B4E9BC[1] = { 1 }; s8 D_80B4E9C0[1] = { 3 }; -EnInvadepohFaceFrame D_80B4E9C4 = { D_80B4E99C, 1 }; -EnInvadepohFaceFrame D_80B4E9CC = { D_80B4E9A0, 4 }; -EnInvadepohFaceFrame D_80B4E9D4 = { D_80B4E9A4, 5 }; -EnInvadepohFaceFrame D_80B4E9DC = { D_80B4E9AC, 6 }; -EnInvadepohFaceFrame D_80B4E9E4 = { D_80B4E9B4, 8 }; -EnInvadepohFaceFrame D_80B4E9EC = { D_80B4E9BC, 1 }; -EnInvadepohFaceFrame D_80B4E9F4 = { D_80B4E9C0, 1 }; -EnInvadepohFaceAnim D_80B4E9FC = { 0, &D_80B4E9C4 }; +EnInvadepohFaceAnim D_80B4E9C4 = { D_80B4E99C, 1 }; +EnInvadepohFaceAnim D_80B4E9CC = { D_80B4E9A0, 4 }; +EnInvadepohFaceAnim D_80B4E9D4 = { D_80B4E9A4, 5 }; +EnInvadepohFaceAnim D_80B4E9DC = { D_80B4E9AC, 6 }; +EnInvadepohFaceAnim D_80B4E9E4 = { D_80B4E9B4, 8 }; +EnInvadepohFaceAnim D_80B4E9EC = { D_80B4E9BC, 1 }; +EnInvadepohFaceAnim D_80B4E9F4 = { D_80B4E9C0, 1 }; +EnInvadepohFaceAnimFixed D_80B4E9FC = { 0, &D_80B4E9C4 }; EnInvadepohFaceAnimNext D_80B4EA04[4] = { { 2, 0.5f }, { 3, 0.9f }, @@ -1122,9 +1154,9 @@ EnInvadepohFaceAnimLoop D_80B4EA40 = { { 1, &D_80B4E9CC }, 1, D_80B4EA24 }; EnInvadepohFaceAnimLoop D_80B4EA50 = { { 1, &D_80B4E9D4 }, 1, D_80B4EA24 }; EnInvadepohFaceAnimLoop D_80B4EA60 = { { 1, &D_80B4E9DC }, 1, D_80B4EA24 }; EnInvadepohFaceAnimLoop D_80B4EA70 = { { 1, &D_80B4E9E4 }, 1, D_80B4EA24 }; -EnInvadepohFaceAnim D_80B4EA80 = { 0, &D_80B4E9EC }; -EnInvadepohFaceAnim D_80B4EA88 = { 0, &D_80B4E9F4 }; -EnInvadepohFaceAnim* D_80B4EA90[8] = { +EnInvadepohFaceAnimFixed D_80B4EA80 = { 0, &D_80B4E9EC }; +EnInvadepohFaceAnimFixed D_80B4EA88 = { 0, &D_80B4E9F4 }; +EnInvadepohFaceAnimFixed* D_80B4EA90[8] = { &D_80B4E9FC, &D_80B4EA2C.loop.anim, &D_80B4EA40.anim, &D_80B4EA50.anim, &D_80B4EA60.anim, &D_80B4EA70.anim, &D_80B4EA80, &D_80B4EA88, }; @@ -1133,15 +1165,15 @@ s8 D_80B4EAB0[1] = { 0 }; s8 D_80B4EAB4[1] = { 1 }; s8 D_80B4EAB8[1] = { 2 }; s8 D_80B4EABC[1] = { 3 }; -EnInvadepohFaceFrame D_80B4EAC0 = { D_80B4EAB0, 1 }; -EnInvadepohFaceFrame D_80B4EAC8 = { D_80B4EAB4, 1 }; -EnInvadepohFaceFrame D_80B4EAD0 = { D_80B4EAB8, 1 }; -EnInvadepohFaceFrame D_80B4EAD8 = { D_80B4EABC, 1 }; -EnInvadepohFaceAnim D_80B4EAE0 = { 0, &D_80B4EAC0 }; -EnInvadepohFaceAnim D_80B4EAE8 = { 0, &D_80B4EAC8 }; -EnInvadepohFaceAnim D_80B4EAF0 = { 0, &D_80B4EAD0 }; -EnInvadepohFaceAnim D_80B4EAF8 = { 0, &D_80B4EAD8 }; -EnInvadepohFaceAnim* D_80B4EB00[4] = { +EnInvadepohFaceAnim D_80B4EAC0 = { D_80B4EAB0, 1 }; +EnInvadepohFaceAnim D_80B4EAC8 = { D_80B4EAB4, 1 }; +EnInvadepohFaceAnim D_80B4EAD0 = { D_80B4EAB8, 1 }; +EnInvadepohFaceAnim D_80B4EAD8 = { D_80B4EABC, 1 }; +EnInvadepohFaceAnimFixed D_80B4EAE0 = { 0, &D_80B4EAC0 }; +EnInvadepohFaceAnimFixed D_80B4EAE8 = { 0, &D_80B4EAC8 }; +EnInvadepohFaceAnimFixed D_80B4EAF0 = { 0, &D_80B4EAD0 }; +EnInvadepohFaceAnimFixed D_80B4EAF8 = { 0, &D_80B4EAD8 }; +EnInvadepohFaceAnimFixed* D_80B4EB00[4] = { &D_80B4EAE0, &D_80B4EAE8, &D_80B4EAF0, @@ -1153,12 +1185,12 @@ s8 D_80B4EB14[4] = { 0, 1, 2, 0 }; s8 D_80B4EB18[5] = { 0, 1, 2, 1, 0 }; s8 D_80B4EB20[6] = { 0, 1, 2, 2, 1, 0 }; s8 D_80B4EB28[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; -EnInvadepohFaceFrame D_80B4EB30 = { D_80B4EB10, 1 }; -EnInvadepohFaceFrame D_80B4EB38 = { D_80B4EB14, 4 }; -EnInvadepohFaceFrame D_80B4EB40 = { D_80B4EB18, 5 }; -EnInvadepohFaceFrame D_80B4EB48 = { D_80B4EB20, 6 }; -EnInvadepohFaceFrame D_80B4EB50 = { D_80B4EB28, 8 }; -EnInvadepohFaceAnim D_80B4EB58 = { 0, &D_80B4EB30 }; +EnInvadepohFaceAnim D_80B4EB30 = { D_80B4EB10, 1 }; +EnInvadepohFaceAnim D_80B4EB38 = { D_80B4EB14, 4 }; +EnInvadepohFaceAnim D_80B4EB40 = { D_80B4EB18, 5 }; +EnInvadepohFaceAnim D_80B4EB48 = { D_80B4EB20, 6 }; +EnInvadepohFaceAnim D_80B4EB50 = { D_80B4EB28, 8 }; +EnInvadepohFaceAnimFixed D_80B4EB58 = { 0, &D_80B4EB30 }; EnInvadepohFaceAnimNext D_80B4EB60[4] = { { 2, 0.5f }, { 3, 0.9f }, @@ -1171,94 +1203,94 @@ EnInvadepohFaceAnimLoop D_80B4EB9C = { { 1, &D_80B4EB38 }, 1, D_80B4EB80 }; EnInvadepohFaceAnimLoop D_80B4EBAC = { { 1, &D_80B4EB40 }, 1, D_80B4EB80 }; EnInvadepohFaceAnimLoop D_80B4EBBC = { { 1, &D_80B4EB48 }, 1, D_80B4EB80 }; EnInvadepohFaceAnimLoop D_80B4EBCC = { { 1, &D_80B4EB50 }, 1, D_80B4EB80 }; -EnInvadepohFaceAnim* D_80B4EBDC[6] = { +EnInvadepohFaceAnimFixed* D_80B4EBDC[6] = { &D_80B4EB58, &D_80B4EB88.loop.anim, &D_80B4EB9C.anim, &D_80B4EBAC.anim, &D_80B4EBBC.anim, &D_80B4EBCC.anim, }; s8 D_80B4EBF4[1] = { 0 }; -EnInvadepohFaceFrame D_80B4EBF8 = { D_80B4EBF4, 1 }; -EnInvadepohFaceAnim D_80B4EC00 = { 0, &D_80B4EBF8 }; -EnInvadepohFaceAnim* D_80B4EC08[1] = { &D_80B4EC00 }; +EnInvadepohFaceAnim D_80B4EBF8 = { D_80B4EBF4, 1 }; +EnInvadepohFaceAnimFixed D_80B4EC00 = { 0, &D_80B4EBF8 }; +EnInvadepohFaceAnimFixed* D_80B4EC08[1] = { &D_80B4EC00 }; -void EnInvadepoh_func_80B45BB8(EnInvadePohFaceInfo* arg0) { - static EnInvadepohFaceFunc D_80B4EC0C[3] = { - EnInvadepoh_func_80B45A4C, - EnInvadepoh_func_80B45A94, - EnInvadepoh_func_80B45B1C, +void EnInvadepoh_Interact_UpdateAnimation(EnInvadePohFaceInfo* faceInfo) { + static EnInvadepohFaceFunc sFaceUpdateFuncs[3] = { + EnInvadepoh_Interact_UpdateFixedAnim, + EnInvadepoh_Interact_UpdateLoopedAnim, + EnInvadepoh_Interact_UpdateDelayedLoopAnim, }; - if ((arg0->animSet != NULL) && (arg0->curAnim != NULL)) { - D_80B4EC0C[arg0->curAnimType](arg0, arg0->animSet); + if ((faceInfo->animSet != NULL) && (faceInfo->curAnim != NULL)) { + sFaceUpdateFuncs[faceInfo->curAnimType](faceInfo, faceInfo->animSet); } } -void EnInvadepoh_func_80B45C04(EnInvadePohUnkStruct_324* arg0, EnInvadepohFaceAnim** arg1, s32 arg2, - EnInvadepohFaceAnim** arg3, s32 arg4, Vec3s* arg5, s16 arg6, f32 arg7, f32 arg8, - f32 arg9) { - Math_Vec3s_Copy(&arg0->unk_26, arg5); - arg0->unk_2C = arg6; - arg0->unk_30 = arg7; - arg0->unk_38 = arg8; - arg0->unk_3C = arg9; - if (arg1 != NULL) { - EnInvadepohFaceAnim* temp_v0 = arg1[arg2]; +void EnInvadepoh_Interact_Init(EnInvadePohInteractInfo* interactInfo, EnInvadepohFaceAnimFixed** eyeAnimSet, + s32 curEyeAnim, EnInvadepohFaceAnimFixed** mouthAnimSet, s32 curMouthAnim, Vec3s* arg5, + s16 arg6, f32 arg7, f32 arg8, f32 arg9) { + Math_Vec3s_Copy(&interactInfo->headRotTarget, arg5); + interactInfo->maxTurnRate = arg6; + interactInfo->scaledTurnRate = arg7; + interactInfo->torsoRotXModTarget = arg8; + interactInfo->torsoRotXModStep = arg9; + if (eyeAnimSet != NULL) { + EnInvadepohFaceAnimFixed* faceAnim = eyeAnimSet[curEyeAnim]; - arg0->eyeAnim.animSet = arg1; - arg0->eyeAnim.curAnimType = temp_v0->type; - arg0->eyeAnim.curAnim = temp_v0; - arg0->eyeAnim.delayTimer = 0; - arg0->eyeAnim.curFrame = 0; - arg0->eyeAnim.curIndex = temp_v0->frames->index[0]; + interactInfo->eyeAnim.animSet = eyeAnimSet; + interactInfo->eyeAnim.curAnimType = faceAnim->type; + interactInfo->eyeAnim.curAnim = faceAnim; + interactInfo->eyeAnim.delayTimer = 0; + interactInfo->eyeAnim.curFrame = 0; + interactInfo->eyeAnim.curIndex = faceAnim->frames->texIndex[0]; } - if (arg3 != NULL) { - EnInvadepohFaceAnim* temp_v0 = arg3[arg4]; + if (mouthAnimSet != NULL) { + EnInvadepohFaceAnimFixed* faceAnim = mouthAnimSet[curMouthAnim]; - arg0->mouthAnim.animSet = arg3; - arg0->mouthAnim.curAnimType = temp_v0->type; - arg0->mouthAnim.curAnim = temp_v0; - arg0->mouthAnim.delayTimer = 0; - arg0->mouthAnim.curFrame = 0; - arg0->mouthAnim.curIndex = temp_v0->frames->index[0]; + interactInfo->mouthAnim.animSet = mouthAnimSet; + interactInfo->mouthAnim.curAnimType = faceAnim->type; + interactInfo->mouthAnim.curAnim = faceAnim; + interactInfo->mouthAnim.delayTimer = 0; + interactInfo->mouthAnim.curFrame = 0; + interactInfo->mouthAnim.curIndex = faceAnim->frames->texIndex[0]; } } -void EnInvadepoh_func_80B45CE0(EnInvadePohUnkStruct_324* arg0) { - Vec3f sp3C; - Vec3s sp34; +void EnInvadepoh_Interact_Update(EnInvadePohInteractInfo* interactInfo) { + Vec3f scaledRotStep; + Vec3s rotStep; - sp34.x = arg0->unk_26.x - arg0->unk_20.x; - sp34.y = arg0->unk_26.y - arg0->unk_20.y; - sp34.z = arg0->unk_26.z - arg0->unk_20.z; - Math_Vec3s_ToVec3f(&sp3C, &sp34); - Math_Vec3f_Scale(&sp3C, arg0->unk_30); - 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, arg0->unk_2C); - sp34.y = CLAMP_MAX(sp34.y, arg0->unk_2C); - sp34.z = CLAMP_MAX(sp34.z, arg0->unk_2C); + rotStep.x = interactInfo->headRotTarget.x - interactInfo->headRot.x; + rotStep.y = interactInfo->headRotTarget.y - interactInfo->headRot.y; + rotStep.z = interactInfo->headRotTarget.z - interactInfo->headRot.z; + Math_Vec3s_ToVec3f(&scaledRotStep, &rotStep); + Math_Vec3f_Scale(&scaledRotStep, interactInfo->scaledTurnRate); + Math_Vec3f_ToVec3s(&rotStep, &scaledRotStep); + rotStep.x = ABS(rotStep.x); + rotStep.y = ABS(rotStep.y); + rotStep.z = ABS(rotStep.z); + rotStep.x = CLAMP_MAX(rotStep.x, interactInfo->maxTurnRate); + rotStep.y = CLAMP_MAX(rotStep.y, interactInfo->maxTurnRate); + rotStep.z = CLAMP_MAX(rotStep.z, interactInfo->maxTurnRate); - Math_ScaledStepToS(&arg0->unk_20.x, arg0->unk_26.x, sp34.x); - Math_ScaledStepToS(&arg0->unk_20.y, arg0->unk_26.y, sp34.y); - Math_ScaledStepToS(&arg0->unk_20.z, arg0->unk_26.z, sp34.z); - Math_StepToF(&arg0->unk_34, arg0->unk_38, arg0->unk_3C); + Math_ScaledStepToS(&interactInfo->headRot.x, interactInfo->headRotTarget.x, rotStep.x); + Math_ScaledStepToS(&interactInfo->headRot.y, interactInfo->headRotTarget.y, rotStep.y); + Math_ScaledStepToS(&interactInfo->headRot.z, interactInfo->headRotTarget.z, rotStep.z); + Math_StepToF(&interactInfo->torsoRotXMod, interactInfo->torsoRotXModTarget, interactInfo->torsoRotXModStep); - if (arg0->unk_40 != arg0->unk_42) { - s16 var_a2 = arg0->unk_42 - arg0->unk_40; + if (interactInfo->torsoRotZ != interactInfo->torsoRotZTarget) { + s16 torsoRotStep = interactInfo->torsoRotZTarget - interactInfo->torsoRotZ; - var_a2 *= arg0->unk_44; - var_a2 = ABS(var_a2); - var_a2 = CLAMP(var_a2, 100, arg0->unk_48); - Math_ScaledStepToS(&arg0->unk_40, arg0->unk_42, var_a2); + torsoRotStep *= interactInfo->torsoMaxTurnRate; + torsoRotStep = ABS(torsoRotStep); + torsoRotStep = CLAMP(torsoRotStep, 0x64, interactInfo->torsoMaxTurnStep); + Math_ScaledStepToS(&interactInfo->torsoRotZ, interactInfo->torsoRotZTarget, torsoRotStep); } - EnInvadepoh_func_80B45BB8(&arg0->eyeAnim); - EnInvadepoh_func_80B45BB8(&arg0->mouthAnim); + EnInvadepoh_Interact_UpdateAnimation(&interactInfo->eyeAnim); + EnInvadepoh_Interact_UpdateAnimation(&interactInfo->mouthAnim); } void EnInvadepoh_LightBall_SpawnSparkles(EnInvadepoh* this, PlayState* play, s32 arg2) { - static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; - static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; + static Color_RGBA8 sLightYellow = { 255, 255, 200, 255 }; + static Color_RGBA8 sGoldenYellow = { 255, 200, 0, 0 }; s32 var_s1; Vec3f spA8; Vec3f sp9C; @@ -1284,19 +1316,19 @@ void EnInvadepoh_LightBall_SpawnSparkles(EnInvadepoh* this, PlayState* play, s32 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(play, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); + EffectSsKirakira_SpawnDispersed(play, &spA8, &sp9C, &sp90, &sLightYellow, &sGoldenYellow, 6000, -40); } } -s32 EnInvadepoh_Invader_SpawnWarp(Vec3f* arg0) { - EnInvadepohWarpEffect* warpEffect = D_80B50350; +s32 EnInvadepoh_Invader_SpawnWarp(Vec3f* spawnPos) { + EnInvadepohWarpEffect* warpEffect = sWarpEffects; s32 i; - for (i = 0; i < 10; i++, warpEffect++) { + for (i = 0; i < ARRAY_COUNT(sWarpEffects); i++, warpEffect++) { if (warpEffect->timer <= 0) { - warpEffect->unk_0 = 0; + warpEffect->type = 0; warpEffect->timer = 40; - Math_Vec3f_Copy(&warpEffect->pos, arg0); + Math_Vec3f_Copy(&warpEffect->pos, spawnPos); warpEffect->alpha = 0; return true; } @@ -1304,7 +1336,7 @@ s32 EnInvadepoh_Invader_SpawnWarp(Vec3f* arg0) { return false; } -void EnInvadepoh_func_80B46184(EnInvadepohWarpEffect* warpEffect) { +void EnInvadepoh_Warp_Fade(EnInvadepohWarpEffect* warpEffect) { if (warpEffect->timer > 20) { if (warpEffect->alpha < 125) { warpEffect->alpha += 10; @@ -1321,19 +1353,19 @@ void EnInvadepoh_func_80B46184(EnInvadepohWarpEffect* warpEffect) { } s32 EnInvadepoh_Event_UpdateWarps(void) { - static void (*D_80B4EC20[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_func_80B46184 }; - s32 var_s4 = false; + static void (*sEnInvadepohWarpUpdateFuncs[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_Warp_Fade }; + s32 warpActive = false; s32 i; EnInvadepohWarpEffect* warpEffect; - for (i = 0, warpEffect = D_80B50350; i < 10; i++, warpEffect++) { + for (i = 0, warpEffect = sWarpEffects; i < 10; i++, warpEffect++) { if (warpEffect->timer > 0) { - D_80B4EC20[warpEffect->unk_0](warpEffect); - var_s4 = true; + sEnInvadepohWarpUpdateFuncs[warpEffect->type](warpEffect); + warpActive = true; warpEffect->timer--; } } - return var_s4; + return warpActive; } void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { @@ -1343,7 +1375,7 @@ void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { s32 pathIndex; this->actor.flags |= ACTOR_FLAG_20; - pathIndex = ENINVADEPOH_GET_PARAM_7F00(&this->actor); + pathIndex = ENINVADEPOH_GET_PATH(&this->actor); for (spawnCount = 1; spawnCount < 8; spawnCount++) { Path* path = &play->setupPathList[pathIndex]; @@ -1356,7 +1388,7 @@ void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { this->spawnCount = spawnCount; EnInvadepoh_Event_CheckState(this, play); EnInvadepoh_Event_SetCutscenes(this); - func_800BC154(play, &play->actorCtx, &this->actor, 0); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_SWITCH); if (sEventState == ENINVADEPOH_EVENT_WAIT) { EnInvadepoh_Event_SetupWait(this); } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { @@ -1364,7 +1396,7 @@ void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { EnInvadepoh_Event_SetupWait(this); } else { EnInvadepoh_Event_SpawnLightBall(this, play); - EnInvadepoh_Event_SpawnAliens(this, play); + EnInvadepoh_Event_SpawnInvaders(this, play); AudioSeq_QueueSeqCmd(0x8000 | NA_BGM_ALIEN_INVASION); EnInvadepoh_Event_SetupInvasion(this); } @@ -1396,7 +1428,7 @@ void EnInvadepoh_Alien_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); this->actor.shape.shadowAlpha = 140; this->actor.flags = ACTOR_FLAG_80000000 | ACTOR_FLAG_1000 | ACTOR_FLAG_10; - if (ENINVADEPOH_GET_PARAM_F0(&this->actor) == ENINVADEPOH_ALIEN_ABDUCTOR) { + if (ENINVADEPOH_GET_TYPE(&this->actor) == ENINVADEPOH_ALIEN_ABDUCTOR) { this->actor.update = EnInvadepoh_Abuductor_WaitForObject; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; } else { @@ -1456,31 +1488,31 @@ InitChainEntry sRomaniInitChain[5] = { void EnInvadepoh_Romani_Init(Actor* thisx, PlayState* play) { // PlayState* play = play2; Stack management problems EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 temp_v1 = ENINVADEPOH_GET_PARAM_F0(&this->actor); + s32 romaniType = ENINVADEPOH_GET_TYPE(&this->actor); Actor_ProcessInitChain(&this->actor, sRomaniInitChain); - if ((temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) || (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3)) { + if ((romaniType == ENINVADEPOH_ROMANI_NIGHT_1) || (romaniType == ENINVADEPOH_ROMANI_NIGHT_3)) { this->actor.targetMode = 3; } else { this->actor.targetMode = 6; } - func_800BC154(play, &play->actorCtx, &this->actor, 4); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); Collider_InitCylinder(play, &this->collider); - if (temp_v1 != ENINVADEPOH_ROMANI_ABDUCTED) { + if (romaniType != ENINVADEPOH_ROMANI_ABDUCTED) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); Collider_SetCylinder(play, &this->collider, &this->actor, &sHumanCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; } - if (temp_v1 == ENINVADEPOH_ROMANI_ABDUCTED) { + if (romaniType == ENINVADEPOH_ROMANI_ABDUCTED) { this->actor.update = EnInvadepoh_AbductedRomani_WaitForObject; - } else if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { + } else if (romaniType == ENINVADEPOH_ROMANI_CONFUSED) { this->actor.update = EnInvadepoh_ConfusedRomani_WaitForObject; this->actor.flags = ACTOR_FLAG_10 | ACTOR_FLAG_8 | ACTOR_FLAG_1; - } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { + } else if (romaniType == ENINVADEPOH_ROMANI_NIGHT_1) { this->actor.update = EnInvadepoh_Night1Romani_WaitForObject; - } else if (temp_v1 == ENINVADEPOH_ROMANI_BARN) { + } else if (romaniType == ENINVADEPOH_ROMANI_BARN) { this->actor.update = EnInvadepoh_BarnRomani_WaitForObject; - } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { + } else if (romaniType == ENINVADEPOH_ROMANI_REWARD) { this->actor.update = EnInvadepoh_RewardRomani_WaitForObject; } else { this->actor.update = EnInvadepoh_Night3Romani_WaitForObject; @@ -1489,21 +1521,21 @@ void EnInvadepoh_Romani_Init(Actor* thisx, PlayState* play) { if (this->bankIndex < 0) { Actor_Kill(&this->actor); } - if (temp_v1 == ENINVADEPOH_ROMANI_CONFUSED) { + if (romaniType == ENINVADEPOH_ROMANI_CONFUSED) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } - } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_1) { - if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { + } else if (romaniType == ENINVADEPOH_ROMANI_NIGHT_1) { + if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { Actor_Kill(&this->actor); } - } else if (temp_v1 == ENINVADEPOH_ROMANI_BARN) { + } else if (romaniType == ENINVADEPOH_ROMANI_BARN) { // nothing - } else if (temp_v1 == ENINVADEPOH_ROMANI_REWARD) { + } else if (romaniType == ENINVADEPOH_ROMANI_REWARD) { if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { Actor_Kill(&this->actor); } - } else if (temp_v1 == ENINVADEPOH_ROMANI_NIGHT_3) { + } else if (romaniType == ENINVADEPOH_ROMANI_NIGHT_3) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } @@ -1523,15 +1555,15 @@ void EnInvadepoh_LightBall_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, sLightBallInitChain); this->actor.update = EnInvadepoh_LightBall_Update; this->actor.draw = EnInvadepoh_LightBall_Draw; - func_800BC154(play, &play->actorCtx, &this->actor, 4); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); if ((sEventState == ENINVADEPOH_EVENT_WAIT) || (gSaveContext.save.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; - EnInvadepoh_func_80B491EC(this); + this->actor.world.pos.x += sLightBallSpawnOffset.x; + this->actor.world.pos.y += sLightBallSpawnOffset.y + 3000.0f; + this->actor.world.pos.z += sLightBallSpawnOffset.z; + EnInvadepoh_LightBall_SetupDescend(this); } else if (sEventState == ENINVADEPOH_EVENT_ACTIVE) { this->actor.world.pos.y += 1500.0f; - EnInvadepoh_func_80B49628(this); + EnInvadepoh_LightBall_SetupAboveBarn(this); } else { Actor_Kill(&this->actor); } @@ -1575,7 +1607,7 @@ void EnInvadepoh_Cremia_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sCremiaInitChain); this->actor.update = EnInvadepoh_Cremia_WaitForObject; - func_800BC154(play, &play->actorCtx, &this->actor, 4); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sHumanCylinderInit); this->actor.colChkInfo.mass = MASS_HEAVY; @@ -1592,23 +1624,23 @@ void EnInvadepoh_Cremia_Init(Actor* thisx, PlayState* play) { void EnInvadepoh_Init(Actor* thisx, PlayState* play) { static ActorFunc sInitFuncs[14] = { - /* 0x0 */ EnInvadepoh_Event_Init, // Event handler - /* 0x1 */ EnInvadepoh_Alien_Init, // Alien invader - /* 0x2 */ EnInvadepoh_Cow_Init, // Abducted cow - /* 0x3 */ EnInvadepoh_CowTail_Init, // Cow tail - /* 0x4 */ EnInvadepoh_Romani_Init, // Abducted Romani - /* 0x5 */ EnInvadepoh_Romani_Init, // Confused Romani + /* 0x0 */ EnInvadepoh_Event_Init, // Event handler + /* 0x1 */ EnInvadepoh_Alien_Init, // Alien invader + /* 0x2 */ EnInvadepoh_Cow_Init, // Abducted cow + /* 0x3 */ EnInvadepoh_CowTail_Init, // Cow tail + /* 0x4 */ EnInvadepoh_Romani_Init, // Abducted Romani + /* 0x5 */ EnInvadepoh_Romani_Init, // Confused Romani /* 0x6 */ EnInvadepoh_LightBall_Init, // Light ball - /* 0x7 */ EnInvadepoh_Romani_Init, // Night 1 Romani - /* 0x8 */ EnInvadepoh_Romani_Init, // Unknown Romani - /* 0x9 */ EnInvadepoh_Romani_Init, // Reward Romani - /* 0xA */ EnInvadepoh_Dog_Init, // Dog - /* 0xB */ EnInvadepoh_Cremia_Init, // Night 3 Cremia - /* 0xC */ EnInvadepoh_Romani_Init, // Night 3 Romani - /* 0xD */ EnInvadepoh_Alien_Init, // Alien abductor + /* 0x7 */ EnInvadepoh_Romani_Init, // Night 1 Romani + /* 0x8 */ EnInvadepoh_Romani_Init, // Unknown Romani + /* 0x9 */ EnInvadepoh_Romani_Init, // Reward Romani + /* 0xA */ EnInvadepoh_Dog_Init, // Dog + /* 0xB */ EnInvadepoh_Cremia_Init, // Night 3 Cremia + /* 0xC */ EnInvadepoh_Romani_Init, // Night 3 Romani + /* 0xD */ EnInvadepoh_Alien_Init, // Alien abductor }; - sInitFuncs[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); + sInitFuncs[ENINVADEPOH_GET_TYPE(thisx)](thisx, play); } void EnInvadepoh_Event_Destroy(Actor* thisx, PlayState* play2) { @@ -1616,11 +1648,11 @@ void EnInvadepoh_Event_Destroy(Actor* thisx, PlayState* play2) { void EnInvadepoh_Invader_Destroy(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp18 = ENINVADEPOH_GET_PARAM_7(&this->actor); + s32 index = ENINVADEPOH_GET_INDEX(&this->actor); PlayState* play = play2; Collider_DestroyCylinder(play, &this->collider); - sAlienInvaders[sp18] = NULL; + sAlienInvaders[index] = NULL; } void EnInvadepoh_Cow_Destroy(Actor* thisx, PlayState* play2) { @@ -1687,24 +1719,24 @@ void EnInvadepoh_Abductor_Destroy(Actor* thisx, PlayState* play2) { } void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { - static ActorFunc D_80B4ECE8[14] = { - /* 0x0 */ EnInvadepoh_Event_Destroy, // Event handler - /* 0x1 */ EnInvadepoh_Invader_Destroy, // Alien invader - /* 0x2 */ EnInvadepoh_Cow_Destroy, // Abducted cow - /* 0x3 */ EnInvadepoh_CowTail_Destroy, // Cow tail - /* 0x4 */ EnInvadepoh_Romani_Destroy, // Abducted Romani - /* 0x5 */ EnInvadepoh_Romani_Destroy, // Confused Romani + static ActorFunc sDestroyFuncs[14] = { + /* 0x0 */ EnInvadepoh_Event_Destroy, // Event handler + /* 0x1 */ EnInvadepoh_Invader_Destroy, // Alien invader + /* 0x2 */ EnInvadepoh_Cow_Destroy, // Abducted cow + /* 0x3 */ EnInvadepoh_CowTail_Destroy, // Cow tail + /* 0x4 */ EnInvadepoh_Romani_Destroy, // Abducted Romani + /* 0x5 */ EnInvadepoh_Romani_Destroy, // Confused Romani /* 0x6 */ EnInvadepoh_LightBall_Destroy, // Light ball - /* 0x7 */ EnInvadepoh_Romani_Destroy, // Night 1 Romani - /* 0x8 */ EnInvadepoh_Romani_Destroy, // Unknown Romani - /* 0x9 */ EnInvadepoh_Romani_Destroy, // Reward Romani - /* 0xA */ EnInvadepoh_Dog_Destroy, // Dog - /* 0xB */ EnInvadepoh_Cremia_Destroy, // Night 3 Cremia - /* 0xC */ EnInvadepoh_Romani_Destroy2, // Night 3 Romani - /* 0xD */ EnInvadepoh_Abductor_Destroy, // Alien abductor + /* 0x7 */ EnInvadepoh_Romani_Destroy, // Night 1 Romani + /* 0x8 */ EnInvadepoh_Romani_Destroy, // Unknown Romani + /* 0x9 */ EnInvadepoh_Romani_Destroy, // Reward Romani + /* 0xA */ EnInvadepoh_Dog_Destroy, // Dog + /* 0xB */ EnInvadepoh_Cremia_Destroy, // Night 3 Cremia + /* 0xC */ EnInvadepoh_Romani_Destroy2, // Night 3 Romani + /* 0xD */ EnInvadepoh_Abductor_Destroy, // Alien abductor }; - D_80B4ECE8[ENINVADEPOH_GET_PARAM_F0(thisx)](thisx, play); + sDestroyFuncs[ENINVADEPOH_GET_TYPE(thisx)](thisx, play); } void EnInvadepoh_Event_SetupWait(EnInvadepoh* this) { @@ -1713,9 +1745,9 @@ void EnInvadepoh_Event_SetupWait(EnInvadepoh* this) { } void EnInvadepoh_Event_Wait(EnInvadepoh* this, PlayState* play) { - if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { + if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { EnInvadepoh_Event_SpawnLightBall(this, play); - EnInvadepoh_Event_SpawnAliens(this, play); + EnInvadepoh_Event_SpawnInvaders(this, play); EnInvadepoh_Event_SetupQueueInvasionCs(this); } } @@ -1775,7 +1807,7 @@ void EnInvadepoh_Event_Invasion(EnInvadepoh* this, PlayState* play) { u16 temp_v0; s32 i; - if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { + if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { SET_WEEKEVENTREG(WEEKEVENTREG_22_01); EnInvadepoh_Event_SetupQueueVictoryCs(this); } else { @@ -1899,7 +1931,7 @@ void EnInvadepoh_Invader_WaitForEvent(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetProgress(this); EnInvadepoh_Invader_SetPositionAlongPath(this, play); EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); - if (sAlienStateFlags[ENINVADEPOH_GET_PARAM_7(&this->actor)] & ENINVADEPOH_INVADER_ACTIVE) { + if (sAlienStateFlags[ENINVADEPOH_GET_INDEX(&this->actor)] & ENINVADEPOH_INVADER_ACTIVE) { Actor_SetScale(&this->actor, 0.01f); EnInvadepoh_SnapToFloor(this); EnInvadepoh_Invader_SpawnWarp(&this->actor.world.pos); @@ -2053,7 +2085,7 @@ void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play) { }; Vec3f* temp; - EnInvadepoh_func_80B44B78(this); + EnInvadepoh_Invader_EmptyFunc(this); if (this->stateTimer < 5) { temp = &D_80B4ED30[this->stateTimer]; if (temp->x > 0.0f) { @@ -2089,7 +2121,7 @@ void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play) { } this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_Invader_ResetWarpInTime(ENINVADEPOH_GET_PARAM_7(&this->actor)); + EnInvadepoh_Invader_SetRespawnTime(ENINVADEPOH_GET_INDEX(&this->actor)); EnInvadepoh_Invader_AddKill(); Item_DropCollectible(play, &this->actor.world.pos, 8); EnInvadepoh_Invader_SetupWaitToRespawn(this); @@ -2107,7 +2139,7 @@ void EnInvadepoh_Invader_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_Invader_Update; SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, ALIEN_LIMB_MAX); - this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame / 8.0f; + this->skelAnime.curFrame = (ENINVADEPOH_GET_INDEX(&this->actor)) * this->skelAnime.endFrame / 8.0f; EnInvadepoh_Invader_SetupPath(this, play); EnInvadepoh_Invader_SetProgress(this); EnInvadepoh_Invader_SetPositionAlongPath(this, play); @@ -2137,7 +2169,8 @@ void EnInvadepoh_Invader_Update(Actor* thisx, PlayState* play2) { thisx->velocity.y = 0.0f; thisx->gravity = 0.0f; EnInvadepoh_Invader_SetupHitstun(this); - } else if ((this->actionFunc == EnInvadepoh_Invade_WaitToRespawn) || (this->actionFunc == EnInvadepoh_Invader_WaitForEvent)) { + } else if ((this->actionFunc == EnInvadepoh_Invade_WaitToRespawn) || + (this->actionFunc == EnInvadepoh_Invader_WaitForEvent)) { Actor_Kill(thisx); return; } @@ -2200,15 +2233,15 @@ void EnInvadepoh_Cow_Update(Actor* thisx, PlayState* play2) { static s16 D_80B4EDC0[3] = { -0x1F40, -0x1770, -0x2AF8 }; PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp6C; + s32 index; if ((sLightBall == NULL) || (this->actor.parent == NULL)) { Actor_Kill(&this->actor); return; } - sp6C = ENINVADEPOH_GET_PARAM_7(&this->actor); + index = ENINVADEPOH_GET_INDEX(&this->actor); SkelAnime_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[sp6C], 0x32); + Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[index], 0x32); if (this->actor.child != NULL) { s32 pad; MtxF sp28; @@ -2277,13 +2310,13 @@ void EnInvadepoh_func_80B48374(EnInvadepoh* this) { void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 20) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; - temp_s0->unk_26.x = 0x7D0; - temp_s0->unk_26.y = 0; - temp_s0->unk_26.z = 0; - temp_s0->unk_30 = 0.1f; - temp_s0->unk_2C = 0x3E8; + interactInfo->headRotTarget.x = 0x7D0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x3E8; } this->actionTimer--; @@ -2293,14 +2326,14 @@ void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { - this->unk_324.unk_26.x = 0xBB8; - this->unk_324.unk_26.y = 0; - this->unk_324.unk_26.z = 0; - this->unk_324.unk_30 = 0.24f; - this->unk_324.unk_2C = 0xBB8; - this->unk_324.unk_42 = 0x3A98; - this->unk_324.unk_44 = 0.1f; - this->unk_324.unk_48 = 0x7D0; + this->unk_324.headRotTarget.x = 0xBB8; + this->unk_324.headRotTarget.y = 0; + this->unk_324.headRotTarget.z = 0; + this->unk_324.scaledTurnRate = 0.24f; + this->unk_324.maxTurnRate = 0xBB8; + this->unk_324.torsoRotZTarget = 0x3A98; + this->unk_324.torsoMaxTurnRate = 0.1f; + this->unk_324.torsoMaxTurnStep = 0x7D0; this->actionTimer = 50; Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, 0, -5.0f); @@ -2310,13 +2343,13 @@ void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 40) { - this->unk_324.unk_26.y = 0x1B58; + this->unk_324.headRotTarget.y = 0x1B58; } else if (this->actionTimer == 30) { - this->unk_324.unk_26.y = -0x1B58; + this->unk_324.headRotTarget.y = -0x1B58; } else if (this->actionTimer == 20) { - this->unk_324.unk_26.y = 0x1B58; + this->unk_324.headRotTarget.y = 0x1B58; } else if (this->actionTimer == 10) { - this->unk_324.unk_26.y = 0; + this->unk_324.headRotTarget.y = 0; } this->actionTimer--; if (this->actionTimer <= 0) { @@ -2325,14 +2358,14 @@ void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B48588(EnInvadepoh* this) { - this->unk_324.unk_26.x = 0; - this->unk_324.unk_26.y = 0; - this->unk_324.unk_26.z = 0; - this->unk_324.unk_30 = 0.24f; - this->unk_324.unk_2C = 0x1388; - this->unk_324.unk_42 = 0; - this->unk_324.unk_44 = 0.28f; - this->unk_324.unk_48 = 0x1B58; + this->unk_324.headRotTarget.x = 0; + this->unk_324.headRotTarget.y = 0; + this->unk_324.headRotTarget.z = 0; + this->unk_324.scaledTurnRate = 0.24f; + this->unk_324.maxTurnRate = 0x1388; + this->unk_324.torsoRotZTarget = 0; + this->unk_324.torsoMaxTurnRate = 0.28f; + this->unk_324.torsoMaxTurnStep = 0x1B58; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actor.draw = EnInvadepoh_Romani_Draw; @@ -2354,7 +2387,7 @@ void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_AbductedRomani_Update; SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); EnInvadepoh_func_80B482D4(this); @@ -2364,7 +2397,7 @@ void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; if (this->actor.parent == NULL) { Actor_Kill(&this->actor); @@ -2372,22 +2405,22 @@ void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { } this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); - if (temp_v1->unk_40 != 0) { - this->actor.shape.rot.x = -temp_v1->unk_40; + EnInvadepoh_Interact_Update(&this->unk_324); + if (interactInfo->torsoRotZ != 0) { + this->actor.shape.rot.x = -interactInfo->torsoRotZ; } } void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { static s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; - EnInvadePohUnkStruct_324* temp_v1 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; this->actionTimer = Rand_S16Offset(150, 250); - temp_v1->unk_26.x = D_80B4EDC8[Rand_Next() >> 0x1E]; - temp_v1->unk_26.y = 0; - temp_v1->unk_26.z = 0; - temp_v1->unk_30 = 0.1f; - temp_v1->unk_2C = 0x320; + interactInfo->headRotTarget.x = D_80B4EDC8[Rand_Next() >> 0x1E]; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); this->actionFunc = EnInvadepoh_func_80B48848; } @@ -2396,14 +2429,14 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 1.6f, 0.1f); - if (EnInvadepoh_func_80B44B84(this, play, this->actor.speed, 50.0f)) { - EnInvadepoh_func_80B44514(this); + if (EnInvadepoh_Romani_MoveAlongPath(this, play, this->actor.speed, 50.0f)) { + EnInvadepoh_ConfusedRomani_SetNextPathPoint(this); this->unk_370 = 0xC8; this->actor.speed *= 0.25f; } else { Math_StepToS(&this->unk_370, 0x7D0, 0x46); } - EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x46); + EnInvadepoh_Romani_TurnToPath(this, 6, this->unk_370, 0x46); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); @@ -2416,61 +2449,61 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B48948(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* sp24 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; f32 sp28 = Rand_ZeroOne(); this->actionTimer = Rand_S16Offset(150, 150); if (sp28 < 0.5f) { this->unk_374 = 0; - Math_Vec3s_Copy(&sp24->unk_26, &gZeroVec3s); - sp24->unk_30 = 0.1f; - sp24->unk_2C = 0x3E8; + Math_Vec3s_Copy(&interactInfo->headRotTarget, &gZeroVec3s); + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x3E8; } else if (sp28 < 0.75f) { this->unk_374 = 1; - sp24->unk_26.x = Rand_S16Offset(0, 0x7D0); - sp24->unk_26.y = 0; - sp24->unk_26.z = 0; - sp24->unk_30 = 0.06f; - sp24->unk_2C = 0x3E8; + interactInfo->headRotTarget.x = Rand_S16Offset(0, 0x7D0); + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.06f; + interactInfo->maxTurnRate = 0x3E8; } else if (sp28 < 0.8f) { this->unk_374 = 2; - sp24->unk_26.x = Rand_S16Offset(-0x7D0, 0x7D0); - sp24->unk_26.y = 0; - sp24->unk_26.z = 0; - sp24->unk_30 = 0.05f; - sp24->unk_2C = 0x3E8; + interactInfo->headRotTarget.x = Rand_S16Offset(-0x7D0, 0x7D0); + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.05f; + interactInfo->maxTurnRate = 0x3E8; } else { this->unk_374 = 3; - sp24->unk_26.x = 0; - sp24->unk_26.y = 0; - sp24->unk_26.z = Rand_S16Offset(-0x9C4, 0x1388); - sp24->unk_30 = 0.04f; - sp24->unk_2C = 0x3E8; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = Rand_S16Offset(-0x9C4, 0x1388); + interactInfo->scaledTurnRate = 0.04f; + interactInfo->maxTurnRate = 0x3E8; } Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actionFunc = EnInvadepoh_func_80B48AD4; } void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; Math_StepToF(&this->actor.speed, 0.0f, 0.2f); - if (EnInvadepoh_func_80B44B84(this, play, this->actor.speed, 50.0f)) { - EnInvadepoh_func_80B44514(this); + if (EnInvadepoh_Romani_MoveAlongPath(this, play, this->actor.speed, 50.0f)) { + EnInvadepoh_ConfusedRomani_SetNextPathPoint(this); } if (this->unk_374 == 0) { if ((this->actor.xzDistToPlayer < 350.0f) && (play->gameplayFrames & 0x60)) { Player* player = GET_PLAYER(play); s16 temp_v0 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v0 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + interactInfo->headRotTarget.x = CLAMP((s16)(temp_v0 - this->actor.shape.rot.x), -0x9C4, 0x9C4); temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v0 * 0.7f), -0x1F40, 0x1F40); + interactInfo->headRotTarget.y = CLAMP((s16)(temp_v0 * 0.7f), -0x1F40, 0x1F40); } } else { - temp_s0->unk_26.x = 0; - temp_s0->unk_26.y = 0; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; } if (this->actionTimer > 0) { s32 temp = (u32)this->actionTimer % 0x20; @@ -2481,23 +2514,23 @@ void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { if (temp_v1_3 != this->unk_374) { this->unk_374 = temp_v1_3; if (this->unk_374 == 0) { - Math_Vec3s_Copy(&temp_s0->unk_26, &gZeroVec3s); - temp_s0->unk_30 = 0.07f; + Math_Vec3s_Copy(&interactInfo->headRotTarget, &gZeroVec3s); + interactInfo->scaledTurnRate = 0.07f; } else if (this->unk_374 == 1) { - temp_s0->unk_26.x = Rand_S16Offset(0x3E8, 0x3E8); - temp_s0->unk_26.y = Rand_S16Offset(-0x3E8, 0x7D0); - temp_s0->unk_26.z = Rand_S16Offset(-0x320, 0x640); - temp_s0->unk_30 = 0.06f; + interactInfo->headRotTarget.x = Rand_S16Offset(0x3E8, 0x3E8); + interactInfo->headRotTarget.y = Rand_S16Offset(-0x3E8, 0x7D0); + interactInfo->headRotTarget.z = Rand_S16Offset(-0x320, 0x640); + interactInfo->scaledTurnRate = 0.06f; } else if (this->unk_374 == 2) { - temp_s0->unk_26.x = Rand_S16Offset(-0x7D0, 0x3E8); - temp_s0->unk_26.y = Rand_S16Offset(-0x3E8, 0x7D0); - temp_s0->unk_26.z = Rand_S16Offset(-0x320, 0x640); - temp_s0->unk_30 = 0.05f; + interactInfo->headRotTarget.x = Rand_S16Offset(-0x7D0, 0x3E8); + interactInfo->headRotTarget.y = Rand_S16Offset(-0x3E8, 0x7D0); + interactInfo->headRotTarget.z = Rand_S16Offset(-0x320, 0x640); + interactInfo->scaledTurnRate = 0.05f; } else { - temp_s0->unk_26.x = Rand_S16Offset(-0x3E8, 0x7D0); - temp_s0->unk_26.y = Rand_S16Offset(-0x7D0, 0xFA0); - temp_s0->unk_26.z = Rand_S16Offset(-0x7D0, 0xFA0); - temp_s0->unk_30 = 0.04f; + interactInfo->headRotTarget.x = Rand_S16Offset(-0x3E8, 0x7D0); + interactInfo->headRotTarget.y = Rand_S16Offset(-0x7D0, 0xFA0); + interactInfo->headRotTarget.z = Rand_S16Offset(-0x7D0, 0xFA0); + interactInfo->scaledTurnRate = 0.04f; } } } @@ -2508,18 +2541,18 @@ void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B48DE4(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; this->actor.speed = 0.0f; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; - temp_v0->unk_30 = 0.05f; - temp_v0->unk_2C = 0x4B0; + temp_v0->scaledTurnRate = 0.05f; + temp_v0->maxTurnRate = 0x4B0; this->actionFunc = EnInvadepoh_func_80B48E4C; } void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -2527,10 +2560,10 @@ void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x23); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_v0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_v0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_v0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_v0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_func_80B48948(this); @@ -2550,8 +2583,8 @@ void EnInvadepoh_ConfusedRomani_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.textId = 0x3330; // ........ SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - EnInvadepoh_func_80B444F4(this, play); + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_ConfusedRomani_SetupPath(this, play); EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); @@ -2572,7 +2605,7 @@ void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); if ((this->actionFunc != EnInvadepoh_func_80B48E4C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } @@ -2581,41 +2614,42 @@ void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B491EC(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupDescend(EnInvadepoh* this) { this->actor.gravity = -15.0f; this->pulseScale = 0.0f; this->pulseScaleTarget = 1.0f; this->pulseScaleRate = 0.0f; this->pulseRate = 0; - this->actionFunc = EnInvadepoh_func_80B49228; + this->actionFunc = EnInvadepoh_LightBall_Descend; } -void EnInvadepoh_func_80B49228(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_Descend(EnInvadepoh* this, PlayState* play) { s32 pad; - f32 sp28; + f32 distToTargetY; Actor_UpdateVelocityWithGravity(&this->actor); this->actor.velocity.y *= 0.97f; - sp28 = 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); + distToTargetY = + Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + sLightBallSpawnOffset.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(sp28) < 1.0f) { + if (fabsf(distToTargetY) < 1.0f) { EnInvadepoh_LightBall_SpawnSparkles(this, play, 50); - EnInvadepoh_func_80B492FC(this); + EnInvadepoh_LightBall_SetupHover(this); } } -void EnInvadepoh_func_80B492FC(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupHover(EnInvadepoh* this) { this->actor.velocity.y *= 0.1f; this->actionTimer = 20; this->pulseScaleTarget = 0.3f; this->pulseScaleRate = 0.03f; this->pulseRate = 0xBB8; - this->actionFunc = EnInvadepoh_func_80B4934C; + this->actionFunc = EnInvadepoh_LightBall_Hover; } -void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play) { - f32 temp = this->actor.home.pos.y + D_80B4E934.y + 300.0f; +void EnInvadepoh_LightBall_Hover(EnInvadepoh* this, PlayState* play) { + f32 temp = this->actor.home.pos.y + sLightBallSpawnOffset.y + 300.0f; if (this->actor.world.pos.y < temp) { this->actor.gravity = 3.0f; @@ -2627,11 +2661,11 @@ void EnInvadepoh_func_80B4934C(EnInvadepoh* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_func_80B49404(this); + EnInvadepoh_LightBall_SetupSpawnInvaders(this); } } -void EnInvadepoh_func_80B49404(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupSpawnInvaders(EnInvadepoh* this) { this->actionTimer = 120; this->pulseScaleTarget = 0.2f; this->pulseScaleRate = 0.01f; @@ -2639,10 +2673,10 @@ void EnInvadepoh_func_80B49404(EnInvadepoh* this) { this->pulseRate = 0xBB8; this->lightBallTarget = 0; this->stateTimer = 0; - this->actionFunc = EnInvadepoh_func_80B49454; + this->actionFunc = EnInvadepoh_LightBall_SpawnInvaders; } -void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_SpawnInvaders(EnInvadepoh* this, PlayState* play) { static Vec3f sLightBallTargets[5] = { { -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 }, @@ -2667,8 +2701,8 @@ void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 170.0f, 21.0f); this->actor.speed *= 0.98f; } - if (EnInvadepoh_func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, - this->actor.speed)) { + if (EnInvadepoh_StepTowardXZ(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, + this->actor.speed)) { this->actor.speed = 0.0f; } if (sp30.y < this->actor.world.pos.y) { @@ -2683,19 +2717,19 @@ void EnInvadepoh_func_80B49454(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B49628(this); + EnInvadepoh_LightBall_SetupAboveBarn(this); } } -void EnInvadepoh_func_80B49628(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupAboveBarn(EnInvadepoh* this) { this->pulseScaleTarget = 0.2f; this->pulseScaleRate = 0.01f; this->pulseRate = 0xBB8; this->actor.velocity.y *= 0.8f; - this->actionFunc = EnInvadepoh_func_80B49670; + this->actionFunc = EnInvadepoh_LightBall_AboveBarn; } -void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_AboveBarn(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -2712,27 +2746,27 @@ void EnInvadepoh_func_80B49670(EnInvadepoh* this, PlayState* play) { this->actor.velocity.y *= 0.97f; Actor_MoveWithGravity(&this->actor); if (sEventState == ENINVADEPOH_EVENT_CLEAR) { - EnInvadepoh_func_80B499BC(this); + EnInvadepoh_LightBall_SetupLeaveBarn(this); } } -void EnInvadepoh_func_80B497A4(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupCircle(EnInvadepoh* this) { this->pulseScaleTarget = 0.2f; this->pulseScaleRate = 0.01f; this->actor.gravity = -1.5f; this->pulseRate = 0xBB8; this->actionTimer = 35; - this->actionFunc = EnInvadepoh_func_80B497EC; + this->actionFunc = EnInvadepoh_LightBall_Circle; } -void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_Circle(EnInvadepoh* this, PlayState* play) { 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, (s16)0x64); + sp30.x = this->actor.home.pos.x + sLightBallSpawnOffset.x; + sp30.y = this->actor.home.pos.y + sLightBallSpawnOffset.y + 400.0f; + sp30.z = this->actor.home.pos.z + sLightBallSpawnOffset.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); Math_StepToF(&this->actor.speed, 70.0f, 3.0f); this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -2.0f : 2.0f; this->actor.velocity.y *= 0.97f; @@ -2740,20 +2774,20 @@ void EnInvadepoh_func_80B497EC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B49904(this); + EnInvadepoh_LightBall_SetupFlee(this); } } -void EnInvadepoh_func_80B49904(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupFlee(EnInvadepoh* this) { this->pulseScaleTarget = 0.2f; this->pulseScaleRate = 0.01f; this->actor.gravity = 1.0f; this->pulseRate = 0xBB8; this->actionTimer = 60; - this->actionFunc = EnInvadepoh_func_80B4994C; + this->actionFunc = EnInvadepoh_LightBall_Flee; } -void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_Flee(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 150.0f, 4.0f); this->actor.velocity.y *= 0.95f; Actor_MoveWithGravity(&this->actor); @@ -2764,16 +2798,16 @@ void EnInvadepoh_func_80B4994C(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B499BC(EnInvadepoh* this) { +void EnInvadepoh_LightBall_SetupLeaveBarn(EnInvadepoh* this) { this->actionTimer = 40; this->pulseScaleTarget = 0.2f; this->pulseScaleRate = 0.01f; this->actor.speed = 0.0f; this->pulseRate = 0xBB8; - this->actionFunc = EnInvadepoh_func_80B49A00; + this->actionFunc = EnInvadepoh_LightBall_LeaveBarn; } -void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_LightBall_LeaveBarn(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -2790,7 +2824,7 @@ void EnInvadepoh_func_80B49A00(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B497A4(this); + EnInvadepoh_LightBall_SetupCircle(this); } } @@ -2812,21 +2846,21 @@ void EnInvadepoh_LightBall_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B49BD0(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x320; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_func_80B49C38; } void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Night1Romani_SetProgress(this); - EnInvadepoh_func_80B44C24(this, play); - EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); + EnInvadepoh_Night1Romani_MoveAlongPathTimed(this, play); + EnInvadepoh_Romani_TurnToPath(this, 6, 0x7D0, 0x64); if ((this->currentPoint == 0) || (this->currentPoint + 1 == this->endPoint)) { if (this->unk_378 == 0) { @@ -2835,7 +2869,7 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { if (temp_v0_2 > 0) { temp_v0_2 = (gRegEditor->data[0xF] * -16.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), temp_v0_2); + this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -2853,25 +2887,25 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B49DA0(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0x7D0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actionFunc = EnInvadepoh_func_80B49DFC; } void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper... @@ -2886,19 +2920,19 @@ void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; s32 pad; - s32 sp38; + s32 currentTime; if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; + currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); EnInvadepoh_Night1Romani_SetupPath(this, play); EnInvadepoh_Night1Romani_SetProgress(this); - EnInvadepoh_func_80B44C24(this, play); + EnInvadepoh_Night1Romani_MoveAlongPathTimed(this, play); EnInvadepoh_SetYawAlongPath(this); EnInvadepoh_SnapToFloor(this); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { @@ -2910,10 +2944,11 @@ void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { } else { this->actor.textId = 0x332C; // ...It's almost time. } - if ((sp38 >= CLOCK_TIME(18, 00)) || (sp38 < CLOCK_TIME(2, 00))) { + if ((currentTime >= CLOCK_TIME(18, 00)) || (currentTime < CLOCK_TIME(2, 00))) { this->actor.update = EnInvadepoh_Night1Romani_WaitForEvent; this->actor.draw = NULL; - } else if ((sp38 < CLOCK_TIME(6, 00)) && (sp38 >= CLOCK_TIME(2, 00)) && (sp38 < CLOCK_TIME(2, 15))) { + } else if ((currentTime < CLOCK_TIME(6, 00)) && (CLOCK_TIME(2, 00) <= currentTime) && + (currentTime < CLOCK_TIME(2, 15))) { this->actor.update = EnInvadepoh_Night1Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B49BD0(this); @@ -2927,7 +2962,7 @@ void EnInvadepoh_Night1Romani_WaitForEvent(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 00))) { + if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(2, 00))) { this->actor.update = EnInvadepoh_Night1Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B49BD0(this); @@ -2947,7 +2982,7 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); if ((this->actionFunc != EnInvadepoh_func_80B49DFC) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -2957,14 +2992,14 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x5DC; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x5DC; this->actionTimer = Rand_S16Offset(200, 200); this->unk_304 = this->actor.shape.rot.y; @@ -2974,7 +3009,7 @@ void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { s32 pad; - EnInvadePohUnkStruct_324* sp30 = &this->unk_324; + EnInvadePohInteractInfo* sp30 = &this->unk_324; if ((play->gameplayFrames % 0x100) == 0) { Vec3f sp44; @@ -2992,18 +3027,18 @@ void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { s16 temp_v1; temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - sp30->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + sp30->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0x9C4, 0x9C4); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - sp30->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + sp30->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if ((play->gameplayFrames % 0x100) == 0) { - sp30->unk_26.z = Rand_S16Offset(-0x5DC, 0xBB8); + sp30->headRotTarget.z = Rand_S16Offset(-0x5DC, 0xBB8); } } else { - sp30->unk_26.x = 0; - sp30->unk_26.y = 0; - sp30->unk_26.z = 0; + sp30->headRotTarget.x = 0; + sp30->headRotTarget.y = 0; + sp30->headRotTarget.z = 0; } if (this->actionTimer > 0) { this->actionTimer--; @@ -3013,14 +3048,14 @@ void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x320; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x320; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_func_80B4A5E4; } @@ -3032,14 +3067,14 @@ void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4A614(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x320; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_func_80B4A67C; } @@ -3047,17 +3082,17 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 5.0f, 1.0f); - if (EnInvadepoh_func_80B44B84(this, play, this->actor.speed, 50.0f) != 0) { - EnInvadepoh_func_80B44640(this); + if (EnInvadepoh_Romani_MoveAlongPath(this, play, this->actor.speed, 50.0f)) { + EnInvadepoh_BarnRomani_SetNextPathPoint(this); this->unk_370 = 0x5DC; this->actor.speed *= 0.5f; } else { Math_StepToS(&this->unk_370, 0x190, 0x32); } - EnInvadepoh_func_80B43E6C(this, 6, this->unk_370, 0x32); + EnInvadepoh_Romani_TurnToPath(this, 6, this->unk_370, 0x32); if (this->currentPoint == 0) { if (this->unk_378 == 0) { - this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), -15); + this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), -15); } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { @@ -3074,25 +3109,25 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4A7C0(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0x7D0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); this->actionFunc = EnInvadepoh_func_80B4A81C; } void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, (s16)0x28); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper SET_WEEKEVENTREG(WEEKEVENTREG_54_10); @@ -3112,16 +3147,16 @@ void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2) { s32 pad; if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - s32 sp38 = gSaveContext.save.time; + s32 currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_BarnRomani_SetupPath(this, play2); - if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 00))) { + if ((currentTime < CLOCK_TIME(2, 15)) || (currentTime >= CLOCK_TIME(6, 00))) { this->currentPoint = 0; this->actor.update = EnInvadepoh_BarnRomani_WaitForEvent; } else { @@ -3170,7 +3205,7 @@ void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange) { this->finishedAnim = SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); if ((this->actionFunc != EnInvadepoh_func_80B4A81C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } @@ -3274,7 +3309,8 @@ void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play) { if (play->msgCtx.unk120B1 == 0) { if (play->msgCtx.msgMode == 0) { sRewardFinished = true; - } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { sRewardFinished = true; } } @@ -3283,7 +3319,7 @@ void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; @@ -3293,9 +3329,9 @@ void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); - temp_s0->unk_30 = 0.08f; - temp_s0->unk_2C = 0x7D0; + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); + temp_s0->scaledTurnRate = 0.08f; + temp_s0->maxTurnRate = 0x7D0; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); EnInvadepoh_func_80B4ACDC(this); @@ -3305,7 +3341,7 @@ void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { void EnInvadepoh_RewardRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); this->actionFunc(this, play); @@ -3319,17 +3355,17 @@ void EnInvadepoh_RewardRomani_Update(Actor* thisx, PlayState* play2) { Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); - EnInvadepoh_func_80B45CE0(&this->unk_324); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + EnInvadepoh_Interact_Update(&this->unk_324); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this) { +void EnInvadepoh_Dog_PlayWalkSfx(EnInvadepoh* this) { s32 pad; if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { @@ -3337,56 +3373,56 @@ void EnInvadepoh_func_80B4B3DC(EnInvadepoh* this) { } } -void EnInvadepoh_func_80B4B430(EnInvadepoh* this) { +void EnInvadepoh_Dog_SetupWalk(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); this->actionTimer = Rand_S16Offset(50, 80); - this->actionFunc = EnInvadepoh_func_80B4B484; + this->actionFunc = EnInvadepoh_Dog_Walk; } -void EnInvadepoh_func_80B4B484(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Dog_Walk(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 1.1f, 0.5f); - if (EnInvadepoh_func_80B44C80(this, play)) { - EnInvadepoh_func_80B44690(this); + if (EnInvadepoh_Dog_MoveAlongPath(this, play)) { + EnInvadepoh_Dog_SetNextPathPoint(this); } - EnInvadepoh_func_80B4B3DC(this); + EnInvadepoh_Dog_PlayWalkSfx(this); if (this->dogTargetPoint >= 0) { this->actionTimer = 0; } if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B4B510(this); + EnInvadepoh_Dog_SetupRun(this); } } -void EnInvadepoh_func_80B4B510(EnInvadepoh* this) { +void EnInvadepoh_Dog_SetupRun(EnInvadepoh* this) { Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); this->actionTimer = Rand_S16Offset(50, 200); - this->actionFunc = EnInvadepoh_func_80B4B564; + this->actionFunc = EnInvadepoh_Dog_Run; } -void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Dog_Run(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 3.8f, 0.45f); if (this->dogTargetPoint >= 0) { - f32 temp_fv0; - Vec3f sp28; + f32 distToTarget; + Vec3f targetPathPoint; - Math_Vec3s_ToVec3f(&sp28, &this->pathPoints[this->dogTargetPoint]); - temp_fv0 = Math3D_Vec3fDistSq(&this->actor.world.pos, &sp28); - if (temp_fv0 < SQ(80.0f)) { + Math_Vec3s_ToVec3f(&targetPathPoint, &this->pathPoints[this->dogTargetPoint]); + distToTarget = Math3D_Vec3fDistSq(&this->actor.world.pos, &targetPathPoint); + if (distToTarget < SQ(80.0f)) { this->actor.speed *= 0.85f; - } else if (temp_fv0 < SQ(150.0f)) { + } else if (distToTarget < SQ(150.0f)) { this->actor.speed *= 0.93f; - } else if (temp_fv0 < SQ(250.0f)) { + } else if (distToTarget < SQ(250.0f)) { this->actor.speed *= 0.96f; } - if ((this->currentPoint == this->dogTargetPoint) || (temp_fv0 < SQ(50.0f))) { + if ((this->currentPoint == this->dogTargetPoint) || (distToTarget < SQ(50.0f))) { this->actionTimer = 0; } } - EnInvadepoh_func_80B4B3DC(this); - if (EnInvadepoh_func_80B44C80(this, play)) { - EnInvadepoh_func_80B44690(this); + EnInvadepoh_Dog_PlayWalkSfx(this); + if (EnInvadepoh_Dog_MoveAlongPath(this, play)) { + EnInvadepoh_Dog_SetNextPathPoint(this); } if (this->actionTimer > 0) { this->actionTimer--; @@ -3394,42 +3430,42 @@ void EnInvadepoh_func_80B4B564(EnInvadepoh* this, PlayState* play) { if (!sAliensTooClose && (Rand_ZeroOne() < 0.4f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } - EnInvadepoh_func_80B4B724(this); + EnInvadepoh_Dog_SetupBark(this); } else { - EnInvadepoh_func_80B4B430(this); + EnInvadepoh_Dog_SetupWalk(this); } } -void EnInvadepoh_func_80B4B724(EnInvadepoh* this) { +void EnInvadepoh_Dog_SetupBark(EnInvadepoh* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDogBarkAnim, -6.0f); - this->actionFunc = EnInvadepoh_func_80B4B768; + this->actionFunc = EnInvadepoh_Dog_Bark; } -void EnInvadepoh_func_80B4B768(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Dog_Bark(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 0.0f, 1.0f); - Math_SmoothStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &sClosestAlien->actor), 5, 0x1388, - (s16)0x64); - EnInvadepoh_func_80B44E90(this, play); + Math_SmoothStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &sClosestAlien->actor), 5, + 0x1388, 0x64); + EnInvadepoh_Dog_Move(this, play); if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } if (this->finishedAnim) { - EnInvadepoh_func_80B4B510(this); + EnInvadepoh_Dog_SetupRun(this); } } -void EnInvadepoh_func_80B4B820(EnInvadepoh* this) { +void EnInvadepoh_Dog_SetupJump(EnInvadepoh* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDogJumpAnim, -6.0f); - this->actionFunc = EnInvadepoh_func_80B4B864; + this->actionFunc = EnInvadepoh_Dog_Jump; } -void EnInvadepoh_func_80B4B864(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Dog_Jump(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.5f, 1.0f); - EnInvadepoh_func_80B44E90(this, play); + EnInvadepoh_Dog_Move(this, play); if (this->finishedAnim) { - EnInvadepoh_func_80B4B510(this); + EnInvadepoh_Dog_SetupRun(this); } } @@ -3438,12 +3474,12 @@ void EnInvadepoh_Dog_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh* this = (EnInvadepoh*)thisx; if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - if(1) {} + if (1) {} this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, DOG_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); + EnInvadepoh_Interact_Init(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); EnInvadepoh_Dog_SetupPath(this, play); EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); @@ -3453,7 +3489,7 @@ void EnInvadepoh_Dog_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_Dog_Update; this->actor.draw = EnInvadepoh_Dog_Draw; this->actor.flags |= ACTOR_FLAG_1; - EnInvadepoh_func_80B4B430(this); + EnInvadepoh_Dog_SetupWalk(this); } else if (sEventState == ENINVADEPOH_EVENT_WAIT) { this->actor.update = EnInvadepoh_Dog_WaitForEvent; } else { @@ -3470,7 +3506,7 @@ void EnInvadepoh_Dog_WaitForEvent(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_Dog_Update; this->actor.draw = EnInvadepoh_Dog_Draw; this->actor.flags |= ACTOR_FLAG_1; - EnInvadepoh_func_80B4B430(this); + EnInvadepoh_Dog_SetupWalk(this); } } @@ -3485,14 +3521,14 @@ void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2) { this->dogTargetPoint = -1; if (hadTarget) { - EnInvadepoh_func_80B4B820(this); + EnInvadepoh_Dog_SetupJump(this); } } else { s32 lastTargetPoint = this->dogTargetPoint; s32 pointsToTarget; s32 halfwayPoint; - this->dogTargetPoint = EnInvadepoh_func_80B44234(this, &sClosestAlien->actor.world.pos); + this->dogTargetPoint = EnInvadepoh_Dog_FindClosestWaypoint(this, &sClosestAlien->actor.world.pos); if (lastTargetPoint != this->dogTargetPoint) { pointsToTarget = this->dogTargetPoint - this->currentPoint; if (pointsToTarget < 0) { @@ -3510,28 +3546,28 @@ void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); this->finishedAnim = SkelAnime_Update(&this->skelAnime); if (inUncullRange && (this->actor.update != NULL)) { - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x320; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x320; this->unk_370 = 0; this->actionFunc = EnInvadepoh_func_80B4BC4C; } void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; EnInvadepoh* romani = sRomani; s32 pad; s32 sp48; @@ -3574,10 +3610,10 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->unk_370, 0x28); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &romani->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = sp40 - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); } } @@ -3593,50 +3629,50 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4BFFC(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0x7D0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_func_80B4C058; } void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* sp28 = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0x9C4, 0x1C2); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_func_80B4BBE0(this); } } void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0x7D0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_func_80B4C218; } void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* sp28 = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0x7D0, 0xC8); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x28); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (sRomani == NULL) { EnInvadepoh_func_80B4BBE0(this); } else if ((sRomani != NULL) && (sRomani->actionFunc != EnInvadepoh_func_80B4CB0C)) { @@ -3650,29 +3686,29 @@ void EnInvadepoh_Cremia_WaitForObject(Actor* thisx, PlayState* play2) { s32 pad; if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { - s32 sp38 = gSaveContext.save.time; + s32 currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_Cremia_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, CREMIA_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; // Good night... See you...tomorrow...OK? - if (sp38 < CLOCK_TIME(20, 01) + 30) { + if (currentTime < CLOCK_TIME(20, 01) + 30) { this->unk_304 = -0x8000; this->unk_2F8 = 40.0f; - } else if (sp38 > CLOCK_TIME(20, 14) + 1) { + } else if (currentTime > CLOCK_TIME(20, 14) + 1) { this->unk_304 = -0x4800; this->unk_2F8 = 20.0f; } else { this->unk_304 = -0x8000; this->unk_2F8 = 40.0f; } - if ((CLOCK_TIME(6, 00) <= sp38) && (sp38 < CLOCK_TIME(20, 00) + 30)) { + if ((CLOCK_TIME(6, 00) <= currentTime) && (currentTime < CLOCK_TIME(20, 00) + 30)) { this->actor.update = EnInvadepoh_Cremia_WaitForEvent; this->actor.draw = NULL; - } else if ((CLOCK_TIME(20, 00) + 30 <= sp38) && (sp38 < CLOCK_TIME(20, 15))) { + } else if ((CLOCK_TIME(20, 00) + 30 <= currentTime) && (currentTime < CLOCK_TIME(20, 15))) { this->actor.update = EnInvadepoh_Cremia_Update; this->actor.draw = EnInvadepoh_Cremia_Draw; EnInvadepoh_func_80B4BBE0(this); @@ -3706,7 +3742,7 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play2); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); if ((this->actionFunc != EnInvadepoh_func_80B4C058) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -3716,19 +3752,19 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this) { - EnInvadePohUnkStruct_324* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - temp_v0->unk_26.x = 0; - temp_v0->unk_26.y = 0; - temp_v0->unk_26.z = 0; - temp_v0->unk_30 = 0.1f; - temp_v0->unk_2C = 0x320; + temp_v0->headRotTarget.x = 0; + temp_v0->headRotTarget.y = 0; + temp_v0->headRotTarget.z = 0; + temp_v0->scaledTurnRate = 0.1f; + temp_v0->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_func_80B4C730; } void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* temp_s0 = &this->unk_324; EnInvadepoh* sp68 = sCremia; s32 var_a2; s32 sp60; @@ -3737,9 +3773,9 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { Vec3f sp4C; Vec3f sp40; - EnInvadepoh_func_80B44700(this); - EnInvadepoh_func_80B44EFC(this, play); - EnInvadepoh_func_80B43E6C(this, 6, 0x7D0, 0x64); + EnInvadepoh_Night3Romani_SetProgress(this); + EnInvadepoh_Night3Romani_MoveAlongPathTimed(this, play); + EnInvadepoh_Romani_TurnToPath(this, 6, 0x7D0, 0x64); var_a2 = (this->currentPoint < this->endPoint) ? this->currentPoint : this->endPoint - 1; @@ -3752,7 +3788,7 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { if (temp_v0_2 > 0) { temp_v0_2 = (gRegEditor->data[0xF] * -23.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_func_80B45550(this, play, SQ(80.0f), temp_v0_2); + this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3771,10 +3807,10 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->unk_370, 40); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = sp3A - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { @@ -3788,50 +3824,50 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_func_80B4CAB0(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0xFA0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0xFA0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_func_80B4CB0C; } void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0xBB8, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + interactInfo->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_func_80B4C6C8(this); } } void EnInvadepoh_func_80B4CC70(EnInvadepoh* this) { - this->unk_324.unk_30 = 0.08f; - this->unk_324.unk_2C = 0x7D0; + this->unk_324.scaledTurnRate = 0.08f; + this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_func_80B4CCCC; } void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play) { - EnInvadePohUnkStruct_324* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; Math_StepToS(&this->unk_370, 0x7D0, 0xC8); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->unk_26.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + interactInfo->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->unk_26.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (sCremia == NULL) { EnInvadepoh_func_80B4C6C8(this); } else if ((sCremia != NULL) && (sCremia->actionFunc != EnInvadepoh_func_80B4C058)) { @@ -3845,25 +3881,25 @@ void EnInvadepoh_Night3Romani_WaitForObject(Actor* thisx, PlayState* play2) { s32 pad; if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { - s32 sp38 = gSaveContext.save.time; + s32 currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_func_80B45C04(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - EnInvadepoh_func_80B446D0(this, play); + EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Night3Romani_SetupPath(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; - EnInvadepoh_func_80B44700(this); - EnInvadepoh_func_80B44EFC(this, play); + EnInvadepoh_Night3Romani_SetProgress(this); + EnInvadepoh_Night3Romani_MoveAlongPathTimed(this, play); EnInvadepoh_SetYawAlongPath(this); EnInvadepoh_SnapToFloor(this); this->actor.textId = 0x33CE; // See you tomorrow! - if ((sp38 >= CLOCK_TIME(6, 00)) && (sp38 < CLOCK_TIME(20, 00))) { + if ((currentTime >= CLOCK_TIME(6, 00)) && (currentTime < CLOCK_TIME(20, 00))) { this->actor.update = EnInvadepoh_Night3Romani_WaitForEvent; this->actor.draw = NULL; - } else if ((sp38 >= CLOCK_TIME(20, 00)) && (sp38 < CLOCK_TIME(20, 14) + 15)) { + } else if ((currentTime >= CLOCK_TIME(20, 00)) && (currentTime < CLOCK_TIME(20, 14) + 15)) { this->actor.update = EnInvadepoh_Night3Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; EnInvadepoh_func_80B4C6C8(this); @@ -3897,7 +3933,7 @@ void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_func_80B45CE0(&this->unk_324); + EnInvadepoh_Interact_Update(&this->unk_324); if ((this->actionFunc != EnInvadepoh_func_80B4CB0C) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -3906,46 +3942,46 @@ void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4D15C(EnInvadepoh* this) { +void EnInvadepoh_Abductor_SetupCow(EnInvadepoh* this) { static EnInvadepohUnkStruct1 D_80B4EE0C[3] = { { 0.08f, 0x2BC, -0xA }, { 0.09f, 0x12C, -5 }, { 0.05f, 0x190, 0 }, }; s32 pad; - s32 sp28 = ENINVADEPOH_GET_PARAM_7(&this->actor); + s32 index = ENINVADEPOH_GET_INDEX(&this->actor); s32 pad2; Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; + this->skelAnime.curFrame = (ENINVADEPOH_GET_INDEX(&this->actor)) * this->skelAnime.endFrame * 0.25f; this->alpha = 255; this->actor.draw = EnInvadepoh_Alien_Draw; this->present = true; this->drawDeathFlash = false; this->eyeBeamAlpha = 255; - this->unk_300 = D_80B4EE0C[sp28].unk0; - this->unk_304 = sp28 * 0x5555; + this->unk_300 = D_80B4EE0C[index].unk0; + this->unk_304 = index * 0x5555; this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; this->actor.world.pos.y = this->actor.home.pos.y; this->actor.world.pos.z = Math_CosS(this->unk_304) * 80.0f + this->actor.home.pos.z; this->actor.shape.rot.y = this->unk_304 + 0x4000; - this->unk_370 = D_80B4EE0C[sp28].unk4; - this->unk_372 = D_80B4EE0C[sp28].unk6; - this->actionFunc = EnInvadepoh_func_80B4D290; + this->unk_370 = D_80B4EE0C[index].unk4; + this->unk_372 = D_80B4EE0C[index].unk6; + this->actionFunc = EnInvadepoh_Abductor_Cow; this->actor.velocity.y = 0.0f; } -void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { - Actor* sp2C; - f32 sp28; +void EnInvadepoh_Abductor_Cow(EnInvadepoh* this, PlayState* play) { + Actor* cow; + f32 distToTarget; if (sLightBall == NULL) { Actor_Kill(&this->actor); return; } Math_StepToF(&this->actor.velocity.y, 15.0f, this->unk_300); - sp28 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, this->actor.velocity.y, - 0.01f); + distToTarget = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, + this->actor.velocity.y, 0.01f); this->unk_304 += 0x2BC; this->actor.world.pos.x = Math_SinS(this->unk_304) * 80.0f + this->actor.home.pos.x; this->actor.world.pos.z = Math_CosS(this->unk_304) * 80.0f + this->actor.home.pos.z; @@ -3953,20 +3989,20 @@ void EnInvadepoh_func_80B4D290(EnInvadepoh* this, PlayState* play) { this->actor.shape.rot.y += this->unk_370; if (this->actor.child != NULL) { - sp2C = this->actor.child; - sp2C->world.pos.x = this->actor.world.pos.x; - sp2C->world.pos.y = this->actor.world.pos.y - 38.0f; - sp2C->world.pos.z = this->actor.world.pos.z; - sp2C->shape.rot.y = this->actor.shape.rot.y; + cow = this->actor.child; + cow->world.pos.x = this->actor.world.pos.x; + cow->world.pos.y = this->actor.world.pos.y - 38.0f; + cow->world.pos.z = this->actor.world.pos.z; + cow->shape.rot.y = this->actor.shape.rot.y; } - if (sp28 < 5.0f) { + if (distToTarget < 5.0f) { Actor_Kill(&this->actor); } } -void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { +void EnInvadepoh_Abductor_SetupRomani(EnInvadepoh* this) { Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (ENINVADEPOH_GET_PARAM_7(&this->actor)) * this->skelAnime.endFrame * 0.25f; + this->skelAnime.curFrame = (ENINVADEPOH_GET_INDEX(&this->actor)) * this->skelAnime.endFrame * 0.25f; this->alpha = 255; this->actor.draw = NULL; this->present = true; @@ -3975,14 +4011,14 @@ void EnInvadepoh_func_80B4D3E4(EnInvadepoh* this) { this->unk_306 = 0x190; this->unk_304 = 0; this->actionTimer = 200; - this->actionFunc = EnInvadepoh_func_80B4D480; + this->actionFunc = EnInvadepoh_Abductor_Romani; this->actor.velocity.y = 0.0f; } -void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play) { s32 pad; f32 pad2; - s32 sp2C = 0; + s32 reachedTargetY = 0; if (this->actionTimer > 0) { this->actionTimer--; @@ -3991,7 +4027,7 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { this->actor.draw = NULL; } else { this->actor.draw = EnInvadepoh_Alien_Draw; - pad = (sp2C ? 0 : this->actionTimer); //! fake + pad = (reachedTargetY ? 0 : this->actionTimer); //! fake if ((105 > pad) && (pad >= 100)) { this->actor.gravity = -1.0f; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); @@ -4005,24 +4041,24 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 80) { this->actor.world.pos.y += this->actor.velocity.y; } else { - f32 pad3 = this->actor.home.pos.y + 850.0f; + f32 targetY = this->actor.home.pos.y + 850.0f; - sp2C = Math_StepToF(&this->actor.world.pos.y, pad3, fabsf(this->actor.velocity.y)); + reachedTargetY = Math_StepToF(&this->actor.world.pos.y, targetY, fabsf(this->actor.velocity.y)); } pad2 = (this->unk_304 * -0.06f) + this->unk_306; pad2 *= 0.98f; this->unk_306 = pad2; this->actor.shape.rot.y += this->unk_306; if (this->actor.child != NULL) { - Actor* pad1 = this->actor.child; + Actor* romani = this->actor.child; - pad1->world.pos.x = this->actor.world.pos.x; - pad1->world.pos.y = this->actor.world.pos.y - 30.0f; - pad1->world.pos.z = this->actor.world.pos.z; - pad1->shape.rot.y = this->actor.shape.rot.y; + romani->world.pos.x = this->actor.world.pos.x; + romani->world.pos.y = this->actor.world.pos.y - 30.0f; + romani->world.pos.z = this->actor.world.pos.z; + romani->shape.rot.y = this->actor.shape.rot.y; } } - if ((this->actionTimer <= 0) || sp2C) { + if ((this->actionTimer <= 0) || reachedTargetY) { Actor_Kill(&this->actor); } } @@ -4030,22 +4066,22 @@ void EnInvadepoh_func_80B4D480(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_Abuductor_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - s32 sp34; + s32 index; if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp34 = ENINVADEPOH_GET_PARAM_7(&this->actor); + index = ENINVADEPOH_GET_INDEX(&this->actor); this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); EnInvadepoh_Alien_SetTexAnim(); this->actor.update = EnInvadepoh_Abductor_Update; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, this->morphTable, - ALIEN_LIMB_MAX); - if (sp34 < 3) { - EnInvadepoh_func_80B453F4(this, play, sp34); - EnInvadepoh_func_80B4D15C(this); + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, + this->morphTable, ALIEN_LIMB_MAX); + if (index < 3) { + EnInvadepoh_Abductor_SpawnCow(this, play, index); + EnInvadepoh_Abductor_SetupCow(this); } else { - EnInvadepoh_func_80B45460(this, play); - EnInvadepoh_func_80B4D3E4(this); + EnInvadepoh_Abductor_SpawnRomani(this, play); + EnInvadepoh_Abductor_SetupRomani(this); } } } @@ -4070,7 +4106,7 @@ void EnInvadepoh_Event_DrawWarps(PlayState* play) { func_8012C2DC(play->state.gfxCtx); - for (i = 0, warpEffect = D_80B50350; i < 10; i++, warpEffect++) { + for (i = 0, warpEffect = sWarpEffects; i < 10; i++, warpEffect++) { if (warpEffect->timer > 0) { u32 temp_s5 = (play->gameplayFrames + (u8)(i * 0x10)) % 0x80; u32 temp_s6 = (play->gameplayFrames * -0xF) % 0x100; @@ -4094,8 +4130,8 @@ void EnInvadepoh_Event_Draw(Actor* thisx, PlayState* play) { EnInvadepoh_Event_DrawWarps(play); } -s32 EnInvadepoh_Alien_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +s32 EnInvadepoh_Alien_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx, Gfx** gfx) { return false; } @@ -4108,14 +4144,14 @@ void EnInvadepoh_Alien_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x3830, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&sAlienLeftEyeBeam); + Matrix_Get(&sAlienLeftEyeBeamMtxF); Matrix_Pop(); } else if ((limbIndex == ALIEN_LIMB_RIGHT_EYE) && (this->eyeBeamAlpha != 0)) { Matrix_Push(); Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&sAlienRightEyeBeam); + Matrix_Get(&sAlienRightEyeBeamMtxF); Matrix_Pop(); } if (limbIndex == ALIEN_LIMB_HEAD) { @@ -4160,11 +4196,11 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { gDPSetPrimColor(ptr++, 0, 0xFF, 240, 180, 100, 60); gDPSetEnvColor(ptr++, 255, 255, 255, 100.0f / 170.0f * this->eyeBeamAlpha); - Matrix_Mult(&sAlienLeftEyeBeam, MTXMODE_NEW); + Matrix_Mult(&sAlienLeftEyeBeamMtxF, MTXMODE_NEW); gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gAlienEyeBeamDL); - Matrix_Mult(&sAlienRightEyeBeam, MTXMODE_NEW); + Matrix_Mult(&sAlienRightEyeBeamMtxF, MTXMODE_NEW); gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gAlienEyeBeamDL); @@ -4213,7 +4249,7 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { POLY_XLU_DISP = ptr; - if ((this->alpha > 128) && EnInvadepoh_func_80B456A8(play, &sp74)) { + if ((this->alpha > 128) && EnInvadepoh_Alien_LensFlareDepthCheck(play, &sp74)) { func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); } @@ -4224,7 +4260,8 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_Cow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Cow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { EnInvadepoh* this = (EnInvadepoh*)thisx; if (limbIndex == COW_LIMB_NOSE_RING) { rot->x -= this->actor.shape.rot.x; @@ -4250,18 +4287,19 @@ void EnInvadepoh_CowTail_Draw(Actor* thisx, PlayState* play2) { NULL, &this->actor); } -s32 EnInvadepoh_Romani_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Romani_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { if (limbIndex == ROMANI_LIMB_HEAD) { EnInvadepoh* this = ((EnInvadepoh*)thisx); - rot->x += this->unk_324.unk_20.y; - rot->y += this->unk_324.unk_20.z; - rot->z += this->unk_324.unk_20.x; + rot->x += this->unk_324.headRot.y; + rot->y += this->unk_324.headRot.z; + rot->z += this->unk_324.headRot.x; } else if (limbIndex == ROMANI_LIMB_TORSO) { EnInvadepoh* this = ((EnInvadepoh*)thisx); - rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); - rot->z += this->unk_324.unk_40; + rot->x += (s16)(this->unk_324.torsoRotXMod * this->unk_324.headRot.y); + rot->z += this->unk_324.torsoRotZ; } return false; } @@ -4307,7 +4345,7 @@ void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { sp5C.x += this->actor.world.pos.x; sp5C.y += this->actor.world.pos.y; sp5C.z += this->actor.world.pos.z; - EnInvadepoh_func_80B45518(&sp5C); + EnInvadepoh_LightBall_ReplaceTranslation(&sp5C); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZS(this->unk_304, MTXMODE_APPLY); @@ -4319,21 +4357,22 @@ void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - if (EnInvadepoh_func_80B456A8(play, &sp5C)) { + if (EnInvadepoh_Alien_LensFlareDepthCheck(play, &sp5C)) { func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); } CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_Dog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Dog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += this->unk_324.unk_20.x; - rot->y += this->unk_324.unk_20.y; - rot->z += this->unk_324.unk_20.z; + rot->x += this->unk_324.headRot.x; + rot->y += this->unk_324.headRot.y; + rot->z += this->unk_324.headRot.z; } return false; } @@ -4359,17 +4398,18 @@ void EnInvadepoh_Dog_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -s32 EnInvadepoh_Cremia_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnInvadepoh_Cremia_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { if (limbIndex == CREMIA_LIMB_HEAD) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += this->unk_324.unk_20.y; - rot->y += this->unk_324.unk_20.z; - rot->z += this->unk_324.unk_20.x; + rot->x += this->unk_324.headRot.y; + rot->y += this->unk_324.headRot.z; + rot->z += this->unk_324.headRot.x; } else if (limbIndex == CREMIA_LIMB_TORSO) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += (s16)(this->unk_324.unk_34 * this->unk_324.unk_20.y); + rot->x += (s16)(this->unk_324.torsoRotXMod * this->unk_324.headRot.y); } return false; } 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 5a219fd69..23a525f5d 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -20,21 +20,21 @@ typedef struct { } EnInvadepohUnkStruct1; // size = 0x8 typedef struct { - /* 0x0 */ s8 unk_0; + /* 0x0 */ s8 type; /* 0x1 */ s8 timer; /* 0x2 */ u8 alpha; /* 0x4 */ Vec3f pos; } EnInvadepohWarpEffect; // size = 0x10 typedef struct { - /* 0x0 */ s8* index; + /* 0x0 */ s8* texIndex; /* 0x1 */ s8 count; -} EnInvadepohFaceFrame; // size = 0x2 +} EnInvadepohFaceAnim; // size = 0x2 typedef struct { /* 0x0 */ s8 type; - /* 0x4 */ EnInvadepohFaceFrame* frames; -} EnInvadepohFaceAnim; // size = 0x8 + /* 0x4 */ EnInvadepohFaceAnim* frames; +} EnInvadepohFaceAnimFixed; // size = 0x8 typedef struct { /* 0x0 */ s8 index; @@ -42,7 +42,7 @@ typedef struct { } EnInvadepohFaceAnimNext; // size = 0x8 typedef struct { - /* 0x0 */ EnInvadepohFaceAnim anim; + /* 0x0 */ EnInvadepohFaceAnimFixed anim; /* 0x8 */ s8 nextCount; /* 0xC */ EnInvadepohFaceAnimNext* nextAnims; } EnInvadepohFaceAnimLoop; // size = 0x10 @@ -54,9 +54,9 @@ typedef struct { } EnInvadepohFaceAnimLoopDelayed; // size = 0x14 typedef struct { - /* 0x0 */ EnInvadepohFaceAnim** animSet; + /* 0x0 */ EnInvadepohFaceAnimFixed** animSet; /* 0x4 */ s8 curAnimType; - /* 0x8 */ EnInvadepohFaceAnim* curAnim; + /* 0x8 */ EnInvadepohFaceAnimFixed* curAnim; /* 0xC */ s16 delayTimer; /* 0xE */ s8 curFrame; /* 0xF */ s8 curIndex; @@ -65,20 +65,20 @@ typedef struct { typedef struct { /* 0x00 */ EnInvadePohFaceInfo eyeAnim; /* 0x10 */ EnInvadePohFaceInfo mouthAnim; - /* 0x20 */ Vec3s unk_20; - /* 0x26 */ Vec3s unk_26; - /* 0x2C */ s16 unk_2C; - /* 0x30 */ f32 unk_30; - /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 unk_38; - /* 0x3c */ f32 unk_3C; - /* 0x40 */ s16 unk_40; - /* 0x42 */ s16 unk_42; - /* 0x44 */ f32 unk_44; - /* 0x48 */ s16 unk_48; -} EnInvadePohUnkStruct_324; // size = 0x4C + /* 0x20 */ Vec3s headRot; + /* 0x26 */ Vec3s headRotTarget; + /* 0x2C */ s16 maxTurnRate; + /* 0x30 */ f32 scaledTurnRate; + /* 0x34 */ f32 torsoRotXMod; + /* 0x38 */ f32 torsoRotXModTarget; + /* 0x3c */ f32 torsoRotXModStep; + /* 0x40 */ s16 torsoRotZ; + /* 0x42 */ s16 torsoRotZTarget; + /* 0x44 */ f32 torsoMaxTurnRate; + /* 0x48 */ s16 torsoMaxTurnStep; +} EnInvadePohInteractInfo; // size = 0x4C -typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnim**); +typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnimFixed**); #define EN_INVADEPOH_LIMB_MAX 23 // #define EN_INVADEPOH_LIMB_MAX MAX(MAX(MAX(MAX(MAX(ALIEN_LIMB_MAX, ROMANI_LIMB_MAX), CREMIA_LIMB_MAX), DOG_LIMB_MAX), COW_LIMB_MAX), COW_TAIL_LIMB_MAX) @@ -106,7 +106,7 @@ typedef struct EnInvadepoh { /* 0x310 */ f32 pathLength; /* 0x314 */ Vec3f unk_314; /* 0x320 */ f32 progress; - /* 0x324 */ EnInvadePohUnkStruct_324 unk_324; + /* 0x324 */ EnInvadePohInteractInfo unk_324; /* 0x370 */ s16 unk_370; /* 0x372 */ s16 unk_372; /* 0x374 */ s8 unk_374; @@ -114,7 +114,7 @@ typedef struct EnInvadepoh { /* 0x378 */ s8 unk_378; /* 0x379 */ s8 spawnCount; /* 0x37C */ f32 checkpoints[3]; - /* 0x388 */ char unk_388; // unused? + /* 0x388 */ char torsoRotXModTarget8; // unused? /* 0x389 */ u8 alpha; /* 0x38A */ s8 atBarn; /* 0x38B */ s8 present; @@ -149,10 +149,10 @@ typedef enum { /* 0xD */ ENINVADEPOH_ALIEN_ABDUCTOR, // Alien abductor, unused, carries cow or Romani } EnInvadepohParamsTypes; -#define ENINVADEPOH_GET_PARAM_7(thisx) ((thisx)->params & 7) -#define ENINVADEPOH_GET_PARAM_F0(thisx) ((thisx)->params >> 4 & 0xF) -#define ENINVADEPOH_GET_PARAM_7F00(thisx) ((thisx)->params >> 8 & 0x7F) +#define ENINVADEPOH_GET_INDEX(thisx) ((thisx)->params & 7) +#define ENINVADEPOH_GET_TYPE(thisx) ((thisx)->params >> 4 & 0xF) +#define ENINVADEPOH_GET_PATH(thisx) ((thisx)->params >> 8 & 0x7F) -#define ENINVADEPOH_SET_PARAMS(p7F00, pF0, p7) (((p7) & 7) | (((p7F00) << 8) & 0x7F00) | (((pF0) << 4) & 0xF0)) +#define ENINVADEPOH_SET_PARAMS(path, type, index) (((index) & 7) | (((path) << 8) & 0x7F00) | (((type) << 4) & 0xF0)) #endif // Z_EN_INVADEPOH_H From 2a56a97f9b8a08c76af0fb6095da483b23d80b17 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Wed, 3 May 2023 12:20:50 -0500 Subject: [PATCH 08/10] all funcs provisionally named --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 346 +++++++++--------- 1 file changed, 173 insertions(+), 173 deletions(-) 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 355be9d76..e356ed87b 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -102,17 +102,17 @@ void EnInvadepoh_Invader_Attack(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Invader_Hitstun(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Invader_SetupDeath(EnInvadepoh* this); void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48374(EnInvadepoh* this); -void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4843C(EnInvadepoh* this); -void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48588(EnInvadepoh* this); -void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48948(EnInvadepoh* this); -void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_AbductedRomani_Wait(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_AbductedRomani_SetupYell(EnInvadepoh* this); +void EnInvadepoh_AbductedRomani_Yell(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_AbductedRomani_SetupStruggle(EnInvadepoh* this); +void EnInvadepoh_AbductedRomani_Struggle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_AbductedRomani_SetupEnd(EnInvadepoh* this); +void EnInvadepoh_AbductedRomani_End(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_ConfusedRomani_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_ConfusedRomani_SetupIdle(EnInvadepoh* this); +void EnInvadepoh_ConfusedRomani_Idle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_ConfusedRomani_Talk(EnInvadepoh* this, PlayState* play); void EnInvadepoh_LightBall_SetupDescend(EnInvadepoh* this); void EnInvadepoh_LightBall_Descend(EnInvadepoh* this, PlayState* play); void EnInvadepoh_LightBall_SetupHover(EnInvadepoh* this); @@ -126,38 +126,38 @@ void EnInvadepoh_LightBall_SetupFlee(EnInvadepoh* this); void EnInvadepoh_LightBall_Flee(EnInvadepoh* this, PlayState* play); void EnInvadepoh_LightBall_SetupLeaveBarn(EnInvadepoh* this); void EnInvadepoh_LightBall_LeaveBarn(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A570(EnInvadepoh* this); -void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this); -void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this); -void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this); -void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4AF80(EnInvadepoh* this); -void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4B024(EnInvadepoh* this); -void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Night1Romani_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Night1Romani_Talk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_BarnRomani_Idle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_BarnRomani_SetupLookAround(EnInvadepoh* this); +void EnInvadepoh_BarnRomani_LookAround(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_BarnRomani_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_BarnRomani_Talk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_ClearCheck(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_SetupStartCs(EnInvadepoh* this); +void EnInvadepoh_RewardRomani_StartCs(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_SetupTalk(EnInvadepoh* this); +void EnInvadepoh_RewardRomani_Talk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_SetupGiveBottle(EnInvadepoh* this); +void EnInvadepoh_RewardRomani_GiveBottle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_SetupAfterGiveBottle(EnInvadepoh* this); +void EnInvadepoh_RewardRomani_AfterGiveBottle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_RewardRomani_SetupFinished(EnInvadepoh* this); +void EnInvadepoh_RewardRomani_Finished(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Dog_Walk(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Dog_SetupRun(EnInvadepoh* this); void EnInvadepoh_Dog_Run(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Dog_SetupBark(EnInvadepoh* this); void EnInvadepoh_Dog_Bark(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Dog_Jump(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this); -void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_func_80B4CC70(EnInvadepoh* this); -void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Cremia_Talk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Cremia_SetupIdle(EnInvadepoh* this); +void EnInvadepoh_Cremia_Idle(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Night3Romani_Walk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Night3Romani_Talk(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_Night3Romani_SetupIdle(EnInvadepoh* this); +void EnInvadepoh_Night3Romani_Idle(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Abductor_Cow(EnInvadepoh* this, PlayState* play); void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play); @@ -991,7 +991,7 @@ s32 EnInvadepoh_Romani_OpenDoor(EnInvadepoh* this, PlayState* play, f32 range, s return doorOpened; } -void EnInvadepoh_Romani_SetTextId(EnInvadepoh* this, PlayState* play, u16 textId) { +void EnInvadepoh_Romani_StartTextBox(EnInvadepoh* this, PlayState* play, u16 textId) { this->textId = textId; Message_StartTextbox(play, textId, &this->actor); } @@ -2285,30 +2285,30 @@ void EnInvadepoh_CowTail_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B482D4(EnInvadepoh* this) { +void EnInvadepoh_AbductedRomani_SetupWait(EnInvadepoh* this) { this->actionTimer = 40; Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); this->actor.draw = NULL; - this->actionFunc = EnInvadepoh_func_80B48324; + this->actionFunc = EnInvadepoh_AbductedRomani_Wait; } -void EnInvadepoh_func_80B48324(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_AbductedRomani_Wait(EnInvadepoh* this, PlayState* play) { this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_Romani_SetTextId(this, play, 0x332F); // Romani's scream when abducted + EnInvadepoh_Romani_StartTextBox(this, play, 0x332F); // Romani's scream when abducted this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B48374(this); + EnInvadepoh_AbductedRomani_SetupYell(this); } } -void EnInvadepoh_func_80B48374(EnInvadepoh* this) { +void EnInvadepoh_AbductedRomani_SetupYell(EnInvadepoh* this) { this->actionTimer = 60; Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); this->actor.draw = EnInvadepoh_Romani_Draw; - this->actionFunc = EnInvadepoh_func_80B483CC; + this->actionFunc = EnInvadepoh_AbductedRomani_Yell; } -void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_AbductedRomani_Yell(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 20) { EnInvadePohInteractInfo* interactInfo = &this->unk_324; @@ -2321,11 +2321,11 @@ void EnInvadepoh_func_80B483CC(EnInvadepoh* this, PlayState* play) { this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_func_80B4843C(this); + EnInvadepoh_AbductedRomani_SetupStruggle(this); } } -void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { +void EnInvadepoh_AbductedRomani_SetupStruggle(EnInvadepoh* this) { this->unk_324.headRotTarget.x = 0xBB8; this->unk_324.headRotTarget.y = 0; this->unk_324.headRotTarget.z = 0; @@ -2338,10 +2338,10 @@ void EnInvadepoh_func_80B4843C(EnInvadepoh* this) { Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, 0, -5.0f); this->actor.draw = EnInvadepoh_Romani_Draw; - this->actionFunc = EnInvadepoh_func_80B484EC; + this->actionFunc = EnInvadepoh_AbductedRomani_Struggle; } -void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_AbductedRomani_Struggle(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 40) { this->unk_324.headRotTarget.y = 0x1B58; } else if (this->actionTimer == 30) { @@ -2353,11 +2353,11 @@ void EnInvadepoh_func_80B484EC(EnInvadepoh* this, PlayState* play) { } this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_func_80B48588(this); + EnInvadepoh_AbductedRomani_SetupEnd(this); } } -void EnInvadepoh_func_80B48588(EnInvadepoh* this) { +void EnInvadepoh_AbductedRomani_SetupEnd(EnInvadepoh* this) { this->unk_324.headRotTarget.x = 0; this->unk_324.headRotTarget.y = 0; this->unk_324.headRotTarget.z = 0; @@ -2369,10 +2369,10 @@ void EnInvadepoh_func_80B48588(EnInvadepoh* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actor.draw = EnInvadepoh_Romani_Draw; - this->actionFunc = EnInvadepoh_func_80B48610; + this->actionFunc = EnInvadepoh_AbductedRomani_End; } -void EnInvadepoh_func_80B48610(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_AbductedRomani_End(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { @@ -2390,7 +2390,7 @@ void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); - EnInvadepoh_func_80B482D4(this); + EnInvadepoh_AbductedRomani_SetupWait(this); } } @@ -2411,7 +2411,7 @@ void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { +void EnInvadepoh_ConfusedRomani_SetupWalk(EnInvadepoh* this) { static s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; EnInvadePohInteractInfo* interactInfo = &this->unk_324; @@ -2422,10 +2422,10 @@ void EnInvadepoh_func_80B487B4(EnInvadepoh* this) { interactInfo->scaledTurnRate = 0.1f; interactInfo->maxTurnRate = 0x320; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - this->actionFunc = EnInvadepoh_func_80B48848; + this->actionFunc = EnInvadepoh_ConfusedRomani_Walk; } -void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_ConfusedRomani_Walk(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 1.6f, 0.1f); @@ -2444,11 +2444,11 @@ void EnInvadepoh_func_80B48848(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B48948(this); + EnInvadepoh_ConfusedRomani_SetupIdle(this); } } -void EnInvadepoh_func_80B48948(EnInvadepoh* this) { +void EnInvadepoh_ConfusedRomani_SetupIdle(EnInvadepoh* this) { EnInvadePohInteractInfo* interactInfo = &this->unk_324; f32 sp28 = Rand_ZeroOne(); @@ -2481,10 +2481,10 @@ void EnInvadepoh_func_80B48948(EnInvadepoh* this) { interactInfo->maxTurnRate = 0x3E8; } Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = EnInvadepoh_func_80B48AD4; + this->actionFunc = EnInvadepoh_ConfusedRomani_Idle; } -void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_ConfusedRomani_Idle(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* interactInfo = &this->unk_324; Math_StepToF(&this->actor.speed, 0.0f, 0.2f); @@ -2537,10 +2537,10 @@ void EnInvadepoh_func_80B48AD4(EnInvadepoh* this, PlayState* play) { this->actionTimer--; return; } - EnInvadepoh_func_80B487B4(this); + EnInvadepoh_ConfusedRomani_SetupWalk(this); } -void EnInvadepoh_func_80B48DE4(EnInvadepoh* this) { +void EnInvadepoh_ConfusedRomani_SetupTalk(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; this->actor.speed = 0.0f; @@ -2548,10 +2548,10 @@ void EnInvadepoh_func_80B48DE4(EnInvadepoh* this) { this->unk_370 = 0; temp_v0->scaledTurnRate = 0.05f; temp_v0->maxTurnRate = 0x4B0; - this->actionFunc = EnInvadepoh_func_80B48E4C; + this->actionFunc = EnInvadepoh_ConfusedRomani_Talk; } -void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_ConfusedRomani_Talk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -2566,7 +2566,7 @@ void EnInvadepoh_func_80B48E4C(EnInvadepoh* this, PlayState* play) { temp_v0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { - EnInvadepoh_func_80B48948(this); + EnInvadepoh_ConfusedRomani_SetupIdle(this); } } @@ -2588,7 +2588,7 @@ void EnInvadepoh_ConfusedRomani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); - EnInvadepoh_func_80B487B4(this); + EnInvadepoh_ConfusedRomani_SetupWalk(this); } } @@ -2600,13 +2600,13 @@ void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { if (talkRequested) { func_80151BB4(play, 5); - EnInvadepoh_func_80B48DE4(this); + EnInvadepoh_ConfusedRomani_SetupTalk(this); } this->actionFunc(this, play); if (inUncullRange) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_Interact_Update(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B48E4C) && !talkRequested && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_ConfusedRomani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -2845,7 +2845,7 @@ void EnInvadepoh_LightBall_Update(Actor* thisx, PlayState* play2) { this->unk_304 += 0x258; } -void EnInvadepoh_func_80B49BD0(EnInvadepoh* this) { +void EnInvadepoh_Night1Romani_SetupWalk(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); @@ -2854,10 +2854,10 @@ void EnInvadepoh_func_80B49BD0(EnInvadepoh* this) { temp_v0->headRotTarget.z = 0; temp_v0->scaledTurnRate = 0.1f; temp_v0->maxTurnRate = 0x320; - this->actionFunc = EnInvadepoh_func_80B49C38; + this->actionFunc = EnInvadepoh_Night1Romani_Walk; } -void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night1Romani_Walk(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Night1Romani_SetProgress(this); EnInvadepoh_Night1Romani_MoveAlongPathTimed(this, play); EnInvadepoh_Romani_TurnToPath(this, 6, 0x7D0, 0x64); @@ -2868,7 +2868,7 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { s32 pad; if (temp_v0_2 > 0) { - temp_v0_2 = (gRegEditor->data[0xF] * -16.0f / temp_v0_2) - 0.5f; + temp_v0_2 = (REG(15) * -16.0f / temp_v0_2) - 0.5f; this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); } } @@ -2886,15 +2886,15 @@ void EnInvadepoh_func_80B49C38(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_func_80B49DA0(EnInvadepoh* this) { +void EnInvadepoh_Night1Romani_SetupTalk(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = EnInvadepoh_func_80B49DFC; + this->actionFunc = EnInvadepoh_Night1Romani_Talk; } -void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night1Romani_Talk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -2912,7 +2912,7 @@ void EnInvadepoh_func_80B49DFC(EnInvadepoh* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_54_10); this->actor.textId = 0x332E; // If you run out of arrows... } - EnInvadepoh_func_80B49BD0(this); + EnInvadepoh_Night1Romani_SetupWalk(this); } } @@ -2951,7 +2951,7 @@ void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { (currentTime < CLOCK_TIME(2, 15))) { this->actor.update = EnInvadepoh_Night1Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B49BD0(this); + EnInvadepoh_Night1Romani_SetupWalk(this); } else { Actor_Kill(&this->actor); } @@ -2965,7 +2965,7 @@ void EnInvadepoh_Night1Romani_WaitForEvent(Actor* thisx, PlayState* play2) { if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(2, 00))) { this->actor.update = EnInvadepoh_Night1Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B49BD0(this); + EnInvadepoh_Night1Romani_SetupWalk(this); } } @@ -2977,13 +2977,13 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { if (talkRequested) { func_80151BB4(play, 5); - EnInvadepoh_func_80B49DA0(this); + EnInvadepoh_Night1Romani_SetupTalk(this); } this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_Interact_Update(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B49DFC) && !talkRequested && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_Night1Romani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -2991,7 +2991,7 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { +void EnInvadepoh_BarnRomani_SetupIdle(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); @@ -3004,10 +3004,10 @@ void EnInvadepoh_func_80B4A2C0(EnInvadepoh* this) { this->actionTimer = Rand_S16Offset(200, 200); this->unk_304 = this->actor.shape.rot.y; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = EnInvadepoh_func_80B4A350; + this->actionFunc = EnInvadepoh_BarnRomani_Idle; } -void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_BarnRomani_Idle(EnInvadepoh* this, PlayState* play) { s32 pad; EnInvadePohInteractInfo* sp30 = &this->unk_324; @@ -3043,11 +3043,11 @@ void EnInvadepoh_func_80B4A350(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - EnInvadepoh_func_80B4A570(this); + EnInvadepoh_BarnRomani_SetupLookAround(this); } } -void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { +void EnInvadepoh_BarnRomani_SetupLookAround(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); @@ -3057,16 +3057,16 @@ void EnInvadepoh_func_80B4A570(EnInvadepoh* this) { temp_v0->scaledTurnRate = 0.1f; temp_v0->maxTurnRate = 0x320; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = EnInvadepoh_func_80B4A5E4; + this->actionFunc = EnInvadepoh_BarnRomani_LookAround; } -void EnInvadepoh_func_80B4A5E4(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_BarnRomani_LookAround(EnInvadepoh* this, PlayState* play) { if (this->finishedAnim) { - EnInvadepoh_func_80B4A2C0(this); + EnInvadepoh_BarnRomani_SetupIdle(this); } } -void EnInvadepoh_func_80B4A614(EnInvadepoh* this) { +void EnInvadepoh_BarnRomani_SetupWalk(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); @@ -3075,10 +3075,10 @@ void EnInvadepoh_func_80B4A614(EnInvadepoh* this) { temp_v0->headRotTarget.z = 0; temp_v0->scaledTurnRate = 0.1f; temp_v0->maxTurnRate = 0x320; - this->actionFunc = EnInvadepoh_func_80B4A67C; + this->actionFunc = EnInvadepoh_BarnRomani_Walk; } -void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_BarnRomani_Walk(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speed, 5.0f, 1.0f); @@ -3104,19 +3104,19 @@ void EnInvadepoh_func_80B4A67C(EnInvadepoh* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } if (this->currentPoint == this->endPoint) { - EnInvadepoh_func_80B4A2C0(this); + EnInvadepoh_BarnRomani_SetupIdle(this); } } -void EnInvadepoh_func_80B4A7C0(EnInvadepoh* this) { +void EnInvadepoh_BarnRomani_SetupTalk(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - this->actionFunc = EnInvadepoh_func_80B4A81C; + this->actionFunc = EnInvadepoh_BarnRomani_Talk; } -void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_BarnRomani_Talk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -3134,9 +3134,9 @@ void EnInvadepoh_func_80B4A81C(EnInvadepoh* this, PlayState* play) { this->actor.textId = 0x332E; // If you run out of arrows... } if (this->currentPoint == this->endPoint) { - EnInvadepoh_func_80B4A2C0(this); + EnInvadepoh_BarnRomani_SetupIdle(this); } else { - EnInvadepoh_func_80B4A614(this); + EnInvadepoh_BarnRomani_SetupWalk(this); } } } @@ -3163,7 +3163,7 @@ void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2) { this->currentPoint = this->endPoint; this->actor.update = EnInvadepoh_BarnRomani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B4A2C0(this); + EnInvadepoh_BarnRomani_SetupIdle(this); } EnInvadepoh_SetPosToPathPoint(this, this->currentPoint); EnInvadepoh_SetYawAlongPath(this); @@ -3188,7 +3188,7 @@ void EnInvadepoh_BarnRomani_WaitForEvent(Actor* thisx, PlayState* play2) { if ((gSaveContext.save.time < CLOCK_TIME(6, 00)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { this->actor.update = EnInvadepoh_BarnRomani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B4A614(this); + EnInvadepoh_BarnRomani_SetupWalk(this); } } @@ -3200,13 +3200,13 @@ void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { if (talkRequested) { func_80151BB4(play, 5); - EnInvadepoh_func_80B4A7C0(this); + EnInvadepoh_BarnRomani_SetupTalk(this); } this->actionFunc(this, play); if (inUncullRange) { this->finishedAnim = SkelAnime_Update(&this->skelAnime); EnInvadepoh_Interact_Update(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4A81C) && !talkRequested && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_BarnRomani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -3214,61 +3214,61 @@ void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4ACDC(EnInvadepoh* this) { - this->actionFunc = EnInvadepoh_func_80B4ACF0; +void EnInvadepoh_RewardRomani_SetupClearCheck(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_RewardRomani_ClearCheck; } -void EnInvadepoh_func_80B4ACF0(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_RewardRomani_ClearCheck(EnInvadepoh* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { this->actor.draw = EnInvadepoh_Romani_Draw; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - EnInvadepoh_func_80B4AD3C(this); + EnInvadepoh_RewardRomani_SetupStartCs(this); } } -void EnInvadepoh_func_80B4AD3C(EnInvadepoh* this) { +void EnInvadepoh_RewardRomani_SetupStartCs(EnInvadepoh* this) { this->actor.flags |= ACTOR_FLAG_10000; - this->actionFunc = EnInvadepoh_func_80B4AD60; + this->actionFunc = EnInvadepoh_RewardRomani_StartCs; } -void EnInvadepoh_func_80B4AD60(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_RewardRomani_StartCs(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_Romani_SetTextId(this, play, 0x3331); // We did it...We won. - EnInvadepoh_func_80B4ADB8(this); + EnInvadepoh_Romani_StartTextBox(this, play, 0x3331); // We did it...We won. + EnInvadepoh_RewardRomani_SetupTalk(this); } else { func_800B8614(&this->actor, play, 2000.0f); } } -void EnInvadepoh_func_80B4ADB8(EnInvadepoh* this) { - this->actionFunc = EnInvadepoh_func_80B4ADCC; +void EnInvadepoh_RewardRomani_SetupTalk(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_RewardRomani_Talk; } -void EnInvadepoh_func_80B4ADCC(EnInvadepoh* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { +void EnInvadepoh_RewardRomani_Talk(EnInvadepoh* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x3331) { // We did it...We won. if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { - EnInvadepoh_Romani_SetTextId(this, play, 0x3334); // I have to get back to bed... + EnInvadepoh_Romani_StartTextBox(this, play, 0x3334); // I have to get back to bed... func_80151BB4(play, 0x1D); func_80151BB4(play, 5); } else { - EnInvadepoh_Romani_SetTextId(this, play, 0x3333); // Here's Romani's thanks + EnInvadepoh_Romani_StartTextBox(this, play, 0x3333); // Here's Romani's thanks } } else if (this->textId == 0x3333) { // Here's Romani's thanks - EnInvadepoh_func_80B4AEC0(this); + EnInvadepoh_RewardRomani_SetupGiveBottle(this); } else if (this->textId == 0x3334) { // I have to get back to bed... Message_CloseTextbox(play); - EnInvadepoh_func_80B4B024(this); + EnInvadepoh_RewardRomani_SetupFinished(this); } } } -void EnInvadepoh_func_80B4AEC0(EnInvadepoh* this) { +void EnInvadepoh_RewardRomani_SetupGiveBottle(EnInvadepoh* this) { this->actionTimer = 2; - this->actionFunc = EnInvadepoh_func_80B4AEDC; + this->actionFunc = EnInvadepoh_RewardRomani_GiveBottle; } -void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_RewardRomani_GiveBottle(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; if (this->actionTimer == 0) { @@ -3278,34 +3278,34 @@ void EnInvadepoh_func_80B4AEDC(EnInvadepoh* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; SET_WEEKEVENTREG(WEEKEVENTREG_22_02); - EnInvadepoh_func_80B4AF80(this); + EnInvadepoh_RewardRomani_SetupAfterGiveBottle(this); } else { - Actor_OfferGetItem(&this->actor, play, 0x60, 2000.0f, 2000.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); } } -void EnInvadepoh_func_80B4AF80(EnInvadepoh* this) { - this->actionFunc = EnInvadepoh_func_80B4AF94; +void EnInvadepoh_RewardRomani_SetupAfterGiveBottle(EnInvadepoh* this) { + this->actionFunc = EnInvadepoh_RewardRomani_AfterGiveBottle; } -void EnInvadepoh_func_80B4AF94(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_RewardRomani_AfterGiveBottle(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_Romani_SetTextId(this, play, 0x3334); // I have to get back to bed.. + EnInvadepoh_Romani_StartTextBox(this, play, 0x3334); // I have to get back to bed.. func_80151BB4(play, 0x1E); func_80151BB4(play, 0x1D); func_80151BB4(play, 5); - EnInvadepoh_func_80B4ADB8(this); + EnInvadepoh_RewardRomani_SetupTalk(this); } else { func_800B85E0(&this->actor, play, 2000.0f, PLAYER_IA_MINUS1); } } -void EnInvadepoh_func_80B4B024(EnInvadepoh* this) { +void EnInvadepoh_RewardRomani_SetupFinished(EnInvadepoh* this) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = EnInvadepoh_func_80B4B048; + this->actionFunc = EnInvadepoh_RewardRomani_Finished; } -void EnInvadepoh_func_80B4B048(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_RewardRomani_Finished(EnInvadepoh* this, PlayState* play) { if (play->msgCtx.unk120B1 == 0) { if (play->msgCtx.msgMode == 0) { sRewardFinished = true; @@ -3334,7 +3334,7 @@ void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { temp_s0->maxTurnRate = 0x7D0; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); - EnInvadepoh_func_80B4ACDC(this); + EnInvadepoh_RewardRomani_SetupClearCheck(this); } } @@ -3552,7 +3552,7 @@ void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this) { +void EnInvadepoh_Cremia_SetupWalk(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); @@ -3563,10 +3563,10 @@ void EnInvadepoh_func_80B4BBE0(EnInvadepoh* this) { temp_v0->maxTurnRate = 0x320; this->unk_370 = 0; - this->actionFunc = EnInvadepoh_func_80B4BC4C; + this->actionFunc = EnInvadepoh_Cremia_Walk; } -void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; EnInvadepoh* romani = sRomani; s32 pad; @@ -3623,20 +3623,20 @@ void EnInvadepoh_func_80B4BC4C(EnInvadepoh* this, PlayState* play) { } if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { Actor_Kill(&this->actor); - } else if ((romani != NULL) && (romani->actionFunc == EnInvadepoh_func_80B4CB0C)) { - EnInvadepoh_func_80B4C1BC(this); + } else if ((romani != NULL) && (romani->actionFunc == EnInvadepoh_Night3Romani_Talk)) { + EnInvadepoh_Cremia_SetupIdle(this); } } -void EnInvadepoh_func_80B4BFFC(EnInvadepoh* this) { +void EnInvadepoh_Cremia_SetupTalk(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; - this->actionFunc = EnInvadepoh_func_80B4C058; + this->actionFunc = EnInvadepoh_Cremia_Talk; } -void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Cremia_Talk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* sp28 = GET_PLAYER(play); s16 temp_v1; @@ -3649,19 +3649,19 @@ void EnInvadepoh_func_80B4C058(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { - EnInvadepoh_func_80B4BBE0(this); + EnInvadepoh_Cremia_SetupWalk(this); } } -void EnInvadepoh_func_80B4C1BC(EnInvadepoh* this) { +void EnInvadepoh_Cremia_SetupIdle(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; - this->actionFunc = EnInvadepoh_func_80B4C218; + this->actionFunc = EnInvadepoh_Cremia_Idle; } -void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Cremia_Idle(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; Player* sp28 = GET_PLAYER(play); s16 temp_v1; @@ -3674,9 +3674,9 @@ void EnInvadepoh_func_80B4C218(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (sRomani == NULL) { - EnInvadepoh_func_80B4BBE0(this); - } else if ((sRomani != NULL) && (sRomani->actionFunc != EnInvadepoh_func_80B4CB0C)) { - EnInvadepoh_func_80B4BBE0(this); + EnInvadepoh_Cremia_SetupWalk(this); + } else if ((sRomani != NULL) && (sRomani->actionFunc != EnInvadepoh_Night3Romani_Talk)) { + EnInvadepoh_Cremia_SetupWalk(this); } } @@ -3711,7 +3711,7 @@ void EnInvadepoh_Cremia_WaitForObject(Actor* thisx, PlayState* play2) { } else if ((CLOCK_TIME(20, 00) + 30 <= currentTime) && (currentTime < CLOCK_TIME(20, 15))) { this->actor.update = EnInvadepoh_Cremia_Update; this->actor.draw = EnInvadepoh_Cremia_Draw; - EnInvadepoh_func_80B4BBE0(this); + EnInvadepoh_Cremia_SetupWalk(this); } else { Actor_Kill(&this->actor); } @@ -3725,7 +3725,7 @@ void EnInvadepoh_Cremia_WaitForEvent(Actor* thisx, PlayState* play2) { if ((gSaveContext.save.time >= CLOCK_TIME(20, 00) + 30) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { this->actor.update = EnInvadepoh_Cremia_Update; this->actor.draw = EnInvadepoh_Cremia_Draw; - EnInvadepoh_func_80B4BBE0(this); + EnInvadepoh_Cremia_SetupWalk(this); } } @@ -3737,13 +3737,13 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { if (talkRequested) { func_80151BB4(play, 6); - EnInvadepoh_func_80B4BFFC(this); + EnInvadepoh_Cremia_SetupTalk(this); } this->actionFunc(this, play2); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_Interact_Update(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4C058) && !talkRequested && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_Cremia_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -3751,7 +3751,7 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { } } -void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this) { +void EnInvadepoh_Night3Romani_SetupWalk(EnInvadepoh* this) { EnInvadePohInteractInfo* temp_v0 = &this->unk_324; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); @@ -3760,10 +3760,10 @@ void EnInvadepoh_func_80B4C6C8(EnInvadepoh* this) { temp_v0->headRotTarget.z = 0; temp_v0->scaledTurnRate = 0.1f; temp_v0->maxTurnRate = 0x320; - this->actionFunc = EnInvadepoh_func_80B4C730; + this->actionFunc = EnInvadepoh_Night3Romani_Walk; } -void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night3Romani_Walk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* temp_s0 = &this->unk_324; EnInvadepoh* sp68 = sCremia; s32 var_a2; @@ -3787,7 +3787,7 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { s32 temp_v0_2 = func_800FE620(play); if (temp_v0_2 > 0) { - temp_v0_2 = (gRegEditor->data[0xF] * -23.0f / temp_v0_2) - 0.5f; + temp_v0_2 = (REG(15) * -23.0f / temp_v0_2) - 0.5f; this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); } } @@ -3818,20 +3818,20 @@ void EnInvadepoh_func_80B4C730(EnInvadepoh* this, PlayState* play) { } if (this->progress >= 0.9999f) { Actor_Kill(&this->actor); - } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_func_80B4C058)) { - EnInvadepoh_func_80B4CC70(this); + } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_Cremia_Talk)) { + EnInvadepoh_Night3Romani_SetupIdle(this); } } -void EnInvadepoh_func_80B4CAB0(EnInvadepoh* this) { +void EnInvadepoh_Night3Romani_SetupTalk(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0xFA0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; - this->actionFunc = EnInvadepoh_func_80B4CB0C; + this->actionFunc = EnInvadepoh_Night3Romani_Talk; } -void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night3Romani_Talk(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* interactInfo = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -3844,19 +3844,19 @@ void EnInvadepoh_func_80B4CB0C(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { - EnInvadepoh_func_80B4C6C8(this); + EnInvadepoh_Night3Romani_SetupWalk(this); } } -void EnInvadepoh_func_80B4CC70(EnInvadepoh* this) { +void EnInvadepoh_Night3Romani_SetupIdle(EnInvadepoh* this) { this->unk_324.scaledTurnRate = 0.08f; this->unk_324.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; - this->actionFunc = EnInvadepoh_func_80B4CCCC; + this->actionFunc = EnInvadepoh_Night3Romani_Idle; } -void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Night3Romani_Idle(EnInvadepoh* this, PlayState* play) { EnInvadePohInteractInfo* interactInfo = &this->unk_324; Player* player = GET_PLAYER(play); s16 temp_v1; @@ -3869,9 +3869,9 @@ void EnInvadepoh_func_80B4CCCC(EnInvadepoh* this, PlayState* play) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); if (sCremia == NULL) { - EnInvadepoh_func_80B4C6C8(this); - } else if ((sCremia != NULL) && (sCremia->actionFunc != EnInvadepoh_func_80B4C058)) { - EnInvadepoh_func_80B4C6C8(this); + EnInvadepoh_Night3Romani_SetupWalk(this); + } else if ((sCremia != NULL) && (sCremia->actionFunc != EnInvadepoh_Cremia_Talk)) { + EnInvadepoh_Night3Romani_SetupWalk(this); } } @@ -3902,7 +3902,7 @@ void EnInvadepoh_Night3Romani_WaitForObject(Actor* thisx, PlayState* play2) { } else if ((currentTime >= CLOCK_TIME(20, 00)) && (currentTime < CLOCK_TIME(20, 14) + 15)) { this->actor.update = EnInvadepoh_Night3Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B4C6C8(this); + EnInvadepoh_Night3Romani_SetupWalk(this); } else { Actor_Kill(&this->actor); } @@ -3916,7 +3916,7 @@ void EnInvadepoh_Night3Romani_WaitForEvent(Actor* thisx, PlayState* play2) { if ((gSaveContext.save.time >= CLOCK_TIME(20, 00)) && (gSaveContext.save.time < CLOCK_TIME(20, 14) + 15)) { this->actor.update = EnInvadepoh_Night3Romani_Update; this->actor.draw = EnInvadepoh_Romani_Draw; - EnInvadepoh_func_80B4C6C8(this); + EnInvadepoh_Night3Romani_SetupWalk(this); } } @@ -3928,13 +3928,13 @@ void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { if (talkRequested) { func_80151BB4(play, 5); - EnInvadepoh_func_80B4CAB0(this); + EnInvadepoh_Night3Romani_SetupTalk(this); } this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); EnInvadepoh_Interact_Update(&this->unk_324); - if ((this->actionFunc != EnInvadepoh_func_80B4CB0C) && !talkRequested && this->actor.isTargeted) { + if ((this->actionFunc != EnInvadepoh_Night3Romani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); From ff1f5d34e17be52b6477f20e07324bbfef036363 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Tue, 6 Jun 2023 11:22:08 -0500 Subject: [PATCH 09/10] more stuff --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 1117 +++++++++-------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 68 +- 2 files changed, 609 insertions(+), 576 deletions(-) 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 e356ed87b..22028c048 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -323,8 +323,8 @@ s32 EnInvadepoh_Invader_GetSpawnTime(s32 invaderIndex) { return warpTime + CLOCK_TIME(2, 30); } -void EnInvadepoh_Invader_SetKillCount(s32 arg0) { - gSaveContext.save.saveInfo.unk_E64[4] = (gSaveContext.save.saveInfo.unk_E64[4] & ~0xFF) | (arg0 & 0xFF); +void EnInvadepoh_Invader_SetKillCount(s32 count) { + gSaveContext.save.saveInfo.unk_E64[4] = (gSaveContext.save.saveInfo.unk_E64[4] & ~0xFF) | (count & 0xFF); } s32 EnInvadepoh_Invader_GetKillCount(void) { @@ -332,22 +332,22 @@ s32 EnInvadepoh_Invader_GetKillCount(void) { } s32 EnInvadepoh_Invader_AddKill(void) { - s32 sp1C = EnInvadepoh_Invader_GetKillCount(); + s32 killCount = EnInvadepoh_Invader_GetKillCount(); - if (sp1C < 12) { - sp1C++; - EnInvadepoh_Invader_SetKillCount(sp1C); + if (killCount < 12) { + killCount++; + EnInvadepoh_Invader_SetKillCount(killCount); } - return sp1C; + return killCount; } -void EnInvadepoh_Invader_SetRespawnTime(s32 arg0) { +void EnInvadepoh_Invader_SetRespawnTime(s32 invaderIndex) { s32 currentTime = gSaveContext.save.time; if ((CURRENT_DAY == 1) && (CLOCK_TIME(2, 30) <= currentTime) && (currentTime < CLOCK_TIME(5, 15))) { - s32 warpDelay = (12 - EnInvadepoh_Invader_GetKillCount()) * 25.0f; + s32 spawnDelay = (12 - EnInvadepoh_Invader_GetKillCount()) * 25.0f; - EnInvadepoh_Invader_SetSpawnTime(arg0, currentTime + warpDelay); + EnInvadepoh_Invader_SetSpawnTime(invaderIndex, currentTime + spawnDelay); } } @@ -363,7 +363,7 @@ s32 EnInvadepoh_Invader_GetCurrentPoint(EnInvadepoh* this) { return i; } -void EnInvadepoh_Romani_SetPositionAlongPath(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { +void EnInvadepoh_Romani_ApplyProgress(EnInvadepoh* this, s8* currentPoint, Vec3f* pathPosition) { f32 curPathLength = 0.0f; f32 curCheckpoint = 0.0f; f32 invPathLength = 1.0f / this->pathLength; @@ -385,79 +385,79 @@ void EnInvadepoh_Romani_SetPositionAlongPath(EnInvadepoh* this, s8* arg1, Vec3f* nextPathLength = curPathLength + pathSegLength; nextCheckpoint = nextPathLength * invPathLength; if (this->progress <= nextCheckpoint) { - *arg1 = i; + *currentPoint = i; segmentProgress = (this->progress - curCheckpoint) / (nextCheckpoint - curCheckpoint); - arg2->x = (segmentProgress * curToNext.x) + curPathPoint->x; - arg2->y = (segmentProgress * curToNext.y) + curPathPoint->y; - arg2->z = (segmentProgress * curToNext.z) + curPathPoint->z; + pathPosition->x = (segmentProgress * curToNext.x) + curPathPoint->x; + pathPosition->y = (segmentProgress * curToNext.y) + curPathPoint->y; + pathPosition->z = (segmentProgress * curToNext.z) + curPathPoint->z; return; } curPathPoint = nextPathPoint++; curPathLength = nextPathLength; curCheckpoint = nextCheckpoint; } - *arg1 = endPoint; - arg2->x = this->pathPoints[endPoint].x; - arg2->y = this->pathPoints[endPoint].y; - arg2->z = this->pathPoints[endPoint].z; + *currentPoint = endPoint; + pathPosition->x = this->pathPoints[endPoint].x; + pathPosition->y = this->pathPoints[endPoint].y; + pathPosition->z = this->pathPoints[endPoint].z; } -void EnInvadepoh_Invader_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2) { +void EnInvadepoh_Invader_TurnToPath(EnInvadepoh* this, s16 step, s16 offset) { s32 pad; - Vec3s* sp40 = &this->pathPoints[this->currentPoint]; - Vec3s* sp3C = sp40 + 1; - Vec3f sp30; - Vec3f sp24; + Vec3s* curPathPoint = &this->pathPoints[this->currentPoint]; + Vec3s* nextPathPoint = curPathPoint + 1; + Vec3f curPathPointF; + Vec3f nextPathPointF; if (this->currentPoint != this->endPoint) { - Math_Vec3s_ToVec3f(&sp30, sp40); - Math_Vec3s_ToVec3f(&sp24, sp3C); - Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); + Math_Vec3s_ToVec3f(&curPathPointF, curPathPoint); + Math_Vec3s_ToVec3f(&nextPathPointF, nextPathPoint); + Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&curPathPointF, &nextPathPointF) + offset, step); } } -void EnInvadepoh_Romani_TurnToPath(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { +void EnInvadepoh_Romani_TurnToPath(EnInvadepoh* this, s16 scale, s16 step, s16 minStep) { s32 pad; - Vec3s* sp40 = &this->pathPoints[this->currentPoint]; - Vec3s* sp3C = sp40 + 1; - Vec3f sp30; - Vec3f sp24; + Vec3s* curPathPoint = &this->pathPoints[this->currentPoint]; + Vec3s* nextPathPoint = curPathPoint + 1; + Vec3f curPathPointF; + Vec3f nextPathPointF; if (this->currentPoint != this->endPoint) { - Math_Vec3s_ToVec3f(&sp30, sp40); - Math_Vec3s_ToVec3f(&sp24, sp3C); - Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24), arg1, arg2, arg3); + Math_Vec3s_ToVec3f(&curPathPointF, curPathPoint); + Math_Vec3s_ToVec3f(&nextPathPointF, nextPathPoint); + Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&curPathPointF, &nextPathPointF), scale, step, minStep); } } void EnInvadepoh_SetYawAlongPath(EnInvadepoh* this) { s32 pad; - Vec3s* sp40 = &this->pathPoints[this->currentPoint]; - Vec3s* sp3C = sp40 + 1; - Vec3f sp30; - Vec3f sp24; + Vec3s* curPathPoint = &this->pathPoints[this->currentPoint]; + Vec3s* nextPathPoint = curPathPoint + 1; + Vec3f curPathPointF; + Vec3f nextPathPointF; - Math_Vec3s_ToVec3f(&sp30, sp40); - Math_Vec3s_ToVec3f(&sp24, sp3C); - this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp30, &sp24); + Math_Vec3s_ToVec3f(&curPathPointF, curPathPoint); + Math_Vec3s_ToVec3f(&nextPathPointF, nextPathPoint); + this->actor.shape.rot.y = Math_Vec3f_Yaw(&curPathPointF, &nextPathPointF); } f32 EnInvadepoh_GetPathLength(EnInvadepoh* this) { - s32 temp_s4 = this->endPoint + 1; - s32 var_s1; - Vec3f sp54; - Vec3f sp48; - Vec3s* var_s0 = this->pathPoints; - f32 var_fs0 = 0.0f; + s32 pointCount = this->endPoint + 1; + s32 i; + Vec3f prevPathVec; + Vec3f curPathVec; + Vec3s* curPathPoint = this->pathPoints; + f32 pathLength = 0.0f; - Math_Vec3s_ToVec3f(&sp48, var_s0); - var_s0++; - for (var_s1 = 1; var_s1 < temp_s4; var_s1++, var_s0++) { - Math_Vec3f_Copy(&sp54, &sp48); - Math_Vec3s_ToVec3f(&sp48, var_s0); - var_fs0 += Math3D_Distance(&sp54, &sp48); + Math_Vec3s_ToVec3f(&curPathVec, curPathPoint); + + for (curPathPoint++, i = 1; i < pointCount; curPathPoint++, i++) { + Math_Vec3f_Copy(&prevPathVec, &curPathVec); + Math_Vec3s_ToVec3f(&curPathVec, curPathPoint); + pathLength += Math3D_Distance(&prevPathVec, &curPathVec); } - return var_fs0; + return pathLength; } void EnInvadepoh_SetPath(EnInvadepoh* this, PlayState* play) { @@ -467,11 +467,11 @@ void EnInvadepoh_SetPath(EnInvadepoh* this, PlayState* play) { this->pathPoints = Lib_SegmentedToVirtual(path->points); } -void EnInvadepoh_SetPosToPathPoint(EnInvadepoh* this, s32 arg1) { - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[arg1]); +void EnInvadepoh_SetPosToPathPoint(EnInvadepoh* this, s32 point) { + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[point]); } -s32 EnInvadepoh_Dog_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { +s32 EnInvadepoh_Dog_IsOnPath(EnInvadepoh* thisx, f32 highValue, f32 lowValue) { EnInvadepoh* this = thisx; // TODO: why recast? Vec3s* currentPoint = &this->pathPoints[this->currentPoint]; Vec3s* nextPoint = &this->pathPoints[this->currentPoint] + 1; @@ -498,7 +498,7 @@ s32 EnInvadepoh_Dog_IsOnPath(EnInvadepoh* thisx, f32 arg1, f32 arg2) { travelSegmentZ = this->actor.world.pos.z - currentPoint->z; distOffPath = fabsf((travelSegmentX * pathUnitVecZ) - (travelSegmentZ * pathUnitVecX)); - if (distOffPath > (arg1 - arg2)) { + if (distOffPath > (highValue - lowValue)) { return false; } @@ -551,27 +551,27 @@ void EnInvadepoh_Invader_SetProgress(EnInvadepoh* this) { } void EnInvadepoh_Invader_SetCheckpoints(EnInvadepoh* this) { - f32 temp_fs3 = 1.0f / this->pathLength; - s32 temp_s4 = this->endPoint; - s32 var_s1; - Vec3f sp54; - Vec3f sp48; - Vec3s* var_s0 = this->pathPoints; - f32 var_fs0 = 0.0f; - f32* var_s2; + f32 invPathLength = 1.0f / this->pathLength; + s32 endPoint = this->endPoint; + s32 i; + Vec3f prevPathPoint; + Vec3f pathPointF; + Vec3s* pathPoint = this->pathPoints; + f32 pathPointLength = 0.0f; + f32* checkpoints; - Math_Vec3s_ToVec3f(&sp48, var_s0); - var_s0++; - var_s2 = this->checkpoints; - for (var_s1 = 1; var_s1 < temp_s4; var_s1++, var_s0++, var_s2++) { - Math_Vec3f_Copy(&sp54, &sp48); - Math_Vec3s_ToVec3f(&sp48, var_s0); - var_fs0 += Math3D_Distance(&sp54, &sp48); - *var_s2 = var_fs0 * temp_fs3; - if (*var_s2 < 0.0f) { - *var_s2 = 0.0f; - } else if (*var_s2 > 1.0f) { - *var_s2 = 1.0f; + Math_Vec3s_ToVec3f(&pathPointF, pathPoint); + pathPoint++; + checkpoints = this->checkpoints; + for (i = 1; i < endPoint; i++, pathPoint++, checkpoints++) { + Math_Vec3f_Copy(&prevPathPoint, &pathPointF); + Math_Vec3s_ToVec3f(&pathPointF, pathPoint); + pathPointLength += Math3D_Distance(&prevPathPoint, &pathPointF); + *checkpoints = pathPointLength * invPathLength; + if (*checkpoints < 0.0f) { + *checkpoints = 0.0f; + } else if (*checkpoints > 1.0f) { + *checkpoints = 1.0f; } } } @@ -604,9 +604,9 @@ void EnInvadepoh_Night1Romani_SetProgress(EnInvadepoh* this) { } else if ((gSaveContext.save.time >= CLOCK_TIME(2, 15)) && (gSaveContext.save.time < CLOCK_TIME(6, 00))) { this->progress = 1.0f; } else { - f32 temp = (gSaveContext.save.time - CLOCK_TIME(2, 00)) * (1.0f / (CLOCK_TIME(2, 15) - CLOCK_TIME(2, 00))); + f32 progress = (gSaveContext.save.time - CLOCK_TIME(2, 00)) * (1.0f / (CLOCK_TIME(2, 15) - CLOCK_TIME(2, 00))); - this->progress = temp; + this->progress = progress; this->progress = CLAMP(this->progress, 0.0f, 1.0f); } } @@ -654,45 +654,46 @@ void EnInvadepoh_Night3Romani_SetProgress(EnInvadepoh* this) { } } -void EnInvadepoh_Invader_SetPositionAlongPath(EnInvadepoh* this, PlayState* play) { +void EnInvadepoh_Invader_ApplyProgress(EnInvadepoh* this, PlayState* play) { s32 pad; - Vec3s* sp60; - s32 pad2; - Vec3f sp50; - Vec3f sp44; - f32 sp40 = this->actor.world.pos.y; - f32 sp3C; - f32 sp38; + Vec3s* curPathPoint; + Vec3s* nextPathPoint; + Vec3f curPathPointF; + Vec3f nextPathPointF; + f32 yPosTemp = this->actor.world.pos.y; + f32 curCheckpoint; + f32 nextCheckpoint; - sp60 = &this->pathPoints[this->currentPoint]; - sp3C = (this->currentPoint < 1) ? 0.0f : this->checkpoints[this->currentPoint - 1]; - sp38 = (this->currentPoint < (this->endPoint - 1)) ? this->checkpoints[this->currentPoint] : 1.0f; + curPathPoint = this->pathPoints + this->currentPoint; + nextPathPoint = curPathPoint + 1; + curCheckpoint = (this->currentPoint <= 0) ? 0.0f : this->checkpoints[this->currentPoint - 1]; + nextCheckpoint = (this->currentPoint < (this->endPoint - 1)) ? this->checkpoints[this->currentPoint] : 1.0f; - if (sp38 - sp3C < 0.001f) { - Math_Vec3s_ToVec3f(&this->unk_314, sp60); + if (nextCheckpoint - curCheckpoint < 0.001f) { + Math_Vec3s_ToVec3f(&this->unk_314, curPathPoint); } else { - f32 sp34 = this->progress - sp3C; - f32 sp30 = sp38 - this->progress; - f32 sp2C = 1.0f / (sp38 - sp3C); + f32 nextWeight = this->progress - curCheckpoint; + f32 prevWeight = nextCheckpoint - this->progress; + f32 invPathLength = 1.0f / (nextCheckpoint - curCheckpoint); s32 pad3; - Math_Vec3s_ToVec3f(&sp50, sp60); - Math_Vec3s_ToVec3f(&sp44, sp60 + 1); - this->unk_314.x = ((sp50.x * sp30) + (sp44.x * sp34)) * sp2C; - this->unk_314.y = ((sp50.y * sp30) + (sp44.y * sp34)) * sp2C; - this->unk_314.z = ((sp50.z * sp30) + (sp44.z * sp34)) * sp2C; + Math_Vec3s_ToVec3f(&curPathPointF, curPathPoint); + Math_Vec3s_ToVec3f(&nextPathPointF, nextPathPoint); + this->unk_314.x = ((curPathPointF.x * prevWeight) + (nextPathPointF.x * nextWeight)) * invPathLength; + this->unk_314.y = ((curPathPointF.y * prevWeight) + (nextPathPointF.y * nextWeight)) * invPathLength; + this->unk_314.z = ((curPathPointF.z * prevWeight) + (nextPathPointF.z * nextWeight)) * invPathLength; } Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_314); func_800B4AEC(play, &this->actor, 0.0f); if (this->actor.floorHeight > BGCHECK_Y_MIN + 1.0f) { - if (sp40 < this->actor.floorHeight) { + if (yPosTemp < 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; + this->actor.world.pos.y = this->actor.velocity.y + yPosTemp; if (this->actor.floorHeight < this->actor.world.pos.y) { this->actor.world.pos.y = this->actor.floorHeight; } @@ -702,14 +703,14 @@ void EnInvadepoh_Invader_SetPositionAlongPath(EnInvadepoh* this, PlayState* play } else { this->actor.velocity.y -= 2.0f; } - this->actor.world.pos.y = this->actor.velocity.y + sp40; + this->actor.world.pos.y = this->actor.velocity.y + yPosTemp; 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; + this->actor.world.pos.y = yPosTemp; } } @@ -731,32 +732,32 @@ void EnInvadepoh_Invader_Knockback(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_Invader_EmptyFunc(EnInvadepoh* this) { } -s32 EnInvadepoh_Romani_MoveAlongPath(EnInvadepoh* this, PlayState* play, f32 arg2, f32 arg3) { +s32 EnInvadepoh_Romani_MoveAlongPath(EnInvadepoh* this, PlayState* play, f32 speed, f32 height) { s32 pad; // TODO: recast? Vec3s* nextPathPoint = &this->pathPoints[this->currentPoint + 1]; s32 reachedNextPoint = EnInvadepoh_StepTowardXZ(&this->actor.world.pos.x, &this->actor.world.pos.z, - nextPathPoint->x, nextPathPoint->z, arg2); + nextPathPoint->x, nextPathPoint->z, speed); - func_800B4AEC(play, &this->actor, arg3); + func_800B4AEC(play, &this->actor, height); EnInvadepoh_SnapToFloor(this); return reachedNextPoint; } void EnInvadepoh_Night1Romani_MoveAlongPathTimed(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? - f32 sp18 = this->actor.world.pos.y; + f32 yPosTemp = this->actor.world.pos.y; - EnInvadepoh_Romani_SetPositionAlongPath(this, &this->currentPoint, &this->actor.world.pos); - this->actor.world.pos.y = sp18; + EnInvadepoh_Romani_ApplyProgress(this, &this->currentPoint, &this->actor.world.pos); + this->actor.world.pos.y = yPosTemp; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); } s32 EnInvadepoh_Dog_MoveAlongPath(EnInvadepoh* this, PlayState* play) { + s32 pad; Vec3s* currentPathPoint = &this->pathPoints[this->currentPoint]; - Vec3s* nextPathPoint; s32 nextPoint; - u32 var_v0; + Vec3s* nextPathPoint; f32 nextPathPointX; f32 nextPathPointZ; f32 curPathPointX; @@ -764,8 +765,8 @@ s32 EnInvadepoh_Dog_MoveAlongPath(EnInvadepoh* this, PlayState* play) { Vec3f currentToNext; Vec3f worldToNext; Vec3f worldToCurrent; - Vec3f sp48; - f32 sp44; + Vec3f worldToTarget; + f32 angleToNext; s32 reachedNext = false; nextPoint = this->currentPoint + this->pathStep; @@ -796,17 +797,18 @@ s32 EnInvadepoh_Dog_MoveAlongPath(EnInvadepoh* this, PlayState* play) { worldToCurrent.z = curPathPointZ - this->actor.world.pos.z; if (this->actor.speed > 0.0f) { - if (Math3D_AngleBetweenVectors(¤tToNext, &worldToNext, &sp44)) { + if (Math3D_AngleBetweenVectors(¤tToNext, &worldToNext, &angleToNext)) { reachedNext = true; - } else if (sp44 <= 0.0f) { + } else if (angleToNext <= 0.0f) { reachedNext = true; } } - sp48.x = ((worldToNext.x + worldToCurrent.x) * 0.9f) + currentToNext.x; - sp48.y = 0.0f; - sp48.z = ((worldToNext.z + worldToCurrent.z) * 0.9f) + currentToNext.z; + // Instead of targeting nextPathPoint, the target is about 5% beyond it along that path segment. + worldToTarget.x = ((worldToNext.x + worldToCurrent.x) * 0.9f) + currentToNext.x; + worldToTarget.y = 0.0f; + worldToTarget.z = ((worldToNext.z + worldToCurrent.z) * 0.9f) + currentToNext.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(sp48.z, sp48.x), 4, 0xFA0, 0x64); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(worldToTarget.z, worldToTarget.x), 4, 0xFA0, 0x64); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, EnInvadepoh_Dog_IsOnPath(this, 50.0f, 15.0f) @@ -825,10 +827,10 @@ void EnInvadepoh_Dog_Move(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_Night3Romani_MoveAlongPathTimed(EnInvadepoh* this, PlayState* play) { s32 pad; // TODO: recast? - f32 sp18 = this->actor.world.pos.y; + f32 yPosTemp = this->actor.world.pos.y; - EnInvadepoh_Romani_SetPositionAlongPath(this, &this->currentPoint, &this->actor.world.pos); - this->actor.world.pos.y = sp18; + EnInvadepoh_Romani_ApplyProgress(this, &this->currentPoint, &this->actor.world.pos); + this->actor.world.pos.y = yPosTemp; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); } @@ -849,16 +851,16 @@ void EnInvadepoh_Romani_DesegmentTextures(void) { } void EnInvadepoh_Cremia_DesegmentTextures(void) { - TexturePtr* var_s0; + TexturePtr* texture; s32 i; if (!sCremiaTexturesDesegmented) { sCremiaTexturesDesegmented = true; - for (i = 0, var_s0 = sCremiaEyeTextures; i < 6; i++, var_s0++) { - *var_s0 = Lib_SegmentedToVirtual(*var_s0); + for (i = 0, texture = sCremiaEyeTextures; i < 6; i++, texture++) { + *texture = Lib_SegmentedToVirtual(*texture); } - for (i = 0, var_s0 = sCremiaMouthTextures; i < 4; i++, var_s0++) { - *var_s0 = Lib_SegmentedToVirtual(*var_s0); + for (i = 0, texture = sCremiaMouthTextures; i < 4; i++, texture++) { + *texture = Lib_SegmentedToVirtual(*texture); } } } @@ -906,7 +908,7 @@ void EnInvadepoh_Event_CheckState(EnInvadepoh* this, PlayState* play) { } else if (currentTime < CLOCK_TIME(5, 15)) { s32 i; s32 firstSpawn = CLOCK_TIME(5, 15); - s32 temp; + s32 pad; for (i = 0; i < this->spawnCount; i++) { s32 spawnTime = EnInvadepoh_Invader_GetSpawnTime(i); @@ -944,10 +946,10 @@ void EnInvadepoh_Event_SpawnInvaders(EnInvadepoh* this, PlayState* play) { } } -void EnInvadepoh_Abductor_SpawnCow(EnInvadepoh* this, PlayState* play, s32 arg2) { +void EnInvadepoh_Abductor_SpawnCow(EnInvadepoh* this, PlayState* play, s32 index) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, - ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, arg2)); + ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_COW, index)); } void EnInvadepoh_Abductor_SpawnRomani(EnInvadepoh* this, PlayState* play) { @@ -962,12 +964,12 @@ void EnInvadepoh_Event_SpawnLightBall(EnInvadepoh* this, PlayState* play) { ENINVADEPOH_SET_PARAMS(0, ENINVADEPOH_LIGHT_BALL, 0)); } -void EnInvadepoh_LightBall_ReplaceTranslation(Vec3f* newTrans) { +void EnInvadepoh_LightBall_ReplaceTranslation(Vec3f* translation) { MtxF* curMtxF = Matrix_GetCurrent(); - curMtxF->mf[3][0] = newTrans->x; - curMtxF->mf[3][1] = newTrans->y; - curMtxF->mf[3][2] = newTrans->z; + curMtxF->xw = translation->x; + curMtxF->yw = translation->y; + curMtxF->zw = translation->z; } s32 EnInvadepoh_Romani_OpenDoor(EnInvadepoh* this, PlayState* play, f32 range, s32 doorTimer) { @@ -1073,21 +1075,21 @@ s8 EnInvadepoh_Interact_GetNextAnim(EnInvadepohFaceAnimNext* nextAnims, s32 next return (nextAnims + nextIndex)->index; // TODO: fake? } -void EnInvadepoh_Interact_SetNextAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed* faceAnim) { +void EnInvadepoh_Interact_SetNextAnim(EnInvadePohFaceAnimInfo* faceInfo, EnInvadepohFaceAnim* faceAnim) { faceInfo->curAnimType = faceAnim->type; faceInfo->curAnim = faceAnim; faceInfo->curFrame = 0; faceInfo->curIndex = faceAnim->frames->texIndex[0]; if (faceInfo->curAnimType == 2) { - EnInvadepohFaceAnimLoopDelayed* faceDelayedLoopAnim = (EnInvadepohFaceAnimLoopDelayed*)faceAnim; + EnInvadepohFaceAnimDelayedBranched* faceDelayedLoopAnim = (EnInvadepohFaceAnimDelayedBranched*)faceAnim; faceInfo->delayTimer = Rand_S16Offset(faceDelayedLoopAnim->minDelay, faceDelayedLoopAnim->maxDelay); } } -void EnInvadepoh_Interact_UpdateFixedAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { - EnInvadepohFaceAnimFixed* faceAnim = faceInfo->curAnim; - EnInvadepohFaceAnim* faceFrames = faceAnim->frames; +void EnInvadepoh_Interact_UpdateFixedAnim(EnInvadePohFaceAnimInfo* faceInfo, EnInvadepohFaceAnim** animSet) { + EnInvadepohFaceAnim* faceAnim = faceInfo->curAnim; + EnInvadepohFaceFrames* faceFrames = faceAnim->frames; if (faceInfo->curFrame < (faceFrames->count - 1)) { faceInfo->curFrame++; @@ -1095,24 +1097,24 @@ void EnInvadepoh_Interact_UpdateFixedAnim(EnInvadePohFaceInfo* faceInfo, EnInvad } } -void EnInvadepoh_Interact_UpdateLoopedAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { - EnInvadepohFaceAnimLoop* faceAnimLoop = (EnInvadepohFaceAnimLoop*)faceInfo->curAnim; - EnInvadepohFaceAnim* faceFrames = faceAnimLoop->anim.frames; +void EnInvadepoh_Interact_UpdateBranchedAnim(EnInvadePohFaceAnimInfo* faceInfo, EnInvadepohFaceAnim** animSet) { + EnInvadepohFaceAnimBranched* faceAnimLoop = (EnInvadepohFaceAnimBranched*)faceInfo->curAnim; + EnInvadepohFaceFrames* faceFrames = faceAnimLoop->anim.frames; if (faceInfo->curFrame < (faceFrames->count - 1)) { faceInfo->curFrame++; faceInfo->curIndex = faceFrames->texIndex[faceInfo->curFrame]; } else { - EnInvadepohFaceAnimFixed* nextAnim = + EnInvadepohFaceAnim* nextAnim = animSet[EnInvadepoh_Interact_GetNextAnim(faceAnimLoop->nextAnims, faceAnimLoop->nextCount)]; EnInvadepoh_Interact_SetNextAnim(faceInfo, nextAnim); } } -void EnInvadepoh_Interact_UpdateDelayedLoopAnim(EnInvadePohFaceInfo* faceInfo, EnInvadepohFaceAnimFixed** animSet) { - EnInvadepohFaceAnimLoopDelayed* faceAnimLoopDelayed = (EnInvadepohFaceAnimLoopDelayed*)faceInfo->curAnim; - EnInvadepohFaceAnim* faceFrames = faceAnimLoopDelayed->loop.anim.frames; +void EnInvadepoh_Interact_UpdateDelayedBranchedAnim(EnInvadePohFaceAnimInfo* faceInfo, EnInvadepohFaceAnim** animSet) { + EnInvadepohFaceAnimDelayedBranched* faceAnimLoopDelayed = (EnInvadepohFaceAnimDelayedBranched*)faceInfo->curAnim; + EnInvadepohFaceFrames* faceFrames = faceAnimLoopDelayed->loop.anim.frames; if (faceInfo->curFrame < (faceFrames->count - 1)) { faceInfo->curFrame++; @@ -1120,7 +1122,7 @@ void EnInvadepoh_Interact_UpdateDelayedLoopAnim(EnInvadePohFaceInfo* faceInfo, E } else if (faceInfo->delayTimer > 0) { faceInfo->delayTimer--; } else { - EnInvadepohFaceAnimFixed* nextAnim = animSet[EnInvadepoh_Interact_GetNextAnim( + EnInvadepohFaceAnim* nextAnim = animSet[EnInvadepoh_Interact_GetNextAnim( faceAnimLoopDelayed->loop.nextAnims, faceAnimLoopDelayed->loop.nextCount)]; EnInvadepoh_Interact_SetNextAnim(faceInfo, nextAnim); @@ -1134,14 +1136,14 @@ s8 D_80B4E9AC[6] = { 0, 1, 2, 2, 1, 0 }; s8 D_80B4E9B4[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; s8 D_80B4E9BC[1] = { 1 }; s8 D_80B4E9C0[1] = { 3 }; -EnInvadepohFaceAnim D_80B4E9C4 = { D_80B4E99C, 1 }; -EnInvadepohFaceAnim D_80B4E9CC = { D_80B4E9A0, 4 }; -EnInvadepohFaceAnim D_80B4E9D4 = { D_80B4E9A4, 5 }; -EnInvadepohFaceAnim D_80B4E9DC = { D_80B4E9AC, 6 }; -EnInvadepohFaceAnim D_80B4E9E4 = { D_80B4E9B4, 8 }; -EnInvadepohFaceAnim D_80B4E9EC = { D_80B4E9BC, 1 }; -EnInvadepohFaceAnim D_80B4E9F4 = { D_80B4E9C0, 1 }; -EnInvadepohFaceAnimFixed D_80B4E9FC = { 0, &D_80B4E9C4 }; +EnInvadepohFaceFrames D_80B4E9C4 = { D_80B4E99C, 1 }; +EnInvadepohFaceFrames D_80B4E9CC = { D_80B4E9A0, 4 }; +EnInvadepohFaceFrames D_80B4E9D4 = { D_80B4E9A4, 5 }; +EnInvadepohFaceFrames D_80B4E9DC = { D_80B4E9AC, 6 }; +EnInvadepohFaceFrames D_80B4E9E4 = { D_80B4E9B4, 8 }; +EnInvadepohFaceFrames D_80B4E9EC = { D_80B4E9BC, 1 }; +EnInvadepohFaceFrames D_80B4E9F4 = { D_80B4E9C0, 1 }; +EnInvadepohFaceAnim D_80B4E9FC = { 0, &D_80B4E9C4 }; EnInvadepohFaceAnimNext D_80B4EA04[4] = { { 2, 0.5f }, { 3, 0.9f }, @@ -1149,14 +1151,14 @@ EnInvadepohFaceAnimNext D_80B4EA04[4] = { { 5, 1.0f }, }; EnInvadepohFaceAnimNext D_80B4EA24[1] = { 1, 1.0f }; -EnInvadepohFaceAnimLoopDelayed D_80B4EA2C = { { { 2, &D_80B4E9C4 }, 4, D_80B4EA04 }, 40, 60 }; -EnInvadepohFaceAnimLoop D_80B4EA40 = { { 1, &D_80B4E9CC }, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA50 = { { 1, &D_80B4E9D4 }, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA60 = { { 1, &D_80B4E9DC }, 1, D_80B4EA24 }; -EnInvadepohFaceAnimLoop D_80B4EA70 = { { 1, &D_80B4E9E4 }, 1, D_80B4EA24 }; -EnInvadepohFaceAnimFixed D_80B4EA80 = { 0, &D_80B4E9EC }; -EnInvadepohFaceAnimFixed D_80B4EA88 = { 0, &D_80B4E9F4 }; -EnInvadepohFaceAnimFixed* D_80B4EA90[8] = { +EnInvadepohFaceAnimDelayedBranched D_80B4EA2C = { { { 2, &D_80B4E9C4 }, 4, D_80B4EA04 }, 40, 60 }; +EnInvadepohFaceAnimBranched D_80B4EA40 = { { 1, &D_80B4E9CC }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimBranched D_80B4EA50 = { { 1, &D_80B4E9D4 }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimBranched D_80B4EA60 = { { 1, &D_80B4E9DC }, 1, D_80B4EA24 }; +EnInvadepohFaceAnimBranched D_80B4EA70 = { { 1, &D_80B4E9E4 }, 1, D_80B4EA24 }; +EnInvadepohFaceAnim D_80B4EA80 = { 0, &D_80B4E9EC }; +EnInvadepohFaceAnim D_80B4EA88 = { 0, &D_80B4E9F4 }; +EnInvadepohFaceAnim* D_80B4EA90[8] = { &D_80B4E9FC, &D_80B4EA2C.loop.anim, &D_80B4EA40.anim, &D_80B4EA50.anim, &D_80B4EA60.anim, &D_80B4EA70.anim, &D_80B4EA80, &D_80B4EA88, }; @@ -1165,15 +1167,15 @@ s8 D_80B4EAB0[1] = { 0 }; s8 D_80B4EAB4[1] = { 1 }; s8 D_80B4EAB8[1] = { 2 }; s8 D_80B4EABC[1] = { 3 }; -EnInvadepohFaceAnim D_80B4EAC0 = { D_80B4EAB0, 1 }; -EnInvadepohFaceAnim D_80B4EAC8 = { D_80B4EAB4, 1 }; -EnInvadepohFaceAnim D_80B4EAD0 = { D_80B4EAB8, 1 }; -EnInvadepohFaceAnim D_80B4EAD8 = { D_80B4EABC, 1 }; -EnInvadepohFaceAnimFixed D_80B4EAE0 = { 0, &D_80B4EAC0 }; -EnInvadepohFaceAnimFixed D_80B4EAE8 = { 0, &D_80B4EAC8 }; -EnInvadepohFaceAnimFixed D_80B4EAF0 = { 0, &D_80B4EAD0 }; -EnInvadepohFaceAnimFixed D_80B4EAF8 = { 0, &D_80B4EAD8 }; -EnInvadepohFaceAnimFixed* D_80B4EB00[4] = { +EnInvadepohFaceFrames D_80B4EAC0 = { D_80B4EAB0, 1 }; +EnInvadepohFaceFrames D_80B4EAC8 = { D_80B4EAB4, 1 }; +EnInvadepohFaceFrames D_80B4EAD0 = { D_80B4EAB8, 1 }; +EnInvadepohFaceFrames D_80B4EAD8 = { D_80B4EABC, 1 }; +EnInvadepohFaceAnim D_80B4EAE0 = { 0, &D_80B4EAC0 }; +EnInvadepohFaceAnim D_80B4EAE8 = { 0, &D_80B4EAC8 }; +EnInvadepohFaceAnim D_80B4EAF0 = { 0, &D_80B4EAD0 }; +EnInvadepohFaceAnim D_80B4EAF8 = { 0, &D_80B4EAD8 }; +EnInvadepohFaceAnim* D_80B4EB00[4] = { &D_80B4EAE0, &D_80B4EAE8, &D_80B4EAF0, @@ -1185,12 +1187,12 @@ s8 D_80B4EB14[4] = { 0, 1, 2, 0 }; s8 D_80B4EB18[5] = { 0, 1, 2, 1, 0 }; s8 D_80B4EB20[6] = { 0, 1, 2, 2, 1, 0 }; s8 D_80B4EB28[8] = { 0, 1, 2, 1, 0, 1, 2, 0 }; -EnInvadepohFaceAnim D_80B4EB30 = { D_80B4EB10, 1 }; -EnInvadepohFaceAnim D_80B4EB38 = { D_80B4EB14, 4 }; -EnInvadepohFaceAnim D_80B4EB40 = { D_80B4EB18, 5 }; -EnInvadepohFaceAnim D_80B4EB48 = { D_80B4EB20, 6 }; -EnInvadepohFaceAnim D_80B4EB50 = { D_80B4EB28, 8 }; -EnInvadepohFaceAnimFixed D_80B4EB58 = { 0, &D_80B4EB30 }; +EnInvadepohFaceFrames D_80B4EB30 = { D_80B4EB10, 1 }; +EnInvadepohFaceFrames D_80B4EB38 = { D_80B4EB14, 4 }; +EnInvadepohFaceFrames D_80B4EB40 = { D_80B4EB18, 5 }; +EnInvadepohFaceFrames D_80B4EB48 = { D_80B4EB20, 6 }; +EnInvadepohFaceFrames D_80B4EB50 = { D_80B4EB28, 8 }; +EnInvadepohFaceAnim D_80B4EB58 = { 0, &D_80B4EB30 }; EnInvadepohFaceAnimNext D_80B4EB60[4] = { { 2, 0.5f }, { 3, 0.9f }, @@ -1198,25 +1200,25 @@ EnInvadepohFaceAnimNext D_80B4EB60[4] = { { 5, 1.0f }, }; EnInvadepohFaceAnimNext D_80B4EB80[1] = { 1, 1.0f }; -EnInvadepohFaceAnimLoopDelayed D_80B4EB88 = { { { 2, &D_80B4EB30 }, 4, D_80B4EB60 }, 40, 60 }; -EnInvadepohFaceAnimLoop D_80B4EB9C = { { 1, &D_80B4EB38 }, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBAC = { { 1, &D_80B4EB40 }, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBBC = { { 1, &D_80B4EB48 }, 1, D_80B4EB80 }; -EnInvadepohFaceAnimLoop D_80B4EBCC = { { 1, &D_80B4EB50 }, 1, D_80B4EB80 }; -EnInvadepohFaceAnimFixed* D_80B4EBDC[6] = { +EnInvadepohFaceAnimDelayedBranched D_80B4EB88 = { { { 2, &D_80B4EB30 }, 4, D_80B4EB60 }, 40, 60 }; +EnInvadepohFaceAnimBranched D_80B4EB9C = { { 1, &D_80B4EB38 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimBranched D_80B4EBAC = { { 1, &D_80B4EB40 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimBranched D_80B4EBBC = { { 1, &D_80B4EB48 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnimBranched D_80B4EBCC = { { 1, &D_80B4EB50 }, 1, D_80B4EB80 }; +EnInvadepohFaceAnim* D_80B4EBDC[6] = { &D_80B4EB58, &D_80B4EB88.loop.anim, &D_80B4EB9C.anim, &D_80B4EBAC.anim, &D_80B4EBBC.anim, &D_80B4EBCC.anim, }; s8 D_80B4EBF4[1] = { 0 }; -EnInvadepohFaceAnim D_80B4EBF8 = { D_80B4EBF4, 1 }; -EnInvadepohFaceAnimFixed D_80B4EC00 = { 0, &D_80B4EBF8 }; -EnInvadepohFaceAnimFixed* D_80B4EC08[1] = { &D_80B4EC00 }; +EnInvadepohFaceFrames D_80B4EBF8 = { D_80B4EBF4, 1 }; +EnInvadepohFaceAnim D_80B4EC00 = { 0, &D_80B4EBF8 }; +EnInvadepohFaceAnim* D_80B4EC08[1] = { &D_80B4EC00 }; -void EnInvadepoh_Interact_UpdateAnimation(EnInvadePohFaceInfo* faceInfo) { +void EnInvadepoh_Interact_UpdateAnimation(EnInvadePohFaceAnimInfo* faceInfo) { static EnInvadepohFaceFunc sFaceUpdateFuncs[3] = { EnInvadepoh_Interact_UpdateFixedAnim, - EnInvadepoh_Interact_UpdateLoopedAnim, - EnInvadepoh_Interact_UpdateDelayedLoopAnim, + EnInvadepoh_Interact_UpdateBranchedAnim, + EnInvadepoh_Interact_UpdateDelayedBranchedAnim, }; if ((faceInfo->animSet != NULL) && (faceInfo->curAnim != NULL)) { @@ -1224,16 +1226,16 @@ void EnInvadepoh_Interact_UpdateAnimation(EnInvadePohFaceInfo* faceInfo) { } } -void EnInvadepoh_Interact_Init(EnInvadePohInteractInfo* interactInfo, EnInvadepohFaceAnimFixed** eyeAnimSet, - s32 curEyeAnim, EnInvadepohFaceAnimFixed** mouthAnimSet, s32 curMouthAnim, Vec3s* arg5, - s16 arg6, f32 arg7, f32 arg8, f32 arg9) { - Math_Vec3s_Copy(&interactInfo->headRotTarget, arg5); - interactInfo->maxTurnRate = arg6; - interactInfo->scaledTurnRate = arg7; - interactInfo->torsoRotXModTarget = arg8; - interactInfo->torsoRotXModStep = arg9; +void EnInvadepoh_Interact_Init(EnInvadePohInteractInfo* interactInfo, EnInvadepohFaceAnim** eyeAnimSet, + s32 curEyeAnim, EnInvadepohFaceAnim** mouthAnimSet, s32 curMouthAnim, Vec3s* headRotTarget, + s16 maxTurnRate, f32 scaledTurnRate, f32 torsoRotXModTarget, f32 torsoRotXModStep) { + Math_Vec3s_Copy(&interactInfo->headRotTarget, headRotTarget); + interactInfo->maxTurnRate = maxTurnRate; + interactInfo->scaledTurnRate = scaledTurnRate; + interactInfo->torsoRotXModTarget = torsoRotXModTarget; + interactInfo->torsoRotXModStep = torsoRotXModStep; if (eyeAnimSet != NULL) { - EnInvadepohFaceAnimFixed* faceAnim = eyeAnimSet[curEyeAnim]; + EnInvadepohFaceAnim* faceAnim = eyeAnimSet[curEyeAnim]; interactInfo->eyeAnim.animSet = eyeAnimSet; interactInfo->eyeAnim.curAnimType = faceAnim->type; @@ -1243,7 +1245,7 @@ void EnInvadepoh_Interact_Init(EnInvadePohInteractInfo* interactInfo, EnInvadepo interactInfo->eyeAnim.curIndex = faceAnim->frames->texIndex[0]; } if (mouthAnimSet != NULL) { - EnInvadepohFaceAnimFixed* faceAnim = mouthAnimSet[curMouthAnim]; + EnInvadepohFaceAnim* faceAnim = mouthAnimSet[curMouthAnim]; interactInfo->mouthAnim.animSet = mouthAnimSet; interactInfo->mouthAnim.curAnimType = faceAnim->type; @@ -1288,35 +1290,35 @@ void EnInvadepoh_Interact_Update(EnInvadePohInteractInfo* interactInfo) { EnInvadepoh_Interact_UpdateAnimation(&interactInfo->mouthAnim); } -void EnInvadepoh_LightBall_SpawnSparkles(EnInvadepoh* this, PlayState* play, s32 arg2) { +void EnInvadepoh_LightBall_SpawnSparkles(EnInvadepoh* this, PlayState* play, s32 spawnCount) { static Color_RGBA8 sLightYellow = { 255, 255, 200, 255 }; static Color_RGBA8 sGoldenYellow = { 255, 200, 0, 0 }; - s32 var_s1; - Vec3f spA8; - Vec3f sp9C; - Vec3f sp90; - f32 temp_fs0; - s16 var_s0 = 0; + s32 i; + Vec3f pos; + Vec3f velocity; + Vec3f accel; + f32 spawnOffset; + s16 spawnAngle = 0; - for (var_s1 = 0; var_s1 < arg2; var_s1++) { - var_s0 += (s16)(0x10000 * 1.0f / arg2); - temp_fs0 = (Rand_ZeroOne() * 0.5f) + 0.5f; + for (i = 0; i < spawnCount; i++) { + spawnAngle += (s16)(0x10000 * 1.0f / spawnCount); + spawnOffset = (Rand_ZeroOne() * 0.5f) + 0.5f; - spA8.x = Math_SinS(var_s0) * temp_fs0; - spA8.z = Math_CosS(var_s0) * temp_fs0; + pos.x = Math_SinS(spawnAngle) * spawnOffset; + pos.z = Math_CosS(spawnAngle) * spawnOffset; - 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; + velocity.x = (Rand_ZeroOne() * 16.0f) + (pos.x * 30.0f) - 8.0f; + velocity.y = -8.0f; + velocity.z = (Rand_ZeroOne() * 16.0f) + (pos.z * 30.0f) - 8.0f; - sp90.x = sp9C.x * -0.025f; - sp90.y = sp9C.y * -0.025f; - sp90.z = sp9C.z * -0.025f; + accel.x = velocity.x * -0.025f; + accel.y = velocity.y * -0.025f; + accel.z = velocity.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(play, &spA8, &sp9C, &sp90, &sLightYellow, &sGoldenYellow, 6000, -40); + pos.x = (pos.x * 100.0f) + this->actor.world.pos.x; + pos.y = (Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y - 90.0f; + pos.z = (pos.z * 100.0f) + this->actor.world.pos.z; + EffectSsKirakira_SpawnDispersed(play, &pos, &velocity, &accel, &sLightYellow, &sGoldenYellow, 6000, -40); } } @@ -1336,7 +1338,7 @@ s32 EnInvadepoh_Invader_SpawnWarp(Vec3f* spawnPos) { return false; } -void EnInvadepoh_Warp_Fade(EnInvadepohWarpEffect* warpEffect) { +void EnInvadepoh_Event_WarpFade(EnInvadepohWarpEffect* warpEffect) { if (warpEffect->timer > 20) { if (warpEffect->alpha < 125) { warpEffect->alpha += 10; @@ -1353,7 +1355,7 @@ void EnInvadepoh_Warp_Fade(EnInvadepohWarpEffect* warpEffect) { } s32 EnInvadepoh_Event_UpdateWarps(void) { - static void (*sEnInvadepohWarpUpdateFuncs[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_Warp_Fade }; + static void (*sEnInvadepohWarpUpdateFuncs[1])(EnInvadepohWarpEffect*) = { EnInvadepoh_Event_WarpFade }; s32 warpActive = false; s32 i; EnInvadepohWarpEffect* warpEffect; @@ -1776,13 +1778,13 @@ void EnInvadepoh_Event_SetupInvasionCs(EnInvadepoh* this) { } void EnInvadepoh_Event_InvasionCs(EnInvadepoh* this, PlayState* play) { - static s16 sAlienWarpTimes[8] = { + static s16 sAlienSpawnTimes[8] = { 130, 125, 115, 100, 80, 78, 76, 74, }; s32 i; for (i = 0; i < 8; i++) { - if (this->actionTimer == sAlienWarpTimes[i]) { + if (this->actionTimer == sAlienSpawnTimes[i]) { sAlienStateFlags[i] |= ENINVADEPOH_INVADER_ACTIVE; } } @@ -1800,17 +1802,12 @@ void EnInvadepoh_Event_SetupInvasion(EnInvadepoh* this) { } void EnInvadepoh_Event_Invasion(EnInvadepoh* this, PlayState* play) { - Actor** var_v1; - EnInvadepoh* temp_a0; - s32 var_v0; - s8 temp_a1; - u16 temp_v0; - s32 i; - if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { SET_WEEKEVENTREG(WEEKEVENTREG_22_01); EnInvadepoh_Event_SetupQueueVictoryCs(this); } else { + s32 i; + EnInvadepoh_Event_SetClosestAlien(this); for (i = 0; i < this->spawnCount; i++) { if ((sAlienInvaders[i] != NULL) && (sAlienInvaders[i]->atBarn)) { @@ -1929,7 +1926,7 @@ void EnInvadepoh_Invader_SetupWaitForEvent(EnInvadepoh* this) { void EnInvadepoh_Invader_WaitForEvent(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetProgress(this); - EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_ApplyProgress(this, play); EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); if (sAlienStateFlags[ENINVADEPOH_GET_INDEX(&this->actor)] & ENINVADEPOH_INVADER_ACTIVE) { Actor_SetScale(&this->actor, 0.01f); @@ -1954,7 +1951,7 @@ void EnInvadepoh_Invader_SetupWaitToRespawn(EnInvadepoh* this) { void EnInvadepoh_Invade_WaitToRespawn(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetProgress(this); - EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_ApplyProgress(this, play); EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); if (this->progress > 0.0f) { Actor_SetScale(&this->actor, 0.01f); @@ -1980,7 +1977,7 @@ void EnInvadepoh_Invader_SetupWarpIn(EnInvadepoh* this) { void EnInvadepoh_Invader_WarpIn(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetProgress(this); - EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_ApplyProgress(this, play); EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->progress >= 0.9999f) { @@ -2024,7 +2021,7 @@ void EnInvadepoh_Invader_SetupAttack(EnInvadepoh* this) { void EnInvadepoh_Invader_Attack(EnInvadepoh* this, PlayState* play) { EnInvadepoh_Invader_SetProgress(this); - EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_ApplyProgress(this, play); EnInvadepoh_Invader_TurnToPath(this, 0x320, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->progress >= 0.9999f) { @@ -2074,24 +2071,24 @@ void EnInvadepoh_Invader_SetupDeath(EnInvadepoh* this) { } void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play) { - static Vec3f D_80B4ED30[5] = { + static Vec3f sDeathScales[5] = { { 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[7] = { + static Vec3f sDeathFlashScales[7] = { { 0.0005f, 0.027999999f, 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 }, }; - Vec3f* temp; + Vec3f* deathScale; EnInvadepoh_Invader_EmptyFunc(this); if (this->stateTimer < 5) { - temp = &D_80B4ED30[this->stateTimer]; - if (temp->x > 0.0f) { + deathScale = &sDeathScales[this->stateTimer]; + if (deathScale->x > 0.0f) { this->present = true; this->eyeBeamAlpha = 255; - Math_Vec3f_Copy(&this->actor.scale, temp); + Math_Vec3f_Copy(&this->actor.scale, deathScale); } else { this->present = false; this->eyeBeamAlpha = 0; @@ -2101,10 +2098,10 @@ void EnInvadepoh_Invader_Death(EnInvadepoh* this, PlayState* play) { this->eyeBeamAlpha = 0; } if ((this->stateTimer >= 2) && (this->stateTimer < 9)) { - temp = &D_80B4ED6C[this->stateTimer - 2]; - if (temp->x > 0.0f) { + deathScale = &sDeathFlashScales[this->stateTimer - 2]; + if (deathScale->x > 0.0f) { this->drawDeathFlash = true; - Math_Vec3f_Copy(&this->deathFlashScale, temp); + Math_Vec3f_Copy(&this->deathFlashScale, deathScale); } else { this->drawDeathFlash = false; } @@ -2142,7 +2139,7 @@ void EnInvadepoh_Invader_WaitForObject(Actor* thisx, PlayState* play2) { this->skelAnime.curFrame = (ENINVADEPOH_GET_INDEX(&this->actor)) * this->skelAnime.endFrame / 8.0f; EnInvadepoh_Invader_SetupPath(this, play); EnInvadepoh_Invader_SetProgress(this); - EnInvadepoh_Invader_SetPositionAlongPath(this, play); + EnInvadepoh_Invader_ApplyProgress(this, play); EnInvadepoh_SetYawAlongPath(this); EnInvadepoh_SnapToFloor(this); if ((sEventState == ENINVADEPOH_EVENT_WAIT) || (gSaveContext.save.time < CLOCK_TIME(2, 31))) { @@ -2244,7 +2241,7 @@ void EnInvadepoh_Cow_Update(Actor* thisx, PlayState* play2) { Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[index], 0x32); if (this->actor.child != NULL) { s32 pad; - MtxF sp28; + MtxF tailMtxF; Matrix_Push(); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -2253,8 +2250,8 @@ void EnInvadepoh_Cow_Update(Actor* thisx, PlayState* play2) { Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); Matrix_MultZero(&this->actor.child->world.pos); - Matrix_Get(&sp28); - Matrix_MtxFToYXZRot(&sp28, &this->actor.child->shape.rot, 0); + Matrix_Get(&tailMtxF); + Matrix_MtxFToYXZRot(&tailMtxF, &this->actor.child->shape.rot, false); Matrix_Pop(); } } @@ -2310,7 +2307,7 @@ void EnInvadepoh_AbductedRomani_SetupYell(EnInvadepoh* this) { void EnInvadepoh_AbductedRomani_Yell(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 20) { - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; interactInfo->headRotTarget.x = 0x7D0; interactInfo->headRotTarget.y = 0; @@ -2326,30 +2323,30 @@ void EnInvadepoh_AbductedRomani_Yell(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_AbductedRomani_SetupStruggle(EnInvadepoh* this) { - this->unk_324.headRotTarget.x = 0xBB8; - this->unk_324.headRotTarget.y = 0; - this->unk_324.headRotTarget.z = 0; - this->unk_324.scaledTurnRate = 0.24f; - this->unk_324.maxTurnRate = 0xBB8; - this->unk_324.torsoRotZTarget = 0x3A98; - this->unk_324.torsoMaxTurnRate = 0.1f; - this->unk_324.torsoMaxTurnStep = 0x7D0; + this->interactInfo.headRotTarget.x = 0xBB8; + this->interactInfo.headRotTarget.y = 0; + this->interactInfo.headRotTarget.z = 0; + this->interactInfo.scaledTurnRate = 0.24f; + this->interactInfo.maxTurnRate = 0xBB8; + this->interactInfo.torsoRotZTarget = 0x3A98; + this->interactInfo.torsoMaxTurnRate = 0.1f; + this->interactInfo.torsoMaxTurnStep = 0x7D0; this->actionTimer = 50; - Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, 0, -5.0f); + Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); this->actor.draw = EnInvadepoh_Romani_Draw; this->actionFunc = EnInvadepoh_AbductedRomani_Struggle; } void EnInvadepoh_AbductedRomani_Struggle(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 40) { - this->unk_324.headRotTarget.y = 0x1B58; + this->interactInfo.headRotTarget.y = 0x1B58; } else if (this->actionTimer == 30) { - this->unk_324.headRotTarget.y = -0x1B58; + this->interactInfo.headRotTarget.y = -0x1B58; } else if (this->actionTimer == 20) { - this->unk_324.headRotTarget.y = 0x1B58; + this->interactInfo.headRotTarget.y = 0x1B58; } else if (this->actionTimer == 10) { - this->unk_324.headRotTarget.y = 0; + this->interactInfo.headRotTarget.y = 0; } this->actionTimer--; if (this->actionTimer <= 0) { @@ -2358,14 +2355,14 @@ void EnInvadepoh_AbductedRomani_Struggle(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_AbductedRomani_SetupEnd(EnInvadepoh* this) { - this->unk_324.headRotTarget.x = 0; - this->unk_324.headRotTarget.y = 0; - this->unk_324.headRotTarget.z = 0; - this->unk_324.scaledTurnRate = 0.24f; - this->unk_324.maxTurnRate = 0x1388; - this->unk_324.torsoRotZTarget = 0; - this->unk_324.torsoMaxTurnRate = 0.28f; - this->unk_324.torsoMaxTurnStep = 0x1B58; + this->interactInfo.headRotTarget.x = 0; + this->interactInfo.headRotTarget.y = 0; + this->interactInfo.headRotTarget.z = 0; + this->interactInfo.scaledTurnRate = 0.24f; + this->interactInfo.maxTurnRate = 0x1388; + this->interactInfo.torsoRotZTarget = 0; + this->interactInfo.torsoMaxTurnRate = 0.28f; + this->interactInfo.torsoMaxTurnStep = 0x1B58; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actor.draw = EnInvadepoh_Romani_Draw; @@ -2387,7 +2384,7 @@ void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.update = EnInvadepoh_AbductedRomani_Update; SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 0x1388, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); EnInvadepoh_AbductedRomani_SetupWait(this); @@ -2397,7 +2394,7 @@ void EnInvadepoh_AbductedRomani_WaitForObject(Actor* thisx, PlayState* play2) { void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; if (this->actor.parent == NULL) { Actor_Kill(&this->actor); @@ -2405,7 +2402,7 @@ void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { } this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if (interactInfo->torsoRotZ != 0) { this->actor.shape.rot.x = -interactInfo->torsoRotZ; } @@ -2413,7 +2410,7 @@ void EnInvadepoh_AbductedRomani_Update(Actor* thisx, PlayState* play2) { void EnInvadepoh_ConfusedRomani_SetupWalk(EnInvadepoh* this) { static s16 D_80B4EDC8[4] = { -0x708, -0x3E8, 0, 0x7D0 }; - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; this->actionTimer = Rand_S16Offset(150, 250); interactInfo->headRotTarget.x = D_80B4EDC8[Rand_Next() >> 0x1E]; @@ -2449,23 +2446,23 @@ void EnInvadepoh_ConfusedRomani_Walk(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_ConfusedRomani_SetupIdle(EnInvadepoh* this) { - EnInvadePohInteractInfo* interactInfo = &this->unk_324; - f32 sp28 = Rand_ZeroOne(); + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; + f32 rand = Rand_ZeroOne(); this->actionTimer = Rand_S16Offset(150, 150); - if (sp28 < 0.5f) { + if (rand < 0.5f) { this->unk_374 = 0; Math_Vec3s_Copy(&interactInfo->headRotTarget, &gZeroVec3s); interactInfo->scaledTurnRate = 0.1f; interactInfo->maxTurnRate = 0x3E8; - } else if (sp28 < 0.75f) { + } else if (rand < 0.75f) { this->unk_374 = 1; interactInfo->headRotTarget.x = Rand_S16Offset(0, 0x7D0); interactInfo->headRotTarget.y = 0; interactInfo->headRotTarget.z = 0; interactInfo->scaledTurnRate = 0.06f; interactInfo->maxTurnRate = 0x3E8; - } else if (sp28 < 0.8f) { + } else if (rand < 0.8f) { this->unk_374 = 2; interactInfo->headRotTarget.x = Rand_S16Offset(-0x7D0, 0x7D0); interactInfo->headRotTarget.y = 0; @@ -2485,7 +2482,7 @@ void EnInvadepoh_ConfusedRomani_SetupIdle(EnInvadepoh* this) { } void EnInvadepoh_ConfusedRomani_Idle(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Math_StepToF(&this->actor.speed, 0.0f, 0.2f); if (EnInvadepoh_Romani_MoveAlongPath(this, play, this->actor.speed, 50.0f)) { @@ -2494,25 +2491,25 @@ void EnInvadepoh_ConfusedRomani_Idle(EnInvadepoh* this, PlayState* play) { if (this->unk_374 == 0) { if ((this->actor.xzDistToPlayer < 350.0f) && (play->gameplayFrames & 0x60)) { Player* player = GET_PLAYER(play); - s16 temp_v0 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + s16 angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - interactInfo->headRotTarget.x = CLAMP((s16)(temp_v0 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0x9C4, 0x9C4); - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - interactInfo->headRotTarget.y = CLAMP((s16)(temp_v0 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); } } else { interactInfo->headRotTarget.x = 0; interactInfo->headRotTarget.y = 0; } if (this->actionTimer > 0) { - s32 temp = (u32)this->actionTimer % 0x20; + s32 timerMod32 = (u32)this->actionTimer % 0x20; - if ((temp == 0) && (Rand_ZeroOne() < 0.3f)) { - s32 temp_v1_3 = (s32)Rand_Next() % 4; + if ((timerMod32 == 0) && (Rand_ZeroOne() < 0.3f)) { + s32 next_unk_374 = (s32)Rand_Next() % 4; - if (temp_v1_3 != this->unk_374) { - this->unk_374 = temp_v1_3; + if (next_unk_374 != this->unk_374) { + this->unk_374 = next_unk_374; if (this->unk_374 == 0) { Math_Vec3s_Copy(&interactInfo->headRotTarget, &gZeroVec3s); interactInfo->scaledTurnRate = 0.07f; @@ -2541,29 +2538,29 @@ void EnInvadepoh_ConfusedRomani_Idle(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_ConfusedRomani_SetupTalk(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; this->actor.speed = 0.0f; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; - temp_v0->scaledTurnRate = 0.05f; - temp_v0->maxTurnRate = 0x4B0; + interactInfo->scaledTurnRate = 0.05f; + interactInfo->maxTurnRate = 0x4B0; this->actionFunc = EnInvadepoh_ConfusedRomani_Talk; } void EnInvadepoh_ConfusedRomani_Talk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x7D0, 0x32); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x23); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_v0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_v0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_ConfusedRomani_SetupIdle(this); @@ -2583,7 +2580,7 @@ void EnInvadepoh_ConfusedRomani_WaitForObject(Actor* thisx, PlayState* play2) { this->actor.textId = 0x3330; // ........ SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_ConfusedRomani_SetupPath(this, play); EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); @@ -2605,7 +2602,7 @@ void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if ((this->actionFunc != EnInvadepoh_ConfusedRomani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } @@ -2649,9 +2646,9 @@ void EnInvadepoh_LightBall_SetupHover(EnInvadepoh* this) { } void EnInvadepoh_LightBall_Hover(EnInvadepoh* this, PlayState* play) { - f32 temp = this->actor.home.pos.y + sLightBallSpawnOffset.y + 300.0f; + f32 hoverY = this->actor.home.pos.y + sLightBallSpawnOffset.y + 300.0f; - if (this->actor.world.pos.y < temp) { + if (this->actor.world.pos.y < hoverY) { this->actor.gravity = 3.0f; } else { this->actor.gravity = -2.0f; @@ -2677,12 +2674,12 @@ void EnInvadepoh_LightBall_SetupSpawnInvaders(EnInvadepoh* this) { } void EnInvadepoh_LightBall_SpawnInvaders(EnInvadepoh* this, PlayState* play) { - static Vec3f sLightBallTargets[5] = { + static Vec3f sLightBallTargetOffsets[5] = { { -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 }, }; s32 pad; - Vec3f sp30; + Vec3f lightBallTargetPos; s32 pad2; if (this->stateTimer < 25) { @@ -2690,22 +2687,22 @@ void EnInvadepoh_LightBall_SpawnInvaders(EnInvadepoh* this, PlayState* play) { } else { this->stateTimer = 0; this->lightBallTarget++; - this->lightBallTarget = CLAMP_MAX(this->lightBallTarget, ARRAY_COUNT(sLightBallTargets) - 1); + this->lightBallTarget = CLAMP_MAX(this->lightBallTarget, ARRAY_COUNT(sLightBallTargetOffsets) - 1); this->actor.gravity = 33.0f; EnInvadepoh_LightBall_SpawnSparkles(this, play, 20); } - Math_Vec3f_Sum(&sLightBallTargets[this->lightBallTarget], &this->actor.home.pos, &sp30); - if (Math3D_Vec3fDistSq(&this->actor.world.pos, &sp30) < SQ(400.0f)) { + Math_Vec3f_Sum(&sLightBallTargetOffsets[this->lightBallTarget], &this->actor.home.pos, &lightBallTargetPos); + if (Math3D_Vec3fDistSq(&this->actor.world.pos, &lightBallTargetPos) < SQ(400.0f)) { this->actor.speed *= 0.8f; } else { Math_StepToF(&this->actor.speed, 170.0f, 21.0f); this->actor.speed *= 0.98f; } - if (EnInvadepoh_StepTowardXZ(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, + if (EnInvadepoh_StepTowardXZ(&this->actor.world.pos.x, &this->actor.world.pos.z, lightBallTargetPos.x, lightBallTargetPos.z, this->actor.speed)) { this->actor.speed = 0.0f; } - if (sp30.y < this->actor.world.pos.y) { + if (lightBallTargetPos.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); @@ -2731,18 +2728,18 @@ void EnInvadepoh_LightBall_SetupAboveBarn(EnInvadepoh* this) { void EnInvadepoh_LightBall_AboveBarn(EnInvadepoh* this, PlayState* play) { s32 pad; - Vec3f sp30; + Vec3f lightBallTargetPos; - 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); + lightBallTargetPos.x = this->actor.home.pos.x; + lightBallTargetPos.y = this->actor.home.pos.y + 1500.0f; + lightBallTargetPos.z = this->actor.home.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &lightBallTargetPos), 0xA, 0xBB8, 0x64); if ((play->gameplayFrames % 0x40) < 14) { Math_StepToF(&this->actor.speed, 5.0f, 1.0f); } else { this->actor.speed *= 0.97f; } - this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -0.5f : 2.0f; + this->actor.gravity = (lightBallTargetPos.y < this->actor.world.pos.y) ? -0.5f : 2.0f; this->actor.velocity.y *= 0.97f; Actor_MoveWithGravity(&this->actor); if (sEventState == ENINVADEPOH_EVENT_CLEAR) { @@ -2761,14 +2758,14 @@ void EnInvadepoh_LightBall_SetupCircle(EnInvadepoh* this) { void EnInvadepoh_LightBall_Circle(EnInvadepoh* this, PlayState* play) { s32 pad; - Vec3f sp30; + Vec3f lightBallTargetPos; - sp30.x = this->actor.home.pos.x + sLightBallSpawnOffset.x; - sp30.y = this->actor.home.pos.y + sLightBallSpawnOffset.y + 400.0f; - sp30.z = this->actor.home.pos.z + sLightBallSpawnOffset.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); + lightBallTargetPos.x = this->actor.home.pos.x + sLightBallSpawnOffset.x; + lightBallTargetPos.y = this->actor.home.pos.y + sLightBallSpawnOffset.y + 400.0f; + lightBallTargetPos.z = this->actor.home.pos.z + sLightBallSpawnOffset.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &lightBallTargetPos), 4, 0x1F40, 0x64); Math_StepToF(&this->actor.speed, 70.0f, 3.0f); - this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -2.0f : 2.0f; + this->actor.gravity = (lightBallTargetPos.y < this->actor.world.pos.y) ? -2.0f : 2.0f; this->actor.velocity.y *= 0.97f; Actor_MoveWithGravity(&this->actor); if (this->actionTimer > 0) { @@ -2809,15 +2806,15 @@ void EnInvadepoh_LightBall_SetupLeaveBarn(EnInvadepoh* this) { void EnInvadepoh_LightBall_LeaveBarn(EnInvadepoh* this, PlayState* play) { s32 pad; - Vec3f sp30; + Vec3f lightBallTargetPos; - 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); + lightBallTargetPos.x = this->actor.home.pos.x; + lightBallTargetPos.y = this->actor.home.pos.y + 800.0f; + lightBallTargetPos.z = this->actor.home.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &lightBallTargetPos), 4, 0x1F40, 0x64); Math_StepToF(&this->actor.speed, 30.0f, 3.0f); this->actor.velocity.y *= 0.98f; - this->actor.gravity = (sp30.y < this->actor.world.pos.y) ? -0.5f : 2.0f; + this->actor.gravity = (lightBallTargetPos.y < this->actor.world.pos.y) ? -0.5f : 2.0f; Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); @@ -2831,29 +2828,29 @@ void EnInvadepoh_LightBall_LeaveBarn(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_LightBall_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - f32 temp; + f32 scaleMod; this->actionFunc(this, play); this->pulsePhase += this->pulseRate; Math_StepToF(&this->pulseScale, this->pulseScaleTarget, this->pulseScaleRate); - temp = 1.0f + (Math_SinS(this->pulsePhase) * this->pulseScale); - Actor_SetScale(&this->actor, 0.27f * temp); + scaleMod = 1.0f + (Math_SinS(this->pulsePhase) * this->pulseScale); + Actor_SetScale(&this->actor, 0.27f * scaleMod); Math_StepToS(&this->unk_306, 0x258, 8); this->actor.world.rot.y += this->unk_306; this->unk_304 += 0x258; } void EnInvadepoh_Night1Romani_SetupWalk(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x320; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_Night1Romani_Walk; } @@ -2864,12 +2861,13 @@ void EnInvadepoh_Night1Romani_Walk(EnInvadepoh* this, PlayState* play) { if ((this->currentPoint == 0) || (this->currentPoint + 1 == this->endPoint)) { if (this->unk_378 == 0) { - s32 temp_v0_2 = func_800FE620(play); - s32 pad; - - if (temp_v0_2 > 0) { - temp_v0_2 = (REG(15) * -16.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); + s32 trueTimeSpeed = func_800FE620(play); + s32 doorTimer = trueTimeSpeed; + + if (trueTimeSpeed > 0) { + // This is really dividing by trueTimeSpeed, but matching requires writing like this + doorTimer = (R_TIME_SPEED * -16.0f / doorTimer) - 0.5f; + this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), doorTimer); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -2887,25 +2885,25 @@ void EnInvadepoh_Night1Romani_Walk(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_Night1Romani_SetupTalk(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0x7D0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actionFunc = EnInvadepoh_Night1Romani_Talk; } void EnInvadepoh_Night1Romani_Talk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper... @@ -2929,7 +2927,7 @@ void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 0x64, 0.03f, 0.3f, 0.03f); EnInvadepoh_Night1Romani_SetupPath(this, play); EnInvadepoh_Night1Romani_SetProgress(this); EnInvadepoh_Night1Romani_MoveAlongPathTimed(this, play); @@ -2982,7 +2980,7 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if ((this->actionFunc != EnInvadepoh_Night1Romani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -2992,14 +2990,14 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_BarnRomani_SetupIdle(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x5DC; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x5DC; this->actionTimer = Rand_S16Offset(200, 200); this->unk_304 = this->actor.shape.rot.y; @@ -3009,36 +3007,36 @@ void EnInvadepoh_BarnRomani_SetupIdle(EnInvadepoh* this) { void EnInvadepoh_BarnRomani_Idle(EnInvadepoh* this, PlayState* play) { s32 pad; - EnInvadePohInteractInfo* sp30 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; if ((play->gameplayFrames % 0x100) == 0) { - Vec3f sp44; - s16 sp42; + Vec3f pathPointF; + s16 yawToPath; - Math_Vec3s_ToVec3f(&sp44, this->pathPoints); - sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); - this->unk_304 = Rand_S16Offset(-0x1F40, 0x3E80) + sp42; + Math_Vec3s_ToVec3f(&pathPointF, this->pathPoints); + yawToPath = Math_Vec3f_Yaw(&this->actor.world.pos, &pathPointF); + this->unk_304 = Rand_S16Offset(-0x1F40, 0x3E80) + yawToPath; this->unk_370 = 0; } Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_304, 6, this->unk_370, 0x28); if (this->actor.xzDistToPlayer < 300.0f) { Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - sp30->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0x9C4, 0x9C4); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0x9C4, 0x9C4); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - sp30->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if ((play->gameplayFrames % 0x100) == 0) { - sp30->headRotTarget.z = Rand_S16Offset(-0x5DC, 0xBB8); + interactInfo->headRotTarget.z = Rand_S16Offset(-0x5DC, 0xBB8); } } else { - sp30->headRotTarget.x = 0; - sp30->headRotTarget.y = 0; - sp30->headRotTarget.z = 0; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; } if (this->actionTimer > 0) { this->actionTimer--; @@ -3048,14 +3046,14 @@ void EnInvadepoh_BarnRomani_Idle(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_BarnRomani_SetupLookAround(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x320; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actionFunc = EnInvadepoh_BarnRomani_LookAround; } @@ -3067,14 +3065,14 @@ void EnInvadepoh_BarnRomani_LookAround(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_BarnRomani_SetupWalk(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x320; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_BarnRomani_Walk; } @@ -3109,25 +3107,25 @@ void EnInvadepoh_BarnRomani_Walk(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_BarnRomani_SetupTalk(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0x7D0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0x7D0; this->unk_370 = 0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); this->actionFunc = EnInvadepoh_BarnRomani_Talk; } void EnInvadepoh_BarnRomani_Talk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x7D0, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, (s16)0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { // It's almost time, Grasshopper SET_WEEKEVENTREG(WEEKEVENTREG_54_10); @@ -3154,7 +3152,7 @@ void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_BarnRomani_SetupPath(this, play2); if ((currentTime < CLOCK_TIME(2, 15)) || (currentTime >= CLOCK_TIME(6, 00))) { this->currentPoint = 0; @@ -3205,7 +3203,7 @@ void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange) { this->finishedAnim = SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if ((this->actionFunc != EnInvadepoh_BarnRomani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 100.0f); } @@ -3319,7 +3317,7 @@ void EnInvadepoh_RewardRomani_Finished(EnInvadepoh* this, PlayState* play) { void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; if (Object_IsLoaded(&play2->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; @@ -3329,9 +3327,9 @@ void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); - temp_s0->scaledTurnRate = 0.08f; - temp_s0->maxTurnRate = 0x7D0; + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 0x7D0, 0.08f, 0.3f, 0.03f); + interactInfo->scaledTurnRate = 0.08f; + interactInfo->maxTurnRate = 0x7D0; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); EnInvadepoh_RewardRomani_SetupClearCheck(this); @@ -3341,25 +3339,25 @@ void EnInvadepoh_RewardRomani_WaitForObject(Actor* thisx, PlayState* play2) { void EnInvadepoh_RewardRomani_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; s32 inUncullRange = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { Player* player; - s16 temp_v1; + s16 angleToPlayer; SkelAnime_Update(&this->skelAnime); player = GET_PLAYER(play); Math_StepToS(&this->unk_370, 0x7D0, 0x28); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); - EnInvadepoh_Interact_Update(&this->unk_324); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); + EnInvadepoh_Interact_Update(&this->interactInfo); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -3479,7 +3477,7 @@ void EnInvadepoh_Dog_WaitForObject(Actor* thisx, PlayState* play2) { Actor_SetObjectDependency(play, &this->actor); SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, DOG_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); + EnInvadepoh_Interact_Init(&this->interactInfo, NULL, 0, NULL, 0, &gZeroVec3s, 0xBB8, 0.1f, 0.0f, 0.0f); EnInvadepoh_Dog_SetupPath(this, play); EnInvadepoh_SetPosToPathPoint(this, 0); func_800B4AEC(play, &this->actor, 50.0f); @@ -3546,35 +3544,35 @@ void EnInvadepoh_Dog_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); this->finishedAnim = SkelAnime_Update(&this->skelAnime); if (inUncullRange && (this->actor.update != NULL)) { - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } void EnInvadepoh_Cremia_SetupWalk(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x320; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; this->unk_370 = 0; this->actionFunc = EnInvadepoh_Cremia_Walk; } void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; EnInvadepoh* romani = sRomani; s32 pad; - s32 sp48; + s32 framesMod0x80; s32 pad2; - s16 sp42; - s16 sp40; - s16 temp_v1; + s16 angleToRomani; + s16 targetYaw; + s16 angleToPlayer; if (romani != NULL) { if (romani->currentPoint == 0) { @@ -3590,10 +3588,10 @@ void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play) { Math_ScaledStepToS(&this->unk_304, -0x8000, 0x12C); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } - sp42 = this->unk_304 + romani->actor.world.rot.y; - this->actor.world.pos.x = (Math_SinS(sp42) * this->unk_2F8) + romani->actor.world.pos.x; + angleToRomani = this->unk_304 + romani->actor.world.rot.y; + this->actor.world.pos.x = (Math_SinS(angleToRomani) * this->unk_2F8) + romani->actor.world.pos.x; this->actor.world.pos.y = romani->actor.world.pos.y; - this->actor.world.pos.z = (Math_CosS(sp42) * this->unk_2F8) + romani->actor.world.pos.z; + this->actor.world.pos.z = (Math_CosS(angleToRomani) * this->unk_2F8) + romani->actor.world.pos.z; func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); Math_StepToS(&this->unk_370, 0xBB8, 0x1F5); @@ -3601,19 +3599,19 @@ void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.prevPos, &this->actor.world.pos), 3, this->unk_370, 0x1F4); } - sp48 = (play->gameplayFrames + 20) % 0x80; - if (sp48 & 0x40) { - sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &romani->actor.world.pos); - if (sp48 == 0x40) { + framesMod0x80 = (play->gameplayFrames + 20) % 0x80; + if (framesMod0x80 & 0x40) { + targetYaw = Math_Vec3f_Yaw(&this->actor.world.pos, &romani->actor.world.pos); + if (framesMod0x80 == 0x40) { this->unk_370 = 0; } Math_StepToS(&this->unk_370, 0x7D0, 0x28); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->unk_370, 0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &romani->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + Math_SmoothStepToS(&this->actor.shape.rot.y, targetYaw, 6, this->unk_370, 0x28); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &romani->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = sp40 - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = targetYaw - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); } } @@ -3629,50 +3627,50 @@ void EnInvadepoh_Cremia_Walk(EnInvadepoh* this, PlayState* play) { } void EnInvadepoh_Cremia_SetupTalk(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0x7D0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_Cremia_Talk; } void EnInvadepoh_Cremia_Talk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; - Player* sp28 = GET_PLAYER(play); - s16 temp_v1; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; + Player* player = GET_PLAYER(play); + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x9C4, 0x1C2); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->unk_370, 0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_Cremia_SetupWalk(this); } } void EnInvadepoh_Cremia_SetupIdle(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0x7D0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_Cremia_Idle; } void EnInvadepoh_Cremia_Idle(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; - Player* sp28 = GET_PLAYER(play); - s16 temp_v1; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; + Player* player = GET_PLAYER(play); + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x7D0, 0xC8); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 0x28); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp28->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (sRomani == NULL) { EnInvadepoh_Cremia_SetupWalk(this); } else if ((sRomani != NULL) && (sRomani->actionFunc != EnInvadepoh_Night3Romani_Talk)) { @@ -3693,7 +3691,7 @@ void EnInvadepoh_Cremia_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Cremia_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, CREMIA_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; // Good night... See you...tomorrow...OK? if (currentTime < CLOCK_TIME(20, 01) + 30) { this->unk_304 = -0x8000; @@ -3742,7 +3740,7 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play2); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if ((this->actionFunc != EnInvadepoh_Cremia_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -3752,43 +3750,45 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { } void EnInvadepoh_Night3Romani_SetupWalk(EnInvadepoh* this) { - EnInvadePohInteractInfo* temp_v0 = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - temp_v0->headRotTarget.x = 0; - temp_v0->headRotTarget.y = 0; - temp_v0->headRotTarget.z = 0; - temp_v0->scaledTurnRate = 0.1f; - temp_v0->maxTurnRate = 0x320; + interactInfo->headRotTarget.x = 0; + interactInfo->headRotTarget.y = 0; + interactInfo->headRotTarget.z = 0; + interactInfo->scaledTurnRate = 0.1f; + interactInfo->maxTurnRate = 0x320; this->actionFunc = EnInvadepoh_Night3Romani_Walk; } void EnInvadepoh_Night3Romani_Walk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* temp_s0 = &this->unk_324; - EnInvadepoh* sp68 = sCremia; - s32 var_a2; - s32 sp60; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; + EnInvadepoh* cremia = sCremia; + s32 curPoint; + s32 framesMod0x80; + s32 doorTimer; s32 pad; - s16 temp_v2; - Vec3f sp4C; - Vec3f sp40; + Vec3f curPathPointF; + Vec3f nextPathPointF; EnInvadepoh_Night3Romani_SetProgress(this); EnInvadepoh_Night3Romani_MoveAlongPathTimed(this, play); EnInvadepoh_Romani_TurnToPath(this, 6, 0x7D0, 0x64); - var_a2 = (this->currentPoint < this->endPoint) ? this->currentPoint : this->endPoint - 1; + curPoint = (this->currentPoint < this->endPoint) ? this->currentPoint : this->endPoint - 1; - Math_Vec3s_ToVec3f(&sp4C, &this->pathPoints[var_a2]); - Math_Vec3s_ToVec3f(&sp40, &this->pathPoints[var_a2 + 1]); - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40) + 0, 5, 0x7D0, 100); - if ((this->currentPoint == 0) || (this->currentPoint + 1 == this->endPoint)) { + Math_Vec3s_ToVec3f(&curPathPointF, &this->pathPoints[curPoint]); + Math_Vec3s_ToVec3f(&nextPathPointF, &this->pathPoints[curPoint + 1]); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&curPathPointF, &nextPathPointF) + 0, 5, 0x7D0, 100); + if ((this->currentPoint == 0) || (this->currentPoint == this->endPoint - 1)) { if (this->unk_378 == 0) { - s32 temp_v0_2 = func_800FE620(play); + s32 trueTimeSpeed = func_800FE620(play); + doorTimer = trueTimeSpeed; - if (temp_v0_2 > 0) { - temp_v0_2 = (REG(15) * -23.0f / temp_v0_2) - 0.5f; - this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), temp_v0_2); + if (trueTimeSpeed > 0) { + // This is really dividing by trueTimeSpeed, but matching requires writing like this + doorTimer = (R_TIME_SPEED * -23.0f / doorTimer) - 0.5f; + this->unk_378 = EnInvadepoh_Romani_OpenDoor(this, play, SQ(80.0f), doorTimer); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3796,21 +3796,21 @@ void EnInvadepoh_Night3Romani_Walk(EnInvadepoh* this, PlayState* play) { this->unk_378 = 0; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - sp60 = play->gameplayFrames % 0x80; - if (sp60 & 0x40) { - s16 sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); - s16 temp_v1; + framesMod0x80 = play->gameplayFrames % 0x80; + if (framesMod0x80 & 0x40) { + s16 targetYaw = Math_Vec3f_Yaw(&this->actor.world.pos, &cremia->actor.world.pos); + s16 angleToPlayer; - if (sp60 == 0x40) { + if (framesMod0x80 == 0x40) { this->unk_370 = 0; } Math_StepToS(&this->unk_370, 0x7D0, 0x28); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->unk_370, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos) * 0.85f; - temp_s0->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + Math_SmoothStepToS(&this->actor.shape.rot.y, targetYaw, 6, this->unk_370, 40); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &cremia->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = sp3A - this->actor.shape.rot.y; - temp_s0->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = targetYaw - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { @@ -3818,56 +3818,56 @@ void EnInvadepoh_Night3Romani_Walk(EnInvadepoh* this, PlayState* play) { } if (this->progress >= 0.9999f) { Actor_Kill(&this->actor); - } else if ((sp68 != NULL) && (sp68->actionFunc == EnInvadepoh_Cremia_Talk)) { + } else if ((cremia != NULL) && (cremia->actionFunc == EnInvadepoh_Cremia_Talk)) { EnInvadepoh_Night3Romani_SetupIdle(this); } } void EnInvadepoh_Night3Romani_SetupTalk(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0xFA0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0xFA0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_Night3Romani_Talk; } void EnInvadepoh_Night3Romani_Talk(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0xBB8, 0x1F4); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - interactInfo->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { EnInvadepoh_Night3Romani_SetupWalk(this); } } void EnInvadepoh_Night3Romani_SetupIdle(EnInvadepoh* this) { - this->unk_324.scaledTurnRate = 0.08f; - this->unk_324.maxTurnRate = 0x7D0; + this->interactInfo.scaledTurnRate = 0.08f; + this->interactInfo.maxTurnRate = 0x7D0; Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->unk_370 = 0; this->actionFunc = EnInvadepoh_Night3Romani_Idle; } void EnInvadepoh_Night3Romani_Idle(EnInvadepoh* this, PlayState* play) { - EnInvadePohInteractInfo* interactInfo = &this->unk_324; + EnInvadePohInteractInfo* interactInfo = &this->interactInfo; Player* player = GET_PLAYER(play); - s16 temp_v1; + s16 angleToPlayer; Math_StepToS(&this->unk_370, 0x7D0, 0xC8); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->unk_370, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - interactInfo->headRotTarget.x = CLAMP((s16)(temp_v1 - this->actor.shape.rot.x), -0xBB8, 0xBB8); + angleToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; + interactInfo->headRotTarget.x = CLAMP((s16)(angleToPlayer - this->actor.shape.rot.x), -0xBB8, 0xBB8); - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - interactInfo->headRotTarget.y = CLAMP((s16)(temp_v1 * 0.7f), -0x1F40, 0x1F40); + angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + interactInfo->headRotTarget.y = CLAMP((s16)(angleToPlayer * 0.7f), -0x1F40, 0x1F40); if (sCremia == NULL) { EnInvadepoh_Night3Romani_SetupWalk(this); } else if ((sCremia != NULL) && (sCremia->actionFunc != EnInvadepoh_Cremia_Talk)) { @@ -3888,7 +3888,7 @@ void EnInvadepoh_Night3Romani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Romani_DesegmentTextures(); SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); - EnInvadepoh_Interact_Init(&this->unk_324, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); + EnInvadepoh_Interact_Init(&this->interactInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); EnInvadepoh_Night3Romani_SetupPath(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; EnInvadepoh_Night3Romani_SetProgress(this); @@ -3933,7 +3933,7 @@ void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (inUncullRange && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); - EnInvadepoh_Interact_Update(&this->unk_324); + EnInvadepoh_Interact_Update(&this->interactInfo); if ((this->actionFunc != EnInvadepoh_Night3Romani_Talk) && !talkRequested && this->actor.isTargeted) { func_800B8614(&this->actor, play, 350.0f); } @@ -4016,8 +4016,8 @@ void EnInvadepoh_Abductor_SetupRomani(EnInvadepoh* this) { } void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 pad2; + s32 actionTimer; + f32 tempUnk_306; s32 reachedTargetY = 0; if (this->actionTimer > 0) { @@ -4027,8 +4027,8 @@ void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play) { this->actor.draw = NULL; } else { this->actor.draw = EnInvadepoh_Alien_Draw; - pad = (reachedTargetY ? 0 : this->actionTimer); //! fake - if ((105 > pad) && (pad >= 100)) { + actionTimer = (reachedTargetY ? 0 : this->actionTimer); + if ((105 > actionTimer) && (actionTimer >= 100)) { this->actor.gravity = -1.0f; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); } else { @@ -4045,9 +4045,9 @@ void EnInvadepoh_Abductor_Romani(EnInvadepoh* this, PlayState* play) { reachedTargetY = Math_StepToF(&this->actor.world.pos.y, targetY, fabsf(this->actor.velocity.y)); } - pad2 = (this->unk_304 * -0.06f) + this->unk_306; - pad2 *= 0.98f; - this->unk_306 = pad2; + tempUnk_306 = (this->unk_304 * -0.06f) + this->unk_306; + tempUnk_306 *= 0.98f; + this->unk_306 = tempUnk_306; this->actor.shape.rot.y += this->unk_306; if (this->actor.child != NULL) { Actor* romani = this->actor.child; @@ -4108,8 +4108,8 @@ void EnInvadepoh_Event_DrawWarps(PlayState* play) { for (i = 0, warpEffect = sWarpEffects; i < 10; i++, warpEffect++) { if (warpEffect->timer > 0) { - u32 temp_s5 = (play->gameplayFrames + (u8)(i * 0x10)) % 0x80; - u32 temp_s6 = (play->gameplayFrames * -0xF) % 0x100; + u32 warpScrollX1 = (play->gameplayFrames + (u8)(i * 0x10)) % 0x80; + u32 warpScrollY2 = (play->gameplayFrames * -0xF) % 0x100; Matrix_Translate(warpEffect->pos.x, warpEffect->pos.y, warpEffect->pos.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); @@ -4117,7 +4117,7 @@ void EnInvadepoh_Event_DrawWarps(PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, warpEffect->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x8, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, warpScrollX1, 0, 0x20, 0x40, 1, 0, warpScrollY2, 0x20, 0x40)); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_02E510); } @@ -4217,9 +4217,9 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { } if (this->present) { Gfx* ptr; - Vec3f sp80; - Vec3f sp74; - s32 temp; + Vec3f glowOffset; + Vec3f glowPos; + s32 glowAlpha; OPEN_DISPS(play->state.gfxCtx); ptr = POLY_XLU_DISP; @@ -4231,26 +4231,26 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { 0); Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(60.0f, &sp80); + Matrix_MultVecZ(60.0f, &glowOffset); - sp74.x = this->actor.world.pos.x + sp80.x; - sp74.y = this->actor.world.pos.y + sp80.y + 68.0f; - sp74.z = this->actor.world.pos.z + sp80.z; + glowPos.x = this->actor.world.pos.x + glowOffset.x; + glowPos.y = this->actor.world.pos.y + glowOffset.y + 68.0f; + glowPos.z = this->actor.world.pos.z + glowOffset.z; - Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); + Matrix_Translate(glowPos.x, glowPos.y, glowPos.z, MTXMODE_NEW); Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); - temp = 100.0f / 255.0f * this->alpha; + glowAlpha = 100.0f / 255.0f * this->alpha; gSPDisplayList(ptr++, gameplay_keep_DL_029CB0); - gDPSetPrimColor(ptr++, 0, 0, 240, 180, 100, temp); + gDPSetPrimColor(ptr++, 0, 0, 240, 180, 100, glowAlpha); gSPMatrix(ptr++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(ptr++, gameplay_keep_DL_029CF0); POLY_XLU_DISP = ptr; - if ((this->alpha > 128) && EnInvadepoh_Alien_LensFlareDepthCheck(play, &sp74)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); + if ((this->alpha > 128) && EnInvadepoh_Alien_LensFlareDepthCheck(play, &glowPos)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, glowPos, 10.0f, 9.0f, 0, 0); } CLOSE_DISPS(play->state.gfxCtx); @@ -4262,8 +4262,9 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { s32 EnInvadepoh_Cow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = (EnInvadepoh*)thisx; if (limbIndex == COW_LIMB_NOSE_RING) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + rot->x -= this->actor.shape.rot.x; } return false; @@ -4292,14 +4293,14 @@ s32 EnInvadepoh_Romani_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dL if (limbIndex == ROMANI_LIMB_HEAD) { EnInvadepoh* this = ((EnInvadepoh*)thisx); - rot->x += this->unk_324.headRot.y; - rot->y += this->unk_324.headRot.z; - rot->z += this->unk_324.headRot.x; + rot->x += this->interactInfo.headRot.y; + rot->y += this->interactInfo.headRot.z; + rot->z += this->interactInfo.headRot.x; } else if (limbIndex == ROMANI_LIMB_TORSO) { EnInvadepoh* this = ((EnInvadepoh*)thisx); - rot->x += (s16)(this->unk_324.torsoRotXMod * this->unk_324.headRot.y); - rot->z += this->unk_324.torsoRotZ; + rot->x += (s16)(this->interactInfo.torsoRotXMod * this->interactInfo.headRot.y); + rot->z += this->interactInfo.torsoRotZ; } return false; } @@ -4325,8 +4326,8 @@ void EnInvadepoh_Romani_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->unk_324.mouthAnim.curIndex]); - gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->unk_324.eyeAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->interactInfo.mouthAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->interactInfo.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_Romani_OverrideLimbDraw, EnInvadepoh_Romani_PostLimbDraw, &this->actor); @@ -4336,16 +4337,16 @@ void EnInvadepoh_Romani_Draw(Actor* thisx, PlayState* play) { void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - Vec3f sp5C; + Vec3f flashPos; Matrix_Push(); Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(200.0f, &sp5C); + Matrix_MultVecZ(200.0f, &flashPos); Matrix_Pop(); - sp5C.x += this->actor.world.pos.x; - sp5C.y += this->actor.world.pos.y; - sp5C.z += this->actor.world.pos.z; - EnInvadepoh_LightBall_ReplaceTranslation(&sp5C); + flashPos.x += this->actor.world.pos.x; + flashPos.y += this->actor.world.pos.y; + flashPos.z += this->actor.world.pos.z; + EnInvadepoh_LightBall_ReplaceTranslation(&flashPos); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZS(this->unk_304, MTXMODE_APPLY); @@ -4357,8 +4358,8 @@ void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - if (EnInvadepoh_Alien_LensFlareDepthCheck(play, &sp5C)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); + if (EnInvadepoh_Alien_LensFlareDepthCheck(play, &flashPos)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, flashPos, 20.0f, 9.0f, 0, 0); } CLOSE_DISPS(play->state.gfxCtx); @@ -4370,17 +4371,17 @@ s32 EnInvadepoh_Dog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += this->unk_324.headRot.x; - rot->y += this->unk_324.headRot.y; - rot->z += this->unk_324.headRot.z; + rot->x += this->interactInfo.headRot.x; + rot->y += this->interactInfo.headRot.y; + rot->z += this->interactInfo.headRot.z; } return false; } void EnInvadepoh_Dog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { - EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == DOG_LIMB_HEAD) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + Matrix_MultVecY(20.0f, &this->actor.focus.pos); } } @@ -4403,21 +4404,21 @@ s32 EnInvadepoh_Cremia_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dL if (limbIndex == CREMIA_LIMB_HEAD) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += this->unk_324.headRot.y; - rot->y += this->unk_324.headRot.z; - rot->z += this->unk_324.headRot.x; + rot->x += this->interactInfo.headRot.y; + rot->y += this->interactInfo.headRot.z; + rot->z += this->interactInfo.headRot.x; } else if (limbIndex == CREMIA_LIMB_TORSO) { EnInvadepoh* this = (EnInvadepoh*)thisx; - rot->x += (s16)(this->unk_324.torsoRotXMod * this->unk_324.headRot.y); + rot->x += (s16)(this->interactInfo.torsoRotXMod * this->interactInfo.headRot.y); } return false; } void EnInvadepoh_Cremia_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { - EnInvadepoh* this = (EnInvadepoh*)thisx; - if (limbIndex == CREMIA_LIMB_HEAD) { + EnInvadepoh* this = (EnInvadepoh*)thisx; + Matrix_MultZero(&this->actor.focus.pos); } } @@ -4428,8 +4429,8 @@ void EnInvadepoh_Cremia_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->unk_324.mouthAnim.curIndex]); - gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->unk_324.eyeAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->interactInfo.mouthAnim.curIndex]); + gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->interactInfo.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_Cremia_OverrideLimbDraw, EnInvadepoh_Cremia_PostLimbDraw, &this->actor); 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 23a525f5d..29b63d870 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -29,42 +29,74 @@ typedef struct { typedef struct { /* 0x0 */ s8* texIndex; /* 0x1 */ s8 count; -} EnInvadepohFaceAnim; // size = 0x2 - -typedef struct { - /* 0x0 */ s8 type; - /* 0x4 */ EnInvadepohFaceAnim* frames; -} EnInvadepohFaceAnimFixed; // size = 0x8 +} EnInvadepohFaceFrames; // size = 0x2 typedef struct { /* 0x0 */ s8 index; /* 0x4 */ f32 chance; } EnInvadepohFaceAnimNext; // size = 0x8 +#if 1 typedef struct { - /* 0x0 */ EnInvadepohFaceAnimFixed anim; + /* 0x0 */ s8 type; + /* 0x4 */ EnInvadepohFaceFrames* frames; +} EnInvadepohFaceAnim; // size = 0x8 + +typedef struct { + /* 0x0 */ EnInvadepohFaceAnim anim; /* 0x8 */ s8 nextCount; /* 0xC */ EnInvadepohFaceAnimNext* nextAnims; -} EnInvadepohFaceAnimLoop; // size = 0x10 +} EnInvadepohFaceAnimBranched; // size = 0x10 typedef struct { - /* 0x00 */ EnInvadepohFaceAnimLoop loop; + /* 0x00 */ EnInvadepohFaceAnimBranched loop; /* 0x10 */ s16 minDelay; /* 0x12 */ s16 maxDelay; -} EnInvadepohFaceAnimLoopDelayed; // size = 0x14 +} EnInvadepohFaceAnimDelayedBranched; // size = 0x14 + +#else typedef struct { - /* 0x0 */ EnInvadepohFaceAnimFixed** animSet; + /* 0x0 */ s8 type; + /* 0x4 */ EnInvadepohFaceFrames* frames; +} EnInvadepohFaceAnimOnce; // size = 0x8 + +typedef struct { + /* 0x0 */ s8 type; + /* 0x4 */ EnInvadepohFaceFrames* frames; + /* 0x8 */ s8 nextCount; + /* 0xC */ EnInvadepohFaceAnimNext* nextAnims; +} EnInvadepohFaceAnimBranched; // size = 0x10 + +typedef struct { + /* 0x0 */ s8 type; + /* 0x4 */ EnInvadepohFaceFrames* frames; + /* 0x8 */ s8 nextCount; + /* 0xC */ EnInvadepohFaceAnimNext* nextAnims; + /* 0x10 */ s16 minDelay; + /* 0x12 */ s16 maxDelay; +} EnInvadepohFaceAnimDelayedBranched; // size = 0x14 + +typedef union { + EnInvadepohFaceAnimOnce once; + EnInvadepohFaceAnimBranched branch; + EnInvadepohFaceAnimDelayedBranched delay; +} EnInvadepohFaceAnim; + +#endif + +typedef struct { + /* 0x0 */ EnInvadepohFaceAnim** animSet; /* 0x4 */ s8 curAnimType; - /* 0x8 */ EnInvadepohFaceAnimFixed* curAnim; + /* 0x8 */ EnInvadepohFaceAnim* curAnim; /* 0xC */ s16 delayTimer; /* 0xE */ s8 curFrame; /* 0xF */ s8 curIndex; -} EnInvadePohFaceInfo; // size = 0x10 +} EnInvadePohFaceAnimInfo; // size = 0x10 typedef struct { - /* 0x00 */ EnInvadePohFaceInfo eyeAnim; - /* 0x10 */ EnInvadePohFaceInfo mouthAnim; + /* 0x00 */ EnInvadePohFaceAnimInfo eyeAnim; + /* 0x10 */ EnInvadePohFaceAnimInfo mouthAnim; /* 0x20 */ Vec3s headRot; /* 0x26 */ Vec3s headRotTarget; /* 0x2C */ s16 maxTurnRate; @@ -78,7 +110,7 @@ typedef struct { /* 0x48 */ s16 torsoMaxTurnStep; } EnInvadePohInteractInfo; // size = 0x4C -typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceInfo*, EnInvadepohFaceAnimFixed**); +typedef void (*EnInvadepohFaceFunc) (EnInvadePohFaceAnimInfo*, EnInvadepohFaceAnim**); #define EN_INVADEPOH_LIMB_MAX 23 // #define EN_INVADEPOH_LIMB_MAX MAX(MAX(MAX(MAX(MAX(ALIEN_LIMB_MAX, ROMANI_LIMB_MAX), CREMIA_LIMB_MAX), DOG_LIMB_MAX), COW_LIMB_MAX), COW_TAIL_LIMB_MAX) @@ -106,7 +138,7 @@ typedef struct EnInvadepoh { /* 0x310 */ f32 pathLength; /* 0x314 */ Vec3f unk_314; /* 0x320 */ f32 progress; - /* 0x324 */ EnInvadePohInteractInfo unk_324; + /* 0x324 */ EnInvadePohInteractInfo interactInfo; /* 0x370 */ s16 unk_370; /* 0x372 */ s16 unk_372; /* 0x374 */ s8 unk_374; @@ -114,7 +146,7 @@ typedef struct EnInvadepoh { /* 0x378 */ s8 unk_378; /* 0x379 */ s8 spawnCount; /* 0x37C */ f32 checkpoints[3]; - /* 0x388 */ char torsoRotXModTarget8; // unused? + /* 0x388 */ char unk_388; // unused? /* 0x389 */ u8 alpha; /* 0x38A */ s8 atBarn; /* 0x38B */ s8 present; From ef109b6ee2aa44ab87bb24790dc6ceed9798b473 Mon Sep 17 00:00:00 2001 From: petrie911 Date: Thu, 8 Jun 2023 06:31:25 -0500 Subject: [PATCH 10/10] merge --- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) 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 22028c048..203564405 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,5 @@ #include "z_en_invadepoh.h" +#include "z64horse.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -921,7 +922,7 @@ void EnInvadepoh_Event_CheckState(EnInvadepoh* this, PlayState* play) { } } if (sEventState == ENINVADEPOH_EVENT_UNSET) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { sEventState = ENINVADEPOH_EVENT_CLEAR; } else { sEventState = ENINVADEPOH_EVENT_FAILED; @@ -941,7 +942,7 @@ void EnInvadepoh_Event_SpawnInvaders(EnInvadepoh* this, PlayState* play) { if (pathIndex != 0xFF) { Path* path = &play->setupPathList[pathIndex]; - pathIndex = path->unk1; + pathIndex = path->additionalPathIndex; } } } @@ -980,8 +981,8 @@ s32 EnInvadepoh_Romani_OpenDoor(EnInvadepoh* this, PlayState* play, f32 range, s while (doorActor != NULL) { if ((doorActor->id == ACTOR_EN_DOOR) && (doorActor->update != NULL)) { door = (EnDoor*)doorActor; - if ((door->dyna.actor.room == this->actor.room) && - (Math3D_Vec3fDistSq(&door->dyna.actor.world.pos, &this->actor.world.pos) < range)) { + if ((door->knobDoor.dyna.actor.room == this->actor.room) && + (Math3D_Vec3fDistSq(&door->knobDoor.dyna.actor.world.pos, &this->actor.world.pos) < range)) { door->unk_1A7 = doorTimer; doorOpened = true; @@ -1018,7 +1019,7 @@ s32 EnInvadepoh_Alien_LensFlareDepthCheck(PlayState* play, Vec3f* pos) { f32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; - if (wZ < func_80178A94(screenPosX, screenPosY)) { + if (wZ < SysCfb_GetZBufferInt(screenPosX, screenPosY)) { return true; } } @@ -1382,7 +1383,7 @@ void EnInvadepoh_Event_Init(Actor* thisx, PlayState* play) { for (spawnCount = 1; spawnCount < 8; spawnCount++) { Path* path = &play->setupPathList[pathIndex]; - pathIndex = path->unk1; + pathIndex = path->additionalPathIndex; if (pathIndex == 0xFF) { break; } @@ -1429,7 +1430,7 @@ void EnInvadepoh_Alien_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); this->actor.shape.shadowAlpha = 140; - this->actor.flags = ACTOR_FLAG_80000000 | ACTOR_FLAG_1000 | ACTOR_FLAG_10; + this->actor.flags = ACTOR_FLAG_80000000 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_10; if (ENINVADEPOH_GET_TYPE(&this->actor) == ENINVADEPOH_ALIEN_ABDUCTOR) { this->actor.update = EnInvadepoh_Abuductor_WaitForObject; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; @@ -1524,7 +1525,7 @@ void EnInvadepoh_Romani_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } if (romaniType == ENINVADEPOH_ROMANI_CONFUSED) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { Actor_Kill(&this->actor); } } else if (romaniType == ENINVADEPOH_ROMANI_NIGHT_1) { @@ -1538,7 +1539,7 @@ void EnInvadepoh_Romani_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } } else if (romaniType == ENINVADEPOH_ROMANI_NIGHT_3) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { Actor_Kill(&this->actor); } sRomani = this; @@ -1618,7 +1619,7 @@ void EnInvadepoh_Cremia_Init(Actor* thisx, PlayState* play) { if (this->bankIndex < 0) { Actor_Kill(&this->actor); } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { Actor_Kill(&this->actor); } sCremia = this; @@ -1803,7 +1804,7 @@ void EnInvadepoh_Event_SetupInvasion(EnInvadepoh* this) { void EnInvadepoh_Event_Invasion(EnInvadepoh* this, PlayState* play) { if ((CLOCK_TIME(6, 00) > gSaveContext.save.time) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - SET_WEEKEVENTREG(WEEKEVENTREG_22_01); + SET_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM); EnInvadepoh_Event_SetupQueueVictoryCs(this); } else { s32 i; @@ -1850,7 +1851,7 @@ void EnInvadepoh_Event_VictoryCs(EnInvadepoh* this, PlayState* play) { play->transitionType = TRANS_TYPE_73; gSaveContext.nextTransitionType = TRANS_TYPE_72; D_801BDAA0 = 1; - D_801BDA9C = 0; + gHorseIsMounted = 0; EnInvadepoh_Event_SetupGoodEnd(this); } } @@ -2596,7 +2597,7 @@ void EnInvadepoh_ConfusedRomani_Update(Actor* thisx, PlayState* play2) { s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); if (talkRequested) { - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 5); EnInvadepoh_ConfusedRomani_SetupTalk(this); } this->actionFunc(this, play); @@ -2933,7 +2934,7 @@ void EnInvadepoh_Night1Romani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_Night1Romani_MoveAlongPathTimed(this, play); EnInvadepoh_SetYawAlongPath(this); EnInvadepoh_SnapToFloor(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PROMISED_TO_HELP_WITH_THEM)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; // If you run out of arrows... } else { @@ -2974,7 +2975,7 @@ void EnInvadepoh_Night1Romani_Update(Actor* thisx, PlayState* play2) { s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); if (talkRequested) { - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 5); EnInvadepoh_Night1Romani_SetupTalk(this); } this->actionFunc(this, play); @@ -3167,7 +3168,7 @@ void EnInvadepoh_BarnRomani_WaitForObject(Actor* thisx, PlayState* play2) { EnInvadepoh_SetYawAlongPath(this); func_800B4AEC(play, &this->actor, 50.0f); EnInvadepoh_SnapToFloor(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PROMISED_TO_HELP_WITH_THEM)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; // If you run out of arrows... } else { @@ -3197,7 +3198,7 @@ void EnInvadepoh_BarnRomani_Update(Actor* thisx, PlayState* play2) { s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); if (talkRequested) { - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 5); EnInvadepoh_BarnRomani_SetupTalk(this); } this->actionFunc(this, play); @@ -3217,7 +3218,7 @@ void EnInvadepoh_RewardRomani_SetupClearCheck(EnInvadepoh* this) { } void EnInvadepoh_RewardRomani_ClearCheck(EnInvadepoh* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { this->actor.draw = EnInvadepoh_Romani_Draw; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); EnInvadepoh_RewardRomani_SetupStartCs(this); @@ -3247,8 +3248,8 @@ void EnInvadepoh_RewardRomani_Talk(EnInvadepoh* this, PlayState* play) { if (this->textId == 0x3331) { // We did it...We won. if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { EnInvadepoh_Romani_StartTextBox(this, play, 0x3334); // I have to get back to bed... - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 0x1D); + Message_BombersNotebookQueueEvent(play, 5); } else { EnInvadepoh_Romani_StartTextBox(this, play, 0x3333); // Here's Romani's thanks } @@ -3289,9 +3290,9 @@ void EnInvadepoh_RewardRomani_SetupAfterGiveBottle(EnInvadepoh* this) { void EnInvadepoh_RewardRomani_AfterGiveBottle(EnInvadepoh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnInvadepoh_Romani_StartTextBox(this, play, 0x3334); // I have to get back to bed.. - func_80151BB4(play, 0x1E); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 0x1E); + Message_BombersNotebookQueueEvent(play, 0x1D); + Message_BombersNotebookQueueEvent(play, 5); EnInvadepoh_RewardRomani_SetupTalk(this); } else { func_800B85E0(&this->actor, play, 2000.0f, PLAYER_IA_MINUS1); @@ -3304,7 +3305,7 @@ void EnInvadepoh_RewardRomani_SetupFinished(EnInvadepoh* this) { } void EnInvadepoh_RewardRomani_Finished(EnInvadepoh* this, PlayState* play) { - if (play->msgCtx.unk120B1 == 0) { + if (play->msgCtx.bombersNotebookEventQueueCount == 0) { if (play->msgCtx.msgMode == 0) { sRewardFinished = true; } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || @@ -3734,7 +3735,7 @@ void EnInvadepoh_Cremia_Update(Actor* thisx, PlayState* play2) { s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); if (talkRequested) { - func_80151BB4(play, 6); + Message_BombersNotebookQueueEvent(play, 6); EnInvadepoh_Cremia_SetupTalk(this); } this->actionFunc(this, play2); @@ -3927,7 +3928,7 @@ void EnInvadepoh_Night3Romani_Update(Actor* thisx, PlayState* play2) { s32 talkRequested = Actor_ProcessTalkRequest(&this->actor, &play->state); if (talkRequested) { - func_80151BB4(play, 5); + Message_BombersNotebookQueueEvent(play, 5); EnInvadepoh_Night3Romani_SetupTalk(this); } this->actionFunc(this, play); @@ -4104,7 +4105,7 @@ void EnInvadepoh_Event_DrawWarps(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); for (i = 0, warpEffect = sWarpEffects; i < 10; i++, warpEffect++) { if (warpEffect->timer > 0) { @@ -4165,11 +4166,11 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); Matrix_Push(); if (this->present) { if (this->alpha == 255) { - func_8012C28C(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); AnimatedMat_Draw(play, sAlienEmptyTexAnim); Scene_SetRenderModeXlu(play, 0, 1); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); @@ -4224,7 +4225,7 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); ptr = POLY_XLU_DISP; - ptr = func_8012C868(ptr); + ptr = Gfx_SetupDL20_NoCD(ptr); gDPSetDither(ptr++, G_CD_NOISE); gDPSetCombineLERP(ptr++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, @@ -4274,7 +4275,7 @@ void EnInvadepoh_Cow_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - func_8012C5B0(play->state.gfxCtx); + Gfx_SetupDL37_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount, EnInvadepoh_Cow_OverrideLimbDraw, NULL, &this->actor); } @@ -4283,7 +4284,7 @@ void EnInvadepoh_CowTail_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnInvadepoh* this = (EnInvadepoh*)thisx; - func_8012C5B0(play->state.gfxCtx); + Gfx_SetupDL37_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); } @@ -4325,7 +4326,7 @@ void EnInvadepoh_Romani_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->interactInfo.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->interactInfo.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, @@ -4352,7 +4353,7 @@ void EnInvadepoh_LightBall_Draw(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->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); @@ -4391,7 +4392,7 @@ void EnInvadepoh_Dog_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnInvadepoh_Dog_OverrideLimbDraw, EnInvadepoh_Dog_PostLimbDraw, &this->actor); @@ -4428,7 +4429,7 @@ void EnInvadepoh_Cremia_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->interactInfo.mouthAnim.curIndex]); gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->interactInfo.eyeAnim.curIndex]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,