From 2a7ef503d48228660e7c6da5b2d6742045ceaaf9 Mon Sep 17 00:00:00 2001 From: Cuyler36 <24523422+Cuyler36@users.noreply.github.com> Date: Tue, 6 Aug 2024 07:22:32 -0400 Subject: [PATCH] Implement & link ef_doyon --- config/rel_slices.yml | 4 +++ include/audio_defs.h | 2 ++ src/ef_doyon.c | 60 ++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/config/rel_slices.yml b/config/rel_slices.yml index f3f35c44..5e68c7bf 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -1139,6 +1139,10 @@ ef_douzou_light.c: .text: [0x8060A808, 0x8060AAD4] .rodata: [0x8064BF90, 0x8064BFA8] .data: [0x806D2280, 0x806D2298] +ef_doyon.c: + .text: [0x8060AAD4, 0x8060B068] + .rodata: [0x8064BFA8, 0x8064C000] + .data: [0x806D2298, 0x806D22B0] ef_flash.c: .text: [0x8060B7B4, 0x8060BCB0] .rodata: [0x8064C078, 0x8064C0B0] diff --git a/include/audio_defs.h b/include/audio_defs.h index 26ff6e9e..eb3399ed 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -100,6 +100,8 @@ typedef enum audio_sound_effects { NA_SE_TREE_TOUCH = 0x134, NA_SE_TREE_YURASU, + NA_SE_DOYON = 0x13F, + NA_SE_KIRIBASU_SCOOP = 0x148, NA_SE_KIRIBASU_OUT, diff --git a/src/ef_doyon.c b/src/ef_doyon.c index a311e8ac..0cde7fe0 100644 --- a/src/ef_doyon.c +++ b/src/ef_doyon.c @@ -1,5 +1,9 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" + static void eDoyon_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eDoyon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eDoyon_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +22,65 @@ eEC_PROFILE_c iam_ef_doyon = { }; static void eDoyon_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_DOYON, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eDoyon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + s16 rng = qrand(); + s16 rng_angle = (s16)((f32)rng * 0.75f); + + effect->position.x += 10.0f * sin_s(rng_angle); + effect->position.y += 10.0f * cos_s(rng_angle); + + effect->velocity.x += sin_s(rng_angle) * 0.5f; + effect->velocity.y += cos_s(rng_angle) * 0.5f; + + effect->offset.z = 20.0f; + + effect->scale = ZeroVec; + effect->scale.z = 0.1f; + + effect->timer = 60; + sAdo_OngenTrgStart(NA_SE_DOYON, &effect->position); } static void eDoyon_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + f32 progress = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 60, 0.0f, 5.0f); + + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); + + effect->effect_specific[0] += DEG2SHORT_ANGLE2(5.625f); + effect->effect_specific[1] += DEG2SHORT_ANGLE2(5.625f); + + effect->velocity.x *= sqrtf(0.95f); + effect->velocity.y *= sqrtf(0.95f); + + if (effect->timer > 50) { + f32 scale = (60 - effect->timer) * 0.00065f; + + effect->scale.x = scale * (1.0f + 0.2f * cos_s(effect->effect_specific[0])); + effect->scale.y = scale * (1.0f + 0.2f * sin_s(effect->effect_specific[0])); + } else { + effect->scale.x = (1.0f + 0.2f * cos_s(effect->effect_specific[0])) * 0.0065f; + effect->scale.y = (1.0f + 0.2f * sin_s(effect->effect_specific[0])) * 0.0065f; + } + + effect->offset.x = progress * cos_s(effect->effect_specific[1]); + effect->offset.y = progress * sin_s(effect->effect_specific[1]); } +extern Gfx ef_doyon01_00_modelT[]; + static void eDoyon_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 8, 0.0f, 220.0f); + + OPEN_DISP(game->graph); + + eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 40, 30, 40, a); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, 100, 100, 255, 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_doyon01_00_modelT); + + CLOSE_DISP(game->graph); }