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)