From 634129da57f70c9f16ce2fd0d7de68980b3443ef Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 00:14:45 +0200 Subject: [PATCH] Implement & link ef_otikomi --- configure.py | 2 +- src/effect/ef_otikomi.c | 109 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 7800bff4..5c3182b3 100644 --- a/configure.py +++ b/configure.py @@ -1304,7 +1304,7 @@ config.libs = [ Object(Matching, "effect/ef_night13_moon.c"), Object(Matching, "effect/ef_night15_moon.c"), Object(Matching, "effect/ef_ongen.c"), - Object(NonMatching, "effect/ef_otikomi.c"), + Object(Matching, "effect/ef_otikomi.c"), Object(Matching, "effect/ef_otosiana.c"), Object(Matching, "effect/ef_pun.c"), Object(Matching, "effect/ef_pun_sekimen.c"), diff --git a/src/effect/ef_otikomi.c b/src/effect/ef_otikomi.c index f5cf17b1..fc0dfb38 100644 --- a/src/effect/ef_otikomi.c +++ b/src/effect/ef_otikomi.c @@ -1,5 +1,13 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_debug.h" +#include "m_rcp.h" +#include "sys_matrix.h" + +extern Gfx ef_doyon01_00_modelT[]; +extern Gfx ef_otikomi_us2_model[]; + static void eOMN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eOMN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eOMN_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +26,110 @@ eEC_PROFILE_c iam_ef_otikomi = { }; static void eOMN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + static xyz_t offset = { 0.0f, 0.0f, 19.0f }; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_OTIKOMI, pos, &offset, game, NULL, item_name, prio, 0, 0); } static void eOMN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 22; + + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + + effect->acceleration.x = 10000.0f; + + effect->velocity.x = 0.4f; + effect->velocity.y = 0.0f; + effect->velocity.z = 0.0f; + + effect->position.y += 17.0f; } static void eOMN_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + float vel; + + effect->effect_specific[0] += DEG2SHORT_ANGLE2(2.29f); + effect->effect_specific[1] += (int)effect->acceleration.x; + + vel = effect->velocity.x * sin_s(effect->effect_specific[1]); + effect->velocity.y = 1.0f - vel; + effect->velocity.z = 1.0f + vel; + + add_calc(&effect->velocity.x, 0.025f, 0.022f, 0.1f, 0.001f); + add_calc(&effect->acceleration.x, 2000.0f, 0.022f, 6000.0f, 0.01f); + + eEC_CLIP->set_continious_env_proc(effect, 22, 100); } static void eOMN_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + Gfx* gfx; + s16 timer; + u8 alpha, alpha2; + f32 scale_m, scale_y; + GAME_PLAY* play = (GAME_PLAY*)game; + + gfx = two_tex_scroll_dolphin(game->graph, 0, 0, 0, 16, 16, 1, 0, play->game_frame * 25, 64, 32); + + switch (effect->state) { + case eEC_STATE_NORMAL: + timer = 22 - effect->timer; + scale_m = eEC_CLIP->calc_adjust_proc(timer, 0, 10, 0.0f, 0.01f); + scale_y = eEC_CLIP->calc_adjust_proc(timer, 10, 21, 0.0f, 0.0135f); + alpha = 255; + alpha2 = 100; + sAdo_OngenPos((u32)effect, 0x59, &effect->position); + break; + + case eEC_STATE_CONTINUOUS: + sAdo_OngenPos((u32)effect, 0x59, &effect->position); + scale_m = 0.01f; + alpha = 255; + scale_y = 0.0135f; + alpha2 = 100; + break; + + default: + timer = 10 - effect->timer; + scale_m = 0.01f; + scale_y = 0.0135f; + alpha = (int)eEC_CLIP->calc_adjust_proc(timer, 0, 9, 255.0f, 0.0f); + alpha2 = (int)eEC_CLIP->calc_adjust_proc(timer, 0, 9, 100.0f, 0.0f); + break; + } + + _texture_z_light_fog_prim_xlu(game->graph); + + OPEN_DISP(game->graph); + + Matrix_translate(effect->position.x, effect->position.y + 4.0f, 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 + 2.0f + GETREG(MYKREG, 0x1a), TRUE); + if (GETREG(MYKREG, 0)) { + Matrix_RotateZ(-effect->effect_specific[0], TRUE); + Matrix_scale(scale_m * 1.025f, scale_m, scale_m, TRUE); + Matrix_RotateZ(effect->effect_specific[0], TRUE); + } else { + Matrix_scale(0.01f, 0.01f, 0.01f, TRUE); + } + Matrix_scale(effect->velocity.z * 1.3f, effect->velocity.y, 1.0f, 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, 40, 30, 40, alpha); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, 100, 100, 255, 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_doyon01_00_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 + GETREG(MYKREG, 0x19), + effect->offset.z + GETREG(MYKREG, 0x1a), TRUE); + Matrix_scale(0.015f, scale_y, 0.01f, 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, 0, 255, 255, alpha2); + gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_9, gfx); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_otikomi_us2_model); + + CLOSE_DISP(game->graph); }