diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 07e283841a..935cec70fc 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1087,7 +1087,7 @@ - + @@ -1112,10 +1112,10 @@ - - - - + + + + diff --git a/include/functions.h b/include/functions.h index f2a4751fc8..285ef524ba 100644 --- a/include/functions.h +++ b/include/functions.h @@ -562,7 +562,6 @@ void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); // void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void EffectSsIcePiece_SpawnBurst(void); -// void EffectSsEnIce_SpawnFlyingVec3f(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, Color_RGBA8* pzParm4, Color_RGBA8* param_5, UNK_TYPE4 param_6); void func_800B2B44(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); // void func_800B2B7C(void); void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); diff --git a/spec b/spec index 851d5c40e0..3dd1140c37 100644 --- a/spec +++ b/spec @@ -1908,8 +1908,7 @@ beginseg name "ovl_Effect_Ss_En_Ice" compress include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.data.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice_reloc.o" endseg beginseg diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ae42cc1e3d..9ca8ffd6e0 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4544,7 +4544,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0, (gameplayFrames * 2) & 0xFF, 64, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); effectAlphaScaled = effectAlpha * 255.0f; @@ -4575,7 +4575,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceVtxDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); } limbPos = limbPosStart; // reset limbPos diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index f9592478e2..7a56a6732a 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -780,15 +780,15 @@ void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) { // EffectSsEnIce Spawn Functions -void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, - f32 scale) { +void EffectSsEnIce_SpawnFlying(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, + f32 scale) { EffectSsEnIceInitParams initParams; initParams.actor = actor; Math_Vec3f_Copy(&initParams.pos, pos); Color_RGBA8_Copy(&initParams.primColor, prim); Color_RGBA8_Copy(&initParams.envColor, env); - initParams.type = 0; + initParams.type = ENICE_TYPE_FLYING; initParams.scale = scale; if (actor != NULL) { @@ -802,7 +802,7 @@ void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) { static Color_RGBA8 primColor = { 150, 150, 150, 250 }; static Color_RGBA8 envColor = { 235, 245, 255, 255 }; - EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale); + EffectSsEnIce_SpawnFlying(play, actor, pos, &primColor, &envColor, scale); } void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) { @@ -823,7 +823,7 @@ void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.scale = scale; initParams.life = life; - initParams.type = 1; + initParams.type = ENICE_TYPE_NORMAL; EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams); } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 1019062c66..395302b483 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1082,7 +1082,7 @@ void func_80A137C0(EnGo* this, PlayState* play, f32 arg2, f32 arg3) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)arg3); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 45503c0def..0210b5ba78 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -354,7 +354,7 @@ void ObjIcePoly_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, 0, (play->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_148); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index aa5ec51402..7d6cf277cd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -1,30 +1,157 @@ /* * File: z_eff_ss_en_ice.c * Overlay: ovl_Effect_Ss_En_Ice - * Description: + * Description: Ice clumps */ #include "z_eff_ss_en_ice.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rLifespan regs[0] +#define rYaw regs[1] +#define rPitch regs[2] +#define rRotSpeed regs[3] +#define rPrimColorR regs[4] +#define rPrimColorG regs[5] +#define rPrimColorB regs[6] +#define rPrimColorA regs[7] +#define rEnvColorR regs[8] +#define rEnvColorG regs[9] +#define rEnvColorB regs[10] +#define rAlphaMode regs[11] +#define rScale regs[12] #define PARAMS ((EffectSsEnIceInitParams*)initParamsx) -s32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void func_8097F62C(PlayState* play, u32 index, EffectSs* this); -void func_8097F7EC(PlayState* play, u32 index, EffectSs* this); +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; -#endif +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsEnIceInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Init.s") + if (initParams->type == ENICE_TYPE_FLYING) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Draw.s") + if (initParams->actor != NULL) { + Math_Vec3f_Diff(&this->pos, &initParams->actor->world.pos, &this->vec); + } else { + Math_Vec3f_Copy(&this->vec, &initParams->pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F62C.s") + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = 10; + this->actor = initParams->actor; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_UpdateFlying; + this->rScale = initParams->scale * 100.0f; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rAlphaMode = 1; + this->rPitch = randPlusMinusPoint5Scaled(0x10000); + } else if (initParams->type == ENICE_TYPE_NORMAL) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->vec, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &initParams->velocity); + Math_Vec3f_Copy(&this->accel, &initParams->accel); + this->life = initParams->life; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_Update; + this->rLifespan = initParams->life; + this->rScale = initParams->scale * 100.0f; + this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x); + this->rPitch = 0; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rAlphaMode = 0; + } else { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F7EC.s") + return 1; +} + +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; + f32 scale = this->rScale * 0.01f; + u32 gameplayFrames = play->gameplayFrames; + f32 alpha; + + OPEN_DISPS(gfxCtx); + + if (this->rAlphaMode != 0) { + alpha = this->life * 12.0f; + } else if ((this->rLifespan > 0) && (this->life < (this->rLifespan >> 1))) { + alpha = (this->life * 2.0f) / this->rLifespan; + alpha *= 255.0f; + } else { + alpha = 255.0f; + } + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_RotateYS(this->rYaw, MTXMODE_APPLY); + Matrix_RotateXS(this->rPitch, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + func_8012C2DC(play->state.gfxCtx); + func_800BCC68(&this->pos, play); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, + (gameplayFrames * 2) & 0xFF, 0x40, 0x20)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, + this->rPrimColorA); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, (u32)alpha); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { + s16 rand; + + if ((this->actor != NULL) && (this->actor->update != NULL)) { + if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) { + Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos); + this->life++; + } else if (this->life == 9) { + this->accel.x = Math_SinS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } else { + this->actor = NULL; + if (this->life >= 9) { + rand = randPlusMinusPoint5Scaled(0xFFFF); + this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f); + this->life = 8; + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } +} + +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { + this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing +} diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index ed0c6d4573..46b162cc13 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -3,6 +3,11 @@ #include "global.h" +typedef enum EffectSsEnIceType { + /* 0 */ ENICE_TYPE_FLYING, + /* 1 */ ENICE_TYPE_NORMAL +} EffectSsEnIceType; + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 8b59e40fa0..32d457d74e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -71,7 +71,7 @@ void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, gEffIceFragmentDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL); CLOSE_DISPS(gfxCtx); } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 2a21ef0e3d..63cabb66c6 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -635,7 +635,7 @@ 0x800B2810:("EffectSsKakera_Spawn",), 0x800B28C8:("EffectSsIcePiece_Spawn",), 0x800B2930:("EffectSsIcePiece_SpawnBurst",), - 0x800B2AC4:("EffectSsEnIce_SpawnFlyingVec3f",), + 0x800B2AC4:("EffectSsEnIce_SpawnFlying",), 0x800B2B44:("func_800B2B44",), 0x800B2B7C:("func_800B2B7C",), 0x800B2BC0:("EffectSsEnIce_Spawn",), @@ -8221,8 +8221,8 @@ 0x8097F020:("EffectSsIcePiece_Update",), 0x8097F0D0:("EffectSsEnIce_Init",), 0x8097F2F0:("EffectSsEnIce_Draw",), - 0x8097F62C:("func_8097F62C",), - 0x8097F7EC:("func_8097F7EC",), + 0x8097F62C:("EffectSsEnIce_UpdateFlying",), + 0x8097F7EC:("EffectSsEnIce_Update",), 0x8097F880:("EffectSsFireTail_Init",), 0x8097F99C:("EffectSsFireTail_Draw",), 0x8097FE8C:("EffectSsFireTail_Update",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index cb8e980c2e..35f03b8086 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -149,7 +149,7 @@ asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsSolderSrchBall_Spaw asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKakera_Spawn.s,EffectSsKakera_Spawn,0x800B2810,0x2E asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_Spawn.s,EffectSsIcePiece_Spawn,0x800B28C8,0x1A asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_SpawnBurst.s,EffectSsIcePiece_SpawnBurst,0x800B2930,0x65 -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlyingVec3f.s,EffectSsEnIce_SpawnFlyingVec3f,0x800B2AC4,0x20 +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlying.s,EffectSsEnIce_SpawnFlying,0x800B2AC4,0x20 asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B44.s,func_800B2B44,0x800B2B44,0xE asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B7C.s,func_800B2B7C,0x800B2B7C,0x11 asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_Spawn.s,EffectSsEnIce_Spawn,0x800B2BC0,0x22 diff --git a/undefined_syms.txt b/undefined_syms.txt index 4ea51aaf00..f051b4470a 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -431,8 +431,6 @@ D_0403F230 = 0x0403F230; D_04044300 = 0x04044300; D_0404F250 = 0x0404F250; D_04050550 = 0x04050550; -D_04050648 = 0x04050648; -D_040506E0 = 0x040506E0; D_04050D10 = 0x04050D10; D_040510B0 = 0x040510B0; D_04051180 = 0x04051180;