From 472b8c87ffdef9133d61831390271fed0ab0c5e9 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 14:50:57 -0400 Subject: [PATCH 1/9] Match ef_furo_yuge --- configure.py | 2 +- src/effect/ef_furo_yuge.c | 116 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 111 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 4e1a7f33..ce879650 100644 --- a/configure.py +++ b/configure.py @@ -1253,7 +1253,7 @@ config.libs = [ Object(Matching, "effect/ef_effect_control.c"), Object(Matching, "effect/ef_flash.c"), Object(Matching, "effect/ef_footprint.c"), - Object(NonMatching, "effect/ef_furo_yuge.c"), + Object(Matching, "effect/ef_furo_yuge.c"), Object(NonMatching, "effect/ef_gimonhu.c"), Object(NonMatching, "effect/ef_goki.c"), Object(NonMatching, "effect/ef_ha.c"), diff --git a/src/effect/ef_furo_yuge.c b/src/effect/ef_furo_yuge.c index e526265d..dc2188cf 100644 --- a/src/effect/ef_furo_yuge.c +++ b/src/effect/ef_furo_yuge.c @@ -1,12 +1,30 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_debug.h" + +// Furo Yuge == Bath Steam + +#define EFFECT_STAGE1 41 +#define EFFECT_FADEOUT 3 +#define EFFECT_LIFETIME (EFFECT_STAGE1 + EFFECT_FADEOUT) static void eFuro_Yuge_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eFuro_Yuge_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eFuro_Yuge_mv(eEC_Effect_c* effect, GAME* game); static void eFuro_Yuge_dw(eEC_Effect_c* effect, GAME* game); +// clang-format off + +extern Gfx ef_dust01_0[], ef_dust01_1[], ef_dust01_2[], ef_dust01_3[], ef_dust01_modelT[]; + +Gfx* eFuro_Yuge_texture_table[] = { + ef_dust01_0, + ef_dust01_1, + ef_dust01_2, + ef_dust01_3 +}; + eEC_PROFILE_c iam_ef_furo_yuge = { - // clang-format off &eFuro_Yuge_init, &eFuro_Yuge_ct, &eFuro_Yuge_mv, @@ -14,21 +32,107 @@ eEC_PROFILE_c iam_ef_furo_yuge = { eEC_IGNORE_DEATH, eEC_NO_CHILD_ID, eEC_IGNORE_DEATH_DIST, - // clang-format on }; +u8 eFuro_Yuge_2tile_texture_idx[][2] = { + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 1 }, + { 0, 1 }, + { 0, 1 }, + { 1, 1 }, + { 1, 2 }, + { 1, 2 }, + { 1, 2 }, + { 2, 2 }, + { 2, 3 }, + { 2, 3 }, + { 2, 3 }, + { 3, 3 }, + { 3, 3 }, + { 3, 3 }, + { 3, 3 }, + { 3, 3 } +}; + +u8 eFuro_Yuge_prim_f[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 64, + 128, + 192, + 0, + 64, + 128, + 192, + 0, + 64, + 128, + 192, + 0, + 0, + 0, + 0, + 0 +}; + +// clang-format on + static void eFuro_Yuge_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->make_effect_proc(eEC_EFFECT_FURO_YUGE, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eFuro_Yuge_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + qrand(); + effect->position.y += GETREG(TAKREG, 0x34) + 1.f; + effect->scale.x = effect->scale.y = effect->scale.z = GETREG(TAKREG, 0x37) * 0.0001f + 0.001f; + effect->timer = EFFECT_LIFETIME; + effect->acceleration = ZeroVec; + effect->acceleration.y = GETREG(TAKREG, 0x32) * 0.001f + 0.05f; + effect->velocity = ZeroVec; + effect->position.x += RANDOM2_F(effect->arg0); + effect->position.z += RANDOM2_F(effect->arg0); } static void eFuro_Yuge_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); + effect->velocity.y *= GETREG(TAKREG, 0x39) * 0.001f + 0.9f; } static void eFuro_Yuge_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + int opacity; + s16 frames_alive = EFFECT_LIFETIME - effect->timer; + s16 half_timer = CLAMP(frames_alive >> 1, 0, EFFECT_LIFETIME / 2); + int texIdx1 = eFuro_Yuge_2tile_texture_idx[half_timer][0]; + int texIdx2 = eFuro_Yuge_2tile_texture_idx[half_timer][1]; + + effect->scale.x = + eEC_CLIP->calc_adjust_proc(frames_alive, 0, EFFECT_LIFETIME, GETREG(TAKREG, 0x37) * 0.0001f + 0.0015f, + GETREG(TAKREG, 0x38) * 0.0001f + 0.009f); + effect->scale.y = effect->scale.z = effect->scale.x; + + if (frames_alive < EFFECT_STAGE1) { + opacity = eEC_CLIP->calc_adjust_proc(frames_alive, 0, EFFECT_STAGE1, GETREG(TAKREG, 0x35) + 50.f, + GETREG(TAKREG, 0x36) + 80.f); + } else { + opacity = + eEC_CLIP->calc_adjust_proc(frames_alive, EFFECT_STAGE1, EFFECT_LIFETIME, GETREG(TAKREG, 0x36) + 80.f, 0.0f); + } + + OPEN_DISP(game->graph); + eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, eFuro_Yuge_texture_table[texIdx1]); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_2_TXT_SEG, eFuro_Yuge_texture_table[texIdx2]); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, eFuro_Yuge_prim_f[half_timer], 255, 255, 255, opacity); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_dust01_modelT); + CLOSE_DISP(game->graph); } From 4d3d24d8185ecfd115631e4f7800cf8e9a0d7fe9 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 16:55:07 -0400 Subject: [PATCH 2/9] Also link ef_gimonhu --- configure.py | 2 +- src/effect/ef_gimonhu.c | 76 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index ce879650..57a032bb 100644 --- a/configure.py +++ b/configure.py @@ -1254,7 +1254,7 @@ config.libs = [ Object(Matching, "effect/ef_flash.c"), Object(Matching, "effect/ef_footprint.c"), Object(Matching, "effect/ef_furo_yuge.c"), - Object(NonMatching, "effect/ef_gimonhu.c"), + Object(Matching, "effect/ef_gimonhu.c"), Object(NonMatching, "effect/ef_goki.c"), Object(NonMatching, "effect/ef_ha.c"), Object(Matching, "effect/ef_halloween.c"), diff --git a/src/effect/ef_gimonhu.c b/src/effect/ef_gimonhu.c index 514db582..da8ecb56 100644 --- a/src/effect/ef_gimonhu.c +++ b/src/effect/ef_gimonhu.c @@ -1,12 +1,19 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" static void eGM_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eGM_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eGM_mv(eEC_Effect_c* effect, GAME* game); static void eGM_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 72 +#define EFFECT_STAGE2 64 +#define EFFECT_STAGE1 50 + +// clang-format off eEC_PROFILE_c iam_ef_gimonhu = { - // clang-format off &eGM_init, &eGM_ct, &eGM_mv, @@ -14,21 +21,78 @@ eEC_PROFILE_c iam_ef_gimonhu = { eEC_IGNORE_DEATH, eEC_NO_CHILD_ID, eEC_DEFAULT_DEATH_DIST, - // clang-format on }; +f32 eGM_scale_data[][2] = { + { 0.5f, 0.5f }, + { 0.5f, 1.2f }, + { 0.5f, 2.f }, + { 1.2f, 1.4f }, + { 2.f, 0.7f }, + { 1.5f, 0.8f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f }, + { 1.f, 1.f } +}; + +extern Gfx ef_gimonhu01_00_modelT[]; + +// clang-format on static void eGM_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + const float delta = 9.58738e-05f; // not sure about this constant, close to 1e-4, but not quite + xyz_t p = { 0.f, 15.f, 7.f }; + sMath_RotateY(&p, angle * delta); + pos.x += p.x; + pos.y += p.y; + eEC_CLIP->make_effect_proc(eEC_EFFECT_GIMONHU, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eGM_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->offset.x = effect->offset.y = effect->offset.z = 0.f; } static void eGM_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 currentFrame = EFFECT_LIFETIME - effect->timer; + if (currentFrame == 0) { + sAdo_OngenTrgStart(0X2F, &effect->position); + } } static void eGM_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 frameIndex; + s16 currentFrame = EFFECT_LIFETIME - effect->timer; + int v = (u8)eEC_CLIP->calc_adjust_proc(currentFrame, EFFECT_STAGE2, EFFECT_LIFETIME, 255.f, 0.f); + if (currentFrame > EFFECT_STAGE1) { + currentFrame = EFFECT_STAGE1; + } + frameIndex = currentFrame >> 1; + frameIndex = CLAMP(frameIndex, 0, EFFECT_STAGE1 / 2); + effect->scale.x = eGM_scale_data[frameIndex][0] * 0.008f; + effect->scale.y = eGM_scale_data[frameIndex][1] * 0.008f; + effect->scale.z = 0.008f; + OPEN_DISP(game->graph); + _texture_z_light_fog_prim_xlu(game->graph); + eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, v); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_gimonhu01_00_modelT); + CLOSE_DISP(game->graph); } From 2009a0b71512f607d920ea026ff4353578b5bb77 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 18:39:28 -0400 Subject: [PATCH 3/9] also match ef_goki --- src/effect/ef_goki.c | 63 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/src/effect/ef_goki.c b/src/effect/ef_goki.c index 2883149a..49d04217 100644 --- a/src/effect/ef_goki.c +++ b/src/effect/ef_goki.c @@ -1,10 +1,22 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eGoki_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eGoki_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eGoki_mv(eEC_Effect_c* effect, GAME* game); static void eGoki_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 190 + +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) +#define CALC_EASE2(x) CALC_EASE(CALC_EASE(x)) + +extern EVW_ANIME_DATA ef_goki01_01_evw_anime[]; +extern Gfx ef_goki01_01_modelT[]; + eEC_PROFILE_c iam_ef_goki = { // clang-format off &eGoki_init, @@ -18,17 +30,60 @@ eEC_PROFILE_c iam_ef_goki = { }; static void eGoki_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->make_effect_proc(eEC_EFFECT_GOKI, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eGoki_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->scale = ZeroVec; + effect->velocity = ZeroVec; + effect->acceleration = ZeroVec; + + effect->velocity.y = 2.25f; + + effect->acceleration.y = 0.075f; + + effect->effect_specific[0] = 0; + + effect->offset.y = 2.f; + effect->offset.z = 2000.f; } static void eGoki_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 now_timer = effect->timer; + if (effect->timer > 160) { + effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 0xa0, EFFECT_LIFETIME, 0.005f, 0.f); + effect->scale.y = effect->scale.z = effect->scale.x; + } else if (effect->timer < 60) { + effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 0x3c, 0.f, 0.005f); + effect->scale.y = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 0x3c, 0.01f, 0.005f); + } + if (effect->timer < 80) { + add_calc0(&effect->offset.y, CALC_EASE(0.06f), 0.5f); + add_calc0(&effect->offset.z, CALC_EASE(0.06f), 50.f); + } + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); + effect->velocity.y *= sqrtf(0.65f); + effect->effect_specific[1] += 1000; + effect->offset.x = effect->offset.y * sin_s(effect->effect_specific[1]); + effect->effect_specific[0] = -effect->offset.z * cos_s(effect->effect_specific[1]); } static void eGoki_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + int opacity = (u8)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 20, 100.f, 255.f); + _texture_z_light_fog_prim_xlu(game->graph); + OPEN_DISP(game->graph); + Matrix_translate(effect->position.x + effect->offset.x, effect->position.y, effect->position.z, FALSE); + Matrix_scale(effect->scale.x * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.y * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.z * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), TRUE); + Matrix_mult(&play->billboard_matrix, TRUE); + Matrix_RotateZ(effect->effect_specific[0], TRUE); + Evw_Anime_Set(play, ef_goki01_01_evw_anime); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, opacity); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_goki01_01_modelT); + CLOSE_DISP(game->graph); } From 659f4bda0f9df375fa28ad1fcebc9c0f41aafd07 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 18:41:01 -0400 Subject: [PATCH 4/9] link ef_goki --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 57a032bb..9dd682c1 100644 --- a/configure.py +++ b/configure.py @@ -1255,7 +1255,7 @@ config.libs = [ Object(Matching, "effect/ef_footprint.c"), Object(Matching, "effect/ef_furo_yuge.c"), Object(Matching, "effect/ef_gimonhu.c"), - Object(NonMatching, "effect/ef_goki.c"), + Object(Matching, "effect/ef_goki.c"), Object(NonMatching, "effect/ef_ha.c"), Object(Matching, "effect/ef_halloween.c"), Object(Matching, "effect/ef_halloween_smoke.c"), From 9956e7f2f1b88270a9c511e25ccb5ac02f391a75 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 20:16:19 -0400 Subject: [PATCH 5/9] link ef_ha --- configure.py | 2 +- include/audio_defs.h | 2 +- src/effect/ef_gimonhu.c | 2 +- src/effect/ef_ha.c | 52 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index 9dd682c1..7c649af3 100644 --- a/configure.py +++ b/configure.py @@ -1256,7 +1256,7 @@ config.libs = [ Object(Matching, "effect/ef_furo_yuge.c"), Object(Matching, "effect/ef_gimonhu.c"), Object(Matching, "effect/ef_goki.c"), - Object(NonMatching, "effect/ef_ha.c"), + Object(Matching, "effect/ef_ha.c"), Object(Matching, "effect/ef_halloween.c"), Object(Matching, "effect/ef_halloween_smoke.c"), Object(NonMatching, "effect/ef_hanabi_botan1.c"), diff --git a/include/audio_defs.h b/include/audio_defs.h index 9761a242..ff56a476 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -60,6 +60,7 @@ typedef enum audio_sound_effects { NA_SE_27 = 0x27, NA_SE_2A = 0x2A, + NA_SE_2C = 0x2C, NA_SE_2F = 0x2F, @@ -327,7 +328,6 @@ typedef enum audio_sound_effects { NA_SE_FOOTSTEP_WAVE, NA_SE_FOOTSTEP_PLUSSBRIDGE, - NA_SE_FLOOR_SE_START = SE_ECHO(0x2E6), } AudioSE; diff --git a/src/effect/ef_gimonhu.c b/src/effect/ef_gimonhu.c index da8ecb56..b4fea60d 100644 --- a/src/effect/ef_gimonhu.c +++ b/src/effect/ef_gimonhu.c @@ -72,7 +72,7 @@ static void eGM_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { static void eGM_mv(eEC_Effect_c* effect, GAME* game) { s16 currentFrame = EFFECT_LIFETIME - effect->timer; if (currentFrame == 0) { - sAdo_OngenTrgStart(0X2F, &effect->position); + sAdo_OngenTrgStart(NA_SE_2F, &effect->position); } } diff --git a/src/effect/ef_ha.c b/src/effect/ef_ha.c index db2d7f93..f58833cd 100644 --- a/src/effect/ef_ha.c +++ b/src/effect/ef_ha.c @@ -1,10 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" + +#define EFFECT_LIFETIME 56 static void eHA_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHA_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHA_mv(eEC_Effect_c* effect, GAME* game); static void eHA_dw(eEC_Effect_c* effect, GAME* game); - +extern Gfx ef_ha01_00_modelT[]; eEC_PROFILE_c iam_ef_ha = { // clang-format off &eHA_init, @@ -17,18 +23,54 @@ eEC_PROFILE_c iam_ef_ha = { // clang-format on }; +s16 eHA_angle_z_data[] = { DEG2SHORT_ANGLE2(45.f), DEG2SHORT_ANGLE2(315.f) }; + static void eHA_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->make_effect_proc(eEC_EFFECT_HA, pos, NULL, game, &angle, item_name, prio, 0, 0); } static void eHA_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + s16* ang_p = (s16*)ct_arg; + u16 angle = *ang_p - (s16)((s16)getCamera2AngleY(play) + DEG2SHORT_ANGLE2(180)); + + effect->scale.x = 0.0067f; + effect->scale.y = 0.0067f; + effect->scale.z = 0.0067f; + effect->timer = EFFECT_LIFETIME; + effect->offset.y += 12.f; + if (angle >= (u16)DEG2SHORT_ANGLE2(180)) { + effect->effect_specific[0] = 0; + effect->offset.x += -16.f; + } else { + effect->effect_specific[0] = 1; + effect->offset.x += 16.f; + } } static void eHA_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + if (effect->timer == EFFECT_LIFETIME) { + sAdo_OngenTrgStart(NA_SE_2C, &effect->position); + } } static void eHA_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + s16 v = effect->effect_specific[0]; + int opacity = (u8)eEC_CLIP->calc_adjust_proc(EFFECT_LIFETIME - effect->timer, 24, EFFECT_LIFETIME, 255.f, 0.f); + OPEN_DISP(game->graph); + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + Matrix_mult(&play->billboard_matrix, TRUE); + Matrix_translate(effect->offset.x + GETREG(MYKREG, 0x18), effect->offset.y + GETREG(MYKREG, 0x19), + effect->offset.z + GETREG(MYKREG, 0x1a), TRUE); + Matrix_RotateZ(eHA_angle_z_data[v], TRUE); + Matrix_scale(effect->scale.x * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.y * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.z * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), TRUE); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, opacity); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, 0, 0, 255, 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_ha01_00_modelT); + CLOSE_DISP(game->graph); } From a313feed528b16f6debc641572c26f284145f9b7 Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 22:32:39 -0400 Subject: [PATCH 6/9] link ef_hanabi_botan1 --- configure.py | 2 +- include/audio_defs.h | 1 + src/effect/ef_hanabi_botan1.c | 90 +++++++++++++++++++++++++++++++++-- 3 files changed, 88 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 7c649af3..f52509d5 100644 --- a/configure.py +++ b/configure.py @@ -1259,7 +1259,7 @@ config.libs = [ Object(Matching, "effect/ef_ha.c"), Object(Matching, "effect/ef_halloween.c"), Object(Matching, "effect/ef_halloween_smoke.c"), - Object(NonMatching, "effect/ef_hanabi_botan1.c"), + Object(Matching, "effect/ef_hanabi_botan1.c"), Object(NonMatching, "effect/ef_hanabi_botan2.c"), Object(Matching, "effect/ef_hanabi_dummy.c"), Object(NonMatching, "effect/ef_hanabi_hoshi.c"), diff --git a/include/audio_defs.h b/include/audio_defs.h index ff56a476..1bc1de73 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -156,6 +156,7 @@ typedef enum audio_sound_effects { NA_SE_KA_BUZZ = 0xCF, + NA_SE_107 = 0x107, NA_SE_108 = 0x108, NA_SE_ROD_STROKE = 0x109, NA_SE_ROD_BACK, diff --git a/src/effect/ef_hanabi_botan1.c b/src/effect/ef_hanabi_botan1.c index 4efaefb1..fc4fbbe9 100644 --- a/src/effect/ef_hanabi_botan1.c +++ b/src/effect/ef_hanabi_botan1.c @@ -1,10 +1,18 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eHanabiBotan1_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiBotan1_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiBotan1_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiBotan1_dw(eEC_Effect_c* effect, GAME* game); +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) + +#define EFFECT_LIFETIME 110 + eEC_PROFILE_c iam_ef_hanabi_botan1 = { // clang-format off &eHanabiBotan1_init, @@ -18,17 +26,91 @@ eEC_PROFILE_c iam_ef_hanabi_botan1 = { }; static void eHanabiBotan1_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->make_effect_proc(eEC_EFFECT_HANABI_BOTAN1, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eHanabiBotan1_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.f; + effect->offset.y = 0.f; + effect->offset.z = 0.f; + effect->effect_specific[3] = ((u16)RANDOM_F(10.f)) & 1; // ??? why not just qrand() & 1? } static void eHanabiBotan1_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 aliveFrames = EFFECT_LIFETIME - effect->timer; + effect->effect_specific[0] += 0x300; + effect->effect_specific[1] += 0x100; + effect->effect_specific[2] += 0x80; + effect->offset.x = sin_s(effect->effect_specific[1]) * 2.f; + effect->offset.z = sin_s(-effect->effect_specific[1]) * 2.f; + add_calc2(&effect->scale.x, 0.07, CALC_EASE(0.2f), 5.f); + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; + if (aliveFrames == 10) { + static rgba_t botan1_light[] = { { 75, 45, 30, 255 }, { 30, 90, 30, 255 } }; + rgba_t resultColor; + eEC_CLIP->decide_light_power_proc(&resultColor, botan1_light[effect->effect_specific[3]], effect->position, + game, 2.f, 0.f, 480.f); + if (effect->arg0) { + // `resultColor.r *= (4.f/3.f);` does not match + resultColor.r = resultColor.r * (4.f / 3.f); + resultColor.g = resultColor.g * (4.f / 3.f); + resultColor.b = resultColor.b * (4.f / 3.f); + } + eEC_CLIP->regist_effect_light(resultColor, 20, 50, TRUE); + } + if (aliveFrames == 72) { + xyz_t p = effect->position; + p.y += 200.f; + sAdo_OngenTrgStart(NA_SE_HANABI0, &p); + } } +eEC_morph_data_c eHanabiBotan1_morph_data1[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, { 34, 44, TRUE, 0.f, 100.f }, + { 44, 54, TRUE, 150.f, 0.f }, { 10, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 34, 44, TRUE, 100.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; + +eEC_morph_data_c eHanabiBotan1_morph_data2[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, { 34, 44, TRUE, 0.f, 50.f }, + { 44, 54, TRUE, 150.f, 0.f }, { 10, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 0.f, 0.f }, + { 0, 0, FALSE, 255.f, 255.f }, { 34, 44, FALSE, 50.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; + +eEC_morph_data_c* eHanabiBotan1_morph_table[] = { eHanabiBotan1_morph_data1, eHanabiBotan1_morph_data2 }; + +extern Gfx ef_hanabi_b_00_modelT[]; + static void eHanabiBotan1_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + u8 result[9]; + f32 v2, v; + s16 index; + s16 active_frames = EFFECT_LIFETIME - effect->timer; + v = (sin_s(effect->effect_specific[0]) + 1.f) * 0.5f * 0.14000005f + 0.93f; + index = effect->effect_specific[3]; + v2 = eEC_CLIP->calc_adjust_proc(active_frames, 0, EFFECT_LIFETIME - 1, 0.0f, 0.01f) + effect->scale.x; + eEC_CLIP->morph_combine_proc(result, eHanabiBotan1_morph_table[index], active_frames); + OPEN_DISP(game->graph); + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x + effect->offset.x, effect->position.y + effect->offset.y, + effect->position.z + effect->offset.z, FALSE); + Matrix_RotateX(DEG2SHORT_ANGLE2(270), TRUE); + Matrix_RotateZ(-effect->effect_specific[1], TRUE); + Matrix_scale(v, 1.f, 1.f, TRUE); + Matrix_RotateZ(effect->effect_specific[1], TRUE); + Matrix_scale(v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), TRUE); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, result[4], result[0], result[1], result[2], result[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, result[5], result[6], result[7], 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_b_00_modelT); + CLOSE_DISP(game->graph); } From ce0f131b2ac47c184637b32ba90005176e8b1aec Mon Sep 17 00:00:00 2001 From: roeming Date: Fri, 30 May 2025 23:49:02 -0400 Subject: [PATCH 7/9] match ef_hanabi_botan2 --- configure.py | 2 +- src/effect/ef_hanabi_botan2.c | 92 +++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index f52509d5..3fcb92c8 100644 --- a/configure.py +++ b/configure.py @@ -1260,7 +1260,7 @@ config.libs = [ Object(Matching, "effect/ef_halloween.c"), Object(Matching, "effect/ef_halloween_smoke.c"), Object(Matching, "effect/ef_hanabi_botan1.c"), - Object(NonMatching, "effect/ef_hanabi_botan2.c"), + Object(Matching, "effect/ef_hanabi_botan2.c"), Object(Matching, "effect/ef_hanabi_dummy.c"), Object(NonMatching, "effect/ef_hanabi_hoshi.c"), Object(NonMatching, "effect/ef_hanabi_set.c"), diff --git a/src/effect/ef_hanabi_botan2.c b/src/effect/ef_hanabi_botan2.c index f1413fe5..b21d45c1 100644 --- a/src/effect/ef_hanabi_botan2.c +++ b/src/effect/ef_hanabi_botan2.c @@ -1,10 +1,17 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eHanabiBotan2_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiBotan2_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiBotan2_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiBotan2_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 110 +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) + eEC_PROFILE_c iam_ef_hanabi_botan2 = { // clang-format off &eHanabiBotan2_init, @@ -18,17 +25,94 @@ eEC_PROFILE_c iam_ef_hanabi_botan2 = { }; static void eHanabiBotan2_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->make_effect_proc(eEC_EFFECT_HANABI_BOTAN2, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eHanabiBotan2_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.f; + effect->offset.y = 0.f; + effect->offset.z = 0.f; + effect->effect_specific[3] = (u16)(RANDOM_F(10.f)) & 1; } static void eHanabiBotan2_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 timer = EFFECT_LIFETIME - effect->timer; + effect->effect_specific[0] += 0x300; + effect->effect_specific[1] += 0x100; + effect->effect_specific[2] += 0x80; + effect->offset.x = sin_s(effect->effect_specific[1]) * 2.f; + effect->offset.z = sin_s(-effect->effect_specific[1]) * 2.f; + add_calc2(&effect->scale.x, 0.08, CALC_EASE(0.2f), 5.f); + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; + if (timer == 10) { + rgba_t resultColor; + static rgba_t botan2_light = { 60, 15, 90, 255 }; + eEC_CLIP->decide_light_power_proc(&resultColor, botan2_light, effect->position, game, 2.f, 0.f, 480.f); + if (effect->arg0) { + resultColor.r = resultColor.r * (4.f / 3.f); + resultColor.g = resultColor.g * (4.f / 3.f); + resultColor.b = resultColor.b * (4.f / 3.f); + } + eEC_CLIP->regist_effect_light(resultColor, 20, 50, TRUE); + } + if (timer == 72) { + xyz_t p = effect->position; + p.y += 200.f; + sAdo_OngenTrgStart(NA_SE_HANABI1, &p); + } } +eEC_morph_data_c eHanabiBotan2_morph_data_out[] = { + { 34, 44, TRUE, 255.f, 0.f }, { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 44, 54, TRUE, 150.f, 0.f }, { 9, 34, TRUE, 0.f, 255.f }, { 9, 34, TRUE, 255.f, 0.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; +eEC_morph_data_c eHanabiBotan2_morph_data_in[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 0.f, 0.f }, + { 44, 54, TRUE, 150.f, 0.f }, { 14, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 14, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; + +extern Gfx ef_hanabi_b_00_modelT[]; + static void eHanabiBotan2_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + u8 res1[9]; + u8 res2[9]; + s16 now_timer = EFFECT_LIFETIME - effect->timer; + f32 v2; + f32 v = (sin_s(effect->effect_specific[0]) + 1.f) * 0.5f * 0.14000005f + 0.93f; + v2 = effect->scale.x + eEC_CLIP->calc_adjust_proc(now_timer, 0, EFFECT_LIFETIME - 1, 0.f, 0.01); + eEC_CLIP->morph_combine_proc(res1, eHanabiBotan2_morph_data_out, now_timer); + eEC_CLIP->morph_combine_proc(res2, eHanabiBotan2_morph_data_in, now_timer); + OPEN_DISP(game->graph); + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x + effect->offset.x, effect->position.y + effect->offset.y, + effect->position.z + effect->offset.z, FALSE); + Matrix_RotateX(DEG2SHORT_ANGLE2(270), TRUE); + Matrix_RotateZ(-effect->effect_specific[1], TRUE); + Matrix_scale(v, 1.f, 1.f, TRUE); + Matrix_RotateZ(effect->effect_specific[1], TRUE); + Matrix_push(); + Matrix_scale(v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), TRUE); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, res1[4], res1[0], res1[1], res1[2], res1[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, res1[5], res1[6], res1[7], res1[8]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_b_00_modelT); + Matrix_pull(); + Matrix_scale(v2 * 0.6f, v2 * 0.6f, v2 * 0.6f, TRUE); + gDPPipeSync(NEXT_POLY_XLU_DISP); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, res2[4], res2[0], res2[1], res2[2], res2[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, res2[5], res2[6], res2[7], res2[8]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_b_00_modelT); + CLOSE_DISP(game->graph); } From be40d11f7a373317cabdc5c076375858ffe4e689 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sat, 31 May 2025 13:30:08 +0200 Subject: [PATCH 8/9] Implement & link ef_kangaeru --- configure.py | 2 +- src/effect/ef_kangaeru.c | 102 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 9dd682c1..d853ebc2 100644 --- a/configure.py +++ b/configure.py @@ -1274,7 +1274,7 @@ config.libs = [ Object(Matching, "effect/ef_impact_star.c"), Object(NonMatching, "effect/ef_kagu_happa.c"), Object(NonMatching, "effect/ef_kamifubuki.c"), - Object(NonMatching, "effect/ef_kangaeru.c"), + Object(Matching, "effect/ef_kangaeru.c"), Object(NonMatching, "effect/ef_kantanhu.c"), Object(Matching, "effect/ef_kasamizu.c"), Object(Matching, "effect/ef_kasamizutama.c"), diff --git a/src/effect/ef_kangaeru.c b/src/effect/ef_kangaeru.c index 3361c713..4083ee31 100644 --- a/src/effect/ef_kangaeru.c +++ b/src/effect/ef_kangaeru.c @@ -1,5 +1,13 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" + +extern Gfx ef_think_l_modelT[]; +extern Gfx ef_think_s_modelT[]; + static void eKG_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKG_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKG_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +26,103 @@ eEC_PROFILE_c iam_ef_kangaeru = { }; static void eKG_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t vec = { 0.0f, 6.0f, 0.0f }; + pos.y += 15.0f; + + sMath_RotateY(&vec, SHORT2RAD_ANGLE2(angle)); + pos.x += vec.x; + pos.y += vec.y; + pos.z += vec.z; + eEC_CLIP->make_effect_proc(eEC_EFFECT_KANGAERU, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eKG_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; + + effect->timer = 36; + + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->effect_specific[0] = 0; } static void eKG_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 orig_es1 = effect->effect_specific[1]; + eEC_CLIP->set_continious_env_proc(effect, 36, 20); + + if (effect->effect_specific[0] < 10) { + effect->effect_specific[1] += DEG2SHORT_ANGLE(2.5f); + effect->effect_specific[2] -= DEG2SHORT_ANGLE(3.75f); + } + + if ((effect->effect_specific[1] >= 0) && (orig_es1 < 0)) { + effect->effect_specific[2] = 0; + effect->effect_specific[1] = 0; + } + + effect->effect_specific[0]++; + + if (effect->effect_specific[0] >= 25) { + effect->effect_specific[0] = 0; + } + + if (effect->state == eEC_STATE_FINISHED) { + effect->effect_specific[4] = (u8)eEC_CLIP->calc_adjust_proc(7 - effect->timer, 0, 6, 255.0f, 0.0f); + } else { + sAdo_OngenPos((u32)effect, 0x58, &effect->position); + effect->effect_specific[4] = 255; + } } static void eKG_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 timer; + GAME_PLAY* play = (GAME_PLAY*)game; + + switch (effect->state) { + case eEC_STATE_NORMAL: { + timer = 36 - effect->timer; + effect->scale.z = 1.0f; + effect->scale.x = effect->scale.y = eEC_CLIP->calc_adjust_proc(timer, 0, 7, 0.0f, 0.008f); + break; + } + + default: { + effect->scale.x = 0.008f; + effect->scale.y = 0.008f; + effect->scale.z = 0.8f; + break; + } + } + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + Matrix_mult(&play->billboard_matrix, TRUE); + Matrix_translate(effect->offset.x + GETREG(MYKREG, 0x18), effect->offset.y - 6.0f + GETREG(MYKREG, 0x19), + effect->offset.z + 30.0f + GETREG(MYKREG, 0x1a), TRUE); + Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, TRUE); + Matrix_translate(-475.0f, 950.0f, 0.0f, TRUE); + Matrix_RotateZ(effect->effect_specific[1], TRUE); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, effect->effect_specific[4]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_think_l_modelT); + + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + Matrix_mult(&play->billboard_matrix, TRUE); + Matrix_translate(effect->offset.x + GETREG(MYKREG, 0x18), effect->offset.y - 6.0f + GETREG(MYKREG, 0x19), + effect->offset.z + 30.0f + GETREG(MYKREG, 0x1a), TRUE); + Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, TRUE); + Matrix_translate(475.0f, 0.0f, 0.0f, TRUE); + Matrix_RotateZ(effect->effect_specific[2], TRUE); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, effect->effect_specific[4]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_think_s_modelT); + + CLOSE_DISP(game->graph); } From 604f4d696d2d36e49a64a17868e706c2e145cfe2 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sat, 31 May 2025 15:25:07 +0200 Subject: [PATCH 9/9] Implement & link ef_kantanhu --- configure.py | 2 +- src/effect/ef_kantanhu.c | 76 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index d853ebc2..db5a1a3d 100644 --- a/configure.py +++ b/configure.py @@ -1275,7 +1275,7 @@ config.libs = [ Object(NonMatching, "effect/ef_kagu_happa.c"), Object(NonMatching, "effect/ef_kamifubuki.c"), Object(Matching, "effect/ef_kangaeru.c"), - Object(NonMatching, "effect/ef_kantanhu.c"), + Object(Matching, "effect/ef_kantanhu.c"), Object(Matching, "effect/ef_kasamizu.c"), Object(Matching, "effect/ef_kasamizutama.c"), Object(NonMatching, "effect/ef_kaze.c"), diff --git a/src/effect/ef_kantanhu.c b/src/effect/ef_kantanhu.c index acb90958..60b96955 100644 --- a/src/effect/ef_kantanhu.c +++ b/src/effect/ef_kantanhu.c @@ -1,12 +1,18 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" + static void eKT_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKT_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKT_mv(eEC_Effect_c* effect, GAME* game); static void eKT_dw(eEC_Effect_c* effect, GAME* game); +extern Gfx ef_kantanhu01_00_modelT[]; + +// clang-format off eEC_PROFILE_c iam_ef_kantanhu = { - // clang-format off &eKT_init, &eKT_ct, &eKT_mv, @@ -14,21 +20,79 @@ eEC_PROFILE_c iam_ef_kantanhu = { eEC_IGNORE_DEATH, eEC_NO_CHILD_ID, eEC_DEFAULT_DEATH_DIST, - // clang-format on }; +f32 eKT_scale_data[][2] = { + { 0.5f, 0.5f }, + { 0.5f, 1.2f }, + { 0.5f, 2.0f }, + { 1.2f, 1.4f }, + { 2.0f, 0.7f }, + { 1.5f, 0.8f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 1.0f } +}; +// clang-format on + static void eKT_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t vec = { 0.0f, 15.0f, -3.0f }; + + sMath_RotateY(&vec, SHORT2RAD_ANGLE2(angle)); + pos.x += vec.x; + pos.y += vec.y; + pos.z += vec.z; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_KANTANHU, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eKT_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 72; + sAdo_OngenTrgStart(0x14b, &effect->position); } static void eKT_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + return; } static void eKT_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 frame_index; + s16 timer = 72 - effect->timer; + u16 alpha = (u8)eEC_CLIP->calc_adjust_proc(timer, 64, 72, 255.0f, 0.0f); + + if (timer > 50) { + timer = 50; + } + frame_index = timer >> 1; + effect->scale.x = eKT_scale_data[frame_index][0] * 0.008f; + effect->scale.y = eKT_scale_data[frame_index][1] * 0.008f; + effect->scale.z = 0.008f; + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, alpha); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_kantanhu01_00_modelT); + + CLOSE_DISP(game->graph); }