diff --git a/configure.py b/configure.py index 29fe43d6..7c5babf7 100644 --- a/configure.py +++ b/configure.py @@ -1272,7 +1272,7 @@ config.libs = [ Object(Matching, "effect/ef_hirameki_hikari.c"), Object(Matching, "effect/ef_ikigire.c"), Object(Matching, "effect/ef_impact_star.c"), - Object(NonMatching, "effect/ef_kagu_happa.c"), + Object(Matching, "effect/ef_kagu_happa.c"), Object(NonMatching, "effect/ef_kamifubuki.c"), Object(Matching, "effect/ef_kangaeru.c"), Object(Matching, "effect/ef_kantanhu.c"), diff --git a/src/effect/ef_hanabi_botan1.c b/src/effect/ef_hanabi_botan1.c index fc4fbbe9..dd4f1bf6 100644 --- a/src/effect/ef_hanabi_botan1.c +++ b/src/effect/ef_hanabi_botan1.c @@ -10,7 +10,6 @@ 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 = { diff --git a/src/effect/ef_kagu_happa.c b/src/effect/ef_kagu_happa.c index cab6939a..ea755b0a 100644 --- a/src/effect/ef_kagu_happa.c +++ b/src/effect/ef_kagu_happa.c @@ -1,10 +1,19 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_malloc.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" +#include "m_player_lib.h" static void eKagu_Happa_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKagu_Happa_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKagu_Happa_mv(eEC_Effect_c* effect, GAME* game); static void eKagu_Happa_dw(eEC_Effect_c* effect, GAME* game); +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) +#define EFFECT_LIFETIME 36 + eEC_PROFILE_c iam_ef_kagu_happa = { // clang-format off &eKagu_Happa_init, @@ -18,17 +27,54 @@ eEC_PROFILE_c iam_ef_kagu_happa = { }; static void eKagu_Happa_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_KAGU_HAPPA, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eKagu_Happa_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + effect->offset = effect->position; + effect->position = player->actor_class.world.position; + effect->position.y += 20.f; + effect->position.x += sin_s(player->actor_class.world.angle.y) * 10.f; + effect->position.z += cos_s(player->actor_class.world.angle.y) * 10.f; + effect->acceleration = effect->position; + effect->scale = ZeroVec; + effect->timer = EFFECT_LIFETIME; + effect->effect_specific[0] = 0; } static void eKagu_Happa_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + effect->position.x = + eEC_CLIP->calc_adjust_proc(effect->timer, 8, EFFECT_LIFETIME, effect->offset.x, effect->acceleration.x); + effect->position.y = + eEC_CLIP->calc_adjust_proc(effect->timer, 8, EFFECT_LIFETIME, effect->offset.y, effect->acceleration.y); + effect->position.z = eEC_CLIP->calc_adjust_proc(effect->timer, 8, 0x1c, effect->offset.z, effect->acceleration.z); + add_calc(&effect->scale.x, 0.01f, CALC_EASE(0.25f), 0.0015f, 5e-5f); + effect->scale.y = effect->scale.z = effect->scale.x; + if (effect->timer > 10) { + effect->position.y += ((effect->timer - 14.f) - 4.f) * (-10.f / 98.f) * ((effect->timer - 14.f) - 4.f) + 20.f; + effect->effect_specific[0] += 0x924; + } else if (effect->timer == 2) { + effect->position.y += 5.f; + eEC_CLIP->effect_make_proc(1, effect->position, effect->prio, 0, game, effect->item_name, 0, 3); + } } static void eKagu_Happa_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 s = sin_s(effect->effect_specific[0]) * 5120.f; + GAME_PLAY* play = (GAME_PLAY*)game; + OPEN_DISP(game->graph); + _texture_z_light_fog_prim(game->graph); + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + if (!effect->arg0) { + Matrix_RotateZ(s, TRUE); + Matrix_mult(&play->billboard_matrix, 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_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(NEXT_POLY_OPA_DISP, aMR_IconNo2Gfx1(effect->arg0)); + gSPDisplayList(NEXT_POLY_OPA_DISP, aMR_IconNo2Gfx2(effect->arg0)); + CLOSE_DISP(game->graph); }