diff --git a/.gitignore b/.gitignore index a9a287cb..b80a46ba 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ ctx.c.m2c /build tools/mio0 tools/ido-recomp -.venv/ \ No newline at end of file +.venv/ +m2cfiles/ diff --git a/.gitmodules b/.gitmodules index 7f1429ab..dfc22b60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,7 @@ url = https://github.com/simonlindholm/asm-processor [submodule "tools/asm-differ"] path = tools/asm-differ - url = https://github.com/simonlindholm/asm-differ \ No newline at end of file + url = https://github.com/simonlindholm/asm-differ +[submodule "tools/m2c"] + path = tools/m2c + url = https://github.com/matt-kempster/m2c diff --git a/include/functions.h b/include/functions.h index 30592ec2..1be76411 100644 --- a/include/functions.h +++ b/include/functions.h @@ -215,13 +215,13 @@ void func_80060D94(s32); void func_80060F30(Vec3f* , u32 , s32 ); void Object_Kill(Object*, Vec3f*); s32 func_80060FE4(Vec3f*, f32); -void Object_SetInfo(ObjectInfo*, u32); +void Object_SetInfo(ObjectInfo* info, u32 objId); void Object_80_Initialize(Object_80*); void Object_4C_Initialize(Object_4C*); void Object_2F4_Initialize(Object_2F4*); void Boss_Initialize(Boss*); void Item_Initialize(Item*); -void Object_8C_Initialize(Object_8C*); +void Effect_Initialize(Effect*); void func_80061B68(void); void func_80061CD0(void); void func_80061E48(Object_2F4* , f32 , f32 , f32 ); @@ -233,6 +233,7 @@ void func_80062C38(f32, f32); s32 func_800631A8(Vec3f*, f32*, Vec3f*); s32 func_8006326C(Vec3f* , Vec3f* , ObjectId , Object* ); s32 func_8006351C(s32 , Vec3f* , Vec3f* , s32 ); +s32 func_801A55D4(s32 , Vec3f* , Vec3f* , s32 ); void func_800652CC(Object_80*); void func_800654E4(Object *); void func_800656D4(Object_2F4*); @@ -265,7 +266,7 @@ void func_80068C48(Item*); void func_80068C88(Item*); void func_80068FE0(Object_4C*); void func_800690D0(s32, ObjectId); -void func_80069924(Object_8C *); +void func_80069924(Effect *); void func_800693E8(Object_2F4 *); void func_80069658(Boss *); void func_800696F8(Object_80 *); @@ -276,7 +277,7 @@ void Boss_Update(Boss *); void Object_80_Update(Object_80 *); void Object_4C_Update(Object_4C *); void Item_Update(Item *); -void Object_8C_Update(Object_8C *); +void Effect_Update(Effect *); void func_8006A06C(UnkEntity30*); void func_8006A38C(void); void Object_UpdateAll(void); @@ -295,6 +296,7 @@ void func_8006BB78(Object_2F4*); void func_8006C008(Object_2F4*); void func_8006D350(Object_80*); void func_8006EEFC(s32, f32, f32, f32, f32, f32, f32, f32, f32, f32); +void func_8006F0D8(f32 xPos, f32 yPos, f32 zPos, f32 arg3); void func_80072594(Object_2F4*); s32 func_80074F90(Object_80*); void func_80074FF0(Object_2F4*); @@ -303,134 +305,139 @@ void func_8007717C(Object_2F4 *); void func_800771CC(Object_2F4*); void func_80077218(Object_2F4*); -// sf_77E40 -void func_80077240(f32 posX, f32 posY, f32 posZ, s32 ); +// fox_effect +void func_80077240(f32 posX, f32 posY, f32 posZ, s32 hits); void func_8007729C(void); void func_80077790(void); -Object_8C* func_8007783C(ObjectId objId); -void func_8007797C(f32 posX, f32 posY, f32 posZ, f32 , f32 , f32 , f32 ); -void func_80077A00(Object_8C* ); -void func_80077A7C(Object_8C* ); -void func_80077B78(Object_8C* ); -void func_80077B84(Object_8C* ); -void func_80078038(Object_8C* ); -void func_800780F8(Object_8C* ); -void func_800783C0(Object_8C* ); -void func_80078438(Object_8C* ); -void func_800784B4(Object_8C* ); -void func_80078550(Object_8C* ); -void func_80078604(Object_8C* ); -void func_8007868C(Object_8C* ); -void func_8007879C(Object_8C* ); -void func_800788B0(Object_8C* ); -void func_80078A64(Object_8C* ); -void func_80078AEC(Object_8C* ); -void func_80078B8C(Object_8C *); -void func_80078BE0(Object_8C* ); -void func_80078C84(Object_8C* ); -void func_80078CE8(Object_8C* ); -void func_80078E50(f32 posX, f32 posY, f32 posZ, f32 ); -void func_80078EBC(Object_8C* ); -void func_80078F78(Object_8C* ); -void func_8007905C(Object_8C* , f32 posX, f32 posY, f32 posZ, f32 , u8 ); -void func_800794CC(f32 posX, f32 posY, f32 posZ, f32 ); -void func_8007953C(f32 posX, f32 posY, f32 posZ, f32 ); -void func_800795AC(f32 posX, f32 posY, f32 posZ, f32 ); -void func_80079618(f32 posX, f32 posY, f32 posZ, f32 ); -void func_8007968C(Object_8C *); +Effect* func_8007783C(ObjectId objId); +void func_8007797C(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2); +void func_80077A00(Effect* ); +void func_80077A7C(Effect* ); +void func_80077B78(Effect* ); +void func_80077B84(Effect* ); +void func_80078038(Effect* ); +void func_800780F8(Effect* ); +void func_800783C0(Effect* ); +void func_80078438(Effect* ); +void func_800784B4(Effect* ); +void func_80078550(Effect* ); +void func_80078604(Effect* ); +void func_8007868C(Effect* ); +void func_8007879C(Effect* ); +void func_800788B0(Effect* ); +void func_80078A64(Effect* ); +void func_80078AEC(Effect* ); +void func_80078B8C(Effect *); +void func_80078BE0(Effect* ); +void func_80078C84(Effect* ); +void func_80078CE8(Effect* ); +void func_80078E50(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_80078EBC(Effect* ); +void func_80078F78(Effect* ); +void func_800794CC(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007953C(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_800795AC(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_80079618(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007968C(Effect *); s32 func_800798C4(s32 , Gfx** , Vec3f* , Vec3f* , void* ); //OverrideLimbDraw -void func_800798F0(Object_8C* ); -void func_8007A28C(Object_8C* ); -void func_8007A3C0(Object_8C* ); -void func_8007A568(f32 xPos, f32 yPos, f32 zPos, f32 ); -void func_8007A5F8(Object_8C* , Vec3f* , u32 ); -void func_8007A6F0(Vec3f *, s32); -void func_8007A748(Object_8C*); -s32 func_8007A774(Player*, Object_8C*, f32); -void func_8007A818(Object_8C*, f32 posX, f32 posY, f32 posZ, f32, u8, u8, u16); -void func_8007A900(f32 posX, f32 posY, f32 posZ, f32, u8, u8, u16); -void func_8007A994(Object_8C*); -void func_8007AA60(Object_8C*); -void func_8007AB50(Object_8C*); -void func_8007ACE0(f32, f32, f32, f32, f32, f32); -void func_8007ADF4(f32 , f32 posY, f32 , f32 , f32 ); -void func_8007AFD0(f32 posX, f32 posZ, f32 , f32 , f32 ); -void func_8007B040(Object_8C*); -void func_8007B0F4(Object_8C*); -void func_8007B228(f32 posX, f32 posY, f32 posZ, f32 ); -void func_8007B344(f32 xPos, f32 yPos, f32 zPos, f32 , s32 ); -void func_8007B3B8(Object_8C*); -void func_8007B550(f32 posX, f32 posY, f32 posZ, f32 , s32 ); -void func_8007B5C0(Object_8C*); -void func_8007B62C(Object_8C*); -void func_8007B670(Object_8C*); -void func_8007B67C(Object_8C*); -void func_8007B758(Object_8C*); -void func_8007B8F8(f32 posX, f32 posY, f32 posZ, f32 ); -void func_8007B960(Object_8C*); -void func_8007BC7C(f32 posX, f32 posY, f32 posZ, f32); -void func_8007BCE8(Object_8C*); -void func_8007B9DC(Object_8C*); -void func_8007BDE0(Object_8C*); -void func_8007BE54(Object_8C*); -void func_8007BEE8(Object_8C*); -void func_8007BFFC(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7); -void func_8007C120(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7); -void func_8007C250(Object_8C*); -void func_8007C484(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7); -void func_8007C50C(Object_8C*); -void func_8007C688(f32 posX, f32 posY, f32 posZ, f32 arg3, s32 arg4); -void func_8007C8C4(Object_8C*); -void func_8007C85C(f32 posX, f32 posY, f32 posZ, f32 arg3); -void func_8007C9E0(Object_8C*); -void func_8007CAF0(Object_8C*); +void func_800798F0(Effect* ); +void func_8007A28C(Effect* ); +void func_8007A3C0(Effect* ); +void func_8007A568(f32 xPos, f32 yPos, f32 zPos, f32 scale1); +void func_8007A5F8(Effect* , Vec3f* pos, u32 sfxId); +void func_8007A6F0(Vec3f* pos, s32 sfxId); +void func_8007A748(Effect*); +s32 func_8007A774(Player*, Effect*, f32); +void func_8007A900(f32 posX, f32 posY, f32 posZ, f32 scale1, u8, u8, u16); +void func_8007A994(Effect*); +void func_8007AA60(Effect*); +void func_8007AB50(Effect*); +void func_8007ACE0(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, f32 rotY); +void func_8007ADF4(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1); +void func_8007AFD0(f32 posX, f32 posZ, f32 velX, f32 velZ, f32 scale1); +void func_8007B040(Effect*); +void func_8007B0F4(Effect*); +void func_8007B228(f32 posX, f32 posY, f32 posZ, f32 scale1); +void func_8007B344(f32 xPos, f32 yPos, f32 zPos, f32 scale1, s32 ); +void func_8007B3B8(Effect*); +void func_8007B550(f32 posX, f32 posY, f32 posZ, f32 scale1, s32 ); +void func_8007B5C0(Effect*); +void func_8007B62C(Effect*); +void func_8007B670(Effect*); +void func_8007B67C(Effect*); +void func_8007B758(Effect*); +void func_8007B8F8(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007B960(Effect*); +void func_8007BC7C(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007BCE8(Effect*); +void func_8007B9DC(Effect*); +void func_8007BDE0(Effect*); +void func_8007BE54(Effect*); +void func_8007BEE8(Effect*); +void func_8007BFFC(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 timer50); +void func_8007C120(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 timer50); +void func_8007C250(Effect*); +void func_8007C484(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 arg7); +void func_8007C50C(Effect*); +void func_8007C688(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50); +void func_8007C8C4(Effect*); +void func_8007C85C(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007C9E0(Effect*); +void func_8007CAF0(Effect*); void func_8007CF30(f32 posX, f32 posY, f32 posZ, f32 scale2); void func_8007D074(f32 posX, f32 posY, f32 posZ, f32 scale2); void func_8007D0E0(f32 posX, f32 posY, f32 posZ, f32 scale2); void func_8007D10C(f32 posX, f32 posY, f32 posZ, f32 scale2); void func_8007D1E0(f32 posX, f32 posY, f32 posZ, f32 scale2); void func_8007D24C(f32 posX, f32 posY, f32 posZ, f32 scale2); -void func_8007D2C8(f32, f32, f32, f32); -void func_8007D2F4(Object_8C*); -void func_8007D55C(Object_8C*); -void func_8007D748(Object_8C*); -void func_8007D8A8(Object_8C*); -void func_8007D9DC(f32, f32, f32, f32, f32, s32); -void func_8007DA58(Object_8C*); -void func_8007DAE4(Object_8C*); -void func_8007DB70(Object_8C*); -void func_8007DED4(Object_8C*); -void func_8007E014(Object_8C*); -void func_8007E258(Object_8C*); -void func_8007E298(Object_8C*); -void func_8007E330(Object_8C*); -void func_8007E3E4(Object_8C*); -void func_8007E45C(Object_8C*); -void func_8007E5CC(Object_8C*); -void func_8007E648(Object_8C*); -void func_8007E93C(Object_8C *, u16 , f32 , f32 , f32 , f32 ); -void func_8007F04C(s32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32); -void func_8007F20C(s32 , f32 , f32 , f32 , f32 ); -void func_8007F438(Object_8C*); -void func_8007F6B0(Object_8C*); -void func_8007F958(Object_8C*); -void func_8007FBE0(Object_8C*); -void func_8007FE88(Object_8C*); -void func_800802B8(Object_8C*); -void func_800802D8(Object_8C*); -void func_800802F8(Object_8C*); -void func_80080360(Object_8C*); -void func_8008040C(Object_8C*); -void func_8008092C(Object_8C*); -void func_80080ACC(Object_8C*); -void func_80080D04(Object_8C*); -void func_80081C5C(Object_8C*); -void func_80082F78(Object_8C*); -void func_800837EC(Object_8C*); -void func_80083B8C(Object_8C*); -void func_80083D2C(f32 , f32 , f32 , f32 ); -void func_80083FA8(Object_8C*); -void func_80084194(Object_8C*); +void func_8007D2C8(f32 posX, f32 posY, f32 posZ, f32 scale2); +void func_8007D2F4(Effect*); +void func_8007D55C(Effect*); +void func_8007D748(Effect*); +void func_8007D8A8(Effect*); +void func_8007D9DC(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, s32 timer50); +void func_8007DA58(Effect*); +void func_8007DAE4(Effect*); +void func_8007DB70(Effect*); +void func_8007DED4(Effect*); +void func_8007E014(Effect*); +void func_8007E258(Effect*); +void func_8007E298(Effect*); +void func_8007E330(Effect*); +void func_8007E3E4(Effect*); +void func_8007E45C(Effect*); +void func_8007E5CC(Effect*); +void func_8007E648(Effect*); +void func_8007E93C(Effect* effect, u32 objId, f32 posX, f32 posY, f32 posZ, f32 arg5); +void func_8007EE68(s32 objId, Vec3f* pos, Vec3f* rot, Vec3f* arg3, Vec3f* arg4, f32 scale2); +void func_8007F04C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 rotX, f32 rotY, f32 rotZ, f32 unkX, f32 unkY, f32 unkZ, f32 velX, f32 velY, f32 velZ, f32 scale2); +void func_8007F11C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 arg4); +void func_8007F20C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 arg4); +void func_8007F438(Effect*); +void func_8007F6B0(Effect*); +void func_8007F958(Effect*); +void func_8007FBE0(Effect*); +void func_8007FE88(Effect*); +s32 func_8007FD84(Effect*); +void func_800802B8(Effect*); +void func_800802D8(Effect*); +void func_800802F8(Effect*); +void func_80080360(Effect*); +void func_8008040C(Effect*); +void func_8008092C(Effect*); +void func_80080ACC(Effect*); +void func_80080D04(Effect*); +void func_800815DC(void); +void func_80081A8C(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 arg4); +void func_80081BEC(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 arg4); +void func_80081C5C(Effect*); +void func_80082F78(Effect*); +void func_800837EC(Effect*); +void func_80083B8C(Effect*); +void func_80083C70(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 arg7, s32 arg8); +void func_80083D2C(f32 posX, f32 posY, f32 posZ, f32 srcZ); +void func_80083FA8(Effect*); +void func_80084194(Effect*); // fox_fade void func_80084370(s32); @@ -476,8 +483,8 @@ void func_80092EC0(Object_2F4*); void func_80093164(Object_2F4*); void func_800935E8(Player*); void func_80095604(Player*); -void func_80094954(Object_8C*); -void func_80094BBC(Object_8C*); +void func_80094954(Effect*); +void func_80094BBC(Effect*); void func_80094D20(f32, f32); // fox_97F80 @@ -514,7 +521,7 @@ void func_800A5FA0(Vec3f* , u32 , s32 ); void func_800A6070(Vec3f* arg0, u32 arg1); void func_800A6148(void); void func_800A69F8(s32 , f32 , f32 , f32 ); -void Player_ApplyDamage(Player *, s32, s32); +void Player_ApplyDamage(Player* player, s32 direction, s32 damage); bool func_800A73E4(f32* , s32* , f32 posX, f32 posY, f32 posZ); s32 func_800A78C4(Hitbox* hitbox, f32 , f32 , f32 , f32 , f32 , f32 ); void func_800A8BA4(Player* player); @@ -660,8 +667,8 @@ void func_E16C50_8019EA7C(Object_2F4*); void func_E16C50_8019F20C(Object_2F4*); void func_E16C50_8019F7AC(Object_2F4*); void func_E16C50_801A003C(Object_2F4*); -void func_E16C50_801A0120(Object_8C*); -void func_E16C50_801A0AF0(Object_8C*); +void func_E16C50_801A0120(Effect*); +void func_E16C50_801A0AF0(Effect*); void func_E16C50_801A10F4(Player* player); void func_E16C50_801A5B3C(Boss*); void func_E16C50_801A71B8(Boss*); @@ -676,7 +683,7 @@ void func_E16C50_801ABA40(PlayerShot*); void func_E16C50_801AC274(Player*); void func_E16C50_801AC8A8(f32, f32, f32, f32, s32); void func_E16C50_801AC8A8(f32, f32, f32, f32, s32); -void func_E16C50_801AC918(Object_8C*); +void func_E16C50_801AC918(Effect*); void func_E16C50_801ACBB4(void); void func_E16C50_801ACE50(Player*); void func_E16C50_801AD328(Player*); diff --git a/include/macros.h b/include/macros.h index e57b7dc5..7a278085 100644 --- a/include/macros.h +++ b/include/macros.h @@ -19,4 +19,10 @@ #define CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(osClockRate/15625LL)) #define CYCLES_TO_MSEC(c) ((s32)CYCLES_TO_USEC(c)/1000) +#if defined(__sgi) +#define PRINTF +#else +#define PRINTF(...) +#endif + #endif // MACROS_H diff --git a/include/sf64math.h b/include/sf64math.h index be59d173..e8877e6b 100644 --- a/include/sf64math.h +++ b/include/sf64math.h @@ -70,8 +70,8 @@ void Matrix_RotateZ(Matrix*, f32, u8); void Matrix_RotateAxis(Matrix*, f32, f32, f32, f32, u8); void Matrix_ToMtx(Mtx *dest); void Matrix_FromMtx(Mtx *src, Matrix *dest); -void Matrix_MultVec3f(Matrix*, Vec3f*, Vec3f*); -void Matrix_MultVec3fNoTranslate(Matrix*, Vec3f*, Vec3f*); +void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest); +void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest); void Matrix_GetYRPAngles(Matrix*, Vec3f*); void Matrix_GetXYZAngles(Matrix*, Vec3f*); void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8); diff --git a/include/sf64object.h b/include/sf64object.h index c31673ac..a0ee550a 100644 --- a/include/sf64object.h +++ b/include/sf64object.h @@ -201,7 +201,7 @@ typedef struct { /* 0x7A */ s16 unk_7A; /* 0x7C */ char pad7C[4]; /* 0x80 */ Vec3f sfxPos; -} Object_8C; // size 0x8C +} Effect; // size 0x8C typedef struct { /* 0x000 */ Object obj; @@ -666,67 +666,67 @@ typedef enum{ /* 336 */ OBJ_ITEM_GOLD_RING, /* 337 */ OBJ_ITEM_WING_REPAIR, /* 338 */ OBJ_ITEM_TRAINING_RING, - /* 339 */ OBJ_8C_339, - /* 340 */ OBJ_8C_340, - /* 341 */ OBJ_8C_341, - /* 342 */ OBJ_8C_342, - /* 343 */ OBJ_8C_343, - /* 344 */ OBJ_8C_344, - /* 345 */ OBJ_8C_345, - /* 346 */ OBJ_8C_346, - /* 347 */ OBJ_8C_347, - /* 348 */ OBJ_8C_348, - /* 349 */ OBJ_8C_349, - /* 350 */ OBJ_8C_350, - /* 351 */ OBJ_8C_351, - /* 352 */ OBJ_8C_352, - /* 353 */ OBJ_8C_353, - /* 354 */ OBJ_8C_354, - /* 355 */ OBJ_8C_355, - /* 356 */ OBJ_8C_356, - /* 357 */ OBJ_8C_357, - /* 358 */ OBJ_8C_358, - /* 359 */ OBJ_8C_359, - /* 360 */ OBJ_8C_360, - /* 361 */ OBJ_8C_361, - /* 362 */ OBJ_8C_362, - /* 363 */ OBJ_8C_363, - /* 364 */ OBJ_8C_364, - /* 365 */ OBJ_8C_365, - /* 366 */ OBJ_8C_366, - /* 367 */ OBJ_8C_367, - /* 368 */ OBJ_8C_368, - /* 369 */ OBJ_8C_369, - /* 370 */ OBJ_8C_370, - /* 371 */ OBJ_8C_371, - /* 372 */ OBJ_8C_372, - /* 373 */ OBJ_8C_373, - /* 374 */ OBJ_8C_374, - /* 375 */ OBJ_8C_375, - /* 376 */ OBJ_8C_376, - /* 377 */ OBJ_8C_377, - /* 378 */ OBJ_8C_378, - /* 379 */ OBJ_8C_379, - /* 380 */ OBJ_8C_380, - /* 381 */ OBJ_8C_381, - /* 382 */ OBJ_8C_382, - /* 383 */ OBJ_8C_383, - /* 384 */ OBJ_8C_384, - /* 385 */ OBJ_8C_385, - /* 386 */ OBJ_8C_386, - /* 387 */ OBJ_8C_387, - /* 388 */ OBJ_8C_388, - /* 389 */ OBJ_8C_389, - /* 390 */ OBJ_8C_390, - /* 391 */ OBJ_8C_391, - /* 392 */ OBJ_8C_392, - /* 393 */ OBJ_8C_393, - /* 394 */ OBJ_8C_394, - /* 395 */ OBJ_8C_395, - /* 396 */ OBJ_8C_396, - /* 397 */ OBJ_8C_397, - /* 398 */ OBJ_8C_398, - /* 399 */ OBJ_8C_399, + /* 339 */ OBJ_EFFECT_339, + /* 340 */ OBJ_EFFECT_340, + /* 341 */ OBJ_EFFECT_341, + /* 342 */ OBJ_EFFECT_342, + /* 343 */ OBJ_EFFECT_343, + /* 344 */ OBJ_EFFECT_344, + /* 345 */ OBJ_EFFECT_345, + /* 346 */ OBJ_EFFECT_346, + /* 347 */ OBJ_EFFECT_347, + /* 348 */ OBJ_EFFECT_348, + /* 349 */ OBJ_EFFECT_349, + /* 350 */ OBJ_EFFECT_350, + /* 351 */ OBJ_EFFECT_351, + /* 352 */ OBJ_EFFECT_352, + /* 353 */ OBJ_EFFECT_353, + /* 354 */ OBJ_EFFECT_354, + /* 355 */ OBJ_EFFECT_355, + /* 356 */ OBJ_EFFECT_356, + /* 357 */ OBJ_EFFECT_357, + /* 358 */ OBJ_EFFECT_358, + /* 359 */ OBJ_EFFECT_359, + /* 360 */ OBJ_EFFECT_360, + /* 361 */ OBJ_EFFECT_361, + /* 362 */ OBJ_EFFECT_362, + /* 363 */ OBJ_EFFECT_363, + /* 364 */ OBJ_EFFECT_364, + /* 365 */ OBJ_EFFECT_365, + /* 366 */ OBJ_EFFECT_366, + /* 367 */ OBJ_EFFECT_367, + /* 368 */ OBJ_EFFECT_368, + /* 369 */ OBJ_EFFECT_369, + /* 370 */ OBJ_EFFECT_370, + /* 371 */ OBJ_EFFECT_371, + /* 372 */ OBJ_EFFECT_372, + /* 373 */ OBJ_EFFECT_373, + /* 374 */ OBJ_EFFECT_374, + /* 375 */ OBJ_EFFECT_375, + /* 376 */ OBJ_EFFECT_376, + /* 377 */ OBJ_EFFECT_377, + /* 378 */ OBJ_EFFECT_378, + /* 379 */ OBJ_EFFECT_379, + /* 380 */ OBJ_EFFECT_380, + /* 381 */ OBJ_EFFECT_381, + /* 382 */ OBJ_EFFECT_382, + /* 383 */ OBJ_EFFECT_383, + /* 384 */ OBJ_EFFECT_384, + /* 385 */ OBJ_EFFECT_385, + /* 386 */ OBJ_EFFECT_386, + /* 387 */ OBJ_EFFECT_387, + /* 388 */ OBJ_EFFECT_388, + /* 389 */ OBJ_EFFECT_389, + /* 390 */ OBJ_EFFECT_390, + /* 391 */ OBJ_EFFECT_391, + /* 392 */ OBJ_EFFECT_392, + /* 393 */ OBJ_EFFECT_393, + /* 394 */ OBJ_EFFECT_394, + /* 395 */ OBJ_EFFECT_395, + /* 396 */ OBJ_EFFECT_396, + /* 397 */ OBJ_EFFECT_397, + /* 398 */ OBJ_EFFECT_398, + /* 399 */ OBJ_EFFECT_399, /* 400 */ OBJ_ID_MAX, } ObjectId; diff --git a/include/variables.h b/include/variables.h index 1660891a..b3ad62a0 100644 --- a/include/variables.h +++ b/include/variables.h @@ -207,20 +207,7 @@ extern s16 D_800CFF94[]; extern u8 D_800CFFB4[]; extern f32 D_800CFFC4[]; -// sf_77E40 -extern Gfx* D_800D14E0[][2]; -extern Gfx* D_800D14FC[]; -extern Vec3f D_800D1528; -extern f32 D_800D1534[10][10]; -extern s32 D_800D173C[]; -extern Gfx* D_800D178C[6]; -extern s32 D_800D18F0[]; //[6][4]? -extern s32 D_800D1950[]; -extern Gfx* D_800D17A4[]; -extern f32 D_800D17F8[]; -extern u8 D_800D184C[][4]; -extern Gfx* D_800D18A0[]; -extern Gfx D_6004900[]; +// fox_effect // sf_hud extern s16 D_800D1970; @@ -402,7 +389,7 @@ extern Object_80 gObjects80[50]; extern Object_4C gObjects4C[40]; extern Object_2F4 gObjects2F4[60]; extern Boss gBosses[4]; -extern Object_8C gObjects8C[100]; +extern Effect gEffects[100]; extern Item gItems[20]; extern PlayerShot gPlayerShots[16]; extern UnkEntity30 gUnkEntities30[100]; diff --git a/linker_scripts/us/symbol_addrs_engine.txt b/linker_scripts/us/symbol_addrs_engine.txt index 5e486d85..bfb60dd0 100644 --- a/linker_scripts/us/symbol_addrs_engine.txt +++ b/linker_scripts/us/symbol_addrs_engine.txt @@ -204,8 +204,8 @@ Object_4C_Draw = 0x8005D8B8; Object_2F4_Draw2 = 0x8005D954; Object_2F4_Draw1 = 0x8005DBC0; Boss_Draw = 0x8005E1B8; -Object_8C_Draw1 = 0x8005E454; -Object_8C_Draw2 = 0x8005E538; +Effect_Draw1 = 0x8005E454; +Effect_Draw2 = 0x8005E538; Item_Draw = 0x8005E7B8; func_8005EA24 = 0x8005EA24; func_8005ECD8 = 0x8005ECD8; @@ -234,7 +234,7 @@ Object_4C_Initialize = 0x80061394; Object_2F4_Initialize = 0x800613C4; Boss_Initialize = 0x80061404; Item_Initialize = 0x80061444; -Object_8C_Initialize = 0x80061474; +Effect_Initialize = 0x80061474; Object_80_Load = 0x800614B4; Object_4C_Load = 0x800615A0; Object_2F4_Load = 0x8006168C; @@ -314,7 +314,7 @@ Boss_Update = 0x80069CBC; Object_80_Update = 0x80069DF4; Object_4C_Update = 0x80069E88; Item_Update = 0x80069F30; -Object_8C_Update = 0x80069FD4; +Effect_Update = 0x80069FD4; func_8006A06C = 0x8006A06C; func_8006A38C = 0x8006A38C; Object_UpdateAll = 0x8006A3E8; @@ -387,7 +387,7 @@ gObjects80 = 0x80161B00; //size:0x1900 gObjects4C = 0x80163400; //size:0xBE0 gObjects2F4 = 0x80163FE0; //size:0xB130 gBosses = 0x8016F110; //size:0x1020 -gObjects8C = 0x80170130; //size:0x36B0 +gEffects = 0x80170130; //size:0x36B0 gItems = 0x801737E0; //size:0x870 gPlayerShots = 0x80174050; //size:0x700 gUnkEntities30 = 0x80174750; //size:0x12C0 diff --git a/linker_scripts/us/undefined_syms.ld b/linker_scripts/us/undefined_syms.ld index bf26a8c2..07598648 100644 --- a/linker_scripts/us/undefined_syms.ld +++ b/linker_scripts/us/undefined_syms.ld @@ -272,6 +272,20 @@ D_1024410 = 0x01024410; D_1024570 = 0x01024570; D_10246D0 = 0x010246D0; +D_1016410 = 0x01016410; +D_1003130 = 0x01003130; +D_10162A0 = 0x010162A0; +D_1016130 = 0x01016130; +D_1015FC0 = 0x01015FC0; + +D_1015810 = 0x01015810; +D_1015E50 = 0x01015E50; +D_10156A0 = 0x010156A0; +D_1015CE0 = 0x01015CE0; +D_1015B70 = 0x01015B70; +D_1015320 = 0x01015320; + + D_2000000 = 0x02000000; D_2000890 = 0x02000890; D_2001090 = 0x02001090; @@ -704,6 +718,11 @@ D_604A190 = 0x0604A190; D_604A400 = 0x0604A400; D_604A710 = 0x0604A710; D_6049F80 = 0x06049F80; +D_6003440 = 0x06003440; +D_60034E0 = 0x060034E0; +D_6003580 = 0x06003580; +D_6003620 = 0x06003620; +D_60036C0 = 0x060036C0; D_700AB70 = 0x0700AB70; D_700BE00 = 0x0700BE00; diff --git a/mips_to_c.sh b/mips_to_c.sh new file mode 100755 index 00000000..53569a28 --- /dev/null +++ b/mips_to_c.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo 1>&2 "$0: not enough arguments" + echo 1>&2 "Usage: $0 path/to/sourcefile.c func_name" + exit 2 +elif [ $# -gt 2 ]; then + echo 1>&2 "$0: too many arguments" + exit 2 +fi + +PYTHON=python3 +SOURCEFILE=$1 +FUNCNAME=$2 +M2CFILE=m2cfiles/$FUNCNAME.c +ASMFILE=$(find . -type f -name "*$FUNCNAME.s") + +# Support python venv's if one is installed. +PYTHON_VENV=.venv/bin/python3 +if test -f $PYTHON_VENV; then + PYTHON=$PYTHON_VENV +fi + +echo "Generating ctx.c from $SOURCEFILE..." +$PYTHON ./tools/m2ctx.py $SOURCEFILE + +echo "Generating $M2CFILE..." +echo '#include "../ctx.c"\n' > $M2CFILE +$PYTHON ./tools/m2c/m2c.py --target mips-ido-c --pointer-style left --context ctx.c -f $FUNCNAME $ASMFILE >> $M2CFILE diff --git a/src/main/fox_beam.c b/src/main/fox_beam.c index 7ed3bfab..92bf7052 100644 --- a/src/main/fox_beam.c +++ b/src/main/fox_beam.c @@ -2,30 +2,30 @@ static Vec3f D_8015F950; -void func_80035D30(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_351; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->vel.z = 0.0f; - obj8C->scale2 = 0.3f; - obj8C->unk_4A = 100; - obj8C->unk_48 = 3; +void func_80035D30(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_351; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->vel.z = 0.0f; + effect->scale2 = 0.3f; + effect->unk_4A = 100; + effect->unk_48 = 3; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; + effect->unk_48 = -effect->unk_48; } - Object_SetInfo(&obj8C->info, obj8C->obj.id); + Object_SetInfo(&effect->info, effect->obj.id); } void func_80035DEC(f32 xPos, f32 yPos, f32 zPos) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_80035D30(&gObjects8C[i], xPos, yPos, zPos); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_80035D30(&gEffects[i], xPos, yPos, zPos); break; } } @@ -157,21 +157,21 @@ void func_80036318(PlayerShot* shot) { } } -void func_80036528(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 xRot, f32 scale, s32 unk44, s32 time) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_344; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->obj.rot.y = yRot; - obj8C->obj.rot.x = xRot; - obj8C->scale2 = scale * 0.5f; - obj8C->unk_44 = unk44; - obj8C->unk_46 = 80; - obj8C->timer_50 = time; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - func_800A6070(&obj8C->sfxPos, 0x29000000); +void func_80036528(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 xRot, f32 scale, s32 unk44, s32 time) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_344; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->obj.rot.y = yRot; + effect->obj.rot.x = xRot; + effect->scale2 = scale * 0.5f; + effect->unk_44 = unk44; + effect->unk_46 = 80; + effect->timer_50 = time; + Object_SetInfo(&effect->info, effect->obj.id); + func_800A6070(&effect->sfxPos, 0x29000000); } void func_800365E4(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 arg4, f32 arg5, f32 yRot, f32 xRot, f32 scale, s32 unk44, @@ -181,26 +181,26 @@ void func_800365E4(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 arg4, f32 arg5, f if ((D_801784AC != 4) && (gLevelType == LEVELTYPE_PLANET) && (D_80161A88 != 2) && (gCurrentLevel != LEVEL_SOLAR) && (gCurrentLevel != LEVEL_BOLSE) && (gCurrentLevel != LEVEL_TRAINING) && (gCurrentLevel != LEVEL_ZONESS)) { for (i = 0; i < 50; i++) { - if (gObjects8C[i].obj.status == 0) { - func_80036528(&gObjects8C[i], xPos, yPos, zPos, yRot, xRot, scale, unk44, time); + if (gEffects[i].obj.status == 0) { + func_80036528(&gEffects[i], xPos, yPos, zPos, yRot, xRot, scale, unk44, time); break; } } } } -void func_800366CC(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_345; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->obj.rot.y = yRot; - obj8C->scale2 = scale * 0.5f; - obj8C->timer_50 = 80; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - func_800A6070(&obj8C->sfxPos, 0x29000000); +void func_800366CC(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_345; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->obj.rot.y = yRot; + effect->scale2 = scale * 0.5f; + effect->timer_50 = 80; + Object_SetInfo(&effect->info, effect->obj.id); + func_800A6070(&effect->sfxPos, 0x29000000); } void func_80036770(f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) { @@ -209,8 +209,8 @@ void func_80036770(f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) { if ((D_801784AC != 4) && (gLevelType == LEVELTYPE_PLANET) && (D_80161A88 <= 0) && (gCurrentLevel != LEVEL_TRAINING) && (gCurrentLevel != LEVEL_SOLAR) && (gCurrentLevel != LEVEL_ZONESS)) { for (i = 0; i < 50; i++) { - if (gObjects8C[i].obj.status == 0) { - func_800366CC(&gObjects8C[i], xPos, yPos, zPos, yRot, scale); + if (gEffects[i].obj.status == 0) { + func_800366CC(&gEffects[i], xPos, yPos, zPos, yRot, scale); func_8007D10C(xPos, yPos, zPos, 2.0f); break; } @@ -727,7 +727,7 @@ void func_80038140(PlayerShot* shot) { Object_58* obj58; Object_4C* obj4C; Object_80* obj80; - Object_8C* obj8C; + Effect* effect; bool sp60; Player* player; @@ -736,15 +736,15 @@ void func_80038140(PlayerShot* shot) { sp60 = false; } if (sp60) { - for (i = 0, obj8C = gObjects8C; i < 100; i++, obj8C++) { - if ((obj8C->obj.status >= 2) && (obj8C->info.unk_19 != 0) && - (fabsf(shot->obj.pos.z - obj8C->obj.pos.z) < 200.0f) && - (fabsf(shot->obj.pos.x - obj8C->obj.pos.x) < 100.0f) && - (fabsf(shot->obj.pos.y - obj8C->obj.pos.y) < 100.0f)) { - if (obj8C->info.unk_19 == 2) { - obj8C->unk_44 = 1; + for (i = 0, effect = gEffects; i < 100; i++, effect++) { + if ((effect->obj.status >= 2) && (effect->info.unk_19 != 0) && + (fabsf(shot->obj.pos.z - effect->obj.pos.z) < 200.0f) && + (fabsf(shot->obj.pos.x - effect->obj.pos.x) < 100.0f) && + (fabsf(shot->obj.pos.y - effect->obj.pos.y) < 100.0f)) { + if (effect->info.unk_19 == 2) { + effect->unk_44 = 1; } else { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + Object_Kill(&effect->obj, &effect->sfxPos); } } } @@ -1835,7 +1835,7 @@ void func_8003C4D0(PlayerShot* shot, s32 unkD6) { Object_2F4* obj2F4; Object_4C* obj4C; Object_80* obj80; - Object_8C* obj8C; + Effect* effect; Player* player; f32 temp_fs2 = shot->unk_44 * 60.0f; @@ -1922,28 +1922,28 @@ void func_8003C4D0(PlayerShot* shot, s32 unkD6) { } else { func_8003C008(shot); } - obj8C = gObjects8C; - for (i = 0; i < 100; i++, obj8C++) { - if (obj8C->obj.status == 2) { - sp68 = obj8C->obj.pos.x - shot->obj.pos.x; - sp64 = obj8C->obj.pos.y - shot->obj.pos.y; - sp60 = obj8C->obj.pos.z - shot->obj.pos.z; + effect = gEffects; + for (i = 0; i < 100; i++, effect++) { + if (effect->obj.status == 2) { + sp68 = effect->obj.pos.x - shot->obj.pos.x; + sp64 = effect->obj.pos.y - shot->obj.pos.y; + sp60 = effect->obj.pos.z - shot->obj.pos.z; if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) { - if (obj8C->info.unk_16 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + if (effect->info.unk_16 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); } - if (obj8C->info.unk_16 == 2) { - obj8C->obj.pos.x += sp68 * 0.03f; - if (!((gLevelType == LEVELTYPE_PLANET) && (obj8C->obj.pos.y < 100.0f))) { - obj8C->obj.pos.y += sp64 * 0.03f; + if (effect->info.unk_16 == 2) { + effect->obj.pos.x += sp68 * 0.03f; + if (!((gLevelType == LEVELTYPE_PLANET) && (effect->obj.pos.y < 100.0f))) { + effect->obj.pos.y += sp64 * 0.03f; } - obj8C->obj.pos.z += sp60 * 0.03f; - if ((obj8C->obj.id == OBJ_8C_392) && (obj8C->unk_4E == 0)) { - obj8C->unk_4E = 1; - obj8C->unk_44 = 176; - obj8C->unk_4C = 0; - obj8C->vel.x = obj8C->vel.y = obj8C->vel.z = 0.0f; - obj8C->scale2 = 20.0f; + effect->obj.pos.z += sp60 * 0.03f; + if ((effect->obj.id == OBJ_EFFECT_392) && (effect->unk_4E == 0)) { + effect->unk_4E = 1; + effect->unk_44 = 176; + effect->unk_4C = 0; + effect->vel.x = effect->vel.y = effect->vel.z = 0.0f; + effect->scale2 = 20.0f; } } } @@ -2132,8 +2132,8 @@ void func_8003CF90(PlayerShot* shot) { shot->obj.rot.y = shot->unk_30; shot->obj.rot.x = shot->unk_2C; - Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * 0.017453292f, 0); - Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * 0.017453292f, 1); + Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * M_DTOR, 1); sp44.x = sp44.y = 0.0f; sp44.z = -(shot->unk_54 + 40.0f); Matrix_MultVec3f(gCalcMatrix, &sp44, &sp38); diff --git a/src/main/fox_demo.c b/src/main/fox_demo.c index 5cd6a441..d3b1d26c 100644 --- a/src/main/fox_demo.c +++ b/src/main/fox_demo.c @@ -470,18 +470,18 @@ void func_80049968(Object_2F4* obj2F4, s32 arg1) { Audio_PlaySfx(0x3100000CU, &obj2F4->sfxPos, 4U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); } -void func_80049A9C(Object_8C* obj8c, f32 x, f32 y, f32 z) { - Object_8C_Initialize(obj8c); - obj8c->obj.status = 1; - obj8c->obj.id = OBJ_8C_346; - obj8c->timer_50 = 100; - obj8c->scale2 = 0.2f; - obj8c->obj.pos.x = x; - obj8c->obj.pos.y = y; - obj8c->obj.pos.z = z; - obj8c->vel.z = 40.0f; - obj8c->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8c->info, obj8c->obj.id); +void func_80049A9C(Effect* effect, f32 x, f32 y, f32 z) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_346; + effect->timer_50 = 100; + effect->scale2 = 0.2f; + effect->obj.pos.x = x; + effect->obj.pos.y = y; + effect->obj.pos.z = z; + effect->vel.z = 40.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_80049B44(void) { @@ -490,12 +490,12 @@ void func_80049B44(void) { f32 y; f32 z; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (!gObjects8C[i].obj.status) { + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (!gEffects[i].obj.status) { x = (Rand_ZeroOne() - 0.5f) * 400.0f; y = (Rand_ZeroOne() - 0.5f) * 400.0f; z = (-D_80177D20 - 500.0f) - Rand_ZeroOne() * 500.0f; - func_80049A9C(&gObjects8C[i], x, y, z); + func_80049A9C(&gEffects[i], x, y, z); break; } } @@ -800,51 +800,51 @@ void func_8004A840(s32 obj2F4) { func_8004A700(&gObjects2F4[obj2F4], obj2F4); } -void func_8004A888(Object_8C* obj8C) { +void func_8004A888(Effect* effect) { Vec3f sp2C; Vec3f sp20; Matrix_RotateY(gCalcMatrix, (gPlayer[0].unk_0E8 + 180.0f) * M_DTOR, 0); Matrix_RotateX(gCalcMatrix, -(gPlayer[0].unk_0E4 * M_DTOR), 1); - Object_8C_Initialize(obj8C); + Effect_Initialize(effect); - obj8C->obj.status = 1; + effect->obj.status = 1; sp2C.x = (Rand_ZeroOne() - 0.5f) * 1500.0f; sp2C.y = (Rand_ZeroOne() - 0.5f) * 800.0f; sp2C.z = 3000.0f; Matrix_MultVec3f(gCalcMatrix, &sp2C, &sp20); - obj8C->obj.pos.x = gPlayer[0].pos.x + sp20.x; - obj8C->obj.pos.y = gPlayer[0].pos.y + sp20.y; - obj8C->obj.pos.z = gPlayer[0].pos.z + sp20.z; + effect->obj.pos.x = gPlayer[0].pos.x + sp20.x; + effect->obj.pos.y = gPlayer[0].pos.y + sp20.y; + effect->obj.pos.z = gPlayer[0].pos.z + sp20.z; sp2C.x = 0.0f; sp2C.y = 0.0f; sp2C.z = -80.0f; Matrix_MultVec3f(gCalcMatrix, &sp2C, &sp20); - obj8C->vel.x = sp20.x; - obj8C->vel.y = sp20.y; - obj8C->vel.z = sp20.z; - obj8C->obj.id = OBJ_8C_352; - obj8C->timer_50 = 0x28; - obj8C->unk_46 = 0x90; - obj8C->scale2 = (Rand_ZeroOne() * 30.0f) + 10.0f; + effect->vel.x = sp20.x; + effect->vel.y = sp20.y; + effect->vel.z = sp20.z; + effect->obj.id = OBJ_EFFECT_352; + effect->timer_50 = 0x28; + effect->unk_46 = 0x90; + effect->scale2 = (Rand_ZeroOne() * 30.0f) + 10.0f; if (Rand_ZeroOne() < 0.5f) { - obj8C->obj.rot.z = 180.0f; + effect->obj.rot.z = 180.0f; } - Object_SetInfo(&obj8C->info, obj8C->obj.id); + Object_SetInfo(&effect->info, effect->obj.id); } void func_8004AA84(void) { s32 i; if (!(gFrameCount & 7) && (gLevelType == LEVEL_CORNERIA)) { - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (!gObjects8C[i].obj.status) { - func_8004A888(&gObjects8C[i]); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (!gEffects[i].obj.status) { + func_8004A888(&gEffects[i]); break; } } diff --git a/src/main/fox_edata_1C.c b/src/main/fox_edata_1C.c index 2829939c..158bdc91 100644 --- a/src/main/fox_edata_1C.c +++ b/src/main/fox_edata_1C.c @@ -763,66 +763,66 @@ ObjectInfo D_800CC124[0x190] = { /* OBJ_ITEM_GOLD_RING */ {(void*) func_8005CA80, 1, (ObjectFunc) func_800685F8, D_800CBF54, 700.0f, 0, 0, 0, 0, 0.0f, 0 }, /* OBJ_ITEM_WING_REPAIR */ {(void*) D_3007650, 0, (ObjectFunc) func_80068618, D_800CBFA8, 700.0f, 0, 0, 0, 0, 0.0f, 0 }, /* OBJ_ITEM_TRAINING_RING */ {(void*) D_6006140, 0, (ObjectFunc) func_80198968, D_6009CFC, 700.0f, 0, 0, 0, 0, 0.0f, 0 }, - /* OBJ_8C_339 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D2F4, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_340 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D748, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_341 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D8A8, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_342 */ {(void*) func_8007E330, 1, (ObjectFunc) func_8007E298, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_343 */ {(void*) func_8007CAF0, 1, (ObjectFunc) func_8007C9E0, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_344 */ {(void*) func_8007868C, 1, (ObjectFunc) func_8007E014, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_345 */ {(void*) func_8007879C, 1, (ObjectFunc) func_8007E258, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_346 */ {(void*) func_800788B0, 1, (ObjectFunc) func_8007F438, NULL, -200.0f, 1, 0, 0, 0, 0.0f, 0 }, - /* OBJ_8C_347 */ {(void*) func_800783C0, 1, (ObjectFunc) func_8007B758, NULL, 100.0f, 1, 0, 40, 0, 0.0f, 0 }, - /* OBJ_8C_348 */ {(void*) func_80078A64, 1, (ObjectFunc) func_8007F6B0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_349 */ {(void*) NULL, 1, (ObjectFunc) func_8007F958, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_350 */ {(void*) NULL, 1, (ObjectFunc) func_8007FBE0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_351 */ {(void*) func_80078438, 1, (ObjectFunc) func_8007E3E4, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_352 */ {(void*) func_800784B4, 1, (ObjectFunc) func_8007B62C, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_353 */ {(void*) func_80078B8C, 1, (ObjectFunc) func_8007FE88, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_354 */ {(void*) func_80197C64, 1, (ObjectFunc) func_8007FE88, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_355 */ {(void*) func_80078AEC, 1, (ObjectFunc) func_800802B8, NULL, 100.0f, 1, 0, 20, 1, 0.0f, 0 }, - /* OBJ_8C_356 */ {(void*) func_80078C84, 1, (ObjectFunc) func_800802F8, NULL, 100.0f, 1, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_357 */ {(void*) func_800798F0, 1, (ObjectFunc) func_8007968C, NULL, 100.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_358 */ {(void*) func_80192A68, 1, (ObjectFunc) func_80192984, NULL, 100.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_359 */ {(void*) func_8007AA60, 1, (ObjectFunc) func_8007A994, NULL, -100.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_360 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BE54, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_361 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BDE0, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_362 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BCE8, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_363 */ {(void*) func_80094BBC, 1, (ObjectFunc) func_80094954, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_364 */ {(void*) func_8007B9DC, 1, (ObjectFunc) func_8007B960, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_365 */ {(void*) func_8007E5CC, 1, (ObjectFunc) func_8007E45C, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_366 */ {(void*) func_80078550, 1, (ObjectFunc) func_E16C50_801AC918, NULL, 100.0f, 1, 2, 0, 0, 0.0f, 0 }, - /* OBJ_8C_367 */ {(void*) func_80078604, 1, (ObjectFunc) func_8007E648, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_368 */ {(void*) func_80188FA8, 1, (ObjectFunc) func_80188F60, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_369 */ {(void*) func_8018DCE4, 1, (ObjectFunc) func_80188CAC, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, - /* OBJ_8C_370 */ {(void*) func_8018DBEC, 1, (ObjectFunc) func_80188FAC, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, - /* OBJ_8C_371 */ {(void*) func_8018DE14, 1, (ObjectFunc) func_80189114, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, - /* OBJ_8C_372 */ {(void*) func_80077A00, 1, (ObjectFunc) func_8007AB50, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_373 */ {(void*) NULL, 1, (ObjectFunc) func_8007A748, NULL, 500.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_374 */ {(void*) func_8007DED4, 1, (ObjectFunc) func_8007DB70, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, - /* OBJ_8C_375 */ {(void*) func_8007DAE4, 1, (ObjectFunc) func_8007DA58, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_376 */ {(void*) func_80078CE8, 1, (ObjectFunc) func_80080360, NULL, -200.0f, 1, 0, 0, 0, 0.0f, 0 }, - /* OBJ_8C_377 */ {(void*) func_80078BE0, 1, (ObjectFunc) func_800802D8, NULL, 100.0f, 1, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_378 */ {(void*) func_801A5AF0, 1, (ObjectFunc) func_801A57D0, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_379 */ {(void*) func_801AEAA0, 1, (ObjectFunc) func_801AE87C, NULL, 100.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_380 */ {(void*) func_801A5D68, 1, (ObjectFunc) func_801A5B4C, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, - /* OBJ_8C_381 */ {(void*) func_80077A7C, 1, (ObjectFunc) func_8007B0F4, NULL, 500.0f, 0, 0, 0, 0, 0.0f, 0 }, - /* OBJ_8C_382 */ {(void*) NULL, 1, (ObjectFunc) func_8007B040, NULL, 200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_383 */ {(void*) func_8007A3C0, 1, (ObjectFunc) func_8007A28C, NULL, 10000.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_384 */ {(void*) func_80077B84, 1, (ObjectFunc) func_8007B3B8, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_385 */ {(void*) func_80078038, 1, (ObjectFunc) func_8007B5C0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_386 */ {(void*) NULL, 1, (ObjectFunc) func_8007C250, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_387 */ {(void*) NULL, 1, (ObjectFunc) func_8007C8C4, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_388 */ {(void*) func_80077B78, 1, (ObjectFunc) func_8007B670, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_389 */ {(void*) func_800780F8, 1, (ObjectFunc) func_8007B67C, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_390 */ {(void*) NULL, 1, (ObjectFunc) func_8007C50C, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_391 */ {(void*) func_80083B8C, 1, (ObjectFunc) func_800837EC, NULL, 500.0f, 0, 0, 0, 0, 0.0f, 0 }, - /* OBJ_8C_392 */ {(void*) func_E16C50_801A0AF0, 1, (ObjectFunc) func_E16C50_801A0120, NULL, 300.0f, 1, 2, 10, 0, 0.0f, 0 }, - /* OBJ_8C_393 */ {(void*) func_80078F78, 1, (ObjectFunc) func_80078EBC, NULL, 300.0f, 1, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_394 */ {(void*) func_80080D04, 1, (ObjectFunc) func_80080ACC, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, - /* OBJ_8C_395 */ {(void*) func_80082F78, 1, (ObjectFunc) func_80081C5C, NULL, 300.0f, 0, 1, 40, 0, 0.0f, 0 }, - /* OBJ_8C_396 */ {(void*) func_8018CF98, 1, (ObjectFunc) func_8018CAD4, NULL, 2000.0f, 0, 1, 40, 2, 0.0f, 0 }, - /* OBJ_8C_397 */ {(void*) func_80191180, 1, (ObjectFunc) func_80191054, NULL, 2000.0f, 0, 1, 20, 0, 0.0f, 0 }, - /* OBJ_8C_398 */ {(void*) func_8008092C, 1, (ObjectFunc) func_8008040C, NULL, 100.0f, 0, 0, 40, 0, 0.0f, 0 }, - /* OBJ_8C_399 */ {(void*) func_80084194, 1, (ObjectFunc) func_80083FA8, NULL, 100.0f, 0, 0, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_339 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D2F4, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_340 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D748, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_341 */ {(void*) func_8007D55C, 1, (ObjectFunc) func_8007D8A8, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_342 */ {(void*) func_8007E330, 1, (ObjectFunc) func_8007E298, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_343 */ {(void*) func_8007CAF0, 1, (ObjectFunc) func_8007C9E0, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_344 */ {(void*) func_8007868C, 1, (ObjectFunc) func_8007E014, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_345 */ {(void*) func_8007879C, 1, (ObjectFunc) func_8007E258, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_346 */ {(void*) func_800788B0, 1, (ObjectFunc) func_8007F438, NULL, -200.0f, 1, 0, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_347 */ {(void*) func_800783C0, 1, (ObjectFunc) func_8007B758, NULL, 100.0f, 1, 0, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_348 */ {(void*) func_80078A64, 1, (ObjectFunc) func_8007F6B0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_349 */ {(void*) NULL, 1, (ObjectFunc) func_8007F958, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_350 */ {(void*) NULL, 1, (ObjectFunc) func_8007FBE0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_351 */ {(void*) func_80078438, 1, (ObjectFunc) func_8007E3E4, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_352 */ {(void*) func_800784B4, 1, (ObjectFunc) func_8007B62C, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_353 */ {(void*) func_80078B8C, 1, (ObjectFunc) func_8007FE88, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_354 */ {(void*) func_80197C64, 1, (ObjectFunc) func_8007FE88, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_355 */ {(void*) func_80078AEC, 1, (ObjectFunc) func_800802B8, NULL, 100.0f, 1, 0, 20, 1, 0.0f, 0 }, + /* OBJ_EFFECT_356 */ {(void*) func_80078C84, 1, (ObjectFunc) func_800802F8, NULL, 100.0f, 1, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_357 */ {(void*) func_800798F0, 1, (ObjectFunc) func_8007968C, NULL, 100.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_358 */ {(void*) func_80192A68, 1, (ObjectFunc) func_80192984, NULL, 100.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_359 */ {(void*) func_8007AA60, 1, (ObjectFunc) func_8007A994, NULL, -100.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_360 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BE54, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_361 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BDE0, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_362 */ {(void*) func_8007BEE8, 1, (ObjectFunc) func_8007BCE8, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_363 */ {(void*) func_80094BBC, 1, (ObjectFunc) func_80094954, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_364 */ {(void*) func_8007B9DC, 1, (ObjectFunc) func_8007B960, NULL, -200.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_365 */ {(void*) func_8007E5CC, 1, (ObjectFunc) func_8007E45C, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_366 */ {(void*) func_80078550, 1, (ObjectFunc) func_E16C50_801AC918, NULL, 100.0f, 1, 2, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_367 */ {(void*) func_80078604, 1, (ObjectFunc) func_8007E648, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_368 */ {(void*) func_80188FA8, 1, (ObjectFunc) func_80188F60, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_369 */ {(void*) func_8018DCE4, 1, (ObjectFunc) func_80188CAC, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_370 */ {(void*) func_8018DBEC, 1, (ObjectFunc) func_80188FAC, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_371 */ {(void*) func_8018DE14, 1, (ObjectFunc) func_80189114, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_372 */ {(void*) func_80077A00, 1, (ObjectFunc) func_8007AB50, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_373 */ {(void*) NULL, 1, (ObjectFunc) func_8007A748, NULL, 500.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_374 */ {(void*) func_8007DED4, 1, (ObjectFunc) func_8007DB70, NULL, 100.0f, 0, 1, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_375 */ {(void*) func_8007DAE4, 1, (ObjectFunc) func_8007DA58, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_376 */ {(void*) func_80078CE8, 1, (ObjectFunc) func_80080360, NULL, -200.0f, 1, 0, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_377 */ {(void*) func_80078BE0, 1, (ObjectFunc) func_800802D8, NULL, 100.0f, 1, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_378 */ {(void*) func_801A5AF0, 1, (ObjectFunc) func_801A57D0, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_379 */ {(void*) func_801AEAA0, 1, (ObjectFunc) func_801AE87C, NULL, 100.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_380 */ {(void*) func_801A5D68, 1, (ObjectFunc) func_801A5B4C, NULL, 100.0f, 0, 0, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_381 */ {(void*) func_80077A7C, 1, (ObjectFunc) func_8007B0F4, NULL, 500.0f, 0, 0, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_382 */ {(void*) NULL, 1, (ObjectFunc) func_8007B040, NULL, 200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_383 */ {(void*) func_8007A3C0, 1, (ObjectFunc) func_8007A28C, NULL, 10000.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_384 */ {(void*) func_80077B84, 1, (ObjectFunc) func_8007B3B8, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_385 */ {(void*) func_80078038, 1, (ObjectFunc) func_8007B5C0, NULL, -200.0f, -1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_386 */ {(void*) NULL, 1, (ObjectFunc) func_8007C250, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_387 */ {(void*) NULL, 1, (ObjectFunc) func_8007C8C4, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_388 */ {(void*) func_80077B78, 1, (ObjectFunc) func_8007B670, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_389 */ {(void*) func_800780F8, 1, (ObjectFunc) func_8007B67C, NULL, -200.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_390 */ {(void*) NULL, 1, (ObjectFunc) func_8007C50C, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_391 */ {(void*) func_80083B8C, 1, (ObjectFunc) func_800837EC, NULL, 500.0f, 0, 0, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_392 */ {(void*) func_E16C50_801A0AF0, 1, (ObjectFunc) func_E16C50_801A0120, NULL, 300.0f, 1, 2, 10, 0, 0.0f, 0 }, + /* OBJ_EFFECT_393 */ {(void*) func_80078F78, 1, (ObjectFunc) func_80078EBC, NULL, 300.0f, 1, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_394 */ {(void*) func_80080D04, 1, (ObjectFunc) func_80080ACC, NULL, -200.0f, 0, 1, 0, 0, 0.0f, 0 }, + /* OBJ_EFFECT_395 */ {(void*) func_80082F78, 1, (ObjectFunc) func_80081C5C, NULL, 300.0f, 0, 1, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_396 */ {(void*) func_8018CF98, 1, (ObjectFunc) func_8018CAD4, NULL, 2000.0f, 0, 1, 40, 2, 0.0f, 0 }, + /* OBJ_EFFECT_397 */ {(void*) func_80191180, 1, (ObjectFunc) func_80191054, NULL, 2000.0f, 0, 1, 20, 0, 0.0f, 0 }, + /* OBJ_EFFECT_398 */ {(void*) func_8008092C, 1, (ObjectFunc) func_8008040C, NULL, 100.0f, 0, 0, 40, 0, 0.0f, 0 }, + /* OBJ_EFFECT_399 */ {(void*) func_80084194, 1, (ObjectFunc) func_80083FA8, NULL, 100.0f, 0, 0, 40, 0, 0.0f, 0 }, }; // clang-format on diff --git a/src/main/fox_edisplay.c b/src/main/fox_edisplay.c index 683af0ec..bdccbace 100644 --- a/src/main/fox_edisplay.c +++ b/src/main/fox_edisplay.c @@ -1,5 +1,4 @@ #include "global.h" -#include "prevent_bss_reordering.h" Vec3f D_801615D0; Vec3f D_801615E0; @@ -621,8 +620,8 @@ void func_8005BAB4(ObjectId objId, s32 index) { f32 temp2; switch (objId) { - case OBJ_8C_374: - if (gObjects8C[index].unk_4E == 0) { + case OBJ_EFFECT_374: + if (gEffects[index].unk_4E == 0) { Matrix_Scale(gGfxMatrix, 1.2f, 0.0f, 1.2f, 1); Matrix_RotateX(gGfxMatrix, M_PI / 2.0f, 1); Matrix_SetGfxMtx(&gMasterDisp); @@ -1186,34 +1185,35 @@ void Boss_Draw(Boss* boss, s32 arg1) { } } -void Object_8C_Draw1(Object_8C* obj8C, s32 arg1) { - if ((arg1 < 0) && (obj8C->obj.pos.y < 7.0f)) { +void Effect_Draw1(Effect* effect, s32 arg1) { + if ((arg1 < 0) && (effect->obj.pos.y < 7.0f)) { return; } - if ((obj8C->obj.id == OBJ_8C_353) || (obj8C->obj.id == OBJ_8C_369)) { - func_8005D3CC(&obj8C->obj, obj8C->unk_60.x, obj8C->unk_60.y, obj8C->unk_60.z, 0); - } else if (obj8C->info.unk_14 == -1) { - obj8C->obj.pos.y += D_8017847C; - func_8005D008(&obj8C->obj, 0); - obj8C->obj.pos.y -= D_8017847C; + if ((effect->obj.id == OBJ_EFFECT_353) || (effect->obj.id == OBJ_EFFECT_369)) { + func_8005D3CC(&effect->obj, effect->unk_60.x, effect->unk_60.y, effect->unk_60.z, 0); + } else if (effect->info.unk_14 == -1) { + effect->obj.pos.y += D_8017847C; + func_8005D008(&effect->obj, 0); + effect->obj.pos.y -= D_8017847C; } else { - func_8005D008(&obj8C->obj, 0); + func_8005D008(&effect->obj, 0); } - if (obj8C->info.draw != NULL) { - obj8C->info.draw(&obj8C->obj); + if (effect->info.draw != NULL) { + effect->info.draw(&effect->obj); } } -void Object_8C_Draw2(Object_8C* obj8C) { +void Effect_Draw2(Effect* effect) { Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; Vec3f sp40; f32 var_fv0; u8 sp3B = 0; - if (obj8C->info.unk_14 == -1) { - Matrix_Translate(gGfxMatrix, obj8C->obj.pos.x, obj8C->obj.pos.y + D_8017847C, obj8C->obj.pos.z + D_80177D20, 1); + if (effect->info.unk_14 == -1) { + Matrix_Translate(gGfxMatrix, effect->obj.pos.x, effect->obj.pos.y + D_8017847C, effect->obj.pos.z + D_80177D20, + 1); } else { - Matrix_Translate(gGfxMatrix, obj8C->obj.pos.x, obj8C->obj.pos.y, obj8C->obj.pos.z + D_80177D20, 1); + Matrix_Translate(gGfxMatrix, effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z + D_80177D20, 1); } Matrix_MultVec3f(gGfxMatrix, &sp4C, &sp40); if ((gCurrentLevel == LEVEL_SECTOR_Z) || (gCurrentLevel == LEVEL_BOLSE)) { @@ -1224,20 +1224,20 @@ void Object_8C_Draw2(Object_8C* obj8C) { if ((sp40.z < 0.0f) && (var_fv0 < sp40.z)) { if (fabsf(sp40.x) < (fabsf(sp40.z * 0.5f) + 500.0f)) { if (fabsf(sp40.y) < (fabsf(sp40.z * 0.5f) + 500.0f)) { - if (obj8C->info.draw != NULL) { - Matrix_RotateY(gGfxMatrix, obj8C->obj.rot.y * M_DTOR, 1); - Matrix_RotateX(gGfxMatrix, obj8C->obj.rot.x * M_DTOR, 1); - Matrix_RotateZ(gGfxMatrix, obj8C->obj.rot.z * M_DTOR, 1); + if (effect->info.draw != NULL) { + Matrix_RotateY(gGfxMatrix, effect->obj.rot.y * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, effect->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gGfxMatrix, effect->obj.rot.z * M_DTOR, 1); Matrix_SetGfxMtx(&gMasterDisp); - obj8C->info.draw(&obj8C->obj); + effect->info.draw(&effect->obj); } sp3B = 1; } } } - func_8005F290(&obj8C->sfxPos, &sp40); - if ((sp3B == 0) && (obj8C->obj.id != OBJ_8C_352) && (obj8C->obj.id != OBJ_8C_373) && (!gVersusMode)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + func_8005F290(&effect->sfxPos, &sp40); + if ((sp3B == 0) && (effect->obj.id != OBJ_EFFECT_352) && (effect->obj.id != OBJ_EFFECT_373) && (!gVersusMode)) { + Object_Kill(&effect->obj, &effect->sfxPos); } } @@ -1675,27 +1675,27 @@ void Object_DrawAll(s32 arg0) { void func_8006046C(s32 arg0) { s32 i; Boss* boss; - Object_8C* obj8C; + Effect* effect; RCP_SetupDL(&gMasterDisp, 0x40); - for (i = 0, obj8C = gObjects8C; i < ARRAY_COUNT(gObjects8C); i++, obj8C++) { - if (obj8C->obj.status >= 2) { - if (obj8C->info.unk_14 == 1) { - obj8C->obj.rot.y = (-gPlayer[gPlayerNum].unk_058 * 180.0f) / M_PI; - obj8C->obj.rot.x = (gPlayer[gPlayerNum].unk_05C * 180.0f) / M_PI; + for (i = 0, effect = gEffects; i < ARRAY_COUNT(gEffects); i++, effect++) { + if (effect->obj.status >= 2) { + if (effect->info.unk_14 == 1) { + effect->obj.rot.y = (-gPlayer[gPlayerNum].unk_058 * 180.0f) / M_PI; + effect->obj.rot.x = (gPlayer[gPlayerNum].unk_05C * 180.0f) / M_PI; } if (gLevelMode == LEVELMODE_ALL_RANGE) { Matrix_Push(&gGfxMatrix); - Object_8C_Draw2(obj8C); + Effect_Draw2(effect); Matrix_Pop(&gGfxMatrix); } else { Matrix_Push(&gGfxMatrix); - Object_8C_Draw1(obj8C, arg0); + Effect_Draw1(effect, arg0); Matrix_Pop(&gGfxMatrix); - func_8005F1EC(&obj8C->sfxPos); - if (obj8C->obj.id == OBJ_8C_374) { + func_8005F1EC(&effect->sfxPos); + if (effect->obj.id == OBJ_EFFECT_374) { Matrix_Push(&gGfxMatrix); - func_8005ECD8(i, &obj8C->obj); + func_8005ECD8(i, &effect->obj); Matrix_Pop(&gGfxMatrix); } } diff --git a/src/main/fox_effect.c b/src/main/fox_effect.c new file mode 100644 index 00000000..7782c8cf --- /dev/null +++ b/src/main/fox_effect.c @@ -0,0 +1,3932 @@ +#include "global.h" +#include "hud.h" + +// rodata +const char D_800D7230[] = "Enm->wrk3=<%d>\n"; +const char D_800D7240[] = "a=<%d>\n"; +const char D_800D7248[] = "a=<%d>\n"; + +extern Gfx D_1003130[]; +extern Gfx D_1015320[]; +extern Gfx D_10156A0[]; +extern Gfx D_1015810[]; +extern Gfx D_1015B70[]; +extern Gfx D_1015CE0[]; +extern Gfx D_1015E50[]; +extern Gfx D_1015FC0[]; +extern Gfx D_1016130[]; +extern Gfx D_10162A0[]; +extern Gfx D_1016410[]; +extern Gfx D_2000000[]; +extern Gfx D_2001090[]; +extern Gfx D_2002120[]; +extern Gfx D_20031B0[]; +extern Gfx D_2004240[]; +extern Gfx D_20052D0[]; +extern Gfx D_2006360[]; +extern Gfx D_20073F0[]; +extern Gfx D_2008480[]; +extern Gfx D_2009510[]; +extern Gfx D_200A5A0[]; +extern Gfx D_200B630[]; +extern Gfx D_200C6C0[]; +extern Gfx D_200E7F0[]; +extern Gfx D_200F080[]; +extern Gfx D_200F910[]; +extern Gfx D_20101A0[]; +extern Gfx D_2010A30[]; +extern Gfx D_4008CE0[]; +extern Gfx D_4008F70[]; +extern Gfx D_6003440[]; +extern Gfx D_60034E0[]; +extern Gfx D_6003580[]; +extern Gfx D_6003620[]; +extern Gfx D_60036C0[]; +extern Gfx D_6004900[]; +extern Gfx D_6012550[]; +extern u16 D_6012840[]; +extern Gfx D_6016880[]; +extern Gfx D_6018AF0[]; +extern Gfx D_601BAD0[]; +extern Gfx D_9013C20[]; + +void func_80077240(f32 posX, f32 posY, f32 posZ, s32 hits) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gUnkEntities1C); i++) { + if (gUnkEntities1C[i].hits == 0) { + gUnkEntities1C[i].hits = hits; + gUnkEntities1C[i].pos.x = posX; + gUnkEntities1C[i].pos.y = posY; + gUnkEntities1C[i].pos.z = posZ; + gUnkEntities1C[i].unk_10 = 0.0f; + gUnkEntities1C[i].timer = 65; + break; + } + } +} + +void func_8007729C(void) { + UnkEntity1C* ent1C; + s32 i; + + for (i = 0, ent1C = gUnkEntities1C; i < ARRAY_COUNT(gUnkEntities1C); i++, ent1C++) { + if (ent1C->hits != 0) { + if (ent1C->timer != 0) { + ent1C->timer -= 1; // can't be -- + } + if (ent1C->timer == 0) { + ent1C->hits = 0; + } + if (gLevelMode == LEVELMODE_ON_RAILS) { + ent1C->pos.z -= D_80177D08; + } else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { + ent1C->pos.x += gPlayer[0].vel.x; + ent1C->pos.z += gPlayer[0].vel.z; + } + if (ent1C->timer < 45) { + Math_SmoothStepToF(&ent1C->unk_10, 300.0f, 0.1f, 20.0f, 0.0f); + } + } + } +} + +Gfx* D_800D14E0[][2] = { + { D_1016410, D_1003130 }, + { D_10162A0, D_1003130 }, + { D_1016130, D_1003130 }, +}; + +// Unused +Gfx* D_800D14F8 = { D_1015FC0 }; + +Gfx* D_800D14FC[] = { D_1003130, D_1015810, D_1016410, D_10162A0, D_1016130, D_1015FC0, + D_1015E50, D_10156A0, D_1015CE0, D_1015B70, D_1015320 }; + +Vec3f D_800D1528 = { 0.0f, 0.0f, 0.0f }; + +void func_80077404(UnkEntity1C* ent1C) { + s32 var_a2; + Vec3f sp60; + Vec3f sp54; + f32 sp50; + + sp60 = D_800D1528; + if (ent1C->timer <= 45) { + Matrix_Translate(gGfxMatrix, ent1C->pos.x, ent1C->pos.y, ent1C->pos.z + D_80177D20, 1); + Matrix_MultVec3f(gGfxMatrix, &sp60, &sp54); + if ((fabsf(sp54.x) < 20000.0f) && (fabsf(sp54.y) < 20000.0f)) { + if ((sp54.z < 0.0f) && (sp54.z > -20000.0f)) { + sp50 = sqrtf(VEC3F_SQ(sp54)) * 0.0015f * 0.2f; + Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].unk_058, 1); + Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].unk_05C, 1); + Matrix_Scale(gGfxMatrix, sp50, sp50, 1.0f, 1); + Matrix_Translate(gGfxMatrix, 0.0f, ent1C->unk_10, 0.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + if (ent1C->hits <= 10) { + gSPDisplayList(gMasterDisp++, D_1015980); + gSPDisplayList(gMasterDisp++, D_800D14FC[ent1C->hits]); + } else if (ent1C->hits == 101) { + gSPDisplayList(gMasterDisp++, D_1011F20); + } else if (ent1C->hits == 100) { + gSPDisplayList(gMasterDisp++, D_1016580); + } else { + gSPDisplayList(gMasterDisp++, D_1015980); + switch (ent1C->hits) { + case 20: + var_a2 = 0; + break; + case 30: + var_a2 = 1; + break; + case 40: + var_a2 = 2; + break; + case 50: + default: + var_a2 = 3; + break; + } + gSPDisplayList(gMasterDisp++, D_800D14E0[var_a2][0]); + gSPDisplayList(gMasterDisp++, D_800D14E0[var_a2][1]); + } + } else { + ent1C->hits = 0; + } + } + } +} + +void func_80077790(void) { + UnkEntity1C* ent1C; + s32 i; + + RCP_SetupDL(&gMasterDisp, 0x3E); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + for (i = 0, ent1C = gUnkEntities1C; i < ARRAY_COUNT(gUnkEntities1C); i++, ent1C++) { + if (ent1C->hits != 0) { + Matrix_Push(&gGfxMatrix); + func_80077404(ent1C); + Matrix_Pop(&gGfxMatrix); + } + } +} + +Effect* func_8007783C(ObjectId objId) { + Effect* effect; + s32 i; + + for (i = 0, effect = gEffects; i < ARRAY_COUNT(gEffects); i++, effect++) { + if (effect->obj.status == 0) { + Effect_Initialize(effect); + effect->obj.status = 2; + effect->obj.id = objId; + Object_SetInfo(&effect->info, effect->obj.id); + break; + } + } + if (i == ARRAY_COUNT(gEffects)) { + effect = NULL; + } + return effect; +} + +void func_800778C4(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_339; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->scale2 = scale2; + effect->unk_4C = 0; + effect->scale1 = 0.5f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); + effect->unk_44 = 0xFF; +} + +void func_8007797C(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_800778C4(&gEffects[i], posX, posY, posZ, velX, velY, velZ, scale2); + break; + } + } +} + +void func_80077A00(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_3016B30); +} + +void func_80077A7C(Effect* effect) { + RCP_SetupDL_49(); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 255, 255, 255, effect->unk_44); + Matrix_Scale(gGfxMatrix, effect->scale1, effect->scale2, 1.0f, 1); + Matrix_Translate(gGfxMatrix, 0.0f, 20.0f, 0.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_6024220); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_80077B78(Effect* effect) { +} + +void func_80077B84(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + if ((effect->scale1 == 71.0f) || + ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && (gCurrentLevel == LEVEL_CORNERIA))) { + RCP_SetupDL(&gMasterDisp, 0x26); + } else { + RCP_SetupDL(&gMasterDisp, 0x43); + } + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + switch (effect->unk_4C) { + case 0: + gDPSetEnvColor(gMasterDisp++, 0, 128, 255, effect->unk_44); + break; + case 1: + gDPSetEnvColor(gMasterDisp++, 255, 64, 255, effect->unk_44); + break; + case 2: + gDPSetEnvColor(gMasterDisp++, 255, 128, 0, effect->unk_44); + break; + case 3: + gDPSetEnvColor(gMasterDisp++, 255, 48, 48, effect->unk_44); + break; + case 4: + gDPSetEnvColor(gMasterDisp++, 255, 255, 48, effect->unk_44); + break; + case 5: + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 255, 32, 32, effect->unk_44); + break; + case 6: + if (gCurrentLevel == LEVEL_BOLSE) { + RCP_SetupDL(&gMasterDisp, 0x26); + } + switch ((effect->index + gFrameCount) & 3) { + case 0: + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 0, 0, effect->unk_44); + break; + case 1: + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 255, 0, effect->unk_44); + break; + case 2: + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 255, effect->unk_44); + break; + case 3: + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, effect->unk_44); + break; + } + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, effect->unk_44); + break; + case 7: + gDPSetEnvColor(gMasterDisp++, 48, 48, 255, effect->unk_44); + break; + case 10: + gDPSetEnvColor(gMasterDisp++, 255, 255, 32, effect->unk_44); + break; + case 11: + gDPSetEnvColor(gMasterDisp++, 255, 32, 32, effect->unk_44); + break; + case 12: + gDPSetEnvColor(gMasterDisp++, 32, 255, 32, effect->unk_44); + break; + case 13: + gDPSetEnvColor(gMasterDisp++, 32, 32, 255, effect->unk_44); + break; + } + + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_80078038(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL_49(); + RCP_SetupDL(&gMasterDisp, 0x26); + gDPSetPrimColor(gMasterDisp++, 0, 0, 64, 192, 255, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +// Possibly the little sparks of electricity that come off the arwing and landmaster when low on health +f32 D_800D1534[][10] = { + { 38.45957f, -65.08043f, 8.068213f, 87.01006f, -86.956184f, -71.82677f, 37.854507f, 46.845963f, 23.723173f, + 84.2551f }, + { -77.50479f, 86.4889f, -8.664565f, -74.90449f, -42.23121f, 49.20716f, -18.885563f, -47.375793f, -58.059227f, + -2.498746f }, + { -74.84084f, -66.523506f, -71.39976f, 21.378086f, 28.324728f, 89.42064f, -85.24717f, -28.109077f, 31.949314f, + 5.697076f }, + { 58.005924f, 64.38876f, 50.419434f, -45.34431f, 60.55692f, 58.689392f, 28.175598f, -20.696762f, -13.056221f, + 36.156307f }, + { -72.78266f, -67.081665f, 57.92814f, -56.805496f, -51.114407f, 79.95429f, 37.474f, -62.60574f, -88.01894f, + -69.37549f }, + { 52.336594f, 34.10212f, 55.353027f, 27.779789f, -38.374107f, -42.059826f, -80.53026f, 60.73118f, 38.044014f, + -62.561646f }, + { -56.799488f, 0.500157f, -71.042145f, -28.663008f, 39.668713f, 36.233597f, -49.26364f, -85.028854f, 71.3247f, + 44.180447f }, + { 62.98788f, -68.41569f, -25.23802f, -89.18237f, -34.72465f, 77.61012f, 83.1443f, -66.71512f, 22.06076f, + -60.077705f }, + { 34.752354f, -61.9954f, 87.50011f, 40.39249f, 25.152748f, -68.16201f, 47.702785f, -44.814285f, 84.87108f, + 71.68733f }, + { 30.700006f, 71.38295f, 18.13302f, -45.159817f, -55.795097f, -52.275223f, 3.216162f, 85.24068f, 49.815186f, + -71.90831f }, + { -53.34575f, 85.58262f, 86.26517f, -60.348373f, 26.2602f, -58.774044f, -58.923035f, 4.206734f, 23.082275f, + -74.58816f }, + { -0.396795f, 74.36148f, 73.00557f, 2.217007f, -77.69297f, -55.191216f, 55.187286f, -53.86457f, -88.575294f, + 35.68634f }, + { 41.014538f, -79.47855f, -29.881096f, 70.93344f, -86.55003f, 60.424816f, 51.190754f, -66.513695f, 73.50617f, + 41.706547f }, +}; + +void func_800780F8(Effect* effect) { + s32 i; + + if (effect->unk_4A >= 0xB) { + if (!((effect->index + gFrameCount) & 1)) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 128, 128, 32); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 128, 128, 128); + } + } else if (!((effect->index + gFrameCount) & 1)) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, 96, 96, 255, 255); + } + Graphics_SetScaleMtx(effect->scale2); + for (i = 0; i < 10; i++) { + if ((i >= effect->unk_48) && (i < effect->unk_46)) { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, 0.0f, -60.0f, 0.0f, 1); + Matrix_Scale(gGfxMatrix, 0.8f, 3.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_102F5E0); + Matrix_Pop(&gGfxMatrix); + } + Matrix_Translate(gGfxMatrix, 0.0f, -120.0f, 0.0f, 1); + Matrix_RotateZ(gGfxMatrix, D_800D1534[effect->unk_4C][i] * M_DTOR, 1); + } +} + +void func_800783C0(Effect* effect) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_2006F50); +} + +void func_80078438(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + gSPDisplayList(gMasterDisp++, D_102A8A0); +} + +void func_800784B4(Effect* effect) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_46); + Graphics_SetScaleMtx(effect->scale2); + Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_200D750); +} + +void func_80078550(Effect* effect) { + RCP_SetupDL(&gMasterDisp, 0x43); + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + gDPSetEnvColor(gMasterDisp++, 101, 138, 153, 255); + gSPDisplayList(gMasterDisp++, D_3000660); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_80078604(Effect* effect) { + if (effect->timer_50 == 0) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_20112C0); + } +} + +void func_8007868C(Effect* effect) { + RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + if (effect->unk_44 >= 2) { + Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); + } + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_1029780); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_8007879C(Effect* effect) { + RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + Matrix_Scale(gGfxMatrix, effect->scale2 * 0.6f, 1.0f, effect->scale2 * 3.5f, 1); + Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_1029780); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +s32 D_800D173C[] = { 255, 255, 255, 0, 0, 0, 255, 0, 255, 0, 0, 0, 255, 255, 0, 0, 0, 255, 0, 0 }; + +void func_800788B0(Effect* effect) { + s32 temp_ft3; + s32* tmp; + + switch (gCurrentLevel) { + case LEVEL_METEO: + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 128, 128, 128, 255); + gSPDisplayList(gMasterDisp++, D_601FF80); + break; + case LEVEL_AQUAS: + RCP_SetupDL(&gMasterDisp, 0x43); + temp_ft3 = Math_ModF(effect->index, 4.0f); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) effect->scale1); + tmp = &D_800D173C[(s32) (temp_ft3 * 4.0f)]; + gDPSetEnvColor(gMasterDisp++, tmp[0], tmp[1], tmp[2], 255); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + } +} + +void func_80078A64(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_20112C0); +} + +void func_80078AE0(void* effect) { +} + +void func_80078AEC(Effect* effect) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 180); + Graphics_SetScaleMtx(effect->scale2 * (13.0f + ((gFrameCount & 1) * 2.5f))); + gSPDisplayList(gMasterDisp++, D_102ED50); +} + +void func_80078B8C(Effect* effect) { + RCP_SetupDL_21(); + gSPDisplayList(gMasterDisp++, D_101ABD0); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_80078BE0(Effect* effect) { + f32 var_fv0; + + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 160); + var_fv0 = 3.0f; + if (gFrameCount & 1) { + var_fv0 *= 1.2f; + } + Graphics_SetScaleMtx(effect->scale2 * var_fv0); + gSPDisplayList(gMasterDisp++, D_600F8A0); +} + +void func_80078C84(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 192); + gSPDisplayList(gMasterDisp++, D_6000A80); +} + +void func_80078CE8(Effect* effect) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_6033000); +} + +void func_80078D60(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_393; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + if (scale2 == 3.1f) { + effect->vel.x = gObjects2F4[8].vel.x; + effect->vel.y = gObjects2F4[8].vel.y; + effect->vel.z = gObjects2F4[8].vel.z; + } + if (scale2 != 30.0f) { + effect->unk_4E = 1; + } + if (scale2 == 3.5f) { + effect->unk_4E = 2; + } + effect->timer_50 = 0xE; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_80078E50(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_80078D60(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_80078EBC(Effect* effect) { + if (effect->unk_4E == 2) { + effect->vel.x = gPlayer[0].vel.x; + effect->vel.y = gPlayer[0].vel.y; + effect->vel.z = gPlayer[0].vel.z; + } + effect->obj.rot.z += 35.0f; + if (effect->timer_50 >= 7) { + effect->scale1 += 0.25f; + } else { + effect->scale1 -= 0.25f; + } + if (effect->scale1 <= 0.0f) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_80078F78(Effect* effect) { + if (effect->unk_4E != 0) { + RCP_SetupDL(&gMasterDisp, 0x43); + } else { + RCP_SetupDL(&gMasterDisp, 0x3F); + } + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 255, 255, 0, 255); + Graphics_SetScaleMtx(effect->scale2 * effect->scale1); + gSPDisplayList(gMasterDisp++, D_101C2E0); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_8007905C(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2, u8 arg5) { + Vec3f sp54; + Vec3f sp48; + Vec3f sp3C; + f32 sp38; + f32 xAng; + f32 yAng; + + Effect_Initialize(effect); + effect->obj.status = 2; + effect->obj.id = OBJ_EFFECT_357; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_4C = arg5; + if (scale2 == 1.6f) { + effect->vel.x = (posX - gBosses[1].obj.pos.x) * 0.1f; + effect->vel.z = (posZ - gBosses[1].obj.pos.z) * 0.1f; + } else if (scale2 == 1.3f) { + effect->vel.x = ((Rand_ZeroOne() * 0.05f) + 0.03f) * posX; + effect->vel.z = ((Rand_ZeroOne() * 0.05f) + 0.03f) * posZ; + effect->vel.y = 5.0f; + } else if (scale2 == 1.55f) { + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->vel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + } else if ((gCurrentLevel == LEVEL_BOLSE) && ((scale2 == 5.11f) || (scale2 == 7.22f))) { + sp3C.x = gPlayer[0].pos.x; + sp3C.y = gPlayer[0].pos.y; + sp3C.z = gPlayer[0].pos.z; + yAng = Math_Atan2F(sp3C.x - posX, sp3C.z - posZ); + sp38 = sqrtf(SQ(sp3C.x - posX) + SQ(sp3C.z - posZ)); + xAng = -Math_Atan2F(sp3C.y - posY, sp38); + Matrix_RotateY(gCalcMatrix, yAng, 0); + Matrix_RotateX(gCalcMatrix, xAng, 1); + sp54.x = (Rand_ZeroOne() - 0.5f) * 50.0f; + sp54.y = (Rand_ZeroOne() - 0.5f) * 50.0f; + sp54.z = (Rand_ZeroOne() * 10.0f) + 150.0f; + Matrix_MultVec3f(gCalcMatrix, &sp54, &sp48); + effect->vel.x = sp48.x; + effect->vel.y = sp48.y; + effect->vel.z = sp48.z; + } else { + effect->vel.y = + (gLevelType == LEVELTYPE_PLANET) ? (Rand_ZeroOne() * 7.0f) + 7.0f : (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->vel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + } + effect->scale2 = ((Rand_ZeroOne() * 0.8f) + 0.3f) * scale2; + effect->timer_50 = (s32) (Rand_ZeroOne() * 50.0f) + 70; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + effect->unk_60.x = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.y = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.z = (Rand_ZeroOne() - 0.5f) * 30.0f; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_800794CC(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = 50; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007905C(&gEffects[i], posX, posY, posZ, scale2, 0); + break; + } + } +} + +void func_8007953C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = 79; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007905C(&gEffects[i], posX, posY, posZ, scale2, 0); + break; + } + } +} + +void func_800795AC(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = 0; i < 95; i++) { + if (gEffects[i].obj.status == 0) { + func_8007905C(&gEffects[i], posX, posY, posZ, scale2, 0); + break; + } + } +} + +void func_80079618(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = 50; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007905C(&gEffects[i], posX, posY, posZ, scale2, 1); + break; + } + } +} + +void func_8007968C(Effect* effect) { + if ((gCurrentLevel != LEVEL_MACBETH) || (effect->unk_44 != 7)) { + if ((effect->timer_50 == 0) || (effect->obj.pos.y < D_80177940)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else { + if (!(gFrameCount & 3)) { + func_8007D2C8(effect->obj.pos.x, effect->obj.pos.y + 550.0f, effect->obj.pos.z, 10.0f); + } + if ((effect->timer_50 == 0) || (effect->obj.pos.y < (D_80177940 - 100.0f))) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->obj.rot.x += effect->unk_60.x; + effect->obj.rot.y += effect->unk_60.y; + effect->obj.rot.z += effect->unk_60.z; + if (gLevelType == LEVELTYPE_PLANET) { + effect->vel.y -= 0.5f; + } + if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && (D_80177A80 >= 176)) { + effect->vel.x *= 0.95f; + effect->vel.y *= 0.95f; + effect->vel.z *= 0.95f; + } + if ((gCurrentLevel == LEVEL_MACBETH) && (effect->unk_44 == 10)) { + effect->obj.rot.x = 0.0f; + effect->obj.rot.y = 0.0f; + if (effect->timer_50 >= 25) { + effect->scale1 = 0.5f; + } else if (effect->scale1 > 0.03) { + effect->scale1 -= 0.02f; + } + } +} + +bool func_800798C4(s32 arg0, Gfx** arg1, Vec3f* arg2, Vec3f* arg3, void* arg4) { + if ((arg0 != 1) && (arg0 != 5)) { + *arg1 = NULL; + } + return false; +} + +void func_800798F0(Effect* effect) { + Vec3f frameJointTable[50]; + + if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7)) { + func_8005F670(&effect->obj.pos); + } + RCP_SetupDL(&gMasterDisp, 0x1D); + if (gCurrentLevel == LEVEL_KATINA) { + gSPFogPosition(gMasterDisp++, gFogNear, 1005); + } + Graphics_SetScaleMtx(effect->scale2); + switch (gCurrentLevel) { + case LEVEL_MACBETH: + switch (effect->unk_44) { + case 1: + if (effect->index & 1) { + gSPDisplayList(gMasterDisp++, D_6022530); + } else { + gSPDisplayList(gMasterDisp++, D_6022450); + } + break; + case 2: + RCP_SetupDL(&gMasterDisp, 0x39); + if (effect->index & 1) { + gSPDisplayList(gMasterDisp++, D_601A7A0); + } else { + gSPDisplayList(gMasterDisp++, D_60223C0); + } + RCP_SetupDL(&gMasterDisp, 0x1D); + break; + case 7: + Animation_GetFrameData(&D_6027320, 0, frameJointTable); + Animation_DrawSkeleton(1, D_602742C, frameJointTable, func_800798C4, NULL, effect, + &gIdentityMatrix); + break; + case 8: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_6020E60); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 9: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_6020A30); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 10: + RCP_SetupDL(&gMasterDisp, 0x43); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 255, 80, 0, 255); + Graphics_SetScaleMtx(effect->scale1); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 11: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_60200E0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 12: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_600F2F0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 13: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_6001A60); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 14: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_600F160); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 15: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_600F3D0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 16: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_600F6C0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 17: + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_600F9B0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + default: + if (effect->index & 1) { + gSPDisplayList(gMasterDisp++, D_10194C0); + } else { + gSPDisplayList(gMasterDisp++, D_1024290); + } + break; + } + break; + case LEVEL_AQUAS: + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x3C); + gSPDisplayList(gMasterDisp++, D_600A220); + break; + default: + switch (effect->unk_4C) { + case 0: + if (effect->index & 1) { + gSPDisplayList(gMasterDisp++, D_10194C0); + } else { + gSPDisplayList(gMasterDisp++, D_1024290); + } + break; + case 1: + switch (effect->index & 3) { + case 0: + Matrix_Scale(gGfxMatrix, 1.0f, 0.3f, 1.0f, 1); + break; + case 1: + Matrix_Scale(gGfxMatrix, 0.3f, 1.0f, 1.0f, 1); + break; + case 2: + Matrix_Scale(gGfxMatrix, 1.0f, 0.5f, 1.0f, 1); + break; + case 3: + Matrix_Scale(gGfxMatrix, 0.5f, 1.0f, 1.0f, 1); + break; + } + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x39); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_1021E20); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + } + break; + } + RCP_SetupDL(&gMasterDisp, 0x40); + if (gCurrentLevel == LEVEL_KATINA) { + gSPFogPosition(gMasterDisp++, gFogNear, gFogFar); + } +} + +void func_8007A28C(Effect* effect) { + Texture_Scroll(D_10190C0, 16, 32, 0); + D_8017812C = 2; + effect->obj.rot.y += 1.0f; + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.05f, 1.5f, 0.001f); + if (effect->timer_50 >= 0xB) { + D_801779A8[0] = 60.0f; + } + if (effect->timer_50 == 48) { + D_80178340 = 150; + } + if (effect->timer_50 > 45) { + D_80178358 = 0; + D_80178348 = D_80178350 = D_80178354 = 255; + } + D_8017835C = 3; + if (effect->timer_50 == 0) { + effect->unk_44 -= 2; + if (effect->unk_44 < 0) { + effect->unk_44 = 0; + Object_Kill(&effect->obj, &effect->sfxPos); + D_8017812C = 0; + } + } +} + +void func_8007A3C0(Effect* effect) { + if (D_80161410 > 0) { + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL_64_2(); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_10182C0); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + RCP_SetupDL_64_2(); + } +} + +void func_8007A4B8(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale1) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_383; + effect->scale1 = scale1; + effect->timer_50 = 50; + effect->unk_44 = 200; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + Audio_PlaySfx(0x2940F026, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007A568(f32 xPos, f32 yPos, f32 zPos, f32 scale1) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007A4B8(&gEffects[i], xPos, yPos, zPos, scale1); + break; + } + } + func_8007B344(xPos, yPos, zPos, 80.0f, 4); +} + +void func_8007A5F8(Effect* effect, Vec3f* pos, u32 sfxId) { + Effect_Initialize(effect); + effect->obj.status = 2; + effect->obj.id = OBJ_EFFECT_373; + effect->obj.pos.x = pos->x; + effect->obj.pos.y = pos->y; + effect->obj.pos.z = pos->z; + effect->timer_50 = 50; + if ((sfxId == 0x1903400F) || (sfxId == 0x11000055)) { + Audio_PlaySfx(sfxId, &effect->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + if (sfxId == 0x11000055) { + effect->timer_50 = 300; + } + } else { + Audio_PlaySfx(sfxId, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007A6F0(Vec3f* pos, s32 sfxId) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8007A5F8(&gEffects[i], pos, sfxId); + break; + } + } +} + +void func_8007A748(Effect* effect) { + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +bool func_8007A774(Player* player, Effect* effect, f32 arg2) { + if ((fabsf(player->unk_138 - effect->obj.pos.z) < arg2) && (fabsf(player->pos.x - effect->obj.pos.x) < arg2) && + (fabsf(player->pos.y - effect->obj.pos.y) < arg2) && (player->timer_498 == 0)) { + Player_ApplyDamage(player, 0, effect->info.damage); + return true; + } else { + return false; + } +} + +void func_8007A818(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale1, u8 arg5, u8 arg6, u16 arg7) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_359; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale1 = scale1; + effect->unk_44 = arg5; + effect->unk_46 = arg6; + effect->unk_60.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->unk_60.y = scale1 * 0.1f; + if (arg7 != 0) { + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 30.0f; + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007A900(f32 posX, f32 posY, f32 posZ, f32 scale1, u8 arg4, u8 arg5, u16 arg6) { + s32 i; + + if (gCurrentLevel == LEVEL_TITANIA) { + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007A818(&gEffects[i], posX, posY, posZ, scale1, arg4, arg5, arg6); + break; + } + } + } +} + +void func_8007A994(Effect* effect) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.01f); + effect->obj.rot.z += effect->unk_60.z; + effect->vel.y += effect->unk_60.y; + if (effect->unk_4A & 1) { + effect->unk_48++; + if (effect->unk_48 >= 6) { + effect->unk_48 = 5; + } + } + effect->unk_44 -= effect->unk_46; + if (effect->unk_44 < 0x15) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->unk_4A++; +} + +Gfx* D_800D178C[] = { D_6003440, D_60034E0, D_6003580, D_6003620, D_60036C0, D_6003760 }; + +void func_8007AA60(Effect* effect) { + RCP_SetupDL(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 31, 10, 00, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 141, 73, 5, 0); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_800D178C[effect->unk_4C]); + effect->unk_4C = effect->unk_48; + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_8007AB50(Effect* effect) { + if (effect->unk_4E == 0) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.0f); + effect->unk_44 -= 20; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.0f); + effect->unk_44 -= 10; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007AC0C(Effect* effect, f32 posX, f32 unused_posY, f32 posZ, f32 scale2, f32 scale1, f32 rotY) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_372; + effect->obj.pos.x = posX; + effect->obj.pos.y = D_80177940; + effect->obj.pos.z = posZ; + effect->unk_44 = 0xB4; + effect->scale2 = scale2; + effect->scale1 = scale1; + effect->obj.rot.y = rotY; + effect->vel.x = gPlayer[0].vel.x * 0.6f; + effect->vel.z = gPlayer[0].vel.z * 0.6; // Forgotten f means bad codegen + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007ACE0(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, f32 rotY) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8007AC0C(&gEffects[i], posX, posY, posZ, scale2, scale1, rotY); + break; + } + } +} + +void func_8007AD58(Effect* effect, f32 posX, f32 unused_posY, f32 posZ, f32 scale2, f32 scale1, f32 rotY) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_372; + effect->unk_4E = 1; + effect->obj.pos.x = posX; + effect->obj.pos.y = D_80177940; + effect->obj.pos.z = posZ; + effect->unk_44 = 0xB4; + effect->scale2 = scale2; + effect->scale1 = scale1; + effect->obj.rot.y = rotY; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007ADF4(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1) { + f32 cosf; + f32 sinf; + f32 rotY; + s32 i; + s32 j; + + for (rotY = 11.25f, i = 0; i < 16; i++, rotY += 22.5f) { + for (j = 0; j < ARRAY_COUNT(gEffects); j++) { + if (gEffects[j].obj.status == 0) { + sinf = __sinf(M_DTOR * rotY) * scale1 * 20.0f; + cosf = __cosf(M_DTOR * rotY) * scale1 * 20.0f; + func_8007AD58(&gEffects[j], posX + sinf, posY, posZ + cosf, scale2, scale1, rotY); + break; + } + } + } +} + +void func_8007AF30(Effect* effect, f32 posX, f32 posZ, f32 velX, f32 velZ, f32 scale1) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_382; + effect->obj.pos.x = posX; + effect->obj.pos.y = -10.0f; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.z = velZ - D_80177D08; + effect->scale1 = scale1; + effect->timer_50 = 100; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007AFD0(f32 posX, f32 posZ, f32 velX, f32 velZ, f32 scale1) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8007AF30(&gEffects[i], posX, posZ, velX, velZ, scale1); + break; + } + } +} + +void func_8007B040(Effect* effect) { + f32 sp2C; + s32 sp28; + + if (func_800A73E4(&sp2C, &sp28, effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z)) { + D_801782EC[sp28] = effect->scale1; + D_801782EC[sp28 + 1] = effect->scale1 * 0.7f; + D_801782EC[sp28 - 1] = effect->scale1 * 0.7f; + } + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007B0F4(Effect* effect) { + Math_SmoothStepToF(&effect->scale2, effect->scale1 * 3.0f, 0.1f, 10.0f, 0.0f); + effect->unk_44 -= 13; + effect->obj.rot.y = 180.0f - effect->obj.rot.y; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007B180(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale1) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_381; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_44 = 0xFF; + effect->scale1 = scale1; + Object_SetInfo(&effect->info, effect->obj.id); + Audio_PlaySfx(0x1100000C, &effect->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); +} + +void func_8007B228(f32 posX, f32 posY, f32 posZ, f32 scale1) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects) && gCurrentLevel == LEVEL_ZONESS; i++) { + if (gEffects[i].obj.status == 0) { + func_8007B180(&gEffects[i], posX, posY, posZ, scale1); + break; + } + } +} + +void func_8007B2BC(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale1, s32 arg5) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_384; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->scale1 = scale1; + effect->unk_44 = 0xFF; + effect->unk_4C = arg5; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007B344(f32 xPos, f32 yPos, f32 zPos, f32 scale1, s32 arg4) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007B2BC(&gEffects[i], xPos, yPos, zPos, scale1, arg4); + break; + } + } +} + +void func_8007B3B8(Effect* effect) { + f32 var_fv0; + f32 var_fv1; + s32 var_v0; + + if (effect->unk_4C == 6) { + var_fv0 = 15.0f; + var_fv1 = 0.05f; + var_v0 = 4; + } else if ((effect->unk_4C == 5) && ((gCurrentLevel == LEVEL_KATINA) || (gCurrentLevel == LEVEL_METEO))) { + var_fv0 = 10.0f; + var_fv1 = 0.1f; + var_v0 = 4; + } else { + var_fv0 = 10.0f; + var_fv1 = 0.1f; + var_v0 = 8; + } + Math_SmoothStepToF(&effect->scale2, effect->scale1, var_fv1, var_fv0, 0.0f); + effect->unk_44 -= var_v0; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007B494(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale1, s32 arg5) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_385; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->obj.rot.x = 90.0f; + effect->scale1 = scale1; + effect->unk_44 = arg5; + if (arg5 < 60) { + effect->unk_46 = 1; + } else if (arg5 < 90) { + effect->unk_46 = 2; + } else { + effect->unk_46 = 3; + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007B550(f32 posX, f32 posY, f32 posZ, f32 scale1, s32 arg4) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8007B494(&gEffects[i], posX, posY, posZ, scale1, arg4); + break; + } + } +} + +void func_8007B5C0(Effect* effect) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.1f); + effect->unk_44 -= effect->unk_46; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007B62C(Effect* effect) { + if (effect->timer_50 == 0) { + effect->unk_46 -= 4; + if (effect->unk_46 <= 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007B670(Effect* effect) { +} + +void func_8007B67C(Effect* effect) { + s32 var_v1; + + effect->unk_46 += 2; + if (effect->unk_46 >= 10) { + effect->unk_46 = 10; + } + if (effect->unk_46 >= 9) { + effect->unk_48++; + if (effect->unk_48 >= 10) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + var_v1 = effect->unk_4A; + if (var_v1 != 0) { + if (var_v1 > 10) { + var_v1 -= 10; + } + effect->vel.x = gPlayer[var_v1 - 1].vel.x; + effect->vel.y = gPlayer[var_v1 - 1].vel.y; + effect->vel.z = gPlayer[var_v1 - 1].vel.z; + } +} + +void func_8007B758(Effect* effect) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.1f); + effect->unk_44 -= 2; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + func_8007A774(gPlayer, effect, effect->scale2 * 20.0f); +} + +void func_8007B7E8(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_364; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; + effect->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; + effect->unk_48 = 3; + if (Rand_ZeroOne() < 0.5f) { + effect->unk_48 = -effect->unk_48; + } + effect->unk_4A = 50; + effect->unk_46 = 1; + effect->scale2 = scale2 * 0.2f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007B8F8(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i, j; + + for (i = ARRAY_COUNT(gEffects) - 1, j = 0; j < ARRAY_COUNT(gEffects); i--, j++) { + if (gEffects[i].obj.status == 0) { + func_8007B7E8(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007B960(Effect* effect) { + effect->scale2 += 0.07f; + effect->unk_4A -= effect->unk_46; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.2f; +} + +void func_8007B9DC(Effect* effect) { + //! DEBUG: Hold Z on controller 4 to set up a display list. + if (gControllerHold[3].button & Z_TRIG) { + RCP_SetupDL(&gMasterDisp, 4); + } + Graphics_SetScaleMtx(effect->scale2); + if (gCurrentLevel != LEVEL_MACBETH) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 140, 99, 58, effect->unk_4A); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, (gFrameCount & 3) + 5, (gFrameCount & 3) + 3, (gFrameCount & 3) + 3, 220); + } + //! DEBUG: Hold Z on controller 4 to set up a display list. + if (!(gControllerHold[3].button & A_BUTTON)) { + gSPDisplayList(gMasterDisp++, D_2010A30); + } + //! DEBUG: Hold Z on controller 4 to set up a display list. + if (gControllerHold[3].button & Z_TRIG) { + RCP_SetupDL(&gMasterDisp, 0x40); + } +} + +void func_8007BB14(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_362; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; + effect->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; + effect->unk_48 = 3; + if (Rand_ZeroOne() < 0.5f) { + effect->unk_48 = -effect->unk_48; + } + effect->unk_4A = 0xB4; + effect->unk_46 = 8; + if (scale2 > 15.0f) { + effect->unk_46 = 5; + effect->unk_4A = 0x50; + } + effect->scale2 = scale2 * 0.25f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + if (scale2 == 6.0f) { + effect->vel.z = gPlayer[0].vel.z * 0.6f; + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007BC7C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 20; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007BB14(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007BCE8(Effect* effect) { + if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) { + effect->obj.rot.x = (gPlayer[0].unk_05C * 180.0f) / M_PI; + effect->obj.rot.y = (-gPlayer[0].unk_058 * 180.0f) / M_PI; + } + if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_6) { + effect->unk_46 = 2; + effect->vel.y -= 0.13f; + } + effect->scale2 += 0.07f; + effect->unk_4A -= effect->unk_46; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.2f; +} + +void func_8007BDE0(Effect* effect) { + effect->scale2 += 0.04f; + effect->unk_4A -= 2; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += effect->scale1; +} + +void func_8007BE54(Effect* effect) { + effect->scale2 += 0.02f; + effect->unk_4A -= 3; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->vel.z = gPlayer[0].vel.z + 7.0f; + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.1f; +} + +void func_8007BEE8(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + gSPDisplayList(gMasterDisp++, D_2010A30); +} + +void func_8007BF64(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, + s32 timer50) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_386; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->scale2 = scale2; + effect->timer_50 = timer50; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007BFFC(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007BF64(&gEffects[i], posX, posY, posZ, velX, velY, velZ, scale2, timer50); + break; + } + } +} + +void func_8007C088(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, + s32 timer50) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_390; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->scale2 = scale2; + effect->timer_50 = timer50; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007C120(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007C088(&gEffects[i], posX, posY, posZ, velX, velY, velZ, scale2, timer50); + break; + } + } +} + +void func_8007C1AC(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007BF64(&gEffects[i], posX, posY, posZ, velX, velY, velZ, scale2, timer50); + func_800A6070(&gEffects[i].sfxPos, 0x29000000); + break; + } + } +} + +void func_8007C250(Effect* effect) { + f32 randX; + f32 randY; + f32 randOther; + s32 var_v0; + + Math_SmoothStepToF(&effect->vel.x, 0.0f, 0.2f, 10.0f, 0.1f); + Math_SmoothStepToF(&effect->vel.y, 0.0f, 0.2f, 10.0f, 0.1f); + Math_SmoothStepToF(&effect->vel.z, 0.0f, 0.2f, 10.0f, 0.1f); + var_v0 = 3; + if (gLevelMode == LEVELMODE_ALL_RANGE) { + var_v0 = 1; + } + if (!(effect->timer_50 & var_v0)) { + randX = (Rand_ZeroOne() - 0.5f) * 40.0f; + randY = (Rand_ZeroOne() - 0.5f) * 40.0f; + randOther = ((Rand_ZeroOne() * 0.5f) + 1.0f); + func_8007D0E0(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, + effect->scale2 * randOther); + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007C3B4(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 arg8) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_389; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->scale2 = scale2; + effect->unk_4A = arg8; + effect->unk_4C = (s32) (Rand_ZeroOne() * 12.0f); + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); + effect->unk_44 = 0xFF; +} + +void func_8007C484(f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2, s32 arg7) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i > 32; i--) { + if (gEffects[i].obj.status == 0) { + func_8007C3B4(&gEffects[i], posX, posY, posZ, velX, velY, velZ, scale2, arg7); + break; + } + } +} + +void func_8007C50C(Effect* effect) { + f32 randX; + f32 randY; + f32 randOther; + + if (!(effect->timer_50 & 7)) { + randX = (Rand_ZeroOne() - 0.5f) * 40.0f * effect->scale2; + randY = (Rand_ZeroOne() - 0.5f) * 40.0f * effect->scale2; + randOther = (Rand_ZeroOne() + 1.0f); + func_8007C484(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, effect->vel.x, + effect->vel.y, effect->vel.z, effect->scale2 * randOther, 0); + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007C608(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_387; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + effect->timer_50 = timer50; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007C688(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007C608(&gEffects[i], posX, posY, posZ, scale2, timer50); + break; + } + } +} + +void func_8007C6FC(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_343; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_48 = 3; + effect->vel.y = 5.0f; + if (Rand_ZeroOne() < 0.5f) { + effect->unk_48 = -effect->unk_48; + } + if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_6)) { + effect->unk_4A = 180; + } else { + effect->unk_4A = 255; + } + effect->scale2 = scale2 * 0.25f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->unk_44 = 0; + if (Rand_ZeroOne() < 0.3f) { + effect->unk_44 = 1; + effect->unk_4A = 255; + effect->scale2 = scale2 * 0.3f; + } + effect->scale1 = Rand_ZeroOne() * 0.2f; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007C85C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects) - 20; i++) { + if (gEffects[i].obj.status == 0) { + func_8007C6FC(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007C8C4(Effect* effect) { + f32 randX; + f32 randY; + f32 randOther; + s32 var_v0; + + var_v0 = 0; + if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_6)) { + var_v0 = 3; + } + if (!(effect->timer_50 & var_v0) && (gLevelType == LEVELTYPE_PLANET)) { + randX = (Rand_ZeroOne() - 0.5f) * 10.0f; + randY = (Rand_ZeroOne() - 0.5f) * 10.0f; + randOther = ((Rand_ZeroOne() * 0.5f) + 1.0f); + func_8007C85C(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, + effect->scale2 * randOther); + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007C9E0(Effect* effect) { + if (effect->unk_44 == 0) { + effect->scale2 *= 1.03f; + effect->unk_4A -= 3; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.3f; + effect->vel.x += effect->scale1; + } else { + effect->scale2 *= 1.03f; + effect->unk_4A -= 7; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.3f; + effect->vel.x += effect->scale1; + } +} + +void func_8007CAF0(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + if (effect->unk_44 == 0) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, effect->unk_4A); + gSPDisplayList(gMasterDisp++, D_102A010); + } else { + Matrix_Scale(gGfxMatrix, 1.5f, 1.5f, 1.5f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + gSPDisplayList(gMasterDisp++, D_20031B0); + } +} + +void func_8007CC00(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_339; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + effect->scale1 = 0.5f; + effect->unk_4C = 0; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); + if (gLevelType == LEVELTYPE_PLANET) { + effect->unk_44 = 230; + } else { + effect->unk_44 = 0xFF; + } +} + +void func_8007CCBC(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_340; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + effect->unk_4C = 3; + effect->scale1 = 0.2f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); + if (gLevelType == LEVELTYPE_PLANET) { + effect->unk_44 = 230; + } else { + effect->unk_44 = 0xFF; + } +} + +void func_8007CD7C(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_342; + effect->timer_50 = timer50; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_48 = 3; + if (Rand_ZeroOne() < 0.5f) { + effect->unk_48 = -effect->unk_48; + } + effect->unk_4A = 0xFF; + effect->scale2 = scale2; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + if ((Rand_ZeroOne() < 0.5f) && (gLevelType == LEVELTYPE_PLANET) && (timer50 != 1)) { + effect->unk_44 = 1; + } + if (timer50 == 2) { + effect->unk_44 = 1; + } + if (scale2 == 2.2f) { + effect->unk_44 = 0; + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007CEBC(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007CD7C(&gEffects[i], posX, posY, posZ, scale2, timer50); + break; + } + } +} + +void func_8007CF30(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007CC00(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007CF9C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007CCBC(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007D008(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007CC00(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007D074(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007CCBC(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007D0E0(f32 posX, f32 posY, f32 posZ, f32 scale2) { + func_8007CF30(posX, posY, posZ, scale2); +} + +void func_8007D10C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + func_8007CF9C(posX, posY, posZ, scale2); +} + +void func_8007D138(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_341; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); + if (gLevelType == LEVELTYPE_PLANET) { + effect->unk_4C = 15; + } + effect->unk_44 = 180; +} + +void func_8007D1E0(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007D138(&gEffects[i], posX, posY, posZ, scale2); + break; + } + } +} + +void func_8007D24C(f32 posX, f32 posY, f32 posZ, f32 scale2) { + if (gLevelType == LEVELTYPE_PLANET) { + func_8007D1E0(posX, posY, posZ, scale2); + func_8007CEBC(posX, scale2 + posY, posZ, scale2, 9); + } else { + func_8007D0E0(posX, posY, posZ, scale2); + } +} + +void func_8007D2C8(f32 posX, f32 posY, f32 posZ, f32 scale2) { + func_8007D008(posX, posY, posZ, scale2); +} + +void func_8007D2F4(Effect* effect) { + if (gLevelType == LEVELTYPE_PLANET) { + if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7)) { + effect->vel.y += 0.1f; + if (effect->timer_50 == 0) { + effect->unk_4C++; + effect->timer_50 = 4; + if (effect->unk_4C > 15) { + effect->timer_50 = 5; + } + if (effect->unk_4C > 20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + } else { + if ((gCurrentLevel == LEVEL_MACBETH) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && + (effect->vel.x != 0)) { + Math_SmoothStepToF(&effect->vel.x, -1.0f, 1.0f, 1.0f, 0.0f); + Math_SmoothStepToF(&effect->vel.z, 4.0f, 1.0f, 1.0f, 0.0f); + effect->vel.y += 1.7f; + } + effect->vel.y += 0.3f; + if (effect->timer_50 == 0) { + effect->unk_4C++; + if (effect->unk_4C > 15) { + effect->timer_50 = 2; + } + if (effect->unk_4C > 20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + } + } else { + if (effect->timer_50 == 0) { + effect->unk_4C++; + effect->timer_50 = effect->unk_46; + if (effect->unk_4C > 13) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->unk_44 -= 15; + } + if (D_8017836C < effect->scale1) { + D_8017836C = effect->scale1; + D_80178370 = effect->obj.pos.x; + D_80178374 = effect->obj.pos.y; + D_80178378 = effect->obj.pos.z; + D_80178360 = 0xFF; + D_80178364 = 50; + D_80178368 = 0; + } + Math_SmoothStepToF(&effect->scale1, 0.0f, 1.0f, 0.05f, 0.0f); +} + +Gfx* D_800D17A4[] = { + D_200B630, D_200B630, D_200B630, D_200B630, D_200A5A0, D_2009510, D_2008480, + D_20073F0, D_2006360, D_200C6C0, D_20052D0, D_2004240, D_20031B0, D_2002120, + D_2001090, D_2000000, D_2010A30, D_20101A0, D_200F910, D_200F080, D_200E7F0, +}; + +f32 D_800D17F8[] = { + 1.0f, 1.1f, 1.1f, 1.2f, 1.2f, 1.3f, 1.3f, 1.4f, 1.4f, 1.5f, 1.5f, + 1.6f, 1.6f, 1.7f, 1.7f, 1.8f, 1.8f, 1.9f, 1.9f, 2.0f, 2.0f, +}; + +// RGBA values +u8 D_800D184C[][4] = { + { 255, 255, 255, 255 }, { 255, 0, 0, 255 }, { 255, 40, 40, 255 }, { 255, 80, 80, 255 }, + { 255, 120, 120, 255 }, { 255, 160, 160, 255 }, { 255, 200, 200, 255 }, { 255, 240, 240, 255 }, + { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, + { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, + { 0, 0, 0, 255 }, { 0, 0, 0, 200 }, { 0, 0, 0, 150 }, { 0, 0, 0, 100 }, + { 0, 0, 0, 50 }, +}; + +Gfx* D_800D18A0[] = { + D_20066C0, D_20066C0, D_2005E30, D_20055A0, D_2004D10, D_2004480, D_2003BF0, + D_2003360, D_2002AD0, D_2002240, D_20019B0, D_2001120, D_2000890, D_2000000, +}; + +void func_8007D55C(Effect* effect) { + f32 scale; + + Graphics_SetScaleMtx(effect->scale2); + if (gLevelType == LEVELTYPE_PLANET) { + gDPSetPrimColor(gMasterDisp++, 0, 0, D_800D184C[effect->unk_4C][0], D_800D184C[effect->unk_4C][1], + D_800D184C[effect->unk_4C][2], D_800D184C[effect->unk_4C][3]); + scale = D_800D17F8[effect->unk_4C] - 0.5f; + Matrix_Scale(gGfxMatrix, scale, scale, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_800D17A4[effect->unk_4C]); + return; + } + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 100, effect->unk_44); + if (effect->unk_4C == 0) { + Matrix_Scale(gGfxMatrix, 2.5f, 2.5f, 2.5f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_800D18A0[effect->unk_4C]); + return; + } + gSPDisplayList(gMasterDisp++, D_800D18A0[effect->unk_4C]); +} + +void func_8007D748(Effect* effect) { + if (gLevelType == LEVELTYPE_PLANET) { + effect->vel.y += 0.3f; + if (effect->timer_50 == 0) { + if (effect->unk_4C > 15) { + effect->timer_50 = 2; + effect->unk_4C = effect->unk_4C + 1; + } else { + effect->unk_4C = effect->unk_4C + 2; + } + if (effect->unk_4C > 20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + } else { + if (effect->timer_50 == 0) { + effect->unk_4C++; + effect->timer_50 = 0; + if (effect->unk_4C > 13) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->unk_44 -= 15; + } + if (D_8017836C < effect->scale1) { + D_8017836C = effect->scale1; + D_80178370 = effect->obj.pos.x; + D_80178374 = effect->obj.pos.y; + D_80178378 = effect->obj.pos.z; + D_80178360 = 0xFF; + D_80178364 = 50; + D_80178368 = 0; + } + Math_SmoothStepToF(&effect->scale1, 0, 1.0f, 0.1f, 0.0f); +} + +void func_8007D8A8(Effect* effect) { + if (gLevelType == LEVELTYPE_SPACE) { + func_8007D2F4(effect); + return; + } + effect->vel.y += 0.3f; + if (effect->timer_50 == 0) { + effect->unk_4C++; + effect->timer_50 = 2; + if (effect->unk_4C >= 20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + if (effect->unk_4C >= 16) { + effect->unk_44 -= 20; + } +} + +void func_8007D94C(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, s32 timer50) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_367; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_44 = 80; + effect->scale2 = scale2; + effect->scale1 = scale1; + effect->timer_50 = timer50; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007D9DC(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, s32 timer50) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007D94C(&gEffects[i], posX, posY, posZ, scale2, scale1, timer50); + break; + } + } +} + +void func_8007DA58(Effect* effect) { + effect->scale2 += effect->scale1; + if (effect->scale1 > 0.0f) { + effect->scale1 -= 0.01f; + } else { + effect->scale1 -= 0.001f; + } + effect->obj.rot.y += effect->unk_60.y; + if (effect->scale2 < 0.01f) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007DAE4(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + gSPDisplayList(gMasterDisp++, D_6004900); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +Vec3f D_800D18D8 = { 0.0f, -10.0f, 0.0f }; + +void func_8007DB70(Effect* effect) { + Vec3f sp54 = D_800D18D8; + + switch (effect->unk_4E) { + case 0: + effect->vel.y -= 0.5f; + if ((effect->timer_50 == 0) && ((func_8006351C(1000, &effect->obj.pos, &sp54, 1) != 0) || + (effect->obj.pos.y < (D_80177940 + 10.0f)))) { + effect->vel.y = 0.0f; + if (effect->obj.pos.y < (D_80177940 + 10.0f)) { + effect->obj.pos.y = D_80177940; + } + effect->unk_4E = 1; + effect->timer_50 = 30; + effect->unk_44 = 192; + effect->scale2 = 2.5f; + effect->scale1 = 2.5f; + Audio_PlaySfx(0x2903B009, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y + 30.0f, effect->obj.pos.z, 7.0f); + func_8007BFFC(effect->obj.pos.x, effect->obj.pos.y + 30.0f, effect->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, + 5); + if ((effect->obj.pos.y < (D_80177940 + 10.0f)) || (D_80161A88 != 2)) { + func_800365E4(effect->obj.pos.x, 3.0f, effect->obj.pos.z, effect->obj.pos.x, effect->obj.pos.z, + 0.0f, 0.0f, 90.0f, 5.0f, 0, 0); + break; + } + } + break; + case 1: + effect->scale2 += ((20.0f - effect->scale2) * 0.1f); + if (effect->scale2 > 19.0f) { + effect->scale1 -= 0.3f; + effect->unk_44 -= 20; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->obj.rot.y = 180.0f - effect->obj.rot.y; + if ((fabsf(gPlayer[0].unk_138 - effect->obj.pos.z) < 40.0f) && + (fabsf(gPlayer[0].pos.x - effect->obj.pos.x) < 80.0f)) { + if ((effect->obj.pos.y < gPlayer[0].pos.y) && + ((gPlayer[0].pos.y - effect->obj.pos.y) < (effect->scale2 * 35.0f)) && + (gPlayer[0].timer_498 == 0)) { + Player_ApplyDamage(gPlayer, 0, effect->info.damage); + } + } + break; + } +} + +void func_8007DED4(Effect* effect) { + switch (effect->unk_4E) { + case 0: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + gSPDisplayList(gMasterDisp++, D_4008CE0); + RCP_SetupDL(&gMasterDisp, 0x40); + return; + case 1: + Matrix_Scale(gGfxMatrix, effect->scale1, effect->scale2, 2.5f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL_40(); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_4008F70); + RCP_SetupDL(&gMasterDisp, 0x40); + return; + } +} + +void func_8007E014(Effect* effect) { + s32 i; + f32 x; + f32 z; + f32 y; + + if (D_801784AC == 4) { + func_E6A810_801B6E20(effect->obj.pos.x, effect->obj.pos.z + D_80177D20, &x, &y, &z); + effect->obj.pos.y = y + 3.0f; + effect->obj.rot.x = (x * 180.0f) / M_PI; + effect->obj.rot.z = (z * 180.0f) / M_PI; + } + if (((effect->unk_44 == 1) || (effect->unk_44 == 3)) && ((effect->timer_50 & 3) == 1) && (Rand_ZeroOne() < 0.5f)) { + func_8007D10C(effect->obj.pos.x, effect->obj.pos.y + (effect->scale2 * 5.0f), effect->obj.pos.z + 3.0f, + ((Rand_ZeroOne() * 0.7f) + 1.0f) * (effect->scale2 * 1.2f)); + } + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if ((gEffects[i].obj.status == 2) && (gEffects[i].obj.id == OBJ_EFFECT_344) && (i != effect->index) && + (fabsf(effect->obj.pos.z - gEffects[i].obj.pos.z) < 20.0f) && + (fabsf(effect->obj.pos.x - gEffects[i].obj.pos.x) < 20.0f) && + (fabsf(effect->obj.pos.y - gEffects[i].obj.pos.y) < 20.0f)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007E258(Effect* effect) { + if ((gCamCount != 1) && (effect->timer_50 == 0)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_8007E298(Effect* effect) { + if (effect->timer_50 == 0) { + effect->scale2 *= 1.035f; + effect->unk_4A -= 8; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->obj.rot.z += effect->unk_48; + if (gLevelType == LEVELTYPE_PLANET) { + effect->vel.y += 0.2f; + } +} + +void func_8007E330(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + if (effect->unk_44 == 0) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, effect->unk_4A); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + } + gSPDisplayList(gMasterDisp++, D_2010A30); +} + +void func_8007E3E4(Effect* effect) { + effect->scale2 += 0.02f; + effect->unk_4A -= 4; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->unk_48; + effect->vel.y += 0.05f; +} + +void func_8007E45C(Effect* effect) { + switch (effect->unk_4E) { + case 0: + if (effect->unk_4C != 0) { + Math_SmoothStepToF(&effect->scale2, 5.0f, 0.05f, 0.5f, 0.0f); + effect->unk_44 -= 10; + effect->obj.rot.z += effect->scale1; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + return; + } + effect->scale2 += 0.02f; + effect->unk_44 -= 1; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + effect->obj.rot.z += effect->scale1; + Math_SmoothStepToF(&effect->vel.y, 0.5f, 0.05f, 0.2f, 0.00001f); + break; + case 1: + effect->vel.y = 3.0f; + Math_SmoothStepToF(&effect->scale2, 5.0f, 0.05f, 0.5f, 0.0f); + effect->unk_44 -= 10; + effect->obj.rot.z += effect->scale1; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + } +} + +void func_8007E5CC(Effect* effect) { + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_2010A30); +} + +void func_8007E648(Effect* effect) { + if (effect->timer_50 == 0) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.05f, 100.0f, 0.0f); + effect->unk_44 -= 2; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007E6B8(Effect* effect, u32 objId, f32 posX, f32 posY, f32 posZ, f32 arg5) { + f32 sp54; + f32 sp50; + f32 temp_ft4; + Vec3f sp40; + Vec3f sp34; + + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = objId; + effect->timer_50 = 100; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + Object_SetInfo(&effect->info, objId & 0xFFFF); + sp50 = Math_Atan2F(gPlayer->pos.x - posX, gPlayer->unk_138 - posZ); + temp_ft4 = sqrtf(SQ(gPlayer->unk_138 - posZ) + SQ(gPlayer->pos.x - posX)); + sp54 = -Math_Atan2F(gPlayer->pos.y - posY, temp_ft4); + Matrix_RotateY(gCalcMatrix, sp50, 0); + Matrix_RotateX(gCalcMatrix, sp54, 1); + sp40.x = 0.0f; + sp40.y = 0.0f; + sp40.z = arg5; + Matrix_MultVec3f(gCalcMatrix, &sp40, &sp34); + effect->vel.x = sp34.x + D_801779E4; + effect->vel.y = sp34.y + D_801779F4; + effect->vel.z = sp34.z - D_80177D08; + if ((objId == OBJ_EFFECT_353) || (objId == OBJ_EFFECT_354)) { + effect->obj.rot.x = (sp54 * 180.0f) / M_PI; + effect->obj.rot.y = (sp50 * 180.0f) / M_PI; + } + if (objId == OBJ_EFFECT_356) { + Audio_PlaySfx(0x31000025, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (objId == OBJ_EFFECT_376) { + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->unk_4A = 180; + effect->scale2 = 5.0f; + return; + } + if ((objId == OBJ_EFFECT_355) || (objId == OBJ_EFFECT_377)) { + Audio_PlaySfx(0x31000025, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + return; + } + Audio_PlaySfx(0x29002002, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); +} + +void func_8007E93C(Effect* effect, u32 objId, f32 posX, f32 posY, f32 posZ, f32 arg5) { + f32 sp54; + f32 sp50; + f32 temp_ft4; + Vec3f sp40; + Vec3f sp34; + + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = objId; + effect->timer_50 = 100; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + Object_SetInfo(&effect->info, objId & 0xFFFF); + sp50 = Math_Atan2F(gPlayer->camEye.x - posX, gPlayer->camEye.z - posZ); + temp_ft4 = sqrtf(SQ(gPlayer->camEye.z - posZ) + SQ(gPlayer->camEye.x - posX)); + sp54 = -Math_Atan2F(gPlayer->camEye.y - posY, temp_ft4); + Matrix_RotateY(gCalcMatrix, sp50, 0); + Matrix_RotateX(gCalcMatrix, sp54, 1); + sp40.x = 0.0f; + sp40.y = 0.0f; + sp40.z = arg5; + Matrix_MultVec3f(gCalcMatrix, &sp40, &sp34); + effect->vel.x = sp34.x + D_801779E4; + effect->vel.y = sp34.y + D_801779F4; + effect->vel.z = sp34.z - D_80177D08; + if (objId == OBJ_EFFECT_353) { + effect->obj.rot.x = (sp54 * 180.0f) / M_PI; + effect->obj.rot.y = (sp50 * 180.0f) / M_PI; + } + if (objId == OBJ_EFFECT_356) { + Audio_PlaySfx(0x31000025, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (objId == OBJ_EFFECT_376) { + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->unk_4A = 180; + effect->scale2 = 5.0f; + return; + } + if ((objId == OBJ_EFFECT_355) || (objId == OBJ_EFFECT_377)) { + Audio_PlaySfx(0x31000025, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + return; + } + Audio_PlaySfx(0x29002002, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); +} + +void func_8007EBB8(Effect* effect, s32 objId, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = objId; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->timer_50 = 100; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->scale2 = scale2; + if (objId == OBJ_EFFECT_355) { + Audio_PlaySfx(0x31000025, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } else { + Audio_PlaySfx(0x29002002, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007ECB4(s32 objId, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007EBB8(&gEffects[i], objId, posX, posY, posZ, velX, velY, velZ, scale2); + break; + } + } +} + +void func_8007ED54(Effect* effect, s32 objId, f32 posX, f32 posY, f32 posZ, f32 rotX, f32 rotY, f32 rotZ, f32 unkX, + f32 unkY, f32 unkZ, f32 velX, f32 velY, f32 velZ, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = objId; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->timer_50 = 100; + if (gCurrentLevel == LEVEL_AQUAS) { + effect->timer_50 = 75; + } + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->obj.rot.x = rotX; + effect->obj.rot.y = rotY; + effect->obj.rot.z = rotZ; + effect->unk_60.x = unkX; + effect->unk_60.y = unkY; + effect->unk_60.z = unkZ; + effect->scale2 = scale2; + if (effect->obj.id != OBJ_EFFECT_380) { + Audio_PlaySfx(0x29002002, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8007EE68(s32 objId, Vec3f* pos, Vec3f* rot, Vec3f* arg3, Vec3f* arg4, f32 scale2) { + s32 i; + Vec3f sp68; + + Matrix_RotateY(gCalcMatrix, arg3->y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, arg3->x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, arg3->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, arg4, &sp68); + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007ED54(&gEffects[i], objId, pos->x + sp68.x, pos->y + sp68.y, pos->z + sp68.z, rot->x, rot->y, + rot->z, arg3->x, arg3->y, arg3->z, sp68.x + D_801779E4, sp68.y + D_801779F4, + sp68.z - D_80177D08, scale2); + break; + } + } +} + +void func_8007F04C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 rotX, f32 rotY, f32 rotZ, f32 unkX, f32 unkY, f32 unkZ, + f32 velX, f32 velY, f32 velZ, f32 scale2) { + s32 i; + + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8007ED54(&gEffects[i], objId, posX, posY, posZ, rotX, rotY, rotZ, unkX, unkY, unkZ, velX, velY, velZ, + scale2); + break; + } + } +} + +void func_8007F11C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 arg4) { + s32 i; + + if ((fabsf(posZ - gPlayer->unk_138) > 300.0f) || (fabsf(posX - gPlayer->pos.x) > 300.0f)) { + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + Matrix_Push(&gCalcMatrix); + func_8007E6B8(&gEffects[i], objId, posX, posY, posZ, arg4); + Matrix_Pop(&gCalcMatrix); + break; + } + } + } +} + +void func_8007F20C(s32 objId, f32 posX, f32 posY, f32 posZ, f32 arg4) { + s32 i; + + if ((fabsf(posZ - gPlayer->camEye.z) > 300.0f) || (fabsf(posX - gPlayer->camEye.x) > 300.0f)) { + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + Matrix_Push(&gCalcMatrix); + func_8007E93C(&gEffects[i], objId, posX, posY, posZ, arg4); + Matrix_Pop(&gCalcMatrix); + break; + } + } + } +} + +void func_8007F2FC(Effect* effect) { + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + if ((effect->obj.pos.y < D_80177940) && (gLevelType == LEVELTYPE_PLANET)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + if (gLevelType == LEVELTYPE_PLANET) { + effect->vel.y -= 0.3f; + } + if (effect->obj.pos.y < D_80177CC0) { + effect->vel.y += 0.2f; + effect->obj.pos.y -= effect->vel.y * 0.5f; + effect->obj.pos.x -= effect->vel.x * 0.5f; + effect->obj.pos.z -= effect->vel.z * 0.5f; + } + if ((effect->unk_44 == 1) && !(gFrameCount & 1)) { + func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 1.5f); + } +} + +void func_8007F438(Effect* effect) { + if (gCurrentLevel == LEVEL_AQUAS) { + effect->obj.rot.z += 3.5f; + effect->vel.z = 5.0f; + if (effect->unk_44 != 0) { + Math_SmoothStepToF(&effect->scale1, 100.0f, 1.0f, 20.0f, 0.0001f); + } else { + Math_SmoothStepToF(&effect->scale1, 0.0f, 1.0f, 20.0f, 0.0001f); + } + if (effect->unk_46 == 0) { + effect->unk_46 = 0x1E; + effect->unk_44 += 1; + effect->unk_44 &= 1; + } else { + effect->unk_46--; + } + if (D_80177D08 < 0.0f) { + effect->vel.z = -10.0f; + } + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else { + effect->obj.rot.z += 3.5f; + if (gLevelType == LEVELTYPE_PLANET) { + effect->vel.y += 0.2f; + } + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } +} + +void func_8007F5AC(Effect* effect) { + if (effect->unk_4C == 0) { + effect->unk_46++; + if (!(effect->unk_46 & 0x20)) { + effect->vel.x += 0.5f; + } else { + effect->vel.x -= 0.5f; + } + if (!(gFrameCount & 1)) { + effect->unk_44--; + if (effect->unk_44 < 20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + effect->scale2 += 0.02f; + if (!(gFrameCount & 0x10)) { + effect->scale2 += 0.01f; + } else { + effect->scale2 -= 0.01f; + } + } +} + +void func_8007F6B0(Effect* effect) { + s32 i; + f32 temp; + f32 cos; + f32 sin; + f32 randfloat; + f32 x; + f32 z; + f32 y; + f32 posY; + + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 12.0f, 0.1f); + effect->unk_44 -= 2; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + if (!(gFrameCount & 3) && (effect->unk_4E == 0)) { + randfloat = Rand_ZeroOne() * 30.0f; + for (i = 0; i < 36; i += 2) { + temp = (i * 10.0f * M_DTOR) + randfloat; + sin = __sinf(temp) * effect->scale2 * 8.0f; + cos = __cosf(temp) * effect->scale2 * 8.0f; + posY = D_80177940 + 40.0f; + if (D_801784AC == 4) { + func_E6A810_801B6E20(effect->obj.pos.x + sin, effect->obj.pos.z + cos + D_80177D20, &x, &y, &z); + posY = y + 30.0f; + } + if (gCurrentLevel == LEVEL_AQUAS) { + func_8007B8F8(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 20.0f); + } else if (gCurrentLevel == LEVEL_FORTUNA) { + func_8007BC7C(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 20.0f); + } else if (gCurrentLevel == LEVEL_TITANIA) { + func_8007A900(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 10.0f, 0xFF, 0xF, 0); + } + } + } +} + +void func_8007F958(Effect* effect) { + s32 i; + f32 x; + f32 z; + f32 y; + f32 temp; + f32 cos; + f32 sin; + f32 randFloat; + f32 posY; + + effect->scale2 += effect->scale1; + effect->scale1 -= 0.08f; + if (effect->scale1 < 0.1f) { + effect->scale1 = 0.1f; + } + effect->unk_44 -= 9; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + if (!(gFrameCount & 1)) { + randFloat = Rand_ZeroOne() * 144.0f; + for (i = 0; i < 5; i++) { + temp = (i * 72.0f * M_DTOR) + randFloat; + sin = __sinf(temp) * effect->scale2 * 16.0f; + cos = __cosf(temp) * effect->scale2 * 16.0f; + posY = D_80177940 + 10.0f; + if (D_801784AC == 4) { + func_E6A810_801B6E20(effect->obj.pos.x + sin, effect->obj.pos.z + cos + D_80177D20, &x, &y, &z); + posY = y + 10.0f; + } + if (gCurrentLevel == LEVEL_FORTUNA) { + func_8007BC7C(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 8.0f); + } else if (gCurrentLevel == LEVEL_TITANIA) { + func_8007A900(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 8.0f, 0xFF, 0xF, 0); + } + } + } +} + +void func_8007FBE0(Effect* effect) { + s32 i; + f32 temp; + f32 sin; + f32 cos; + f32 randFloat; + f32 posY; + + effect->scale2 += effect->scale1; + effect->scale1 -= 0.1000000015f; // Not sure why this can't be reduced to 0.1f... + if (effect->scale1 < 0.1f) { + effect->scale1 = 0.1f; + } + effect->unk_44 -= 6; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + if (!(gFrameCount & 1)) { + randFloat = Rand_ZeroOne() * 144.0f; + for (i = 0; i < 10; i++) { + temp = (i * 36.0f * M_DTOR) + randFloat; + sin = __sinf(temp) * effect->scale2 * 16.0f; + cos = __cosf(temp) * effect->scale2 * 16.0f; + posY = D_80177940 + 10.0f; + func_8007BC7C(effect->obj.pos.x + sin, posY, effect->obj.pos.z + cos, 12.0f); + } + } +} + +s32 func_8007FD84(Effect* effect) { + s32 i; + Object_2F4* obj2F4; + + for (i = 1; i < ARRAY_COUNT(D_800CFF80); i++) { + obj2F4 = &gObjects2F4[D_800CFF80[i]]; + if (obj2F4->obj.status == 2) { + if ((obj2F4->unk_080 > 0) && (obj2F4->unk_080 < 6) && + (fabsf(obj2F4->obj.pos.z - effect->obj.pos.z) < 100.0f) && + (fabsf(obj2F4->obj.pos.x - effect->obj.pos.x) < 100.0f) && + (fabsf(obj2F4->obj.pos.y - effect->obj.pos.y) < 100.0f)) { + obj2F4->unk_0D0 = 1; + obj2F4->unk_0D2 = 0; + obj2F4->unk_0D6 = 10; + if (effect->obj.id == OBJ_EFFECT_354) { + obj2F4->unk_0D6 = 30; + } + obj2F4->unk_0D4 = 100; + return 1; + } + } + } + return 0; +} + +void func_8007FE88(Effect* effect) { + Vec3f srcVelocity; + Vec3f destVelocity; + Vec3f velocity; + f32 var_fa0; + + var_fa0 = 0.0f; + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + if (func_8007FD84(effect) != 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + if (gPlayer->unk_280 != 0) { + var_fa0 = 100.0f; + } + if (fabsf(gPlayer->unk_138 - effect->obj.pos.z) < (50.0f + var_fa0)) { + if ((fabsf(gPlayer->pos.x - effect->obj.pos.x) < (30.0f + var_fa0)) && + (fabsf(gPlayer->pos.y - effect->obj.pos.y) < (30.0f + var_fa0))) { + if ((gPlayer->unk_280 != 0) || (gPlayer->timer_27C != 0)) { + effect->obj.rot.y = 90.0f; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + Matrix_RotateY(gCalcMatrix, effect->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, effect->obj.rot.x * M_DTOR, 1); + srcVelocity.x = 0.0f; + srcVelocity.y = 0.0f; + srcVelocity.z = 100.0f; + Matrix_MultVec3f(gCalcMatrix, &srcVelocity, &destVelocity); + effect->vel.x = destVelocity.x; + effect->vel.y = destVelocity.y; + effect->vel.z = destVelocity.z; + gPlayer->unk_2C4 += 1; + Audio_PlaySfx(0x09007011, &effect->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if ((gPlayer->unk_280 == 0) && (gPlayer->timer_498 == 0)) { + Player_ApplyDamage(gPlayer, 0, effect->info.damage); + gPlayer->unk_0D8.x = 20.0f; + if (effect->vel.x < 0.0f) { + gPlayer->unk_0D8.x *= -1.0f; + } + if (gCurrentLevel != LEVEL_MACBETH) { + gPlayer->unk_0D8.y = 20.0f; + if (effect->vel.y < 0.0f) { + gPlayer->unk_0D8.y *= -1.0f; + } + } + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + } + if (D_801784AC == 4) { + if (func_E6A810_801B6AEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z + D_80177D20) != 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else if (effect->obj.pos.y < D_80177940) { + Object_Kill(&effect->obj, &effect->sfxPos); + if (D_80161A88 != 2) { + effect->obj.pos.y = D_80177940; + func_8007D074(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); + } + } + velocity.x = effect->vel.x; + velocity.y = effect->vel.y; + velocity.z = effect->vel.z; + if (gCurrentLevel != LEVEL_MACBETH) { + if (func_8006351C(1000, &effect->obj.pos, &velocity, 2) != 0) { + func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else if (func_801A55D4(1000, &effect->obj.pos, &velocity, 0) != 0) { + func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); + Object_Kill(&effect->obj, &effect->sfxPos); + } +} + +void func_800802B8(Effect* effect) { + func_8007FE88(effect); +} + +void func_800802D8(Effect* effect) { + func_8007FE88(effect); +} + +void func_800802F8(Effect* effect) { + func_8007FE88(effect); + effect->obj.rot.z += 10.0f; + effect->scale2 = 3.0f; + if (gFrameCount & 1) { + effect->scale2 = 3.5f; + } +} + +void func_80080360(Effect* effect) { + effect->obj.rot.z += 8.0f; + effect->scale2 += 0.1f; + // It seems they forgot that unk_4A is s16 and not a float... + effect->unk_4A -= 3.5f; + if (effect->unk_4A < 50.0f) { + effect->unk_4A = 50; + } + func_8007A774(gPlayer, effect, 50.0f); +} + +void func_8008040C(Effect* effect) { + f32 rotX; + f32 rotY; + f32 temp; + f32 var_fa0; + Vec3f srcVelocity; + Vec3f destVelocity; + Vec3f sp3C; + + var_fa0 = 0.0f; + switch (effect->unk_4E) { + case 0: + rotY = Math_Atan2F(gPlayer->pos.x - effect->obj.pos.x, gPlayer->unk_138 - effect->obj.pos.z); + temp = sqrtf(SQ(gPlayer->unk_138 - effect->obj.pos.z) + SQ(gPlayer->pos.x - effect->obj.pos.x)); + rotX = -Math_Atan2F(gPlayer->pos.y - effect->obj.pos.y, temp); + Matrix_RotateY(gCalcMatrix, rotY, 0); + Matrix_RotateX(gCalcMatrix, rotX, 1); + srcVelocity.y = 0.0f; + srcVelocity.x = 0.0f; + srcVelocity.z = 100.0f; + Matrix_MultVec3f(gCalcMatrix, &srcVelocity, &destVelocity); + effect->vel.x = destVelocity.x + D_801779E4; + effect->vel.y = destVelocity.y + D_801779F4; + effect->vel.z = destVelocity.z - D_80177D08; + effect->unk_4E++; + break; + case 1: + effect->obj.rot.z = 360.0f - effect->obj.rot.z; + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + if (func_8007FD84(effect) != 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + if (gPlayer->unk_280 != 0) { + var_fa0 = 100.0f; + } + if (fabsf(gPlayer->unk_138 - effect->obj.pos.z) < (50.0f + var_fa0)) { + if ((fabsf(gPlayer->pos.x - effect->obj.pos.x) < (30.0f + var_fa0)) && + (fabsf(gPlayer->pos.y - effect->obj.pos.y) < (30.0f + var_fa0))) { + if ((gPlayer->unk_280 != 0) || (gPlayer->timer_27C != 0)) { + effect->obj.rot.y = 90.0f; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + Matrix_RotateY(gCalcMatrix, effect->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, effect->obj.rot.x * M_DTOR, 1); + srcVelocity.y = 0.0f; + srcVelocity.x = 0.0f; + srcVelocity.z = 100.0f; + Matrix_MultVec3f(gCalcMatrix, &srcVelocity, &destVelocity); + effect->vel.x = destVelocity.x; + effect->vel.y = destVelocity.y; + effect->vel.z = destVelocity.z; + gPlayer->unk_2C4++; + Audio_PlaySfx(0x09007011, &effect->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if ((gPlayer->unk_280 == 0) && (gPlayer->timer_498 == 0)) { + Player_ApplyDamage(gPlayer, 0, effect->info.damage); + gPlayer->unk_0D8.x = 20.0f; + if (effect->vel.x < 0.0f) { + gPlayer->unk_0D8.x *= -1.0f; + } + gPlayer->unk_0D8.y = 20.0f; + if (effect->vel.y < 0.0f) { + gPlayer->unk_0D8.y *= -1.0f; + } + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + if (D_801784AC == 4) { + if (func_E6A810_801B6AEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z + D_80177D20) != + 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else if (effect->obj.pos.y < D_80177940) { + Object_Kill(&effect->obj, &effect->sfxPos); + if (D_80161A88 != 2) { + effect->obj.pos.y = D_80177940; + func_8007D074(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); + } + } + sp3C.x = effect->vel.x; + sp3C.y = effect->vel.y; + sp3C.z = effect->vel.z; + if (func_8006351C(1000, &effect->obj.pos, &sp3C, 2) != 0) { + func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); + Object_Kill(&effect->obj, &effect->sfxPos); + } + } + break; + } + + func_8007A774(gPlayer, effect, 50.0f); +} + +void func_8008092C(Effect* effect) { + switch (effect->unk_44) { + case 0: + RCP_SetupDL(&gMasterDisp, 0x31); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); + gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); + Matrix_Scale(gGfxMatrix, 4.0f, 2.0f, 4.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_6018AF0); + break; + case 1: + RCP_SetupDL(&gMasterDisp, 0x31); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); + gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); + Matrix_RotateZ(gGfxMatrix, 0.5235988f, 1); + Matrix_Scale(gGfxMatrix, 3.0f, 1.5f, 3.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + } +} + +void func_80080ACC(Effect* effect) { + s16 temp_ft2; + + switch (effect->unk_78) { + case 0: + break; + case 0x1: + effect->unk_46 -= 1; + break; + case 0xA: + effect->unk_44 -= 1; + if (effect->unk_44 <= 0) { + effect->unk_44 = effect->unk_46; + } + temp_ft2 = (((f32) effect->unk_44 / (f32) effect->unk_46) * 255.0f); + effect->unk_48 = temp_ft2; + if (temp_ft2 >= 256) { + effect->unk_48 = 0xFF; + } + if (effect->unk_48 < 0x20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 0xB: + effect->obj.rot.z += effect->unk_60.z; + effect->scale2 += 0.07f; + effect->vel.y += 0.2f; + effect->unk_44 += effect->unk_46; + if (effect->unk_44 < 10) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 0xC: + effect->obj.rot.x += effect->unk_60.x; + effect->obj.rot.y += effect->unk_60.y; + effect->obj.rot.z += effect->unk_60.z; + if ((effect->unk_44 == 0) && (effect->obj.pos.y < D_80177940)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + if (effect->unk_44 != 0) { + effect->unk_44--; + } + effect->vel.y -= 4.0f; + break; + case 0x10: + break; + case 0x64: + func_8007E45C(effect); + break; + case 0x65: + func_8007BCE8(effect); + break; + case 0x66: + func_8007B758(effect); + break; + } +} + +void func_80080D04(Effect* effect) { + static s32 D_800D18E4 = 0; + s32 i; + s32 alpha; + + switch (effect->unk_7A) { + case 0: + if (effect->unk_44 != 0x40) { + RCP_SetupDL(&gMasterDisp, effect->unk_44); + } + gSPDisplayList(gMasterDisp++, effect->unk_74); + if (effect->unk_44 != 0x40) { + RCP_SetupDL(&gMasterDisp, 0x40); + } + break; + case 1: + if (effect->unk_48 == 0) { + effect->unk_48 = effect->unk_46; + } + if (effect->unk_44 != 0x40) { + RCP_SetupDL(&gMasterDisp, effect->unk_44); + } + alpha = (((f32) effect->unk_46 / (f32) effect->unk_48) * 255.0f); + if (alpha > 0xFF) { + alpha = 0xFF; + } + if (alpha < 0x20) { + Object_Kill(&effect->obj, &effect->sfxPos); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, alpha); + gSPDisplayList(gMasterDisp++, effect->unk_74); + } + if (effect->unk_44 != 0x40) { + RCP_SetupDL(&gMasterDisp, 0x40); + } + break; + case 10: + RCP_SetupDL(&gMasterDisp, 0x41); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_48); + Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_A000000); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 11: + RCP_SetupDL(&gMasterDisp, 0x44); + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 120, 60, 0, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, 0); + gSPDisplayList(gMasterDisp++, D_1023750); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 12: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x17); + gSPDisplayList(gMasterDisp++, D_9013C20); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 13: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 36, 45, 28, 0); + gSPDisplayList(gMasterDisp++, D_1023750); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 14: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 255, 255, 255, 0); + gSPDisplayList(gMasterDisp++, D_1023750); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 15: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); + gDPSetEnvColor(gMasterDisp++, 36, 45, 28, 0); + gSPDisplayList(gMasterDisp++, D_1023750); + RCP_SetupDL(&gMasterDisp, 0x40); + break; + case 16: + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 96, 96, 255, 255); + Matrix_Translate(gGfxMatrix, 34.14f, 0.0f, 0.0f, 1); + Matrix_Push(&gGfxMatrix); + Matrix_Scale(gGfxMatrix, 0.25f, 1.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_102F5E0); + Matrix_Pop(&gGfxMatrix); + for (i = 0; i < 7; i++) { + Matrix_Translate(gGfxMatrix, 0.0f, 10.0f, 0.0f, 1); + Matrix_RotateZ(gGfxMatrix, (M_PI / 4), 1); + Matrix_Translate(gGfxMatrix, 1.0f, 20.0f, 0.0f, 1); + Matrix_Push(&gGfxMatrix); + Matrix_Scale(gGfxMatrix, 0.25f, 1.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_102F5E0); + Matrix_Pop(&gGfxMatrix); + } + effect->obj.rot.z += 1.0f; + break; + case 17: + //! DEBUG: some code used for debugging with the 4th controller + if ((gControllerPress[3].button & U_JPAD) && (D_800D18E4 > 0)) { + D_800D18E4--; + } + if ((gControllerPress[3].button & D_JPAD) && (D_800D18E4 < 12)) { + D_800D18E4++; + } + if (!((effect->index + gFrameCount) & 1)) { + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0, 0, 96, 96, 255, 255); + } + Graphics_SetScaleMtx(effect->scale2); + for (i = 0; i < 10; i++) { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, 0.0f, -60.0f, 0.0f, 1); + Matrix_Scale(gGfxMatrix, 0.8f, 3.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_102F5E0); + Matrix_Pop(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, 0.0f, -120.0f, 0.0f, 1); + Matrix_RotateZ(gGfxMatrix, D_800D1534[D_800D18E4][i] * M_DTOR, 1); + } + break; + case 18: + RCP_SetupDL(&gMasterDisp, 0x30); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 190, 255); + gDPSetEnvColor(gMasterDisp++, 239, 15, 0, 255); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + } +} + +void func_800815DC(void) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if ((gEffects[i].obj.id == OBJ_EFFECT_366 || + (gEffects[i].obj.id == OBJ_EFFECT_395 && gEffects[i].unk_4E == 1) || + gEffects[i].obj.id == OBJ_EFFECT_364 || gEffects[i].obj.id == OBJ_EFFECT_346) && + gEffects[i].obj.status == 2) { + gEffects[i].obj.status = 0; + break; + } + } +} + +void func_8008165C(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 scale2, s32 arg5) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_395; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->scale2 = scale2; + effect->unk_4E = arg5; + Object_SetInfo(&effect->info, effect->obj.id); + effect->timer_50 = 300; + switch (effect->unk_4E) { + case 4: + effect->unk_4A = 0xFF; + effect->unk_46 = 1; + break; + case 5: + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 20.0f; + effect->vel.y = (Rand_ZeroOne() * 20.0f) + 30.0f; + effect->vel.z = Rand_ZeroOne() * 30.0f; + effect->unk_46 = 5; + effect->unk_44 = ((Rand_ZeroOne() - 0.5f) * 20.0f) * 1.5f; + effect->info.unk_14 = 0; + effect->unk_4A = 0xFF; + break; + case 6: + effect->unk_4A = 0xFF; + effect->unk_46 = 0xA; + break; + case 7: + effect->vel.y = (Rand_ZeroOne() * 7.0f) + 7.0f; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->vel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->scale2 = ((Rand_ZeroOne() * 0.8f) + 0.3f) * scale2; + effect->timer_50 = (s32) (Rand_ZeroOne() * 50.0f) + 70; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + effect->unk_60.x = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.y = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.z = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->info.unk_14 = 0; + break; + case 9: + effect->obj.pos.x += (Rand_ZeroOne() - 0.5f) * 600.0f; + effect->obj.pos.y += (Rand_ZeroOne() - 0.5f) * 600.0f; + effect->obj.pos.z += ((Rand_ZeroOne() - 0.5f) * 300.0f) + 300.0f; + effect->scale1 = 0.0f; + effect->scale2 = Rand_ZeroOne() + 1.0f; + break; + case 10: + effect->timer_50 = 10; + Audio_PlaySfx(0x31405094, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 11: + effect->scale1 = 255.0f; + effect->vel.y = 20.0f; + if (effect->scale2 > 10.0f) { + effect->scale2 = 10.0f; + } + break; + case 12: + effect->scale1 = scale2; + effect->scale2 = 1.0f; + effect->timer_50 = 50; + effect->unk_44 = 100; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + Audio_PlaySfx(0x2940F026, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + D_Timer_80177BD0[0] = 60; + break; + } +} + +void func_80081A8C(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 arg4) { + s32 i; + + if (arg4 == 6 || arg4 == 7) { + func_800815DC(); + } + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8008165C(&gEffects[i], posX, posY, posZ, scale2, arg4); + break; + } + } +} + +s32 func_80081B24(f32 posX, f32 posY, f32 posZ, f32 scale2) { + s32 i; + Effect* effect; + + func_800815DC(); + + for (i = 0, effect = gEffects; i < ARRAY_COUNT(gEffects); i++, effect++) { + if (effect->obj.status == 0) { + Effect_Initialize(effect); + effect->obj.status = 2; + effect->obj.id = OBJ_EFFECT_395; + + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + + effect->scale2 = scale2; + effect->timer_50 = 80; + effect->unk_4E = 2; + Object_SetInfo(&effect->info, effect->obj.id); + break; + } + } + if (i == ARRAY_COUNT(gEffects)) { + i = 0; + } + return i; +} + +void func_80081BEC(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 arg4) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8008165C(&gEffects[i], posX, posY, posZ, scale2, arg4); + break; + } + } +} + +f32 D_800D18E8 = 0.0f; +f32 D_800D18EC = 0.0f; + +void func_80081C5C(Effect* effect) { + f32 sp84; + f32 posXDiff; + f32 posYDiff; + f32 posZDiff; + f32 xRotDeg; + f32 yRotDeg; + f32 posYOut; + s32 unusedOut; + Vec3f velocity; + Vec3f velocityDest; + + velocity.x = effect->vel.x; + velocity.y = effect->vel.y; + velocity.z = effect->vel.z; + + //! FAKE: Probably some debug stuff printing different messages depending on what unk_4E is. + if (effect->unk_4E != 0 && effect->unk_4E != 6 && effect->unk_4E != 7 && effect->unk_4E != 11) { + if (gCurrentLevel) {} + PRINTF("ZO_MOVE HELP %d\n"); + } + if (effect->unk_4E != 1 && effect->unk_4E != 2 && effect->unk_4E != 4 && effect->unk_4E != 5 && + effect->unk_4E != 8 && effect->unk_4E != 9) { + if (gCurrentLevel) {} + PRINTF("AC_MOVE HELP %d\n"); + } + + switch (effect->unk_4E) { + case 0: + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + break; + } + if (!(gFrameCount & 1)) { + func_8007C484(((Rand_ZeroOne() - 0.5f) * 50.0f) + effect->obj.pos.x, + ((Rand_ZeroOne() - 0.5f) * 50.0f) + effect->obj.pos.y, + ((Rand_ZeroOne() - 0.5f) * 50.0f) + effect->obj.pos.z, effect->vel.x, effect->vel.y, + effect->vel.z, (Rand_ZeroOne() * 0.05f) + 0.05f, 0); + } + if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { + func_8007B344(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 3.0f, 7); + Object_Kill(&effect->obj, &effect->sfxPos); + } + sp84 = 50.0f; + break; + case 1: + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + break; + } + effect->unk_60.z += 10.0f; + effect->vel.z = 5.0f; + if (!(gFrameCount & 7)) { + effect->unk_44 += 1; + effect->unk_44 &= 1; + } + if (effect->unk_44 == 0) { + Math_SmoothStepToF(&effect->scale2, 0.2f, 0.01f, 0.02f, 0.0f); + } else { + Math_SmoothStepToF(&effect->scale2, 0.5f, 0.01f, 0.02f, 0.0f); + } + if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 1.0f); + } + break; + case 2: + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + break; + } + switch (effect->unk_44) { + case 1: + case 2: + break; + case 0: + Math_SmoothStepToF(&effect->scale2, 1.0f, 0.1f, 5.0f, 0.0001f); + if (effect->scale2 >= 1.0f) { + effect->unk_44 += 1; + } + break; + case 3: + Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 10.0f, 0.0001f); + if (effect->scale2 < 0.3f) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + } + + if (!(gFrameCount & 3)) { + func_8007C120((((Rand_ZeroOne() - 0.5f) * effect->scale2) * 50.0f) + effect->obj.pos.x, + (((Rand_ZeroOne() - 0.5f) * effect->scale2) * 50.0f) + effect->obj.pos.y, + (((Rand_ZeroOne() - 0.5f) * effect->scale2) * 50.0f) + effect->obj.pos.z, effect->vel.x, + effect->vel.y, effect->vel.z, (Rand_ZeroOne() * 0.03f) + 0.05f, 10); + } + if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { + func_8007B344(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 3.0f, 7); + Object_Kill(&effect->obj, &effect->sfxPos); + } + sp84 = 50.0f; + break; + case 3: + effect->info.unk_19 = 2; + if (effect->unk_44 != 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 5.0f); + } else if (fabsf(gPlayer->unk_138 - effect->obj.pos.z) < 1000.0f) { + func_8006F0D8(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 15.0f); + Object_Kill(&effect->obj, &effect->sfxPos); + } + sp84 = 50.0f; + break; + case 4: + effect->scale2 += 0.07f; + effect->unk_4A -= effect->unk_46; + effect->obj.rot.z += 3.0f; + effect->vel.y += 0.2f; + if (effect->unk_4A < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 5: + func_80081A8C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 5.0f, 6); + effect->unk_4A -= effect->unk_46; + effect->obj.rot.x += effect->unk_44; + effect->obj.rot.y += effect->unk_44; + effect->obj.rot.z += effect->unk_44; + effect->vel.y -= 2.0f; + if ((effect->unk_4A < 0) || (effect->timer_50 == 0)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 6: + effect->unk_4A -= effect->unk_46; + Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 1.0f, 0.00001f); + if ((effect->unk_4A < 0) || (effect->timer_50 == 0)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 7: + switch (gCurrentLevel) { + case LEVEL_AQUAS: + if (!(gFrameCount & 3)) { + func_80081A8C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, effect->scale2, 6); + } + effect->obj.rot.x += effect->unk_60.x; + effect->obj.rot.y += effect->unk_60.y; + effect->obj.rot.z += effect->unk_60.z; + effect->vel.y -= 0.5f; + if ((effect->timer_50 == 0) || (effect->obj.pos.y < D_80177940)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + + case LEVEL_ZONESS: + if (!(gFrameCount & 3)) { + func_80081A8C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, effect->scale2 * 3.0f, + 6); + } + effect->obj.rot.x += effect->unk_60.x; + effect->obj.rot.y += effect->unk_60.y; + effect->obj.rot.z += effect->unk_60.z; + effect->vel.y -= 1.0f; + if ((func_800A73E4(&posYOut, &unusedOut, effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z) != + 0) || + (effect->timer_50 == 0)) { + func_8007B228(effect->obj.pos.x, posYOut, effect->obj.pos.z, effect->scale2); + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + } + break; + case 8: + Math_SmoothStepToF(D_801779A8, 30.0f, 1.0f, 5.0f, 0.0f); + Matrix_RotateY(gCalcMatrix, gBosses->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, gBosses->obj.rot.x * M_DTOR, 1); + velocity.y = 0.0f; + velocity.x = 0; + velocity.z = 250.0f; + if (effect->unk_44 > 0) { + velocity.z = 2000.0f; + } + Matrix_MultVec3fNoTranslate(gCalcMatrix, &velocity, &velocityDest); + effect->obj.pos.x = gBosses[0].obj.pos.x + velocityDest.x; + effect->obj.pos.y = gBosses[0].obj.pos.y + velocityDest.y; + effect->obj.pos.z = gBosses[0].obj.pos.z + velocityDest.z; + switch (effect->unk_44) { + case 0: + func_80081BEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 1.0f, 9); + Math_SmoothStepToF(&effect->scale2, 6.0f, 0.01f, 0.05f, 0.00001f); + if (effect->scale2 >= 5.0f) { + gEffects[ARRAY_COUNT(gEffects) - 1].obj.status = + (gEffects[ARRAY_COUNT(gEffects) - 2].obj.status = 0); + func_80081BEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 1.0f, 10); + D_80178348 = (D_80178350 = (D_80178354 = 0xFF)); + D_80178340 = (D_80178358 = 0xFF); + D_80178358 = 0; + D_8017835C = 25; + effect->timer_50 = 10; + D_800D18EC = 0.0f; + D_800D18E8 = 0.0f; + gBosses[0].timer_050 = 150; + gBosses[0].unk_04E = 6; + effect->unk_44++; + } + break; + + case 1: + Math_SmoothStepToF(&effect->scale2, 8.0f, 0.1f, 1.0f, 0.00001f); + if (effect->timer_50 == 0) { + if (D_80178340 != 0) { + D_80178348 = (D_80178350 = (D_80178354 = (D_80178340 = 0))); + } + effect->timer_50 = gBosses->timer_050; + effect->unk_44++; + } + break; + + case 2: + if (effect->timer_50 == 0) { + Math_SmoothStepToF(&effect->scale2, 0.0f, 1.0f, 10.0f, 0.00001f); + if (effect->scale2 == 0.0f) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + } else { + Math_SmoothStepToF(&effect->scale2, 8.0f, 0.1f, 1.0f, 0.00001f); + } + break; + } + break; + case 9: + posXDiff = gBosses[0].obj.pos.x - effect->obj.pos.x; + posYDiff = gBosses[0].obj.pos.y - effect->obj.pos.y; + posZDiff = gBosses[0].obj.pos.z - effect->obj.pos.z; + yRotDeg = Math_RadToDeg(Math_Atan2F(posXDiff, posZDiff)); + xRotDeg = Math_RadToDeg(-Math_Atan2F(posYDiff, sqrtf((posXDiff * posXDiff) + (posZDiff * posZDiff)))); + Matrix_RotateY(gCalcMatrix, M_DTOR * yRotDeg, 0); + Matrix_RotateX(gCalcMatrix, M_DTOR * xRotDeg, 1); + velocity.x = velocity.y = 0.0f; + velocity.z = 20.0f; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &velocity, &velocityDest); + effect->vel.x = velocityDest.x; + effect->vel.y = velocityDest.y; + effect->vel.z = -50.0f; + effect->unk_44++; + Math_SmoothStepToF(&effect->scale1, 255.0f, 1.0f, 20.0f, 0.0f); + Math_SmoothStepToF(&effect->vel.z, -70.0f, 0.01f, 0.1f, 0.0f); + Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 0.5f, 0.00001f); + if (effect->scale2 == 0.0f) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 10: + switch (effect->unk_44) { + case 0: + D_801779A8[0] = 50.0f; + if (effect->unk_46 == 10) { + D_80178348 = D_80178350 = D_80178354 = 0xFF; + D_80178340 = D_80178358 = 0xFF; + D_80178358 = 0; + D_8017835C = 25; + D_80178480 = 50; + } + if (effect->unk_46 == 0) { + D_80178348 = (D_80178350 = (D_80178354 = (D_80178340 = 0))); + effect->unk_46 = 50; + } + if (effect->unk_46 != 0) { + effect->unk_46 -= 1; + } + if ((!(gFrameCount & 0xF)) && (effect->timer_50 == 0)) { + D_800D18EC = (Math_Atan2F(gPlayer->camEye.x - gBosses->obj.pos.x, + gPlayer->camEye.z - (gBosses->obj.pos.z + D_80177D20)) * + 180.0f) / + M_PI; + D_800D18E8 = ((-Math_Atan2F(gPlayer->camEye.y - gBosses->obj.pos.y, + sqrtf(((gPlayer->camEye.x - gBosses->obj.pos.x) * + (gPlayer->camEye.x - gBosses->obj.pos.x)) + + ((gPlayer->camEye.z - (gBosses->obj.pos.z + D_80177D20)) * + (gPlayer->camEye.z - (gBosses->obj.pos.z + D_80177D20)))))) * + 180.0f) / + M_PI; + } + if (gBosses->timer_050 == 0) { + gBosses->swork[39] = effect->index; + effect->unk_44 = 1; + } + break; + case 1: + Math_SmoothStepToF(D_801779A8, 20.0f, 1.0f, 5.0f, 0.0f); + break; + } + + effect->info.unk_14 = 0; + Math_SmoothStepToAngle(&gBosses->obj.rot.x, D_800D18E8, 0.1f, 1.0f, 0.00001f); + Math_SmoothStepToAngle(&gBosses->obj.rot.y, D_800D18EC, 0.1f, 1.0f, 0.00001f); + effect->obj.rot.x = gBosses->obj.rot.x; + effect->obj.rot.y = gBosses->obj.rot.y; + effect->obj.rot.z += 30.0f; + Matrix_RotateY(gCalcMatrix, gBosses->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, gBosses->obj.rot.x * M_DTOR, 1); + velocity.x = velocity.y = 0.0f; + velocity.z = 250.0f; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &velocity, &velocityDest); + effect->obj.pos.x = gBosses->obj.pos.x + velocityDest.x; + effect->obj.pos.y = gBosses->obj.pos.y + velocityDest.y; + effect->obj.pos.z = gBosses->obj.pos.z + velocityDest.z; + if (effect->unk_44 == 0) { + Math_SmoothStepToF(&effect->unk_60.x, 5.0f, 0.1f, 1.0f, 0.00001f); + Math_SmoothStepToF(&effect->unk_60.y, 5.0f, 0.1f, 1.0f, 0.00001f); + Math_SmoothStepToF(&effect->unk_60.z, 50.0f, 1.0f, 2.0f, 0.00001f); + } + velocity.x = velocity.y = 0.0f; + velocity.z = fabsf(gPlayer->unk_138 - effect->obj.pos.z); + Matrix_MultVec3fNoTranslate(gCalcMatrix, &velocity, &velocityDest); + if ((((effect->timer_50 == 0) && + (fabsf(gPlayer->pos.x - (effect->obj.pos.x + velocityDest.x)) <= (effect->unk_60.x * 50.0f))) && + (fabsf(gPlayer->pos.y - (effect->obj.pos.y + velocityDest.y)) <= (effect->unk_60.y * 50.0f))) && + (gPlayer->timer_498 == 0)) { + Player_ApplyDamage(gPlayer, 0, 40); + } + break; + case 11: + effect->obj.rot.z += 20.0f; + effect->vel.y -= 2.0f; + if (effect->vel.y < (-20.0f)) { + effect->vel.y = -20.0f; + } + Math_SmoothStepToF(&effect->scale1, 0.0f, 0.1f, 100.0f, 0.00001f); + if ((effect->scale1 < 1.0f) || (effect->timer_50 == 0)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + case 12: + func_8007A28C(effect); + break; + } + + if ((effect->unk_4E == 2) && (effect->unk_44 == 2)) { + func_8007FE88(effect); + } + if ((effect->unk_4E < 4) && (effect->unk_4E != 1)) { + func_8007A774(gPlayer, effect, sp84); + } +} + +void func_80082F78(Effect* effect) { + //! FAKE: Probably some debug stuff printing different messages depending on what unk_4E is. + if (effect->unk_4E != 0 && effect->unk_4E != 6) { + if (effect->unk_4A && effect->unk_4A) {} + PRINTF("ZO_DISP HELP %d\n"); + } + if (effect->unk_4E != 1 && effect->unk_4E != 2 && effect->unk_4E != 4 && effect->unk_4E != 5 && + effect->unk_4E != 7) { + if (effect->unk_4A && !effect->scale2) {} + PRINTF("AC_DISP HELP %d\n"); + } + + switch (effect->unk_4E) { + case 0: + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, 0.7f, 0.7f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 32, 32, 255, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 1: + RCP_SetupDL(&gMasterDisp, 0x29); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_101C2E0); + break; + case 2: + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 32, 32, 255, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 3: + RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + gSPDisplayList(gMasterDisp++, D_601A120); + break; + case 4: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, effect->unk_4A); + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, 0); + gSPDisplayList(gMasterDisp++, D_1023750); + break; + case 5: + case 7: + Graphics_SetScaleMtx(effect->scale2); + RCP_SetupDL(&gMasterDisp, 0x3C); + if (gCurrentLevel == LEVEL_AQUAS) { + gSPDisplayList(gMasterDisp++, D_600A220); + } + if (gCurrentLevel == LEVEL_ZONESS) { + gSPDisplayList(gMasterDisp++, D_6016880); + } + break; + case 6: + Graphics_SetScaleMtx(effect->scale2); + if (gCurrentLevel == LEVEL_ZONESS) { + Graphics_SetScaleMtx(effect->scale2); + } + RCP_SetupDL(&gMasterDisp, 0x40); + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 255, 0, effect->unk_4A); + gSPDisplayList(gMasterDisp++, D_1023750); + break; + case 8: + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 255, 0, 128, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 9: + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->scale1); + gDPSetEnvColor(gMasterDisp++, 255, 255, 128, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 10: + if (D_80177854 != 100) { + Texture_Scroll(D_6012840, 16, 16, 0); + } + RCP_SetupDL(&gMasterDisp, 0x35); + Matrix_Scale(gGfxMatrix, effect->unk_60.x, effect->unk_60.y, effect->unk_60.z, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + gSPDisplayList(gMasterDisp++, D_6012550); + break; + case 11: + RCP_SetupDL(&gMasterDisp, 0x43); + gDPSetPrimColor(gMasterDisp++, 0, 0, 111, 111, 111, (s32) effect->scale1); + gDPSetEnvColor(gMasterDisp++, 255, 255, 255, 255); + Graphics_SetScaleMtx(effect->scale2); + gSPDisplayList(gMasterDisp++, D_1024AC0); + break; + case 12: + func_8007A3C0(effect); + break; + } + + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_800836C0(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 arg4, f32 scale) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_391; + effect->obj.pos.x = posX; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->unk_60.x = scale * 0.8f; + effect->unk_60.y = 1.2f; + if (arg4 != 0.0f) { + effect->unk_60.y = arg4; + } + effect->unk_44 = 230; + effect->scale1 = scale; + effect->scale2 = 0.1f; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_8008377C(f32 posX, f32 posY, f32 posZ, f32 arg3, f32 scale) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_800836C0(&gEffects[i], posX, posY, posZ, arg3, scale); + break; + } + } +} + +void func_800837EC(Effect* effect) { + s32 pad[2]; + f32 var_fv1; + s32 var_s2; + s32 i; + + switch (effect->unk_4E) { + case 0: + if (effect->unk_60.y == 1.2f) { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.5f, effect->scale1, 0.01f); + } else { + Math_SmoothStepToF(&effect->scale2, effect->scale1, 1.0f, effect->scale1 * 0.1f, 0.01f); + } + if (effect->scale2 > (effect->scale1 * 0.7f)) { + Math_SmoothStepToF(&effect->unk_60.x, effect->scale2 * 1.3f, 0.1f, 0.5f, 0.0001f); + } + if (effect->scale2 == effect->scale1) { + var_s2 = effect->scale2 * 5.0f; + if (var_s2 < 5) { + var_s2 = 5; + } + if (var_s2 > 10) { + var_s2 = 10; + } + var_fv1 = effect->unk_60.y * 300.0f; + if (effect->unk_60.y == 1.2f) { + var_fv1 = effect->unk_60.y * 100.0f; + } + for (i = 0; i < var_s2; i++) { + func_80081BEC(((Rand_ZeroOne() - 0.5f) * (effect->scale2 * 200.0f)) + effect->obj.pos.x, + ((Rand_ZeroOne() - 0.5f) * (effect->scale2 * 100.0f)) + (effect->obj.pos.y + var_fv1), + ((Rand_ZeroOne() - 0.5f) * (effect->scale2 * 200.0f)) + effect->obj.pos.z, + 0.3f - ((Rand_ZeroOne() - 0.5f) * 0.2f), 0xB); + } + effect->unk_4E += 1; + } + break; + case 1: + effect->vel.y -= 4.0f; + Math_SmoothStepToF(&effect->scale2, 0.0f, 0.01f, 0.1f, 0.0001f); + Math_SmoothStepToF(&effect->unk_60.x, effect->scale2 * 1.3f, 0.1f, 0.5f, 0.0001f); + effect->unk_44 -= 35; + if (effect->unk_44 < 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + } + break; + } + effect->obj.rot.y = + (Math_Atan2F(gPlayer->camEye.x - effect->obj.pos.x, gPlayer->camEye.z - (effect->obj.pos.z + D_80177D20)) * + 180.0f) / + M_PI; +} + +void func_80083B8C(Effect* effect) { + RCP_SetupDL_49(); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_44); + gDPSetEnvColor(gMasterDisp++, 36, 45, 28, 255); + Matrix_Scale(gGfxMatrix, effect->unk_60.x, effect->scale2 * effect->unk_60.y, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_601BAD0); + RCP_SetupDL(&gMasterDisp, 0x40); +} + +void func_80083C70(Effect* effect, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, f32 arg7, s32 arg8) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = 0x18F; + effect->obj.pos.x = posX; + effect->unk_60.x = posX; + effect->unk_60.y = posY; + effect->obj.pos.y = posY; + effect->obj.pos.z = posZ; + effect->vel.x = velX; + effect->vel.y = velY; + effect->vel.z = velZ; + effect->unk_60.z = arg7; + effect->scale2 = 1.6f; + effect->scale1 = 0.0f; + effect->timer_50 = 100; + effect->unk_44 = arg8; + Object_SetInfo(&effect->info, effect->obj.id); +} + +void func_80083D2C(f32 posX, f32 posY, f32 posZ, f32 srcZ) { + s32 i; + s32 j; + s32 pad1; + f32 x; + f32 y; + f32 z; + f32 rotX; + f32 rotY; + f32 xSway; + s32 pad2; + Vec3f src; + Vec3f dest; + + if (gCurrentLevel != LEVEL_AQUAS) { + xSway = 175.0f; + if (Rand_ZeroOne() < 0.5f) { + xSway = -175.0f; + } + } else { + xSway = 350.0f; + if (Rand_ZeroOne() < 0.5f) { + xSway = -350.0f; + } + } + x = gPlayer->pos.x + xSway - posX; + y = gPlayer->pos.y - posY; + z = gPlayer->unk_138 - posZ; + rotY = Math_Atan2F(x, z); + rotX = -Math_Atan2F(y, sqrtf(SQ(x) + SQ(z))); + Matrix_RotateY(gCalcMatrix, rotY, 0); + Matrix_RotateX(gCalcMatrix, rotX, 1); + src.x = src.y = 0.0f; + src.z = srcZ; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); + dest.z -= D_80177D08; + for (i = 0; i < 6; i++) { + for (j = 0; j < ARRAY_COUNT(gEffects); j++) { + if (gEffects[j].obj.status == 0) { + func_80083C70(&gEffects[j], posX, posY, posZ, dest.x, dest.y, dest.z, i * 60.0f, i); + if (i == 0) { + Audio_PlaySfx(0x3103109B, &gEffects[j].sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + break; + } + } + } +} + +// RGB Values. Used like an array of [8][3], but only matches this way. +s32 D_800D18F0[24] = { 32, 32, 255, 0, 255, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 255, 0, 255, 0 }; + +// Alpha values +s32 D_800D1950[] = { 255, 210, 180, 120, 70, 30, 0, 0 }; + +void func_80083FA8(Effect* effect) { + Vec3f src; + Vec3f dest; + + if (effect->timer_50 == 0) { + Object_Kill(&effect->obj, &effect->sfxPos); + return; + } + effect->obj.rot.y = (-gPlayer->unk_058 * 180.0f) / M_PI; + effect->obj.rot.x = (gPlayer->unk_05C * 180.0f) / M_PI; + effect->obj.rot.z += 20.0f; + Matrix_RotateZ(gCalcMatrix, effect->unk_60.z * M_DTOR, 0); + Matrix_RotateZ(gCalcMatrix, effect->unk_46 * M_DTOR, 1); + src.x = 0.0f; + src.y = effect->scale1; + src.z = 0.0f; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); + effect->unk_60.x += effect->vel.x; + effect->unk_60.y += effect->vel.y; + effect->obj.pos.x = effect->unk_60.x + dest.x; + effect->obj.pos.y = effect->unk_60.y + dest.y; + effect->unk_48 += 2; + if (effect->unk_48 > 20) { + effect->unk_48 = 20; + } + effect->unk_46 += effect->unk_48; + Math_SmoothStepToF(&effect->scale1, 350.0f, 1.0f, 20.0f, 0.00001f); + if ((effect->scale1 >= 349.0f) && (effect->timer_50 > 50)) { + effect->timer_50 = 50; + } + func_8007A774(gPlayer, effect, 100.0f); +} + +void func_80084194(Effect* effect) { + s32 tmp; + + if (gCurrentLevel != LEVEL_AQUAS) { + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + tmp = effect->unk_44 * 4; + gDPSetEnvColor(gMasterDisp++, D_800D18F0[tmp + 0], D_800D18F0[tmp + 1], D_800D18F0[tmp + 2], 255); + } else { + RCP_SetupDL(&gMasterDisp, 0x31); + Matrix_Scale(gGfxMatrix, effect->scale2, effect->scale2, effect->scale2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_800D1950[effect->unk_44]); + gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); + } + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x40); +} diff --git a/src/main/fox_enmy.c b/src/main/fox_enmy.c index 027f510e..027bb5f7 100644 --- a/src/main/fox_enmy.c +++ b/src/main/fox_enmy.c @@ -167,14 +167,14 @@ void Item_Initialize(Item* item) { } } -void Object_8C_Initialize(Object_8C* obj8C) { +void Effect_Initialize(Effect* effect) { s32 i; - u8* ptr = (u8*) obj8C; + u8* ptr = (u8*) effect; - for (i = 0; i < sizeof(Object_8C); i++, ptr++) { + for (i = 0; i < sizeof(Effect); i++, ptr++) { *ptr = 0; } - obj8C->scale2 = 1.0f; + effect->scale2 = 1.0f; } void Object_80_Load(Object_80* obj80, ObjectInit* objInit) { @@ -248,24 +248,24 @@ void Item_Load(Item* item, ObjectInit* objInit) { Object_SetInfo(&item->info, item->obj.id); } -void func_80061958(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_346; - obj8C->timer_50 = 50; - obj8C->scale2 = 0.2f; +void func_80061958(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_346; + effect->timer_50 = 50; + effect->scale2 = 0.2f; if (gCurrentLevel == LEVEL_AQUAS) { - obj8C->timer_50 = 200; - obj8C->scale2 = 0.3f; - obj8C->scale1 = Rand_ZeroOne() * 255.0f; + effect->timer_50 = 200; + effect->scale2 = 0.3f; + effect->scale1 = Rand_ZeroOne() * 255.0f; } - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); if (gLevelType == LEVELTYPE_PLANET) { - obj8C->info.unk_10 = 100.0f; + effect->info.unk_10 = 100.0f; } } @@ -276,8 +276,8 @@ void func_80061A4C(void) { f32 z; f32 sp1C; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { sp1C = (Rand_ZeroOne() - 0.5f); x = gPlayer[0].pos.x + (sp1C * 400.0f) + (5.0f * gPlayer[0].vel.x); sp1C = (Rand_ZeroOne() - 0.5f); @@ -286,7 +286,7 @@ void func_80061A4C(void) { if (D_80177D08 < 0.0f) { z = -D_80177D20 + 500.0f; } - func_80061958(&gObjects8C[i], x, y, z); + func_80061958(&gEffects[i], x, y, z); break; } } @@ -299,8 +299,8 @@ void func_80061B68(void) { f32 z; f32 sp1C; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { sp1C = (Rand_ZeroOne() - 0.5f); x = gPlayer[0].pos.x + (sp1C * 2000.0f) + (5.0f * gPlayer[0].vel.x); @@ -313,7 +313,7 @@ void func_80061B68(void) { if (D_80177D08 < 0.0f) { z = -D_80177D20 + 1000.0f; } - func_80061958(&gObjects8C[i], x, y, z); + func_80061958(&gEffects[i], x, y, z); break; } } @@ -326,8 +326,8 @@ void func_80061CD0(void) { f32 z; f32 sp1C; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { sp1C = (Rand_ZeroOne() - 0.5f); x = gPlayer[gPlayerNum].pos.x + (sp1C * 3000.0f) + (5.0f * gPlayer[gPlayerNum].vel.x); sp1C = (Rand_ZeroOne() - 0.5f); @@ -336,7 +336,7 @@ void func_80061CD0(void) { if (D_80177D08 < 0.0f) { z = -D_80177D20 + 1000.0f; } - func_80061958(&gObjects8C[i], x, y, z); + func_80061958(&gEffects[i], x, y, z); break; } } @@ -448,7 +448,7 @@ void Object_Load(ObjectInit* objInit, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { } } } - if ((objInit->id >= OBJ_ITEM_LASERS) && (objInit->id < OBJ_8C_339)) { + if ((objInit->id >= OBJ_ITEM_LASERS) && (objInit->id < OBJ_EFFECT_339)) { for (i = 0; i < ARRAY_COUNT(gItems); i++) { if (gItems[i].obj.status == 0) { Item_Load(&gItems[i], objInit); @@ -456,7 +456,7 @@ void Object_Load(ObjectInit* objInit, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { } } } - if (objInit->id >= OBJ_8C_339 && objInit->id <= OBJ_UNK_406) { + if (objInit->id >= OBJ_EFFECT_339 && objInit->id <= OBJ_UNK_406) { switch (objInit->id) { case OBJ_UNK_403: D_E6A810_801BA1E8 = 99; @@ -578,19 +578,19 @@ void func_80062B60(f32 xPos, f32 zPos, s32 arg2, f32 arg3) { s32 i; if (gLevelType == LEVELTYPE_PLANET) { - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - Object_8C_Initialize(&gObjects8C[i]); - gObjects8C[i].obj.status = 1; - gObjects8C[i].obj.id = OBJ_8C_348; - gObjects8C[i].obj.pos.x = xPos; - gObjects8C[i].obj.pos.y = D_80177940 + 3.0f; - gObjects8C[i].obj.pos.z = zPos; - gObjects8C[i].scale2 = 10.0f; - gObjects8C[i].scale1 = arg3; - gObjects8C[i].unk_44 = 80; - gObjects8C[i].unk_4E = arg2; - Object_SetInfo(&gObjects8C[i].info, gObjects8C[i].obj.id); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + Effect_Initialize(&gEffects[i]); + gEffects[i].obj.status = 1; + gEffects[i].obj.id = OBJ_EFFECT_348; + gEffects[i].obj.pos.x = xPos; + gEffects[i].obj.pos.y = D_80177940 + 3.0f; + gEffects[i].obj.pos.z = zPos; + gEffects[i].scale2 = 10.0f; + gEffects[i].scale1 = arg3; + gEffects[i].unk_44 = 80; + gEffects[i].unk_4E = arg2; + Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id); break; } } @@ -601,18 +601,18 @@ void func_80062C38(f32 xPos, f32 yPos) { s32 i; if (gLevelType == LEVELTYPE_PLANET) { - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - Object_8C_Initialize(&gObjects8C[i]); - gObjects8C[i].obj.status = 1; - gObjects8C[i].obj.id = OBJ_8C_349; - gObjects8C[i].obj.pos.x = xPos; - gObjects8C[i].obj.pos.y = D_80177940 + 3.0f; - gObjects8C[i].obj.pos.z = yPos; - gObjects8C[i].scale2 = 1.0f; - gObjects8C[i].scale1 = 1.3f; - gObjects8C[i].unk_44 = 120; - Object_SetInfo(&gObjects8C[i].info, gObjects8C[i].obj.id); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + Effect_Initialize(&gEffects[i]); + gEffects[i].obj.status = 1; + gEffects[i].obj.id = OBJ_EFFECT_349; + gEffects[i].obj.pos.x = xPos; + gEffects[i].obj.pos.y = D_80177940 + 3.0f; + gEffects[i].obj.pos.z = yPos; + gEffects[i].scale2 = 1.0f; + gEffects[i].scale1 = 1.3f; + gEffects[i].unk_44 = 120; + Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id); break; } } @@ -622,18 +622,18 @@ void func_80062C38(f32 xPos, f32 yPos) { void func_80062D04(f32 xPos, f32 yPos) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - Object_8C_Initialize(&gObjects8C[i]); - gObjects8C[i].obj.status = 1; - gObjects8C[i].obj.id = OBJ_8C_350; - gObjects8C[i].obj.pos.x = xPos; - gObjects8C[i].obj.pos.y = D_80177940 + 3.0f; - gObjects8C[i].obj.pos.z = yPos; - gObjects8C[i].scale2 = 3.0f; - gObjects8C[i].scale1 = 2.0f; - gObjects8C[i].unk_44 = 120; - Object_SetInfo(&gObjects8C[i].info, gObjects8C[i].obj.id); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + Effect_Initialize(&gEffects[i]); + gEffects[i].obj.status = 1; + gEffects[i].obj.id = OBJ_EFFECT_350; + gEffects[i].obj.pos.x = xPos; + gEffects[i].obj.pos.y = D_80177940 + 3.0f; + gEffects[i].obj.pos.z = yPos; + gEffects[i].scale2 = 3.0f; + gEffects[i].scale1 = 2.0f; + gEffects[i].unk_44 = 120; + Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id); break; } } @@ -1016,15 +1016,15 @@ void Object_Init(s32 index, ObjectId objId) { case OBJ_2F4_247: func_E16C50_8019D060(&gObjects2F4[index]); break; - case OBJ_8C_368: + case OBJ_EFFECT_368: if (gCurrentLevel == LEVEL_TITANIA) { - func_E6A810_801B6E20(gObjects8C[index].obj.pos.x, gObjects8C[index].obj.pos.z + D_80177D20, &sp54, - &sp4C, &sp50); - gObjects8C[index].obj.pos.y = sp4C + 3.0f; - gObjects8C[index].obj.rot.x = (sp54 * 180.0f) / M_PI; - gObjects8C[index].obj.rot.z = (sp50 * 180.0f) / M_PI; + func_E6A810_801B6E20(gEffects[index].obj.pos.x, gEffects[index].obj.pos.z + D_80177D20, &sp54, &sp4C, + &sp50); + gEffects[index].obj.pos.y = sp4C + 3.0f; + gEffects[index].obj.rot.x = (sp54 * 180.0f) / M_PI; + gEffects[index].obj.rot.z = (sp50 * 180.0f) / M_PI; } else if (gCurrentLevel == LEVEL_MACBETH) { - gObjects8C[index].obj.status = 0; + gEffects[index].obj.status = 0; } break; case OBJ_80_30: @@ -2573,16 +2573,16 @@ void func_80069858(Object_4C* obj4C) { } } -void func_80069924(Object_8C* obj8C) { - obj8C->obj.pos.x += obj8C->vel.x; - obj8C->obj.pos.y += obj8C->vel.y; - obj8C->obj.pos.z += obj8C->vel.z; +void func_80069924(Effect* effect) { + effect->obj.pos.x += effect->vel.x; + effect->obj.pos.y += effect->vel.y; + effect->obj.pos.z += effect->vel.z; if (D_80161AB8 != 0) { - if ((gPlayer[0].camEye.z + obj8C->info.unk_10) < (obj8C->obj.pos.z + D_80177D20)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } else if ((fabsf(obj8C->obj.pos.y - gPlayer[0].camEye.y) > 25000.0f) || - (fabsf(obj8C->obj.pos.x - gPlayer[0].camEye.x) > 25000.0f)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + if ((gPlayer[0].camEye.z + effect->info.unk_10) < (effect->obj.pos.z + D_80177D20)) { + Object_Kill(&effect->obj, &effect->sfxPos); + } else if ((fabsf(effect->obj.pos.y - gPlayer[0].camEye.y) > 25000.0f) || + (fabsf(effect->obj.pos.x - gPlayer[0].camEye.x) > 25000.0f)) { + Object_Kill(&effect->obj, &effect->sfxPos); } } } @@ -2763,19 +2763,19 @@ void Item_Update(Item* item) { } } -void Object_8C_Update(Object_8C* obj8C) { - if (obj8C->timer_50 != 0) { - obj8C->timer_50--; +void Effect_Update(Effect* effect) { + if (effect->timer_50 != 0) { + effect->timer_50--; } - switch (obj8C->obj.status) { + switch (effect->obj.status) { case 1: - obj8C->obj.status = 2; - Object_Init(obj8C->index, obj8C->obj.id); + effect->obj.status = 2; + Object_Init(effect->index, effect->obj.id); /* fallthrough */ case 2: - func_80069924(obj8C); - if ((obj8C->obj.status != 0) && (obj8C->info.action != NULL)) { - obj8C->info.action(&obj8C->obj); + func_80069924(effect); + if ((effect->obj.status != 0) && (effect->info.action != NULL)) { + effect->info.action(&effect->obj); } break; } @@ -2852,7 +2852,7 @@ void Object_UpdateAll(void) { Object_4C* obj4C; Object_80* obj80; Item* item; - Object_8C* obj8C; + Effect* effect; D_80161AB8 = 0; if ((gLevelMode == LEVELMODE_ON_RAILS) && @@ -2906,10 +2906,10 @@ void Object_UpdateAll(void) { Item_Update(item); } } - for (i = 0, obj8C = gObjects8C; i < ARRAY_COUNT(gObjects8C); i++, obj8C++) { - if (obj8C->obj.status != 0) { - obj8C->index = i; - Object_8C_Update(obj8C); + for (i = 0, effect = gEffects; i < ARRAY_COUNT(gEffects); i++, effect++) { + if (effect->obj.status != 0) { + effect->index = i; + Effect_Update(effect); } } func_8006A38C(); diff --git a/src/main/fox_enmy2.c b/src/main/fox_enmy2.c index 9e57bdcd..ca9d2d20 100644 --- a/src/main/fox_enmy2.c +++ b/src/main/fox_enmy2.c @@ -4,7 +4,6 @@ s32 D_800CFF80[4] = { 0, 0, 0, 0 }; s32 D_800CFF90 = 0; s32 D_80161690; -void func_8007F11C(s32, f32, f32, f32, f32); void func_80187530(Object_2F4*); // figure out which one later void func_8006A7B0(u16* msg, s32 character) { @@ -14,38 +13,38 @@ void func_8006A7B0(u16* msg, s32 character) { } } -void func_8006A800(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { - Object_8C_Initialize(obj8C); +void func_8006A800(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { + Effect_Initialize(effect); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_361; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->unk_48 = 3; + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_361; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->unk_48 = 3; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; + effect->unk_48 = -effect->unk_48; } - obj8C->unk_4A = 100; - obj8C->scale2 = arg4 * 0.25f; - obj8C->scale1 = 0.3f; + effect->unk_4A = 100; + effect->scale2 = arg4 * 0.25f; + effect->scale1 = 0.3f; if (arg4 < 10.0f) { - obj8C->scale1 = 0.1f; + effect->scale1 = 0.1f; } - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_8006A900(f32 xPos, f32 yPos, f32 zPos, f32 arg3) { s32 i; - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8006A800(&gObjects8C[i], xPos, yPos, zPos, arg3); + for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { + if (gEffects[i].obj.status == 0) { + func_8006A800(&gEffects[i], xPos, yPos, zPos, arg3); break; } } @@ -57,29 +56,29 @@ void func_8006A96C(Object_2F4* obj2F4) { void func_8006A978(Object_2F4* obj2F4) { } -void func_8006A984(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_365; +void func_8006A984(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_365; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; - obj8C->unk_44 = 40; - obj8C->scale2 = 5.0f; - obj8C->scale1 = 2.0f * (Rand_ZeroOne() - 0.5f); - obj8C->vel.y = 10.0f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->unk_44 = 40; + effect->scale2 = 5.0f; + effect->scale1 = 2.0f * (Rand_ZeroOne() - 0.5f); + effect->vel.y = 10.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_8006AA3C(f32 xPos, f32 yPos, f32 zPos) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8006A984(&gObjects8C[i], xPos, yPos, zPos); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8006A984(&gEffects[i], xPos, yPos, zPos); break; } } @@ -114,7 +113,7 @@ void func_8006AC08(Object_2F4* obj2F4) { f32 sp2C; if (func_8006ABA4(obj2F4) && (obj2F4->timer_0BC == 0)) { - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); obj2F4->timer_0BC = 20; } sp2C = obj2F4->obj.pos.z + D_80177D20; @@ -141,7 +140,7 @@ void func_8006AD18(Object_2F4* obj2F4) { } if (!(gFrameCount & 0x1F)) { - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y + 180.0f, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y + 180.0f, obj2F4->obj.pos.z, D_80177828); } switch (obj2F4->unk_0B8) { @@ -349,28 +348,28 @@ void func_8006B95C(Object_80* obj80) { } } -void func_8006BA64(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_375; +void func_8006BA64(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_375; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; - obj8C->scale2 = 0.0f; - obj8C->scale1 = 0.12f; - obj8C->obj.rot.y = Rand_ZeroOne() * 360.0f; - obj8C->unk_60.y = (Rand_ZeroOne() - 0.5f) * 3.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->scale2 = 0.0f; + effect->scale1 = 0.12f; + effect->obj.rot.y = Rand_ZeroOne() * 360.0f; + effect->unk_60.y = (Rand_ZeroOne() - 0.5f) * 3.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_8006BB1C(f32 xPos, f32 yPos, f32 zPos) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8006BA64(&gObjects8C[i], xPos, yPos, zPos); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8006BA64(&gEffects[i], xPos, yPos, zPos); break; } } @@ -427,7 +426,7 @@ void func_8006BB78(Object_2F4* obj2F4) { case 3: if (obj2F4->timer_0BC == 1) { - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); } if (obj2F4->vel.y < 12.0f) { Math_SmoothStepToF(&obj2F4->obj.rot.x, 180.0f, 0.1f, 7.0f, 0.01f); @@ -1545,26 +1544,26 @@ void func_8006EA50(Object_2F4* obj2F4) { } } -void func_8006EAC4(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_374; +void func_8006EAC4(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_374; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; - obj8C->timer_50 = 20; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - Audio_PlaySfx(0x2900201D, &obj8C->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + effect->timer_50 = 20; + Object_SetInfo(&effect->info, effect->obj.id); + Audio_PlaySfx(0x2900201D, &effect->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); } void func_8006EB64(f32 xPos, f32 yPos, f32 zPos) { s32 i; - for (i = 50; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8006EAC4(&gObjects8C[i], xPos, yPos, zPos); + for (i = 50; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8006EAC4(&gEffects[i], xPos, yPos, zPos); break; } } @@ -1663,56 +1662,56 @@ void func_8006EFA0(s32 unk0E4, f32 xPos, f32 yPos, f32 zPos, f32 arg4, f32 arg5, } } -void func_8006F044(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_347; +void func_8006F044(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_347; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; - obj8C->scale1 = arg4; - obj8C->unk_44 = 100; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - func_8007A6F0(&obj8C->obj.pos, 0x2903B009); + effect->scale1 = arg4; + effect->unk_44 = 100; + Object_SetInfo(&effect->info, effect->obj.id); + func_8007A6F0(&effect->obj.pos, 0x2903B009); } void func_8006F0D8(f32 xPos, f32 yPos, f32 zPos, f32 arg3) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8006F044(&gObjects8C[i], xPos, yPos, zPos, arg3); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8006F044(&gEffects[i], xPos, yPos, zPos, arg3); break; } } } -void func_8006F140(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_394; +void func_8006F140(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_394; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; - obj8C->scale1 = arg4; - obj8C->unk_44 = 100; - obj8C->unk_78 = 102; - obj8C->unk_7A = 18; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - obj8C->info.damage = 40; - func_8007A6F0(&obj8C->obj.pos, 0x2903B009); + effect->scale1 = arg4; + effect->unk_44 = 100; + effect->unk_78 = 102; + effect->unk_7A = 18; + Object_SetInfo(&effect->info, effect->obj.id); + effect->info.damage = 40; + func_8007A6F0(&effect->obj.pos, 0x2903B009); } void func_8006F1EC(f32 xPos, f32 yPos, f32 zPos, f32 arg3) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8006F140(&gObjects8C[i], xPos, yPos, zPos, arg3); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_8006F140(&gEffects[i], xPos, yPos, zPos, arg3); break; } } @@ -1733,7 +1732,7 @@ void func_8006F254(Object_2F4* obj2F4) { sp54.z = D_80177828; Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48); - func_8007F04C(OBJ_8C_353, obj2F4->obj.pos.x + sp48.x, obj2F4->obj.pos.y + sp48.y, obj2F4->obj.pos.z + sp48.z, + func_8007F04C(OBJ_EFFECT_353, obj2F4->obj.pos.x + sp48.x, obj2F4->obj.pos.y + sp48.y, obj2F4->obj.pos.z + sp48.z, obj2F4->obj.rot.x, obj2F4->obj.rot.y, obj2F4->obj.rot.z, obj2F4->unk_2E8.x, obj2F4->unk_2E8.y, obj2F4->unk_2E8.z + obj2F4->unk_0F4.z, sp48.x, sp48.y, sp48.z, 1.0f); } @@ -1758,7 +1757,7 @@ void func_8006F40C(Object_2F4* obj2F4) { case 2: if (obj2F4->obj.pos.z < (gPlayer[0].unk_138 - 600.0f)) { - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); } obj2F4->unk_048 = 0; break; @@ -1798,7 +1797,7 @@ void func_8006F40C(Object_2F4* obj2F4) { sp78.z = D_80177828; Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp78, &sp6C); - func_8007F04C(OBJ_8C_355, obj2F4->obj.pos.x + sp6C.x, obj2F4->obj.pos.y + sp6C.y, + func_8007F04C(OBJ_EFFECT_355, obj2F4->obj.pos.x + sp6C.x, obj2F4->obj.pos.y + sp6C.y, obj2F4->obj.pos.z + sp6C.z, obj2F4->obj.rot.x, obj2F4->obj.rot.y, obj2F4->obj.rot.z, obj2F4->unk_2E8.x, obj2F4->unk_2E8.y, obj2F4->unk_2E8.z + obj2F4->unk_0F4.z, sp6C.x, sp6C.y, sp6C.z, 1.0f); @@ -1807,14 +1806,14 @@ void func_8006F40C(Object_2F4* obj2F4) { case 6: if (obj2F4->obj.pos.z < (gPlayer[0].unk_138 - 600.0f)) { - func_8007F11C(OBJ_8C_355, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_355, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); } obj2F4->unk_048 = 0; break; case 7: if (obj2F4->obj.pos.z < (gPlayer[0].unk_138 - 600.0f)) { - func_8007F11C(OBJ_8C_356, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, 60.0f); + func_8007F11C(OBJ_EFFECT_356, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, 60.0f); } obj2F4->unk_048 = 0; break; @@ -1824,7 +1823,7 @@ void func_8006F40C(Object_2F4* obj2F4) { sp6C.y = gPlayer[0].pos.y; gPlayer[0].pos.x += (Rand_ZeroOne() - 0.5f) * 300.0f; gPlayer[0].pos.y += (Rand_ZeroOne() - 0.5f) * 300.0f; - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); gPlayer[0].pos.x = sp6C.x; gPlayer[0].pos.y = sp6C.y; obj2F4->unk_048 = 0; @@ -1877,16 +1876,16 @@ void func_8006F40C(Object_2F4* obj2F4) { break; case 16: - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x + 190.0f, obj2F4->obj.pos.y + 90.0f, + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x + 190.0f, obj2F4->obj.pos.y + 90.0f, obj2F4->obj.pos.z + 220.0f, D_80177828); - func_8007F11C(OBJ_8C_353, obj2F4->obj.pos.x - 190.0f, obj2F4->obj.pos.y + 90.0f, + func_8007F11C(OBJ_EFFECT_353, obj2F4->obj.pos.x - 190.0f, obj2F4->obj.pos.y + 90.0f, obj2F4->obj.pos.z + 220.0f, D_80177828); obj2F4->unk_048 = 0; break; case 17: if (obj2F4->obj.pos.z < (gPlayer[0].camEye.z - 600.0f)) { - func_8007F20C(OBJ_8C_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); + func_8007F20C(OBJ_EFFECT_353, obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, D_80177828); } obj2F4->unk_048 = 0; break; @@ -2859,36 +2858,36 @@ void func_800720E8(Object_2F4* obj2F4) { } } -void func_800722EC(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 yRot) { +void func_800722EC(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot) { Vec3f sp2C; Vec3f sp20; - Object_8C_Initialize(obj8C); + Effect_Initialize(effect); Matrix_RotateY(gCalcMatrix, M_DTOR * yRot, 0); sp2C.x = 0.0f; sp2C.y = 0.0f; sp2C.z = 20.0f; Matrix_MultVec3f(gCalcMatrix, &sp2C, &sp20); - obj8C->vel.x = sp20.x; - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_365; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->unk_44 = 250; - obj8C->scale2 = 2.0f; - obj8C->scale1 = (Rand_ZeroOne() - 0.5f) * 200.0f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - obj8C->unk_4C = obj8C->unk_4E = 1; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->vel.x = sp20.x; + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_365; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->unk_44 = 250; + effect->scale2 = 2.0f; + effect->scale1 = (Rand_ZeroOne() - 0.5f) * 200.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->unk_4C = effect->unk_4E = 1; + Object_SetInfo(&effect->info, effect->obj.id); } void func_8007240C(f32 xPos, f32 yPos, f32 zPos, f32 yRot) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_800722EC(&gObjects8C[i], xPos, yPos, zPos, yRot); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_800722EC(&gEffects[i], xPos, yPos, zPos, yRot); break; } } @@ -3088,7 +3087,7 @@ void func_80072594(Object_2F4* obj2F4) { var_fv0 = 0.0f; } - func_8007F04C(OBJ_8C_353, obj2F4->obj.pos.x + spAC.x + spA0.x, + func_8007F04C(OBJ_EFFECT_353, obj2F4->obj.pos.x + spAC.x + spA0.x, obj2F4->obj.pos.y + spAC.y + spA0.y + var_fv0, obj2F4->obj.pos.z + spAC.z + spA0.z, obj2F4->unk_150, obj2F4->obj.rot.y, obj2F4->obj.rot.z, obj2F4->unk_2E8.x, obj2F4->unk_2E8.y, @@ -3507,7 +3506,7 @@ void func_80072594(Object_2F4* obj2F4) { break; case 80: { - Object_8C* obj8C; + Effect* effect; Vec3f sp90; Vec3f sp84; Vec3f sp78; @@ -3523,30 +3522,30 @@ void func_80072594(Object_2F4* obj2F4) { if ((obj2F4->obj.pos.y + sp90.y) > -30.0f) { for (sp74 = 0; sp74 < 7; sp74++) { - obj8C = func_8007783C(OBJ_8C_394); + effect = func_8007783C(OBJ_EFFECT_394); - if (obj8C != NULL) { - obj8C->unk_78 = obj8C->unk_7A = 12; - obj8C->obj.status = 2; - obj8C->obj.pos.x = obj2F4->obj.pos.x + sp90.x; - obj8C->obj.pos.y = obj2F4->obj.pos.y + sp90.y; - obj8C->obj.pos.z = obj2F4->obj.pos.z; - obj8C->obj.rot.x = Rand_ZeroOne() * 360.0f; - obj8C->obj.rot.y = Rand_ZeroOne() * 360.0f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; + if (effect != NULL) { + effect->unk_78 = effect->unk_7A = 12; + effect->obj.status = 2; + effect->obj.pos.x = obj2F4->obj.pos.x + sp90.x; + effect->obj.pos.y = obj2F4->obj.pos.y + sp90.y; + effect->obj.pos.z = obj2F4->obj.pos.z; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + effect->obj.rot.y = Rand_ZeroOne() * 360.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; sp84.x = (Rand_ZeroOne() * 25.0f) + 30.0f; sp84.y = (Rand_ZeroOne() * 25.0f) + 20.0f; sp84.z = 0.0f; - obj8C->unk_44 = 10; - obj8C->scale2 = 1.0f; + effect->unk_44 = 10; + effect->scale2 = 1.0f; Matrix_RotateY(gCalcMatrix, ((Rand_ZeroOne() * 180.0f) + 180.0f) * M_DTOR, 0); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp84, &sp78); - obj8C->vel.x = sp78.x; - obj8C->vel.y = sp78.y; - obj8C->vel.z = sp78.z; - obj8C->unk_60.x = (Rand_ZeroOne() - 0.5f) + 5.0f; - obj8C->unk_60.y = (Rand_ZeroOne() - 0.5f) + 5.0f; - obj8C->unk_60.z = (Rand_ZeroOne() - 0.5f) + 5.0f; + effect->vel.x = sp78.x; + effect->vel.y = sp78.y; + effect->vel.z = sp78.z; + effect->unk_60.x = (Rand_ZeroOne() - 0.5f) + 5.0f; + effect->unk_60.y = (Rand_ZeroOne() - 0.5f) + 5.0f; + effect->unk_60.z = (Rand_ZeroOne() - 0.5f) + 5.0f; } } obj2F4->unk_046++; @@ -3555,58 +3554,58 @@ void func_80072594(Object_2F4* obj2F4) { } if ((fabsf(obj2F4->unk_114) > 10.0f) && !(gFrameCount & 1)) { - obj8C = func_8007783C(OBJ_8C_394); - if (obj8C != NULL) { + effect = func_8007783C(OBJ_EFFECT_394); + if (effect != NULL) { Matrix_RotateZ(gCalcMatrix, obj2F4->unk_0F4.z * M_DTOR, 0); Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_800D1290, &sp90); - obj8C->unk_78 = obj8C->unk_7A = 0xB; + effect->unk_78 = effect->unk_7A = 0xB; - obj8C->obj.status = 2; + effect->obj.status = 2; - obj8C->obj.pos.x = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.x + sp90.x; - obj8C->obj.pos.y = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.y + sp90.y; - obj8C->obj.pos.z = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.z + 180.0f; + effect->obj.pos.x = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.x + sp90.x; + effect->obj.pos.y = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.y + sp90.y; + effect->obj.pos.z = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.z + 180.0f; - obj8C->scale2 = 9.0f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; - obj8C->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f + 30.0f; - obj8C->unk_44 = 100; - obj8C->unk_46 = -8; - obj8C->unk_60.z = 3; + effect->scale2 = 9.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; + effect->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f + 30.0f; + effect->unk_44 = 100; + effect->unk_46 = -8; + effect->unk_60.z = 3; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_60.z = -obj8C->unk_60.z; + effect->unk_60.z = -effect->unk_60.z; } if (gFrameCount & 2) { - obj8C->vel.y = -obj8C->vel.y; + effect->vel.y = -effect->vel.y; } } if (!(gFrameCount & 3)) { - obj8C = func_8007783C(OBJ_8C_394); - if (obj8C != NULL) { - obj8C->unk_78 = obj8C->unk_7A = 0xB; - obj8C->obj.status = 2; - obj8C->obj.pos.x = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.x; - obj8C->obj.pos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + obj2F4->obj.pos.y + 50.0f; - obj8C->obj.pos.z = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.z + 200.0f; - obj8C->scale2 = 9.0f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; - obj8C->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f + 10.0f; - obj8C->unk_44 = 100; - obj8C->unk_46 = -8; - obj8C->unk_60.z = 3; + effect = func_8007783C(OBJ_EFFECT_394); + if (effect != NULL) { + effect->unk_78 = effect->unk_7A = 0xB; + effect->obj.status = 2; + effect->obj.pos.x = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.x; + effect->obj.pos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + obj2F4->obj.pos.y + 50.0f; + effect->obj.pos.z = ((Rand_ZeroOne() - 0.5f) * 3.0f) + obj2F4->obj.pos.z + 200.0f; + effect->scale2 = 9.0f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; + effect->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f + 10.0f; + effect->unk_44 = 100; + effect->unk_46 = -8; + effect->unk_60.z = 3; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_60.z = -obj8C->unk_60.z; + effect->unk_60.z = -effect->unk_60.z; } if (gFrameCount & 4) { - obj8C->vel.y = -obj8C->vel.y; + effect->vel.y = -effect->vel.y; } } } diff --git a/src/main/fox_play.c b/src/main/fox_play.c index 1be70e80..ad7158b8 100644 --- a/src/main/fox_play.c +++ b/src/main/fox_play.c @@ -617,9 +617,9 @@ void func_800A6148(void) { Object_Kill(&gBosses[i].obj, &gBosses[i].sfxPos); Boss_Initialize(&gBosses[i]); } - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - Object_Kill(&gObjects8C[i].obj, &gObjects8C[i].sfxPos); - Object_8C_Initialize(&gObjects8C[i]); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + Object_Kill(&gEffects[i].obj, &gEffects[i].sfxPos); + Effect_Initialize(&gEffects[i]); } for (i = 0; i < ARRAY_COUNT(gItems); i++) { Object_Kill(&gItems[i].obj, &gItems[i].sfxPos); diff --git a/src/main/sf_43E80.c b/src/main/sf_43E80.c index 5e1c5cf9..b0df5d3f 100644 --- a/src/main/sf_43E80.c +++ b/src/main/sf_43E80.c @@ -133,33 +133,33 @@ void func_80043468(Player* player) { Math_SmoothStepToF(&player->unk_014, 1.0f, 1.0f, 0.1f, 0.0f); } -void func_800438E0(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 scale) { +void func_800438E0(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale) { f32 pad[12]; - Object_8C_Initialize(obj8C); - obj8C->obj.status = 2; - obj8C->obj.id = OBJ_8C_357; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->vel.x = Rand_ZeroOne() - (2.0f * Rand_ZeroOne()); - obj8C->vel.y = ((Rand_ZeroOne() * 3.0f) - (gPlayer[0].vel.z / 5.0f)) + 3.0f; - obj8C->vel.z = ((Rand_ZeroOne() * 3.0f) - (gPlayer[0].vel.z / 5.0f)) + 2.0f; - obj8C->scale2 = ((Rand_ZeroOne() * 0.8f) + 0.3f) * scale; - obj8C->timer_50 = (s32) (Rand_ZeroOne() * 5.0f) + 8; - obj8C->obj.rot.x = Rand_ZeroOne() * 360.0f; - obj8C->unk_60.x = (Rand_ZeroOne() - 0.5f) * 30.0f; - obj8C->unk_60.y = (Rand_ZeroOne() - 0.5f) * 30.0f; - obj8C->unk_60.z = (Rand_ZeroOne() - 0.5f) * 30.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + Effect_Initialize(effect); + effect->obj.status = 2; + effect->obj.id = OBJ_EFFECT_357; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->vel.x = Rand_ZeroOne() - (2.0f * Rand_ZeroOne()); + effect->vel.y = ((Rand_ZeroOne() * 3.0f) - (gPlayer[0].vel.z / 5.0f)) + 3.0f; + effect->vel.z = ((Rand_ZeroOne() * 3.0f) - (gPlayer[0].vel.z / 5.0f)) + 2.0f; + effect->scale2 = ((Rand_ZeroOne() * 0.8f) + 0.3f) * scale; + effect->timer_50 = (s32) (Rand_ZeroOne() * 5.0f) + 8; + effect->obj.rot.x = Rand_ZeroOne() * 360.0f; + effect->unk_60.x = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.y = (Rand_ZeroOne() - 0.5f) * 30.0f; + effect->unk_60.z = (Rand_ZeroOne() - 0.5f) * 30.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_80043AA0(f32 xPos, f32 yPos, f32 zPos, f32 scale) { s32 i; for (i = 50; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_800438E0(&gObjects8C[i], xPos, yPos, zPos, scale); + if (gEffects[i].obj.status == 0) { + func_800438E0(&gEffects[i], xPos, yPos, zPos, scale); break; } } diff --git a/src/main/sf_77E40.c b/src/main/sf_77E40.c deleted file mode 100644 index 40cd3a90..00000000 --- a/src/main/sf_77E40.c +++ /dev/null @@ -1,2196 +0,0 @@ -#include "global.h" -#include "hud.h" - -void func_80077240(f32 posX, f32 posY, f32 posZ, s32 hits) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gUnkEntities1C); i++) { - if (gUnkEntities1C[i].hits == 0) { - gUnkEntities1C[i].hits = hits; - gUnkEntities1C[i].pos.x = posX; - gUnkEntities1C[i].pos.y = posY; - gUnkEntities1C[i].pos.z = posZ; - gUnkEntities1C[i].unk_10 = 0.0f; - gUnkEntities1C[i].timer = 65; - break; - } - } -} - -void func_8007729C(void) { - UnkEntity1C* ent1C; - s32 i; - - for (i = 0, ent1C = gUnkEntities1C; i < ARRAY_COUNT(gUnkEntities1C); i++, ent1C++) { - if (ent1C->hits != 0) { - if (ent1C->timer != 0) { - ent1C->timer -= 1; // can't be -- - } - if (ent1C->timer == 0) { - ent1C->hits = 0; - } - if (gLevelMode == LEVELMODE_ON_RAILS) { - ent1C->pos.z -= D_80177D08; - } else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { - ent1C->pos.x += gPlayer[0].vel.x; - ent1C->pos.z += gPlayer[0].vel.z; - } - if (ent1C->timer < 45) { - Math_SmoothStepToF(&ent1C->unk_10, 300.0f, 0.1f, 20.0f, 0.0f); - } - } - } -} - -void func_80077404(UnkEntity1C* ent1C) { - s32 var_a2; - Vec3f sp60; - Vec3f sp54; - f32 sp50; - - sp60 = D_800D1528; - if (ent1C->timer <= 45) { - Matrix_Translate(gGfxMatrix, ent1C->pos.x, ent1C->pos.y, ent1C->pos.z + D_80177D20, 1); - Matrix_MultVec3f(gGfxMatrix, &sp60, &sp54); - if ((fabsf(sp54.x) < 20000.0f) && (fabsf(sp54.y) < 20000.0f)) { - if ((sp54.z < 0.0f) && (sp54.z > -20000.0f)) { - sp50 = sqrtf(VEC3F_SQ(sp54)) * 0.0015f * 0.2f; - Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].unk_058, 1); - Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].unk_05C, 1); - Matrix_Scale(gGfxMatrix, sp50, sp50, 1.0f, 1); - Matrix_Translate(gGfxMatrix, 0.0f, ent1C->unk_10, 0.0f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - if (ent1C->hits <= 10) { - gSPDisplayList(gMasterDisp++, D_1015980); - gSPDisplayList(gMasterDisp++, D_800D14FC[ent1C->hits]); - } else if (ent1C->hits == 101) { - gSPDisplayList(gMasterDisp++, D_1011F20); - } else if (ent1C->hits == 100) { - gSPDisplayList(gMasterDisp++, D_1016580); - } else { - gSPDisplayList(gMasterDisp++, D_1015980); - switch (ent1C->hits) { - case 20: - var_a2 = 0; - break; - case 30: - var_a2 = 1; - break; - case 40: - var_a2 = 2; - break; - case 50: - default: - var_a2 = 3; - break; - } - gSPDisplayList(gMasterDisp++, D_800D14E0[var_a2][0]); - gSPDisplayList(gMasterDisp++, D_800D14E0[var_a2][1]); - } - } else { - ent1C->hits = 0; - } - } - } -} - -void func_80077790(void) { - UnkEntity1C* ent1C; - s32 i; - - RCP_SetupDL(&gMasterDisp, 0x3E); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - for (i = 0, ent1C = gUnkEntities1C; i < ARRAY_COUNT(gUnkEntities1C); i++, ent1C++) { - if (ent1C->hits != 0) { - Matrix_Push(&gGfxMatrix); - func_80077404(ent1C); - Matrix_Pop(&gGfxMatrix); - } - } -} - -Object_8C* func_8007783C(ObjectId objId) { - Object_8C* obj8C; - s32 i; - - for (i = 0, obj8C = gObjects8C; i < ARRAY_COUNT(gObjects8C); i++, obj8C++) { - if (obj8C->obj.status == 0) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 2; - obj8C->obj.id = objId; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - break; - } - } - if (i == ARRAY_COUNT(gObjects8C)) { - obj8C = NULL; - } - return obj8C; -} - -void func_800778C4(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_339; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = arg4; - obj8C->vel.y = arg5; - obj8C->vel.z = arg6; - obj8C->scale2 = arg7; - obj8C->unk_4C = 0; - obj8C->scale1 = 0.5f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - obj8C->unk_44 = 0xFF; -} - -void func_8007797C(f32 posX, f32 posY, f32 posZ, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_800778C4(&gObjects8C[i], posX, posY, posZ, arg3, arg4, arg5, arg6); - break; - } - } -} - -void func_80077A00(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - gSPDisplayList(gMasterDisp++, D_3016B30); -} - -void func_80077A7C(Object_8C* obj8C) { - RCP_SetupDL_49(); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - gDPSetEnvColor(gMasterDisp++, 255, 255, 255, obj8C->unk_44); - Matrix_Scale(gGfxMatrix, obj8C->scale1, obj8C->scale2, 1.0f, 1); - Matrix_Translate(gGfxMatrix, 0.0f, 20.0f, 0.0f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_6024220); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_80077B78(Object_8C* obj8C) { -} - -void func_80077B84(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - if ((obj8C->scale1 == 71.0f) || - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && (gCurrentLevel == LEVEL_CORNERIA))) { - RCP_SetupDL(&gMasterDisp, 0x26); - } else { - RCP_SetupDL(&gMasterDisp, 0x43); - } - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - switch (obj8C->unk_4C) { - case 0: - gDPSetEnvColor(gMasterDisp++, 0, 128, 255, obj8C->unk_44); - break; - case 1: - gDPSetEnvColor(gMasterDisp++, 255, 64, 255, obj8C->unk_44); - break; - case 2: - gDPSetEnvColor(gMasterDisp++, 255, 128, 0, obj8C->unk_44); - break; - case 3: - gDPSetEnvColor(gMasterDisp++, 255, 48, 48, obj8C->unk_44); - break; - case 4: - gDPSetEnvColor(gMasterDisp++, 255, 255, 48, obj8C->unk_44); - break; - case 5: - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, obj8C->unk_44); - gDPSetEnvColor(gMasterDisp++, 255, 32, 32, obj8C->unk_44); - break; - case 6: - if (gCurrentLevel == LEVEL_BOLSE) { - RCP_SetupDL(&gMasterDisp, 0x26); - } - switch ((obj8C->index + gFrameCount) & 3) { - case 0: - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 0, 0, obj8C->unk_44); - break; - case 1: - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 255, 0, obj8C->unk_44); - break; - case 2: - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 255, obj8C->unk_44); - break; - case 3: - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, obj8C->unk_44); - break; - } - gDPSetEnvColor(gMasterDisp++, 0, 0, 0, obj8C->unk_44); - break; - case 7: - gDPSetEnvColor(gMasterDisp++, 48, 48, 255, obj8C->unk_44); - break; - case 10: - gDPSetEnvColor(gMasterDisp++, 255, 255, 32, obj8C->unk_44); - break; - case 11: - gDPSetEnvColor(gMasterDisp++, 255, 32, 32, obj8C->unk_44); - break; - case 12: - gDPSetEnvColor(gMasterDisp++, 32, 255, 32, obj8C->unk_44); - break; - case 13: - gDPSetEnvColor(gMasterDisp++, 32, 32, 255, obj8C->unk_44); - break; - } - - gSPDisplayList(gMasterDisp++, D_1024AC0); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_80078038(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - RCP_SetupDL_49(); - RCP_SetupDL(&gMasterDisp, 0x26); - gDPSetPrimColor(gMasterDisp++, 0, 0, 64, 192, 255, obj8C->unk_44); - gDPSetEnvColor(gMasterDisp++, 0, 0, 0, obj8C->unk_44); - gSPDisplayList(gMasterDisp++, D_1024AC0); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_800780F8(Object_8C* obj8C) { - s32 i; - - if (obj8C->unk_4A >= 0xB) { - if (!((obj8C->index + gFrameCount) & 1)) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 128, 128, 32); - } else { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 128, 128, 128); - } - } else if (!((obj8C->index + gFrameCount) & 1)) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - } else { - gDPSetPrimColor(gMasterDisp++, 0, 0, 96, 96, 255, 255); - } - Graphics_SetScaleMtx(obj8C->scale2); - for (i = 0; i < 10; i++) { - if ((i >= obj8C->unk_48) && (i < obj8C->unk_46)) { - Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, 0.0f, -60.0f, 0.0f, 1); - Matrix_Scale(gGfxMatrix, 0.8f, 3.0f, 1.0f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_102F5E0); - Matrix_Pop(&gGfxMatrix); - } - Matrix_Translate(gGfxMatrix, 0.0f, -120.0f, 0.0f, 1); - Matrix_RotateZ(gGfxMatrix, D_800D1534[obj8C->unk_4C][i] * M_DTOR, 1); - } -} - -void func_800783C0(Object_8C* obj8C) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - Graphics_SetScaleMtx(obj8C->scale2); - gSPDisplayList(gMasterDisp++, D_2006F50); -} - -void func_80078438(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - gSPDisplayList(gMasterDisp++, D_102A8A0); -} - -void func_800784B4(Object_8C* obj8C) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_46); - Graphics_SetScaleMtx(obj8C->scale2); - Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_200D750); -} - -void func_80078550(Object_8C* obj8C) { - RCP_SetupDL(&gMasterDisp, 0x43); - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - gDPSetEnvColor(gMasterDisp++, 101, 138, 153, 255); - gSPDisplayList(gMasterDisp++, D_3000660); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_80078604(Object_8C* obj8C) { - if (obj8C->timer_50 == 0) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - gSPDisplayList(gMasterDisp++, D_20112C0); - } -} - -void func_8007868C(Object_8C* obj8C) { - RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - Matrix_Scale(gGfxMatrix, obj8C->scale2, obj8C->scale2, obj8C->scale2, 1); - if (obj8C->unk_44 >= 2) { - Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); - } - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_1029780); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_8007879C(Object_8C* obj8C) { - RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - Matrix_Scale(gGfxMatrix, obj8C->scale2 * 0.6f, 1.0f, obj8C->scale2 * 3.5f, 1); - Matrix_RotateX(gGfxMatrix, (M_PI / 2.0f), 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_1029780); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_800788B0(Object_8C* obj8C) { - s32 temp_ft3; - s32* tmp; - - switch (gCurrentLevel) { - case LEVEL_METEO: - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 128, 128, 128, 255); - gSPDisplayList(gMasterDisp++, D_601FF80); - break; - case LEVEL_AQUAS: - RCP_SetupDL(&gMasterDisp, 0x43); - temp_ft3 = Math_ModF(obj8C->index, 4.0f); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) obj8C->scale1); - tmp = &D_800D173C[(s32) (temp_ft3 * 4.0f)]; - gDPSetEnvColor(gMasterDisp++, tmp[0], tmp[1], tmp[2], 255); - Graphics_SetScaleMtx(obj8C->scale2); - gSPDisplayList(gMasterDisp++, D_1024AC0); - RCP_SetupDL(&gMasterDisp, 0x40); - break; - } -} - -void func_80078A64(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - gSPDisplayList(gMasterDisp++, D_20112C0); -} - -void func_80078AE0(void* obj8C) { -} - -void func_80078AEC(Object_8C* obj8C) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 180); - Graphics_SetScaleMtx(obj8C->scale2 * (13.0f + ((gFrameCount & 1) * 2.5f))); - gSPDisplayList(gMasterDisp++, D_102ED50); -} - -void func_80078B8C(Object_8C* obj8C) { - RCP_SetupDL_21(); - gSPDisplayList(gMasterDisp++, D_101ABD0); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_80078BE0(Object_8C* obj8C) { - f32 var_fv0; - - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 160); - var_fv0 = 3.0f; - if (gFrameCount & 1) { - var_fv0 *= 1.2f; - } - Graphics_SetScaleMtx(obj8C->scale2 * var_fv0); - gSPDisplayList(gMasterDisp++, D_600F8A0); -} - -void func_80078C84(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 192); - gSPDisplayList(gMasterDisp++, D_6000A80); -} - -void func_80078CE8(Object_8C* obj8C) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - Graphics_SetScaleMtx(obj8C->scale2); - gSPDisplayList(gMasterDisp++, D_6033000); -} - -void func_80078D60(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_393; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale2 = arg4; - if (arg4 == 3.1f) { - obj8C->vel.x = gObjects2F4[8].vel.x; - obj8C->vel.y = gObjects2F4[8].vel.y; - obj8C->vel.z = gObjects2F4[8].vel.z; - } - if (arg4 != 30.0f) { - obj8C->unk_4E = 1; - } - if (arg4 == 3.5f) { - obj8C->unk_4E = 2; - } - obj8C->timer_50 = 0xE; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_80078E50(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_80078D60(&gObjects8C[i], posX, posY, posZ, arg3); - break; - } - } -} - -void func_80078EBC(Object_8C* obj8C) { - if (obj8C->unk_4E == 2) { - obj8C->vel.x = gPlayer[0].vel.x; - obj8C->vel.y = gPlayer[0].vel.y; - obj8C->vel.z = gPlayer[0].vel.z; - } - obj8C->obj.rot.z += 35.0f; - if (obj8C->timer_50 >= 7) { - obj8C->scale1 += 0.25f; - } else { - obj8C->scale1 -= 0.25f; - } - if (obj8C->scale1 <= 0.0f) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_80078F78(Object_8C* obj8C) { - if (obj8C->unk_4E != 0) { - RCP_SetupDL(&gMasterDisp, 0x43); - } else { - RCP_SetupDL(&gMasterDisp, 0x3F); - } - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - gDPSetEnvColor(gMasterDisp++, 255, 255, 0, 255); - Graphics_SetScaleMtx(obj8C->scale2 * obj8C->scale1); - gSPDisplayList(gMasterDisp++, D_101C2E0); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_8007905C(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4, u8 arg5) { - Vec3f sp54; - Vec3f sp48; - Vec3f sp3C; - f32 sp38; - f32 xAng; - f32 yAng; - - Object_8C_Initialize(obj8C); - obj8C->obj.status = 2; - obj8C->obj.id = OBJ_8C_357; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->unk_4C = arg5; - if (arg4 == 1.6f) { - obj8C->vel.x = (posX - gBosses[1].obj.pos.x) * 0.1f; - obj8C->vel.z = (posZ - gBosses[1].obj.pos.z) * 0.1f; - } else if (arg4 == 1.3f) { - obj8C->vel.x = ((Rand_ZeroOne() * 0.05f) + 0.03f) * posX; - obj8C->vel.z = ((Rand_ZeroOne() * 0.05f) + 0.03f) * posZ; - obj8C->vel.y = 5.0f; - } else if (arg4 == 1.55f) { - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; - obj8C->vel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - } else if ((gCurrentLevel == LEVEL_BOLSE) && ((arg4 == 5.11f) || (arg4 == 7.22f))) { - sp3C.x = gPlayer[0].pos.x; - sp3C.y = gPlayer[0].pos.y; - sp3C.z = gPlayer[0].pos.z; - yAng = Math_Atan2F(sp3C.x - posX, sp3C.z - posZ); - sp38 = sqrtf(SQ(sp3C.x - posX) + SQ(sp3C.z - posZ)); - xAng = -Math_Atan2F(sp3C.y - posY, sp38); - Matrix_RotateY(gCalcMatrix, yAng, 0); - Matrix_RotateX(gCalcMatrix, xAng, 1); - sp54.x = (Rand_ZeroOne() - 0.5f) * 50.0f; - sp54.y = (Rand_ZeroOne() - 0.5f) * 50.0f; - sp54.z = (Rand_ZeroOne() * 10.0f) + 150.0f; - Matrix_MultVec3f(gCalcMatrix, &sp54, &sp48); - obj8C->vel.x = sp48.x; - obj8C->vel.y = sp48.y; - obj8C->vel.z = sp48.z; - } else { - obj8C->vel.y = - (gLevelType == LEVELTYPE_PLANET) ? (Rand_ZeroOne() * 7.0f) + 7.0f : (Rand_ZeroOne() - 0.5f) * 10.0f; - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; - obj8C->vel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - } - obj8C->scale2 = ((Rand_ZeroOne() * 0.8f) + 0.3f) * arg4; - obj8C->timer_50 = (s32) (Rand_ZeroOne() * 50.0f) + 0x46; - obj8C->obj.rot.x = Rand_ZeroOne() * 360.0f; - obj8C->unk_60.x = (Rand_ZeroOne() - 0.5f) * 30.0f; - obj8C->unk_60.y = (Rand_ZeroOne() - 0.5f) * 30.0f; - obj8C->unk_60.z = (Rand_ZeroOne() - 0.5f) * 30.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_800794CC(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 50; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007905C(&gObjects8C[i], posX, posY, posZ, arg3, 0); - break; - } - } -} - -void func_8007953C(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 79; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007905C(&gObjects8C[i], posX, posY, posZ, arg3, 0); - break; - } - } -} - -void func_800795AC(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 0; i < 95; i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007905C(&gObjects8C[i], posX, posY, posZ, arg3, 0); - break; - } - } -} - -void func_80079618(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 50; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007905C(&gObjects8C[i], posX, posY, posZ, arg3, 1); - break; - } - } -} - -void func_8007968C(Object_8C* obj8C) { - if ((gCurrentLevel != LEVEL_MACBETH) || (obj8C->unk_44 != 7)) { - if ((obj8C->timer_50 == 0) || (obj8C->obj.pos.y < D_80177940)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } else { - if (!(gFrameCount & 3)) { - func_8007D2C8(obj8C->obj.pos.x, obj8C->obj.pos.y + 550.0f, obj8C->obj.pos.z, 10.0f); - } - if ((obj8C->timer_50 == 0) || (obj8C->obj.pos.y < (D_80177940 - 100.0f))) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - obj8C->obj.rot.x += obj8C->unk_60.x; - obj8C->obj.rot.y += obj8C->unk_60.y; - obj8C->obj.rot.z += obj8C->unk_60.z; - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->vel.y -= 0.5f; - } - if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && (D_80177A80 >= 176)) { - obj8C->vel.x *= 0.95f; - obj8C->vel.y *= 0.95f; - obj8C->vel.z *= 0.95f; - } - if ((gCurrentLevel == LEVEL_MACBETH) && (obj8C->unk_44 == 10)) { - obj8C->obj.rot.x = 0.0f; - obj8C->obj.rot.y = 0.0f; - if (obj8C->timer_50 >= 25) { - obj8C->scale1 = 0.5f; - } else if (obj8C->scale1 > 0.03) { - obj8C->scale1 -= 0.02f; - } - } -} - -bool func_800798C4(s32 arg0, Gfx** arg1, Vec3f* arg2, Vec3f* arg3, void* arg4) { - if ((arg0 != 1) && (arg0 != 5)) { - *arg1 = NULL; - } - return false; -} - -void func_800798F0(Object_8C* obj8C) { - Vec3f frameJointTable[50]; - - if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7)) { - func_8005F670(&obj8C->obj.pos); - } - RCP_SetupDL(&gMasterDisp, 0x1D); - if (gCurrentLevel == LEVEL_KATINA) { - gSPFogPosition(gMasterDisp++, gFogNear, 1005); - } - Graphics_SetScaleMtx(obj8C->scale2); - switch (gCurrentLevel) { - case LEVEL_MACBETH: - switch (obj8C->unk_44) { - case 1: - if (obj8C->index & 1) { - gSPDisplayList(gMasterDisp++, D_6022530); - } else { - gSPDisplayList(gMasterDisp++, D_6022450); - } - break; - case 2: - RCP_SetupDL(&gMasterDisp, 0x39); - if (obj8C->index & 1) { - gSPDisplayList(gMasterDisp++, D_601A7A0); - } else { - gSPDisplayList(gMasterDisp++, D_60223C0); - } - RCP_SetupDL(&gMasterDisp, 0x1D); - break; - case 7: - Animation_GetFrameData(&D_6027320, 0, frameJointTable); - Animation_DrawSkeleton(1, D_602742C, frameJointTable, func_800798C4, NULL, obj8C, &gIdentityMatrix); - break; - case 8: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_6020E60); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 9: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_6020A30); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 10: - RCP_SetupDL(&gMasterDisp, 0x43); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - gDPSetEnvColor(gMasterDisp++, 255, 80, 0, 255); - Graphics_SetScaleMtx(obj8C->scale1); - gSPDisplayList(gMasterDisp++, D_1024AC0); - break; - case 11: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_60200E0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 12: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_600F2F0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 13: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_6001A60); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 14: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_600F160); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 15: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_600F3D0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 16: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_600F6C0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - case 17: - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_600F9B0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - break; - default: - if (obj8C->index & 1) { - gSPDisplayList(gMasterDisp++, D_10194C0); - } else { - gSPDisplayList(gMasterDisp++, D_1024290); - } - break; - } - break; - case LEVEL_AQUAS: - Matrix_SetGfxMtx(&gMasterDisp); - RCP_SetupDL(&gMasterDisp, 0x3C); - gSPDisplayList(gMasterDisp++, D_600A220); - break; - default: - switch (obj8C->unk_4C) { - case 0: - if (obj8C->index & 1) { - gSPDisplayList(gMasterDisp++, D_10194C0); - } else { - gSPDisplayList(gMasterDisp++, D_1024290); - } - break; - case 1: - switch (obj8C->index & 3) { - case 0: - Matrix_Scale(gGfxMatrix, 1.0f, 0.3f, 1.0f, 1); - break; - case 1: - Matrix_Scale(gGfxMatrix, 0.3f, 1.0f, 1.0f, 1); - break; - case 2: - Matrix_Scale(gGfxMatrix, 1.0f, 0.5f, 1.0f, 1); - break; - case 3: - Matrix_Scale(gGfxMatrix, 0.5f, 1.0f, 1.0f, 1); - break; - } - Matrix_SetGfxMtx(&gMasterDisp); - RCP_SetupDL(&gMasterDisp, 0x39); - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_1021E20); - RCP_SetupDL(&gMasterDisp, 0x40); - break; - } - break; - } - RCP_SetupDL(&gMasterDisp, 0x40); - if (gCurrentLevel == LEVEL_KATINA) { - gSPFogPosition(gMasterDisp++, gFogNear, gFogFar); - } -} - -void func_8007A28C(Object_8C* obj8C) { - Texture_Scroll(D_10190C0, 16, 32, 0); - D_8017812C = 2; - obj8C->obj.rot.y += 1.0f; - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.05f, 1.5f, 0.001f); - if (obj8C->timer_50 >= 0xB) { - D_801779A8[0] = 60.0f; - } - if (obj8C->timer_50 == 48) { - D_80178340 = 150; - } - if (obj8C->timer_50 > 45) { - D_80178358 = 0; - D_80178348 = D_80178350 = D_80178354 = 255; - } - D_8017835C = 3; - if (obj8C->timer_50 == 0) { - obj8C->unk_44 -= 2; - if (obj8C->unk_44 < 0) { - obj8C->unk_44 = 0; - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - D_8017812C = 0; - } - } -} - -void func_8007A3C0(Object_8C* obj8C) { - if (D_80161410 > 0) { - Matrix_Scale(gGfxMatrix, obj8C->scale2, obj8C->scale2, obj8C->scale2, 1); - Matrix_SetGfxMtx(&gMasterDisp); - RCP_SetupDL_64_2(); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_44); - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_10182C0); - gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); - RCP_SetupDL_64_2(); - } -} - -void func_8007A4B8(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_383; - obj8C->scale1 = arg4; - obj8C->timer_50 = 50; - obj8C->unk_44 = 200; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - Audio_PlaySfx(0x2940F026, &obj8C->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007A568(f32 xPos, f32 yPos, f32 zPos, f32 arg3) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007A4B8(&gObjects8C[i], xPos, yPos, zPos, arg3); - break; - } - } - func_8007B344(xPos, yPos, zPos, 80.0f, 4); -} - -void func_8007A5F8(Object_8C* obj8C, Vec3f* arg1, u32 arg2) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 2; - obj8C->obj.id = OBJ_8C_373; - obj8C->obj.pos.x = arg1->x; - obj8C->obj.pos.y = arg1->y; - obj8C->obj.pos.z = arg1->z; - obj8C->timer_50 = 50; - if ((arg2 == 0x1903400F) || (arg2 == 0x11000055)) { - Audio_PlaySfx(arg2, &obj8C->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); - if (arg2 == 0x11000055) { - obj8C->timer_50 = 300; - } - } else { - Audio_PlaySfx(arg2, &obj8C->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); - } - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007A6F0(Vec3f* arg0, s32 arg1) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007A5F8(&gObjects8C[i], arg0, arg1); - break; - } - } -} - -void func_8007A748(Object_8C* obj8C) { - if (obj8C->timer_50 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -bool func_8007A774(Player* player, Object_8C* obj8C, f32 arg2) { - if ((fabsf(player->unk_138 - obj8C->obj.pos.z) < arg2) && (fabsf(player->pos.x - obj8C->obj.pos.x) < arg2) && - (fabsf(player->pos.y - obj8C->obj.pos.y) < arg2) && (player->timer_498 == 0)) { - Player_ApplyDamage(player, 0, obj8C->info.damage); - return true; - } else { - return false; - } -} - -void func_8007A818(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4, u8 arg5, u8 arg6, u16 arg7) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_359; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale1 = arg4; - obj8C->unk_44 = arg5; - obj8C->unk_46 = arg6; - obj8C->unk_60.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - obj8C->unk_60.y = arg4 * 0.1f; - if (arg7 != 0) { - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 30.0f; - } - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007A900(f32 posX, f32 posY, f32 posZ, f32 arg3, u8 arg4, u8 arg5, u16 arg6) { - s32 i; - - if (gCurrentLevel == LEVEL_TITANIA) { - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007A818(&gObjects8C[i], posX, posY, posZ, arg3, arg4, arg5, arg6); - break; - } - } - } -} - -void func_8007A994(Object_8C* obj8C) { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.1f, 10.0f, 0.01f); - obj8C->obj.rot.z += obj8C->unk_60.z; - obj8C->vel.y += obj8C->unk_60.y; - if (obj8C->unk_4A & 1) { - obj8C->unk_48++; - if (obj8C->unk_48 >= 6) { - obj8C->unk_48 = 5; - } - } - obj8C->unk_44 -= obj8C->unk_46; - if (obj8C->unk_44 < 0x15) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->unk_4A++; -} - -// Gfx* D_800D178C[6] = { -// 0x06003440, 0x060034E0, 0x06003580, -// 0x06003620, 0x060036C0, 0x06003760 -// }; - -void func_8007AA60(Object_8C* obj8C) { - RCP_SetupDL(&gMasterDisp, 0x44); - gDPSetPrimColor(gMasterDisp++, 0, 0, 31, 10, 00, obj8C->unk_44); - gDPSetEnvColor(gMasterDisp++, 141, 73, 5, 0); - Matrix_Scale(gGfxMatrix, obj8C->scale2, obj8C->scale2, 1.0f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_800D178C[obj8C->unk_4C]); - obj8C->unk_4C = obj8C->unk_48; - RCP_SetupDL(&gMasterDisp, 0x40); -} - -void func_8007AB50(Object_8C* obj8C) { - if (obj8C->unk_4E == 0) { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.1f, 10.0f, 0.0f); - obj8C->unk_44 -= 20; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } else { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.1f, 10.0f, 0.0f); - obj8C->unk_44 -= 10; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007AC0C(Object_8C* obj8C, f32 posX, f32 unused_posY, f32 posZ, f32 arg4, f32 arg5, f32 arg6) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_372; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = D_80177940; - obj8C->obj.pos.z = posZ; - obj8C->unk_44 = 0xB4; - obj8C->scale2 = arg4; - obj8C->scale1 = arg5; - obj8C->obj.rot.y = arg6; - obj8C->vel.x = gPlayer[0].vel.x * 0.6f; - obj8C->vel.z = gPlayer[0].vel.z * 0.6; // Forgotten f means bad codegen - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007ACE0(f32 posX, f32 posY, f32 posZ, f32 arg3, f32 arg4, f32 arg5) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007AC0C(&gObjects8C[i], posX, posY, posZ, arg3, arg4, arg5); - break; - } - } -} - -void func_8007AD58(Object_8C* obj8C, f32 posX, f32 unused_posY, f32 posZ, f32 arg4, f32 arg5, f32 arg6) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_372; - obj8C->unk_4E = 1; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = D_80177940; - obj8C->obj.pos.z = posZ; - obj8C->unk_44 = 0xB4; - obj8C->scale2 = arg4; - obj8C->scale1 = arg5; - obj8C->obj.rot.y = arg6; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007ADF4(f32 posX, f32 posY, f32 posZ, f32 arg3, f32 arg4) { - f32 temp_fs0; - f32 temp_fs2; - f32 var_fs1; - s32 var_s2; - s32 i; - - for (var_fs1 = 11.25f, var_s2 = 0; var_s2 < 16; var_s2++, var_fs1 += 22.5f) { - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - temp_fs2 = __sinf(M_DTOR * var_fs1) * arg4 * 20.0f; - temp_fs0 = __cosf(M_DTOR * var_fs1) * arg4 * 20.0f; - func_8007AD58(&gObjects8C[i], posX + temp_fs2, posY, posZ + temp_fs0, arg3, arg4, var_fs1); - break; - } - } - } -} - -void func_8007AF30(Object_8C* obj8C, f32 posX, f32 posZ, f32 arg3, f32 arg4, f32 arg5) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_382; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = -10.0f; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = arg3; - obj8C->vel.z = arg4 - D_80177D08; - obj8C->scale1 = arg5; - obj8C->timer_50 = 0x64; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007AFD0(f32 posX, f32 posZ, f32 arg2, f32 arg3, f32 arg4) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007AF30(&gObjects8C[i], posX, posZ, arg2, arg3, arg4); - break; - } - } -} - -void func_8007B040(Object_8C* obj8C) { - f32 sp2C; - s32 sp28; - - if (func_800A73E4(&sp2C, &sp28, obj8C->obj.pos.x, obj8C->obj.pos.y, obj8C->obj.pos.z)) { - D_801782EC[sp28] = obj8C->scale1; - D_801782EC[sp28 + 1] = obj8C->scale1 * 0.7f; - D_801782EC[sp28 - 1] = obj8C->scale1 * 0.7f; - } - if (obj8C->timer_50 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007B0F4(Object_8C* obj8C) { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1 * 3.0f, 0.1f, 10.0f, 0.0f); - obj8C->unk_44 -= 13; - obj8C->obj.rot.y = 180.0f - obj8C->obj.rot.y; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007B180(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_381; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->unk_44 = 0xFF; - obj8C->scale1 = arg4; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - Audio_PlaySfx(0x1100000C, &obj8C->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); -} - -void func_8007B228(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C) && gCurrentLevel == LEVEL_ZONESS; i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007B180(&gObjects8C[i], posX, posY, posZ, arg3); - break; - } - } -} - -void func_8007B2BC(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 arg4, s32 arg5) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_384; - obj8C->obj.pos.x = xPos; - obj8C->obj.pos.y = yPos; - obj8C->obj.pos.z = zPos; - obj8C->scale1 = arg4; - obj8C->unk_44 = 0xFF; - obj8C->unk_4C = arg5; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007B344(f32 xPos, f32 yPos, f32 zPos, f32 arg3, s32 arg4) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007B2BC(&gObjects8C[i], xPos, yPos, zPos, arg3, arg4); - break; - } - } -} - -void func_8007B3B8(Object_8C* obj8C) { - f32 var_fv0; - f32 var_fv1; - s32 var_v0; - - if (obj8C->unk_4C == 6) { - var_fv0 = 15.0f; - var_fv1 = 0.05f; - var_v0 = 4; - } else if ((obj8C->unk_4C == 5) && ((gCurrentLevel == LEVEL_KATINA) || (gCurrentLevel == LEVEL_METEO))) { - var_fv0 = 10.0f; - var_fv1 = 0.1f; - var_v0 = 4; - } else { - var_fv0 = 10.0f; - var_fv1 = 0.1f; - var_v0 = 8; - } - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, var_fv1, var_fv0, 0.0f); - obj8C->unk_44 -= var_v0; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007B494(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_385; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->obj.rot.x = 90.0f; - obj8C->scale1 = arg4; - obj8C->unk_44 = arg5; - if (arg5 < 60) { - obj8C->unk_46 = 1; - } else if (arg5 < 90) { - obj8C->unk_46 = 2; - } else { - obj8C->unk_46 = 3; - } - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007B550(f32 posX, f32 posY, f32 posZ, f32 arg3, s32 arg4) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007B494(&gObjects8C[i], posX, posY, posZ, arg3, arg4); - break; - } - } -} - -void func_8007B5C0(Object_8C* obj8C) { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.1f, 10.0f, 0.1f); - obj8C->unk_44 -= obj8C->unk_46; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007B62C(Object_8C* obj8C) { - if (obj8C->timer_50 == 0) { - obj8C->unk_46 -= 4; - if (obj8C->unk_46 <= 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007B670(Object_8C* obj8C) { -} - -void func_8007B67C(Object_8C* obj8C) { - s32 var_v1; - - obj8C->unk_46 += 2; - if (obj8C->unk_46 >= 10) { - obj8C->unk_46 = 10; - } - if (obj8C->unk_46 >= 9) { - obj8C->unk_48++; - if (obj8C->unk_48 >= 10) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - var_v1 = obj8C->unk_4A; - if (var_v1 != 0) { - if (var_v1 > 10) { - var_v1 -= 10; - } - obj8C->vel.x = gPlayer[var_v1 - 1].vel.x; - obj8C->vel.y = gPlayer[var_v1 - 1].vel.y; - obj8C->vel.z = gPlayer[var_v1 - 1].vel.z; - } -} - -void func_8007B758(Object_8C* obj8C) { - Math_SmoothStepToF(&obj8C->scale2, obj8C->scale1, 0.1f, 10.0f, 0.1f); - obj8C->unk_44 -= 2; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - func_8007A774(gPlayer, obj8C, obj8C->scale2 * 20.0f); -} - -void func_8007B7E8(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_364; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; - obj8C->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; - obj8C->unk_48 = 3; - if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; - } - obj8C->unk_4A = 50; - obj8C->unk_46 = 1; - obj8C->scale2 = arg4 * 0.2f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007B8F8(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i, j; - - for (i = ARRAY_COUNT(gObjects8C) - 1, j = 0; j < ARRAY_COUNT(gObjects8C); i--, j++) { - if (gObjects8C[i].obj.status == 0) { - func_8007B7E8(&gObjects8C[i], posX, posY, posZ, arg3); - break; - } - } -} - -void func_8007B960(Object_8C* obj8C) { - obj8C->scale2 += 0.07f; - obj8C->unk_4A -= obj8C->unk_46; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += 0.2f; -} - -void func_8007B9DC(Object_8C* obj8C) { - //! DEBUG - if (gControllerHold[3].button & Z_TRIG) { - RCP_SetupDL(&gMasterDisp, 4); - } - Graphics_SetScaleMtx(obj8C->scale2); - if (gCurrentLevel != LEVEL_MACBETH) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 140, 99, 58, obj8C->unk_4A); - } else { - gDPSetPrimColor(gMasterDisp++, 0, 0, (gFrameCount & 3) + 5, (gFrameCount & 3) + 3, (gFrameCount & 3) + 3, 220); - } - //! DEBUG - if (!(gControllerHold[3].button & A_BUTTON)) { - gSPDisplayList(gMasterDisp++, D_2010A30); - } - //! DEBUG - if (gControllerHold[3].button & Z_TRIG) { - RCP_SetupDL(&gMasterDisp, 0x40); - } -} - -void func_8007BB14(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_362; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; - obj8C->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; - obj8C->unk_48 = 3; - if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; - } - obj8C->unk_4A = 0xB4; - obj8C->unk_46 = 8; - if (arg4 > 15.0f) { - obj8C->unk_46 = 5; - obj8C->unk_4A = 0x50; - } - obj8C->scale2 = arg4 * 0.25f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - if (arg4 == 6.0f) { - obj8C->vel.z = gPlayer[0].vel.z * 0.6f; - } - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007BC7C(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 20; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007BB14(&gObjects8C[i], posX, posY, posZ, arg3); - break; - } - } -} - -void func_8007BCE8(Object_8C* obj8C) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) { - obj8C->obj.rot.x = (gPlayer[0].unk_05C * 180.0f) / M_PI; - obj8C->obj.rot.y = (-gPlayer[0].unk_058 * 180.0f) / M_PI; - } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_6) { - obj8C->unk_46 = 2; - obj8C->vel.y -= 0.13f; - } - obj8C->scale2 += 0.07f; - obj8C->unk_4A -= obj8C->unk_46; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += 0.2f; -} - -void func_8007BDE0(Object_8C* obj8C) { - obj8C->scale2 += 0.04f; - obj8C->unk_4A -= 2; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += obj8C->scale1; -} - -void func_8007BE54(Object_8C* obj8C) { - obj8C->scale2 += 0.02f; - obj8C->unk_4A -= 3; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->vel.z = gPlayer[0].vel.z + 7.0f; - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += 0.1f; -} - -void func_8007BEE8(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - gSPDisplayList(gMasterDisp++, D_2010A30); -} - -void func_8007BF64(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg7, s32 arg8) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_386; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = x; - obj8C->vel.y = y; - obj8C->vel.z = z; - obj8C->scale2 = arg7; - obj8C->timer_50 = arg8; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007BFFC(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007BF64(&gObjects8C[i], posX, posY, posZ, x, y, z, arg6, arg7); - break; - } - } -} - -void func_8007C088(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg7, s32 arg8) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_390; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = x; - obj8C->vel.y = y; - obj8C->vel.z = z; - obj8C->scale2 = arg7; - obj8C->timer_50 = arg8; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007C120(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007C088(&gObjects8C[i], posX, posY, posZ, x, y, z, arg6, arg7); - break; - } - } -} - -void func_8007C1AC(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007BF64(&gObjects8C[i], posX, posY, posZ, x, y, z, arg6, arg7); - func_800A6070(&gObjects8C[i].sfxPos, 0x29000000); - break; - } - } -} - -void func_8007C250(Object_8C* obj8C) { - f32 randX; - f32 randY; - f32 randOther; - s32 var_v0; - - Math_SmoothStepToF(&obj8C->vel.x, 0.0f, 0.2f, 10.0f, 0.1f); - Math_SmoothStepToF(&obj8C->vel.y, 0.0f, 0.2f, 10.0f, 0.1f); - Math_SmoothStepToF(&obj8C->vel.z, 0.0f, 0.2f, 10.0f, 0.1f); - var_v0 = 3; - if (gLevelMode == LEVELMODE_ALL_RANGE) { - var_v0 = 1; - } - if (!(obj8C->timer_50 & var_v0)) { - randX = (Rand_ZeroOne() - 0.5f) * 40.0f; - randY = (Rand_ZeroOne() - 0.5f) * 40.0f; - randOther = ((Rand_ZeroOne() * 0.5f) + 1.0f); - func_8007D0E0(obj8C->obj.pos.x + randX, obj8C->obj.pos.y + randY, obj8C->obj.pos.z, obj8C->scale2 * randOther); - if (obj8C->timer_50 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007C3B4(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg7, s32 arg8) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_389; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->vel.x = x; - obj8C->vel.y = y; - obj8C->vel.z = z; - obj8C->scale2 = arg7; - obj8C->unk_4A = arg8; - obj8C->unk_4C = (s32) (Rand_ZeroOne() * 12.0f); - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - obj8C->unk_44 = 0xFF; -} - -void func_8007C484(f32 posX, f32 posY, f32 posZ, f32 x, f32 y, f32 z, f32 arg6, s32 arg7) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i > 32; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007C3B4(&gObjects8C[i], posX, posY, posZ, x, y, z, arg6, arg7); - break; - } - } -} - -void func_8007C50C(Object_8C* obj8C) { - f32 randX; - f32 randY; - f32 randOther; - - if (!(obj8C->timer_50 & 7)) { - randX = (Rand_ZeroOne() - 0.5f) * 40.0f * obj8C->scale2; - randY = (Rand_ZeroOne() - 0.5f) * 40.0f * obj8C->scale2; - randOther = (Rand_ZeroOne() + 1.0f); - func_8007C484(obj8C->obj.pos.x + randX, obj8C->obj.pos.y + randY, obj8C->obj.pos.z, obj8C->vel.x, obj8C->vel.y, - obj8C->vel.z, obj8C->scale2 * randOther, 0); - if (obj8C->timer_50 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007C608(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_387; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale2 = arg4; - obj8C->timer_50 = arg5; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007C688(f32 posX, f32 posY, f32 posZ, f32 arg3, s32 arg4) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007C608(&gObjects8C[i], posX, posY, posZ, arg3, arg4); - break; - } - } -} - -void func_8007C6FC(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 arg4) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_343; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->unk_48 = 3; - obj8C->vel.y = 5.0f; - if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; - } - if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_6)) { - obj8C->unk_4A = 180; - } else { - obj8C->unk_4A = 255; - } - obj8C->scale2 = arg4 * 0.25f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - obj8C->unk_44 = 0; - if (Rand_ZeroOne() < 0.3f) { - obj8C->unk_44 = 1; - obj8C->unk_4A = 255; - obj8C->scale2 = arg4 * 0.3f; - } - obj8C->scale1 = Rand_ZeroOne() * 0.2f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007C85C(f32 posX, f32 posY, f32 posZ, f32 arg3) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(gObjects8C) - 20; i++) { - if (gObjects8C[i].obj.status == 0) { - func_8007C6FC(&gObjects8C[i], posX, posY, posZ, arg3); - break; - } - } -} - -void func_8007C8C4(Object_8C* obj8C) { - f32 randX; - f32 randY; - f32 randOther; - s32 var_v0; - - var_v0 = 0; - if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_6)) { - var_v0 = 3; - } - if (!(obj8C->timer_50 & var_v0) && (gLevelType == LEVELTYPE_PLANET)) { - randX = (Rand_ZeroOne() - 0.5f) * 10.0f; - randY = (Rand_ZeroOne() - 0.5f) * 10.0f; - randOther = ((Rand_ZeroOne() * 0.5f) + 1.0f); - func_8007C85C(obj8C->obj.pos.x + randX, obj8C->obj.pos.y + randY, obj8C->obj.pos.z, obj8C->scale2 * randOther); - if (obj8C->timer_50 == 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007C9E0(Object_8C* obj8C) { - if (obj8C->unk_44 == 0) { - obj8C->scale2 *= 1.03f; - obj8C->unk_4A -= 3; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += 0.3f; - obj8C->vel.x += obj8C->scale1; - } else { - obj8C->scale2 *= 1.03f; - obj8C->unk_4A -= 7; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - obj8C->obj.rot.z += obj8C->unk_48; - obj8C->vel.y += 0.3f; - obj8C->vel.x += obj8C->scale1; - } -} - -void func_8007CAF0(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - if (obj8C->unk_44 == 0) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, obj8C->unk_4A); - gSPDisplayList(gMasterDisp++, D_102A010); - } else { - Matrix_Scale(gGfxMatrix, 1.5f, 1.5f, 1.5f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - gSPDisplayList(gMasterDisp++, D_20031B0); - } -} - -void func_8007CC00(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 scale2) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_339; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale2 = scale2; - obj8C->scale1 = 0.5f; - obj8C->unk_4C = 0; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->unk_44 = 230; - } else { - obj8C->unk_44 = 0xFF; - } -} - -void func_8007CCBC(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 scale2) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_340; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale2 = scale2; - obj8C->unk_4C = 3; - obj8C->scale1 = 0.2f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->unk_44 = 230; - } else { - obj8C->unk_44 = 0xFF; - } -} - -void func_8007CD7C(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_342; - obj8C->timer_50 = timer50; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->unk_48 = 3; - if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; - } - obj8C->unk_4A = 0xFF; - obj8C->scale2 = scale2; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - if ((Rand_ZeroOne() < 0.5f) && (gLevelType == LEVELTYPE_PLANET) && (timer50 != 1)) { - obj8C->unk_44 = 1; - } - if (timer50 == 2) { - obj8C->unk_44 = 1; - } - if (scale2 == 2.2f) { - obj8C->unk_44 = 0; - } - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007CEBC(f32 posX, f32 posY, f32 posZ, f32 scale2, s32 timer50) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007CD7C(&gObjects8C[i], posX, posY, posZ, scale2, timer50); - break; - } - } -} - -void func_8007CF30(f32 posX, f32 posY, f32 posZ, f32 scale2) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007CC00(&gObjects8C[i], posX, posY, posZ, scale2); - break; - } - } -} - -void func_8007CF9C(f32 posX, f32 posY, f32 posZ, f32 scale2) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007CCBC(&gObjects8C[i], posX, posY, posZ, scale2); - break; - } - } -} - -void func_8007D008(f32 posX, f32 posY, f32 posZ, f32 scale2) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007CC00(&gObjects8C[i], posX, posY, posZ, scale2); - break; - } - } -} - -void func_8007D074(f32 posX, f32 posY, f32 posZ, f32 scale2) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007CCBC(&gObjects8C[i], posX, posY, posZ, scale2); - break; - } - } -} - -void func_8007D0E0(f32 posX, f32 posY, f32 posZ, f32 scale2) { - func_8007CF30(posX, posY, posZ, scale2); -} - -void func_8007D10C(f32 posX, f32 posY, f32 posZ, f32 scale2) { - func_8007CF9C(posX, posY, posZ, scale2); -} - -void func_8007D138(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 scale2) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_341; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->scale2 = scale2; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->unk_4C = 15; - } - obj8C->unk_44 = 180; -} - -void func_8007D1E0(f32 posX, f32 posY, f32 posZ, f32 scale2) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007D138(&gObjects8C[i], posX, posY, posZ, scale2); - break; - } - } -} - -void func_8007D24C(f32 posX, f32 posY, f32 posZ, f32 scale2) { - if (gLevelType == LEVELTYPE_PLANET) { - func_8007D1E0(posX, posY, posZ, scale2); - func_8007CEBC(posX, scale2 + posY, posZ, scale2, 9); - } else { - func_8007D0E0(posX, posY, posZ, scale2); - } -} - -void func_8007D2C8(f32 posX, f32 posY, f32 posZ, f32 scale2) { - func_8007D008(posX, posY, posZ, scale2); -} - -void func_8007D2F4(Object_8C* obj8C) { - if (gLevelType == LEVELTYPE_PLANET) { - if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7)) { - obj8C->vel.y += 0.1f; - if (obj8C->timer_50 == 0) { - obj8C->unk_4C++; - obj8C->timer_50 = 4; - if (obj8C->unk_4C > 15) { - obj8C->timer_50 = 5; - } - if (obj8C->unk_4C > 20) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - } else { - if ((gCurrentLevel == LEVEL_MACBETH) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && - (obj8C->vel.x != 0)) { - Math_SmoothStepToF(&obj8C->vel.x, -1.0f, 1.0f, 1.0f, 0.0f); - Math_SmoothStepToF(&obj8C->vel.z, 4.0f, 1.0f, 1.0f, 0.0f); - obj8C->vel.y += 1.7f; - } - obj8C->vel.y += 0.3f; - if (obj8C->timer_50 == 0) { - obj8C->unk_4C++; - if (obj8C->unk_4C > 15) { - obj8C->timer_50 = 2; - } - if (obj8C->unk_4C > 20) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - } - } else { - if (obj8C->timer_50 == 0) { - obj8C->unk_4C++; - obj8C->timer_50 = obj8C->unk_46; - if (obj8C->unk_4C > 13) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - obj8C->unk_44 -= 15; - } - if (D_8017836C < obj8C->scale1) { - D_8017836C = obj8C->scale1; - D_80178370 = obj8C->obj.pos.x; - D_80178374 = obj8C->obj.pos.y; - D_80178378 = obj8C->obj.pos.z; - D_80178360 = 0xFF; - D_80178364 = 50; - D_80178368 = 0; - } - Math_SmoothStepToF(&obj8C->scale1, 0.0f, 1.0f, 0.05f, 0.0f); -} - -void func_8007D55C(Object_8C* obj8C) { - f32 scale; - - Graphics_SetScaleMtx(obj8C->scale2); - if (gLevelType == LEVELTYPE_PLANET) { - gDPSetPrimColor(gMasterDisp++, 0, 0, D_800D184C[obj8C->unk_4C][0], D_800D184C[obj8C->unk_4C][1], - D_800D184C[obj8C->unk_4C][2], D_800D184C[obj8C->unk_4C][3]); - scale = D_800D17F8[obj8C->unk_4C] - 0.5f; - Matrix_Scale(gGfxMatrix, scale, scale, 1.0f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_800D17A4[obj8C->unk_4C]); - return; - } - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 100, obj8C->unk_44); - if (obj8C->unk_4C == 0) { - Matrix_Scale(gGfxMatrix, 2.5f, 2.5f, 2.5f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_800D18A0[obj8C->unk_4C]); - return; - } - gSPDisplayList(gMasterDisp++, D_800D18A0[obj8C->unk_4C]); -} - -void func_8007D748(Object_8C* obj8C) { - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->vel.y += 0.3f; - if (obj8C->timer_50 == 0) { - if (obj8C->unk_4C > 15) { - obj8C->timer_50 = 2; - obj8C->unk_4C = obj8C->unk_4C + 1; - } else { - obj8C->unk_4C = obj8C->unk_4C + 2; - } - if (obj8C->unk_4C > 20) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - } else { - if (obj8C->timer_50 == 0) { - obj8C->unk_4C++; - obj8C->timer_50 = 0; - if (obj8C->unk_4C > 13) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - obj8C->unk_44 -= 15; - } - if (D_8017836C < obj8C->scale1) { - D_8017836C = obj8C->scale1; - D_80178370 = obj8C->obj.pos.x; - D_80178374 = obj8C->obj.pos.y; - D_80178378 = obj8C->obj.pos.z; - D_80178360 = 0xFF; - D_80178364 = 50; - D_80178368 = 0; - } - Math_SmoothStepToF(&obj8C->scale1, 0, 1.0f, 0.1f, 0.0f); -} - -void func_8007D8A8(Object_8C* obj8C) { - if (gLevelType == LEVELTYPE_SPACE) { - func_8007D2F4(obj8C); - return; - } - obj8C->vel.y += 0.3f; - if (obj8C->timer_50 == 0) { - obj8C->unk_4C++; - obj8C->timer_50 = 2; - if (obj8C->unk_4C >= 20) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - if (obj8C->unk_4C >= 16) { - obj8C->unk_44 -= 20; - } -} - -void func_8007D94C(Object_8C* obj8C, f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, s32 timer50) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_367; - obj8C->obj.pos.x = posX; - obj8C->obj.pos.y = posY; - obj8C->obj.pos.z = posZ; - obj8C->unk_44 = 80; - obj8C->scale2 = scale2; - obj8C->scale1 = scale1; - obj8C->timer_50 = timer50; - Object_SetInfo(&obj8C->info, obj8C->obj.id); -} - -void func_8007D9DC(f32 posX, f32 posY, f32 posZ, f32 scale2, f32 scale1, s32 timer50) { - s32 i; - - for (i = ARRAY_COUNT(gObjects8C) - 1; i >= 0; i--) { - if (gObjects8C[i].obj.status == 0) { - func_8007D94C(&gObjects8C[i], posX, posY, posZ, scale2, scale1, timer50); - break; - } - } -} - -void func_8007DA58(Object_8C* obj8C) { - obj8C->scale2 += obj8C->scale1; - if (obj8C->scale1 > 0.0f) { - obj8C->scale1 -= 0.01f; - } else { - obj8C->scale1 -= 0.001f; - } - obj8C->obj.rot.y += obj8C->unk_60.y; - if (obj8C->scale2 < 0.01f) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007DAE4(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); - gSPDisplayList(gMasterDisp++, D_6004900); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -extern Vec3f D_800D18D8; -// Vec3f D_800D18D8 = { 0.0f, -10.0f, 0.0f }; - -void func_8007DB70(Object_8C* obj8C) { - Vec3f sp54 = D_800D18D8; - - switch (obj8C->unk_4E) { - case 0: - obj8C->vel.y -= 0.5f; - if ((obj8C->timer_50 == 0) && - ((func_8006351C(1000, &obj8C->obj.pos, &sp54, 1) != 0) || (obj8C->obj.pos.y < (D_80177940 + 10.0f)))) { - obj8C->vel.y = 0.0f; - if (obj8C->obj.pos.y < (D_80177940 + 10.0f)) { - obj8C->obj.pos.y = D_80177940; - } - obj8C->unk_4E = 1; - obj8C->timer_50 = 30; - obj8C->unk_44 = 192; - obj8C->scale2 = 2.5f; - obj8C->scale1 = 2.5f; - Audio_PlaySfx(0x2903B009, &obj8C->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); - func_8007D0E0(obj8C->obj.pos.x, obj8C->obj.pos.y + 30.0f, obj8C->obj.pos.z, 7.0f); - func_8007BFFC(obj8C->obj.pos.x, obj8C->obj.pos.y + 30.0f, obj8C->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, 5); - if ((obj8C->obj.pos.y < (D_80177940 + 10.0f)) || (D_80161A88 != 2)) { - func_800365E4(obj8C->obj.pos.x, 3.0f, obj8C->obj.pos.z, obj8C->obj.pos.x, obj8C->obj.pos.z, 0.0f, - 0.0f, 90.0f, 5.0f, 0, 0); - break; - } - } - break; - case 1: - obj8C->scale2 += ((20.0f - obj8C->scale2) * 0.1f); - if (obj8C->scale2 > 19.0f) { - obj8C->scale1 -= 0.3f; - obj8C->unk_44 -= 20; - if (obj8C->unk_44 < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - obj8C->obj.rot.y = 180.0f - obj8C->obj.rot.y; - if ((fabsf(gPlayer[0].unk_138 - obj8C->obj.pos.z) < 40.0f) && - (fabsf(gPlayer[0].pos.x - obj8C->obj.pos.x) < 80.0f)) { - if ((obj8C->obj.pos.y < gPlayer[0].pos.y) && - ((gPlayer[0].pos.y - obj8C->obj.pos.y) < (obj8C->scale2 * 35.0f)) && (gPlayer[0].timer_498 == 0)) { - Player_ApplyDamage(gPlayer, 0, obj8C->info.damage); - } - } - break; - } -} - -extern Gfx D_4008CE0[]; -extern Gfx D_4008F70[]; - -void func_8007DED4(Object_8C* obj8C) { - switch (obj8C->unk_4E) { - case 0: - Graphics_SetScaleMtx(obj8C->scale2); - RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); - gSPDisplayList(gMasterDisp++, D_4008CE0); - RCP_SetupDL(&gMasterDisp, 0x40); - return; - case 1: - Matrix_Scale(gGfxMatrix, obj8C->scale1, obj8C->scale2, 2.5f, 1); - Matrix_SetGfxMtx(&gMasterDisp); - RCP_SetupDL_40(); - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, D_4008F70); - RCP_SetupDL(&gMasterDisp, 0x40); - return; - } -} - -void func_8007E014(Object_8C* obj8C) { - s32 i; - f32 x; - f32 z; - f32 y; - - if (D_801784AC == 4) { - func_E6A810_801B6E20(obj8C->obj.pos.x, obj8C->obj.pos.z + D_80177D20, &x, &y, &z); - obj8C->obj.pos.y = y + 3.0f; - obj8C->obj.rot.x = (x * 180.0f) / M_PI; - obj8C->obj.rot.z = (z * 180.0f) / M_PI; - } - if (((obj8C->unk_44 == 1) || (obj8C->unk_44 == 3)) && ((obj8C->timer_50 & 3) == 1) && (Rand_ZeroOne() < 0.5f)) { - func_8007D10C(obj8C->obj.pos.x, obj8C->obj.pos.y + (obj8C->scale2 * 5.0f), obj8C->obj.pos.z + 3.0f, - ((Rand_ZeroOne() * 0.7f) + 1.0f) * (obj8C->scale2 * 1.2f)); - } - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if ((gObjects8C[i].obj.status == 2) && (gObjects8C[i].obj.id == OBJ_8C_344) && (i != obj8C->index) && - (fabsf(obj8C->obj.pos.z - gObjects8C[i].obj.pos.z) < 20.0f) && - (fabsf(obj8C->obj.pos.x - gObjects8C[i].obj.pos.x) < 20.0f) && - (fabsf(obj8C->obj.pos.y - gObjects8C[i].obj.pos.y) < 20.0f)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } -} - -void func_8007E258(Object_8C* obj8C) { - if ((gCamCount != 1) && (obj8C->timer_50 == 0)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } -} - -void func_8007E298(Object_8C* obj8C) { - if (obj8C->timer_50 == 0) { - obj8C->scale2 *= 1.035f; - obj8C->unk_4A -= 8; - if (obj8C->unk_4A < 0) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); - } - } - obj8C->obj.rot.z += obj8C->unk_48; - if (gLevelType == LEVELTYPE_PLANET) { - obj8C->vel.y += 0.2f; - } -} - -void func_8007E330(Object_8C* obj8C) { - Graphics_SetScaleMtx(obj8C->scale2); - if (obj8C->unk_44 == 0) { - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, obj8C->unk_4A); - } else { - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); - } - gSPDisplayList(gMasterDisp++, D_2010A30); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E3E4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E45C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E5CC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E648.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E6B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007E93C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007EBB8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007ECB4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007ED54.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007EE68.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F04C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F11C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F20C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F2FC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F438.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F5AC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F6B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007F958.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007FBE0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007FD84.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8007FE88.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800802B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800802D8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800802F8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80080360.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8008040C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8008092C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80080ACC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80080D04.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800815DC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8008165C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80081A8C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80081B24.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80081BEC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80081C5C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80082F78.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800836C0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_8008377C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_800837EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80083B8C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80083C70.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80083D2C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/func_80083FA8.s") - -void func_80084194(Object_8C* obj8C) { - s32 tmp; - - if (gCurrentLevel != LEVEL_AQUAS) { - RCP_SetupDL(&gMasterDisp, 0x31); - Matrix_Scale(gGfxMatrix, obj8C->scale2, obj8C->scale2, obj8C->scale2, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - tmp = obj8C->unk_44 * 4; - gDPSetEnvColor(gMasterDisp++, D_800D18F0[tmp + 0], D_800D18F0[tmp + 1], D_800D18F0[tmp + 2], 255); - } else { - RCP_SetupDL(&gMasterDisp, 0x31); - Matrix_Scale(gGfxMatrix, obj8C->scale2, obj8C->scale2, obj8C->scale2, 1); - Matrix_SetGfxMtx(&gMasterDisp); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_800D1950[obj8C->unk_44]); - gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); - } - gSPDisplayList(gMasterDisp++, D_1024AC0); - RCP_SetupDL(&gMasterDisp, 0x40); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_77E40/D_800D7230.s") diff --git a/src/main/sf_hud.c b/src/main/sf_hud.c index 218f869e..532ef126 100644 --- a/src/main/sf_hud.c +++ b/src/main/sf_hud.c @@ -2224,123 +2224,123 @@ void func_80093310(void) { void func_800933D8(f32 x, f32 y, f32 z, f32 arg3) { s32 i; - Object_8C* obj8C = &gObjects8C[ARRAY_COUNT(gObjects8C) - 1]; + Effect* effect = &gEffects[ARRAY_COUNT(gEffects) - 1]; Player* player = gPlayer; for (i = 0; i < 100; i++) { - if (obj8C->obj.status == 0) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_363; - obj8C->obj.pos.x = x; - obj8C->obj.pos.y = y; - obj8C->obj.pos.z = z; + if (effect->obj.status == 0) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_363; + effect->obj.pos.x = x; + effect->obj.pos.y = y; + effect->obj.pos.z = z; if ((player->state_1C8 == PLAYERSTATE_1C8_2) && (gCurrentLevel == LEVEL_AQUAS) && (player->unk_1D0 < 2)) { - obj8C->scale1 = 0.4f; - obj8C->unk_44 = 0; - obj8C->unk_46 = 24; - obj8C->unk_48 = Rand_ZeroOne() * 4.0f; + effect->scale1 = 0.4f; + effect->unk_44 = 0; + effect->unk_46 = 24; + effect->unk_48 = Rand_ZeroOne() * 4.0f; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; + effect->unk_48 = -effect->unk_48; } } else { - obj8C->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; - obj8C->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; - obj8C->unk_48 = 0; + effect->vel.x = (Rand_ZeroOne() - 0.5f) * 5.0f; + effect->vel.y = (Rand_ZeroOne() - 0.5f) * 3.0f; + effect->unk_48 = 0; if (Rand_ZeroOne() < 0.5f) { - obj8C->unk_48 = -obj8C->unk_48; + effect->unk_48 = -effect->unk_48; } if (player->unk_1D0 >= 5) { - obj8C->unk_4A = 0x60; - obj8C->unk_46 = 4; + effect->unk_4A = 0x60; + effect->unk_46 = 4; } else { - obj8C->unk_4A = 0x80; - obj8C->unk_46 = 2; + effect->unk_4A = 0x80; + effect->unk_46 = 2; } } - obj8C->scale2 = arg3 * 0.2f; - obj8C->obj.rot.z = Rand_ZeroOne() * 360.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); + effect->scale2 = arg3 * 0.2f; + effect->obj.rot.z = Rand_ZeroOne() * 360.0f; + Object_SetInfo(&effect->info, effect->obj.id); break; } - obj8C--; + effect--; } } #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_800935E8.s") -void func_80094954(Object_8C* obj8C) { +void func_80094954(Effect* effect) { Player* player = gPlayer; if ((player->state_1C8 == PLAYERSTATE_1C8_2) && (gCurrentLevel == LEVEL_AQUAS) && (player->unk_1D0 < 2)) { - switch (obj8C->unk_4E) { + switch (effect->unk_4E) { case 0: - obj8C->unk_44 += obj8C->unk_46; - obj8C->unk_4A = obj8C->unk_44; - obj8C->scale2 += 0.01f; + effect->unk_44 += effect->unk_46; + effect->unk_4A = effect->unk_44; + effect->scale2 += 0.01f; - if (obj8C->unk_4A >= 200) { - obj8C->unk_4E = 1; - obj8C->unk_4A = 200; + if (effect->unk_4A >= 200) { + effect->unk_4E = 1; + effect->unk_4A = 200; } break; case 1: - obj8C->unk_4A -= obj8C->unk_46; - obj8C->scale2 -= 0.1f; + effect->unk_4A -= effect->unk_46; + effect->scale2 -= 0.1f; break; } - if ((obj8C->unk_4E == 1) && (obj8C->unk_4A <= 0)) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + if ((effect->unk_4E == 1) && (effect->unk_4A <= 0)) { + Object_Kill(&effect->obj, &effect->sfxPos); } - obj8C->vel.y += obj8C->scale1; - obj8C->scale1 -= 0.05f; + effect->vel.y += effect->scale1; + effect->scale1 -= 0.05f; - if (obj8C->scale1 < -1.0f) { - obj8C->scale1 = -1.0f; + if (effect->scale1 < -1.0f) { + effect->scale1 = -1.0f; } - obj8C->obj.rot.z += obj8C->unk_48; + effect->obj.rot.z += effect->unk_48; return; } if (player->state_1C8 == PLAYERSTATE_1C8_7) { - obj8C->obj.rot.x = player->unk_05C * 180.0f / M_PI; - obj8C->obj.rot.y = -player->unk_058 * 180.0f / M_PI; + effect->obj.rot.x = player->unk_05C * 180.0f / M_PI; + effect->obj.rot.y = -player->unk_058 * 180.0f / M_PI; } if (player->state_1C8 == PLAYERSTATE_1C8_6) { - obj8C->unk_46 = 2; + effect->unk_46 = 2; if (player->unk_1D0 >= 4) { - obj8C->vel.y -= 0.13f; + effect->vel.y -= 0.13f; } } - obj8C->scale2 += 0.8f; - obj8C->unk_4A -= obj8C->unk_46; + effect->scale2 += 0.8f; + effect->unk_4A -= effect->unk_46; - if ((obj8C->unk_4A < 0) || + if ((effect->unk_4A < 0) || ((player->state_1C8 == PLAYERSTATE_1C8_2) && (gCurrentLevel == LEVEL_AQUAS) && (player->unk_1D0 == 5))) { - Object_Kill(&obj8C->obj, &obj8C->sfxPos); + Object_Kill(&effect->obj, &effect->sfxPos); } - obj8C->obj.rot.z += obj8C->unk_48; + effect->obj.rot.z += effect->unk_48; } -void func_80094BBC(Object_8C* obj8C) { +void func_80094BBC(Effect* effect) { if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_2) && (gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].unk_1D0 < 2)) { RCP_SetupDL(&gMasterDisp, 0x44); - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 21, 34, obj8C->unk_4A); + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 21, 34, effect->unk_4A); gDPSetEnvColor(gMasterDisp++, 255, 255, 251, 0); - Graphics_SetScaleMtx(obj8C->scale2); + Graphics_SetScaleMtx(effect->scale2); gSPDisplayList(gMasterDisp++, D_1023750); } else { - Graphics_SetScaleMtx(obj8C->scale2); - gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, obj8C->unk_4A); + Graphics_SetScaleMtx(effect->scale2); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, effect->unk_4A); gSPDisplayList(gMasterDisp++, D_1023750); } } diff --git a/src/main/sys_math.c b/src/main/sys_math.c index eb8ef6a5..58f50661 100644 --- a/src/main/sys_math.c +++ b/src/main/sys_math.c @@ -1,5 +1,4 @@ #include "global.h" -#include "prevent_bss_reordering.h" s32 sSeededRandSeed3; s32 sRandSeed1; diff --git a/src/overlays/ovl_E16C50/fox_a6.c b/src/overlays/ovl_E16C50/fox_a6.c index 07e41180..e29f5c1f 100644 --- a/src/overlays/ovl_E16C50/fox_a6.c +++ b/src/overlays/ovl_E16C50/fox_a6.c @@ -183,24 +183,24 @@ void func_E16C50_801875E4(f32 xPos, f32 yPos, f32 zPos, f32 unk124y, f32 xRot, f } } -void func_E16C50_8018767C(Object_8C* obj8C) { - Object_8C_Initialize(obj8C); - obj8C->obj.status = 1; - obj8C->obj.id = OBJ_8C_395; - obj8C->obj.pos.x = gBosses[0].obj.pos.x; - obj8C->obj.pos.y = gBosses[0].obj.pos.y; - obj8C->obj.pos.z = gBosses[0].obj.pos.z + 250.0f; - obj8C->unk_4E = 8; - obj8C->scale2 = 1.0f; - Object_SetInfo(&obj8C->info, obj8C->obj.id); +void func_E16C50_8018767C(Effect* effect) { + Effect_Initialize(effect); + effect->obj.status = 1; + effect->obj.id = OBJ_EFFECT_395; + effect->obj.pos.x = gBosses[0].obj.pos.x; + effect->obj.pos.y = gBosses[0].obj.pos.y; + effect->obj.pos.z = gBosses[0].obj.pos.z + 250.0f; + effect->unk_4E = 8; + effect->scale2 = 1.0f; + Object_SetInfo(&effect->info, effect->obj.id); } void func_E16C50_80187704(void) { s32 i; - for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) { - if (gObjects8C[i].obj.status == 0) { - func_E16C50_8018767C(&gObjects8C[i]); + for (i = 0; i < ARRAY_COUNT(gEffects); i++) { + if (gEffects[i].obj.status == 0) { + func_E16C50_8018767C(&gEffects[i]); break; } } @@ -257,7 +257,7 @@ void func_E16C50_80187944(Boss* bossA6) { f32 sp114; f32 sp110; f32 sp10C; - Object_8C* temp_s0_3; + Effect* temp_s0_3; f32 sp104; Vec3f spC8[5]; Vec3f spA4[3]; @@ -744,7 +744,7 @@ void func_E16C50_80187944(Boss* bossA6) { } break; case 7: - temp_s0_3 = &gObjects8C[bossA6->swork[39]]; + temp_s0_3 = &gEffects[bossA6->swork[39]]; Math_SmoothStepToF(&D_E16C50_801C22F0.unk_28[0], 255.0f, 1.0f, 100.0f, 0.00001f); Math_SmoothStepToF(&D_E16C50_801C22F0.unk_28[2], 255.0f, 1.0f, 100.0f, 0.00001f); Math_SmoothStepToF(&D_E16C50_801C22F0.unk_28[1], 255.0f, 1.0f, 100.0f, 0.00001f); @@ -1392,9 +1392,9 @@ void func_E16C50_8018BCD4(Vec3f* arg0, f32 arg1, f32 arg2, Vec3f* arg3, s32 arg4 Matrix_Push(&gGfxMatrix); Matrix_Push(&gCalcMatrix); Matrix_Copy(gCalcMatrix, &gIdentityMatrix); - Matrix_RotateZ(gCalcMatrix, 0.017453292f * arg1, 1); + Matrix_RotateZ(gCalcMatrix, M_DTOR * arg1, 1); Matrix_Translate(gCalcMatrix, 0.0f, 100.0f, -223.0f, 1); - Matrix_RotateX(gCalcMatrix, 0.017453292f * arg2, 1); + Matrix_RotateX(gCalcMatrix, M_DTOR * arg2, 1); for (i = 0; i < arg6; i++) { Matrix_Push(&gGfxMatrix); Matrix_Push(&gCalcMatrix); @@ -1417,8 +1417,8 @@ void func_E16C50_8018BCD4(Vec3f* arg0, f32 arg1, f32 arg2, Vec3f* arg3, s32 arg4 } Matrix_Pop(&gGfxMatrix); Matrix_Pop(&gCalcMatrix); - Matrix_RotateY(gCalcMatrix, arg0[i].y * 0.017453292f, 1); - Matrix_RotateX(gCalcMatrix, arg0[i].x * 0.017453292f, 1); + Matrix_RotateY(gCalcMatrix, arg0[i].y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, arg0[i].x * M_DTOR, 1); Matrix_Translate(gCalcMatrix, 0.0f, 0.0f, arg5, 1); } Matrix_Pop(&gGfxMatrix); @@ -1441,9 +1441,9 @@ void func_E16C50_8018C0D0(f32* arg0, f32 arg1, Vec3f* arg2, f32 arg3, s32 arg4) Matrix_Push(&gCalcMatrix); Matrix_Copy(gCalcMatrix, &gIdentityMatrix); GCGM_BACK(); - Matrix_RotateZ(gCalcMatrix, (D_E16C50_801C22F0.unk_34 + arg1) * 0.017453292f, 1); + Matrix_RotateZ(gCalcMatrix, (D_E16C50_801C22F0.unk_34 + arg1) * M_DTOR, 1); Matrix_Translate(gCalcMatrix, 0.0f, -360.0f, 120.0f, 1); - Matrix_RotateX(gCalcMatrix, -(90.0f - arg3) * 0.017453292f, 1); + Matrix_RotateX(gCalcMatrix, -(90.0f - arg3) * M_DTOR, 1); Matrix_Scale(gCalcMatrix, 0.7f, 0.7f, 0.7f, 1); Matrix_SetGfxMtx(&gMasterDisp); for (i = 0; i < 5; i++) { @@ -1451,7 +1451,7 @@ void func_E16C50_8018C0D0(f32* arg0, f32 arg1, Vec3f* arg2, f32 arg3, s32 arg4) Matrix_Push(&gCalcMatrix); if (i == 4) { Matrix_RotateX(gCalcMatrix, 1.3962634f, 1); - Matrix_RotateX(gCalcMatrix, (90.0f - arg3) * 0.017453292f, 1); + Matrix_RotateX(gCalcMatrix, (90.0f - arg3) * M_DTOR, 1); Matrix_Scale(gCalcMatrix, var_fs3, var_fs3, 1.0f, 1); Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); Matrix_SetGfxMtx(&gMasterDisp); @@ -1466,7 +1466,7 @@ void func_E16C50_8018C0D0(f32* arg0, f32 arg1, Vec3f* arg2, f32 arg3, s32 arg4) gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 64, 64, 192); Matrix_Translate(gCalcMatrix, 0.0f, -60.0f, 0.0f, 1); Matrix_Scale(gCalcMatrix, 2.0f, 3.0f, 1.0f, 1); - Matrix_RotateY(gCalcMatrix, 0.017453292f * spAC, 1); + Matrix_RotateY(gCalcMatrix, M_DTOR * spAC, 1); Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_102F5E0); @@ -1475,7 +1475,7 @@ void func_E16C50_8018C0D0(f32* arg0, f32 arg1, Vec3f* arg2, f32 arg3, s32 arg4) Matrix_Pop(&gGfxMatrix); Matrix_Translate(gCalcMatrix, 0.0f, -120.0f, 0.0f, 1); Matrix_RotateX(gCalcMatrix, -0.34906584f, 1); - Matrix_RotateZ(gCalcMatrix, arg0[i] * 0.017453292f, 1); + Matrix_RotateZ(gCalcMatrix, arg0[i] * M_DTOR, 1); } Matrix_Pop(&gCalcMatrix); Matrix_Pop(&gGfxMatrix); @@ -1495,7 +1495,7 @@ void func_E16C50_8018C54C(Boss* bossA6) { gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, (s32) D_E16C50_801C22F0.unk_24); gDPSetEnvColor(gMasterDisp++, 255, 255, 0, 255); Matrix_Scale(gGfxMatrix, 10.0f, 10.0f, 10.0f, 1); - Matrix_RotateZ(gGfxMatrix, bossA6->fwork[0x21] * 0.017453292f, 1); + Matrix_RotateZ(gGfxMatrix, bossA6->fwork[0x21] * M_DTOR, 1); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_101C2E0); } else if (D_E16C50_801C22F0.unk_24 != 0.0f) { @@ -1508,13 +1508,13 @@ void func_E16C50_8018C54C(Boss* bossA6) { spAC.x = 0.0f; } spAC.y = spAC.z = 0.0f; - Matrix_RotateZ(gCalcMatrix, gFrameCount * 6.0f * 0.017453292f, 0); + Matrix_RotateZ(gCalcMatrix, gFrameCount * 6.0f * M_DTOR, 0); Matrix_MultVec3f(gCalcMatrix, &spAC, &spB8); Matrix_Translate(gGfxMatrix, spB8.x, spB8.y, 0.0f, 1); Matrix_Scale(gGfxMatrix, bossA6->unk_3F8, bossA6->unk_3F8, bossA6->unk_3F8, 1); - Matrix_RotateZ(gGfxMatrix, gFrameCount * 10.0f * 0.017453292f, 1); + Matrix_RotateZ(gGfxMatrix, gFrameCount * 10.0f * M_DTOR, 1); Matrix_Scale(gGfxMatrix, bossA6->fwork[0x22], bossA6->fwork[0x23], 1.0f, 1); - Matrix_RotateZ(gGfxMatrix, -(f32) gFrameCount * 10.0f * 0.017453292f, 1); + Matrix_RotateZ(gGfxMatrix, -(f32) gFrameCount * 10.0f * M_DTOR, 1); Matrix_Scale(gGfxMatrix, bossA6->fwork[0x22], bossA6->fwork[0x23], 1.0f, 1); } else { RCP_SetupDL(&gMasterDisp, 0x1B); @@ -1533,9 +1533,9 @@ void func_E16C50_8018C54C(Boss* bossA6) { for (i = 0; i < 3; i++) { if ((bossA6->swork[33 + i] == 0) && (bossA6->unk_04E != 3) && (D_E16C50_801C2250.unk_00[2 + i] == 0) && !(gFrameCount & 3) && (bossA6->swork[0x1B + i] != 0) && (D_80177854 != 0x64)) { - Matrix_RotateY(gCalcMatrix, bossA6->obj.rot.y * 0.017453292f, 0); - Matrix_RotateX(gCalcMatrix, bossA6->obj.rot.x * 0.017453292f, 1); - Matrix_RotateZ(gCalcMatrix, bossA6->obj.rot.z * 0.017453292f, 1); + Matrix_RotateY(gCalcMatrix, bossA6->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, bossA6->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, bossA6->obj.rot.z * M_DTOR, 1); Matrix_MultVec3f(gCalcMatrix, &bossA6->vwork[1 + i], &spC4); func_8007D0E0(bossA6->obj.pos.x + spC4.x, bossA6->obj.pos.y + spC4.y, bossA6->obj.pos.z + spC4.z, 20.0f); @@ -1789,8 +1789,8 @@ void func_E16C50_8018D920(Vec3f* arg0) { Vec3f sp50; Vec3f sp44; - Matrix_RotateY(gCalcMatrix, 0.017453292f * sp60, 0); - Matrix_RotateX(gCalcMatrix, 0.017453292f * sp5C, 1); + Matrix_RotateY(gCalcMatrix, M_DTOR * sp60, 0); + Matrix_RotateX(gCalcMatrix, M_DTOR * sp5C, 1); sp50.x = 0.0f; sp50.y = 0.0f; sp50.z = 100.0f; @@ -1811,11 +1811,11 @@ void func_E16C50_8018DA58(Object_2F4* obj2F4) { switch (obj2F4->unk_0B8) { /* irregular */ case 1: obj2F4->unk_130 += 2.5f; - obj2F4->unk_0F4.z = __sinf(obj2F4->unk_130 * 0.017453292f) * 10.0f; + obj2F4->unk_0F4.z = __sinf(obj2F4->unk_130 * M_DTOR) * 10.0f; obj2F4->unk_134 += 1.0f; - obj2F4->obj.pos.y += __sinf(obj2F4->unk_134 * 0.017453292f) * 1.5f; + obj2F4->obj.pos.y += __sinf(obj2F4->unk_134 * M_DTOR) * 1.5f; obj2F4->unk_138 += 1.0f; - obj2F4->obj.pos.z += __cosf(obj2F4->unk_138 * 0.017453292f) * 1.5f; + obj2F4->obj.pos.z += __cosf(obj2F4->unk_138 * M_DTOR) * 1.5f; break; case 2: Math_SmoothStepToF(&obj2F4->unk_0F4.z, -180.0f, 0.1f, 3.0f, 0.0f); @@ -1874,8 +1874,8 @@ void func_E16C50_8018DA58(Object_2F4* obj2F4) { case 90: break; } - Matrix_RotateY(gCalcMatrix, (obj2F4->unk_0F4.y + 180.0f) * 0.017453292f, 0); - Matrix_RotateX(gCalcMatrix, -(obj2F4->unk_0F4.x * 0.017453292f), 1); + Matrix_RotateY(gCalcMatrix, (obj2F4->unk_0F4.y + 180.0f) * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -(obj2F4->unk_0F4.x * M_DTOR), 1); sp5C.x = 0.0f; sp5C.y = 0.0f; sp5C.z = obj2F4->unk_114; @@ -1937,7 +1937,7 @@ void func_E16C50_8018DF74(Player* player) { sp74.y = 0.0f; sp74.z = D_80177A48[5]; Matrix_Translate(gCalcMatrix, 0.0f, 350.0f, D_80177A48[6], 0); - Matrix_RotateY(gCalcMatrix, -(D_80177A48[4] * 0.017453292f), 1); + Matrix_RotateY(gCalcMatrix, -(D_80177A48[4] * M_DTOR), 1); Matrix_MultVec3f(gCalcMatrix, &sp74, &sp68); D_80177978 = sp68.x; D_80177980 = sp68.y; @@ -2063,8 +2063,8 @@ void func_E16C50_8018DF74(Player* player) { func_800A6148(); break; } - Matrix_RotateY(gCalcMatrix, (player->unk_0E8 + player->unk_114 + 180.0f) * 0.017453292f, 0); - Matrix_RotateX(gCalcMatrix, -(player->unk_0E4 * 0.017453292f), 1); + Matrix_RotateY(gCalcMatrix, (player->unk_0E8 + player->unk_114 + 180.0f) * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -(player->unk_0E4 * M_DTOR), 1); if (player->state_1C8 != PLAYERSTATE_1C8_3) { sp74.x = 0.0f; sp74.y = 0.0f; @@ -2326,7 +2326,7 @@ void func_E16C50_8018ED78(Player* player) { sp78.y = 0.0f; sp78.z = D_80177A48[5]; Matrix_Translate(gCalcMatrix, D_80177A48[1], 0.0f, D_80177A48[3] + D_80177D20, 0); - Matrix_RotateY(gCalcMatrix, -(D_80177A48[4] * 0.017453292f), 1); + Matrix_RotateY(gCalcMatrix, -(D_80177A48[4] * M_DTOR), 1); Matrix_MultVec3f(gCalcMatrix, &sp78, &sp6C); player->camEye.x = D_80177978 = sp6C.x; player->camEye.y = D_80177980 = sp6C.y; @@ -2410,8 +2410,8 @@ void func_E16C50_8018ED78(Player* player) { if (D_80177A80 >= 1076) { Math_SmoothStepToF(&player->unk_0D0, 50.0f, 0.1f, 1000.0f, 0.001f); } - Matrix_RotateY(gCalcMatrix, (player->unk_0E8 + player->unk_114 + 180.0f) * 0.017453292f, 0); - Matrix_RotateX(gCalcMatrix, -(player->unk_0E4 * 0.017453292f), 1); + Matrix_RotateY(gCalcMatrix, (player->unk_0E8 + player->unk_114 + 180.0f) * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -(player->unk_0E4 * M_DTOR), 1); sp78.x = 0.0f; sp78.y = 0.0f; sp78.z = player->unk_0D0; diff --git a/src/overlays/ovl_E16C50/sf_aq.c b/src/overlays/ovl_E16C50/sf_aq.c index a9e40284..bc33e1ab 100644 --- a/src/overlays/ovl_E16C50/sf_aq.c +++ b/src/overlays/ovl_E16C50/sf_aq.c @@ -1,6 +1,6 @@ #include "global.h" -void func_E16C50_801AC918(Object_8C*); +void func_E16C50_801AC918(Effect*); void func_E16C50_801AD6C0(Object_2F4*); void func_E16C50_801AE168(Object_2F4*); void func_E16C50_801AE3D8(Object_2F4*); @@ -293,7 +293,7 @@ f32 D_E16C50_801C445C; #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_aq/func_E16C50_801AC8A8.s") -// OBJ_8C_366 action +// OBJ_EFFECT_366 action #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_aq/func_E16C50_801AC918.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_aq/func_E16C50_801ACBB4.s") diff --git a/src/overlays/ovl_E16C50/sf_so.c b/src/overlays/ovl_E16C50/sf_so.c index 79177876..9da8bc4c 100644 --- a/src/overlays/ovl_E16C50/sf_so.c +++ b/src/overlays/ovl_E16C50/sf_so.c @@ -6,8 +6,8 @@ void func_E16C50_8019EA7C(Object_2F4*); void func_E16C50_8019F20C(Object_2F4*); void func_E16C50_8019F7AC(Object_2F4*); void func_E16C50_801A003C(Object_2F4*); -void func_E16C50_801A0120(Object_8C*); -void func_E16C50_801A0AF0(Object_8C*); +void func_E16C50_801A0120(Effect*); +void func_E16C50_801A0AF0(Effect*); void func_E16C50_801A1F80(Boss* bossSO); void func_E16C50_801A23F4(Boss* bossSO); @@ -125,10 +125,10 @@ s32 D_E16C50_801C27A0[8]; // unused? part of previous? // OBJ_2F4_279 action #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_so/func_E16C50_801A003C.s") -// OBJ_8C_392 action +// OBJ_EFFECT_392 action #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_so/func_E16C50_801A0120.s") -// OBJ_8C_392 draw +// OBJ_EFFECT_392 draw #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_so/func_E16C50_801A0AF0.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_E16C50/sf_so/func_E16C50_801A0CEC.s") diff --git a/tools/fixfloats.py b/tools/fixfloats.py new file mode 100755 index 00000000..8818a1fd --- /dev/null +++ b/tools/fixfloats.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python3 + +import os +import re +import struct +import math +from collections import Counter +import argparse + +def removepower(f, n): + if(n <= 1): + return f + t = f + while t % n == 0: + t /= n + return t + +def rationalcheck(f, dmax, tol=23): + for den in range(1, dmax+1): + num = f * den + if round(num,0) > 0: + error = abs(math.log(num/round(num,0))) + else: + error = 1 + if(error == 0 or -math.log2(error) > tol): #and (den % 10 == 0 or den % 0x10 == 0)): + if(removepower(den, 10) < 20 or removepower(den, 16) < 20): + print(f, int(round(num,0)), den, hex(den), math.floor(-math.log2(error)) if error != 0 else 0) + break + return 0 + +def findallfloats(path, odd=True, off=True): + numfilesodd = 0 + numfilesoff = 0 + for subdir, dirs, files in os.walk(path): + for filename in files: + filepath = subdir + os.sep + filename + if(filename.endswith('.c')): # and 'data' not in filename): + numodd, allodd, numoff, alloff = findoddfloats(filepath) + if(odd and numodd > 0): + print(filepath,'has', ('an ' if numodd == 1 else '') + 'odd float' + ('' if numodd == 1 else 's') + ':') + # print(set(allodd)) + # breakpoint() + [rationalcheck(float(x.strip('f')), 1000) for x in set(allodd)] + numfilesodd += 1 + if(off and numoff > 0): + print(filepath,'has', ('an ' if numoff == 1 else '') + 'off float' + ('' if numoff == 1 else 's') + ':') + print(set(alloff)) + [rationalcheck(float(x[0].strip('f')), 1000, 22) for x in set(alloff)] + numfilesoff += 1 + return numfilesodd, numfilesoff + +def roundallfloats(path): + for subdir, dirs, files in os.walk(path): + for filename in files: + filepath = subdir + os.sep + filename + if filename.endswith('.c'): + numodd, numob1 = roundfloats(filepath) + if(numodd > 0): + print(filepath,'has', ('a ' if numodd == 1 else '') + 'fixable float' + ('' if numodd == 1 else 's')) + # print(allodd) + if(numob1 > 0): + print(filepath,'has', ('a ' if numob1 == 1 else '') + 'off-by-1 float' + ('' if numob1 == 1 else 's')) + return 0 + +def roundfloats(src): + floatmatch = re.compile('[0-9][0-9]*\.[0-9][0-9]*f') + numfix = 0 + numob1 = 0 + with open(src,'r',encoding='utf-8',newline='\n') as srcfile: + srcdata = srcfile.readlines() + for i, line in enumerate(srcdata): + floats = floatmatch.findall(line) + fixline = line + for f in floats: + fn = float(f.strip('f')) + rfn, ob1 = roundfloat(fn) + rf = str(rfn) + 'f' + if(fn != rfn): + numfix += 1 + if('data' not in src): + print(src, 'line', i, ':', f, 'to', rf) + fixline = fixline.replace(f, rf) + # if(ob1): + # numob1 += 1 + # print(src, 'line', i, ':', f, 'off-by-1') + + srcdata[i] = fixline + if(numfix > 0): + with open(src, 'w', encoding='utf-8',newline='\n') as outfile: + outfile.writelines(srcdata) + + return numfix, numob1 + + +def findoddfloats(src): + floatmatch = re.compile('[0-9]*\.[0-9]*f') + numodd = 0 + numoff = 0 + allodd = [] + alloff = [] + with open(src,'r',encoding='utf-8') as srcfile: + for i, line in enumerate(srcfile): + floats = floatmatch.findall(line) + print("all") + print(floats) + oddfloats = [x for x in floats if (isoddfloat(x) and offby(x) >= 10)] + print("odd") + print(oddfloats) + offfloats = [(x, offby(x)) for x in floats if (isoddfloat(x) and offby(x) < 10)] + print("offfloats") + print(offfloats) + numodd += len(oddfloats) + numoff += len(offfloats) + alloff += offfloats + allodd += oddfloats + return numodd, allodd, numoff, alloff + +def isoddfloat(floatstr): + return len(floatstr.strip('f').replace('.','').strip('0')) >= 7 + +def offby(floatstr): + val = float(floatstr.strip('f')) + fbytes = struct.pack(">f", val) + i = -math.floor(math.log10(val)) + offvals = [] + while(struct.pack(">f",round(val,i)) != fbytes): + fi = struct.unpack(">i",fbytes)[0] + rfi = struct.unpack(">i",struct.pack(">f",round(val,i-1)))[0] + + offvals += [abs(fi - rfi)] + + i += 1 + + if(offvals[-1] <= 2 and offvals[-2] <= 2): + return offvals[-1] + + counter = Counter(offvals) + + if(not counter.values()): + return 1000000 + + if(max(counter.values()) >= 3): + mode = min([item for item, count in counter.items() if count == max(counter.values())]) + return mode + else: + return 1000000 + +def roundfloat(val): + fbytes = struct.pack(">f", val) + i = 0 + offby1 = False + while(struct.pack(">f",round(val,i)) != fbytes): + fi = struct.unpack(">i",fbytes)[0] + rfi = struct.unpack(">i",struct.pack(">f",round(val,i)))[0] + if(fi - rfi == 1 or fi - rfi == -1): + offby1 = True + i += 1 + return round(val, i), offby1 + +parser = argparse.ArgumentParser(description='Analyze floats in a project\'s source') +parser.add_argument('src', help="source file or directory to analyze") +parser.add_argument('-r', action='store_true',help='round all floats to minimum precision') +parser.add_argument('-d', action="store_true",help='Apply to a directory') +# parser.add_argument('-v', action='store_true',help='show what changes are made') + +if __name__ == '__main__': + args = parser.parse_args() + + if(args.r): + if(args.d): + roundallfloats(args.src) + else: + roundfloats(args.src) + if(args.d): + findallfloats(args.src) + else: + findoddfloats(args.src) \ No newline at end of file diff --git a/tools/m2c b/tools/m2c new file mode 160000 index 00000000..0514701e --- /dev/null +++ b/tools/m2c @@ -0,0 +1 @@ +Subproject commit 0514701ef53ce46e91e4e675455c44647714d014 diff --git a/yamls/us/main.yaml b/yamls/us/main.yaml index c7559272..5c01eb2d 100644 --- a/yamls/us/main.yaml +++ b/yamls/us/main.yaml @@ -182,7 +182,7 @@ - [0x5A2C0, c, fox_edisplay] - [0x61B30, c, fox_enmy] - [0x6B3B0, c, fox_enmy2] - - [0x77E40, c, sf_77E40] + - [0x77E40, c, fox_effect] - [0x84F70, c, fox_fade] - [0x852F0, c, fox_852F0] - [0x85530, c, sf_hud] @@ -275,7 +275,7 @@ - [0xD0570, .data, fox_edisplay] - [0xD09A0, .data, fox_enmy] - [0xD0B80, .data, fox_enmy2] - - [0xD20E0, data, sf_77E40] + - [0xD20E0, .data, fox_effect] - [0xD2570, data, sf_hud] - [0xD31D0, .data, fox_std_lib] - [0xD3460, .data, fox_game] @@ -299,7 +299,7 @@ - [0xD6C20, .rodata, fox_edisplay] - [0xD6FD0, .rodata, fox_enmy] - [0xD7650, .rodata, fox_enmy2] - - [0xD7E30, .rodata, sf_77E40] + - [0xD7E30, .rodata, fox_effect] - [0xD82F0, .rodata, fox_fade] - [0xD8320, .rodata, sf_hud] - [0xD8DE0, .rodata, fox_97F80]