From da9e2fb03671b2750b28fec6367260f41b07d197 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Tue, 12 Mar 2024 05:31:43 -0400 Subject: [PATCH] Implement & link ef_yukidaruma --- config/rel_slices.yml | 4 +++ src/ef_yukidaruma.c | 60 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 8ac9fede..823bb05b 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -915,6 +915,10 @@ ef_tent_lamp.c: .text: [0x80622304, 0x8062260C] .rodata: [0x8064CF10, 0x8064CF38] .data: [0x806D3910, 0x806D3928] +ef_yukidaruma.c: + .text: [0x80627914, 0x80627CB8] + .rodata: [0x8064D180, 0x8064D190] + .data: [0x806D3CA8, 0x806D3CD0] ef_yukihane.c: .text: [0x80627CB8, 0x80627F88] .rodata: [0x8064D190, 0x8064D1B0] diff --git a/src/ef_yukidaruma.c b/src/ef_yukidaruma.c index e2cc60ce..867fc8f3 100644 --- a/src/ef_yukidaruma.c +++ b/src/ef_yukidaruma.c @@ -1,5 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_rcp.h" +#include "m_debug.h" + +extern Gfx ef_daruma01_00_model[]; +extern Gfx ef_daruma01_01_model[]; +extern Gfx ef_daruma01_02_model[]; + +static Gfx* ef_yukidaruma_model_tbl[] = { ef_daruma01_00_model, ef_daruma01_01_model, ef_daruma01_02_model }; + static void eYukidaruma_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eYukidaruma_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eYukidaruma_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +29,58 @@ eEC_PROFILE_c iam_ef_yukidaruma = { }; static void eYukidaruma_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + int count = arg0 > 66 ? 8 : 3; + int i; + + while ((s16)count-- != 0) { + xyz_t sub_pos = pos; + + sub_pos.x += fqrand2() * 20.0f; + sub_pos.y += fqrand2() * 20.0f; + sub_pos.z += fqrand2() * 20.0f; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_YUKIDAMA, sub_pos, prio, 0, game, item_name, 0, 0x4000 | count); + } + + eEC_CLIP->make_effect_proc(eEC_EFFECT_YUKIDARUMA, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eYukidaruma_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 20; + effect->offset.x = eEC_CLIP->calc_adjust_proc(effect->arg0, 0, 100, 0.01f, 0.03f); + + effect->scale.x = effect->scale.y = effect->scale.z = effect->offset.x; } static void eYukidaruma_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + // nothing } static void eYukidaruma_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + int frame = (20 - effect->timer) >> 1; + int model = frame / 3; + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + + if (model < ARRAY_COUNT(ef_yukidaruma_model_tbl)) { + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0); + Matrix_scale(effect->offset.x, effect->offset.x, effect->offset.x, 1); + + 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, 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_yukidaruma_model_tbl[model]); + } + + if (frame == 3 || frame == 6 || frame == 9) { + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0); + Matrix_scale(effect->offset.x, effect->offset.x, effect->offset.x, 1); + + 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, 120); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_yukidaruma_model_tbl[model - 1]); + } + + CLOSE_DISP(game->graph); }