From 9633d9b7e9b0d84d5a647226ad38dba1683007a4 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Sat, 14 Jun 2025 07:44:06 -0400 Subject: [PATCH] Implement & link ef_kaze --- configure.py | 2 +- include/audio_defs.h | 1 + src/effect/ef_kaze.c | 89 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index d25bffee..5712adb5 100644 --- a/configure.py +++ b/configure.py @@ -1278,7 +1278,7 @@ config.libs = [ Object(Matching, "effect/ef_kantanhu.c"), Object(Matching, "effect/ef_kasamizu.c"), Object(Matching, "effect/ef_kasamizutama.c"), - Object(NonMatching, "effect/ef_kaze.c"), + Object(Matching, "effect/ef_kaze.c"), Object(NonMatching, "effect/ef_kaze_happa.c"), Object(Matching, "effect/ef_kigae.c"), Object(Matching, "effect/ef_kigae_light.c"), diff --git a/include/audio_defs.h b/include/audio_defs.h index e34d3571..09e1a9c0 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -197,6 +197,7 @@ typedef enum audio_sound_effects { NA_SE_TREE_TOUCH = 0x134, NA_SE_TREE_YURASU, + NA_SE_KAZE = 0x13A, NA_SE_PUN_YUGE = 0x13B, NA_SE_DOYON = 0x13F, diff --git a/src/effect/ef_kaze.c b/src/effect/ef_kaze.c index 8e4d81c1..6b414de9 100644 --- a/src/effect/ef_kaze.c +++ b/src/effect/ef_kaze.c @@ -1,5 +1,10 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_rcp.h" +#include "m_debug.h" + static void eKZ_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKZ_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKZ_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +22,94 @@ eEC_PROFILE_c iam_ef_kaze = { // clang-format on }; +typedef struct { + s16 angle; +} eKZ_dt_c; + static void eKZ_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eKZ_dt_c data; + + data.angle = angle; + eEC_CLIP->make_effect_proc(eEC_EFFECT_KAZE, pos, NULL, game, &data, item_name, prio, 0, 0); } static void eKZ_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + eKZ_dt_c* data_p = (eKZ_dt_c*)ct_arg; + GAME_PLAY* play = (GAME_PLAY*)game; + u16 angle = data_p->angle - DIFF_SHORT_ANGLE((s16)getCamera2AngleY(play), DEG2SHORT_ANGLE2(-180.0f)); + + effect->effect_specific[1] = angle; + effect->offset.x = 0.0f; + effect->offset.y = -3.0f; + effect->offset.z = 24.0f; + + effect->timer = 100; + + if (angle >= DEG2SHORT_ANGLE2(90.0f) && angle <= DEG2SHORT_ANGLE2(270.0f)) { + effect->effect_specific[0] = 1; + } else { + effect->effect_specific[0] = 0; + } + + effect->scale.x = 0.063f; + effect->scale.y = 0.021f; + effect->scale.z = 0.021f; + sAdo_OngenTrgStart(NA_SE_KAZE, &effect->position); } static void eKZ_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + if (effect->timer == 64 && eEC_CLIP != NULL) { + xyz_t pos = effect->position; + + pos.y += -10.0f; + pos.z += 10.0f; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_KAZE_HAPPA, pos, effect->prio, effect->effect_specific[1], game, effect->item_name, 0, 0); + } } +extern EVW_ANIME_DATA ef_kaze01_evw_anime; +extern Gfx ef_kaze01_modelT[]; +extern Gfx ef_kaze01_modelT2[]; + static void eKZ_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + s16 counter = 100 - effect->timer; + u8 a; + f32 scale; + + if (counter <= 9) { + a = (int)eEC_CLIP->calc_adjust_proc(counter, 0, 18, 0.0f, 150.0f); + } else if (counter < 80) { + a = 150; + } else { + a = (int)eEC_CLIP->calc_adjust_proc(counter, 80, 98, 150.0f, 0.0f); + } + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0); + Matrix_mult(&play->billboard_matrix, 1); + Matrix_translate(effect->offset.x, effect->offset.y, effect->offset.z, 1); + + if (effect->effect_specific[0] == 0) { + Matrix_RotateZ(DEG2SHORT_ANGLE2(-11.25f), 1); + } else { + Matrix_RotateZ(DEG2SHORT_ANGLE2(11.25f), 1); + } + + scale = GETREG(MYKREG, 27) * 0.01f + 1.0f; + Matrix_scale(effect->scale.x * scale, effect->scale.y * scale, effect->scale.z * scale, 1); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Evw_Anime_Set(play, &ef_kaze01_evw_anime); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, a); + if (effect->effect_specific[0] == 0) { + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_kaze01_modelT); + } else { + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_kaze01_modelT2); + } + + CLOSE_DISP(game->graph); }