From ecbe94f0052c2c9d9057c2b0e9de83e0c1d5b6c3 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Sun, 21 Apr 2024 20:50:23 +0200 Subject: [PATCH] link ef_clacker --- config/rel_slices.yml | 4 +++ src/ef_clacker.c | 61 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/config/rel_slices.yml b/config/rel_slices.yml index e71dab8a..4cd7546f 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -1018,6 +1018,10 @@ ef_car_light.c: .text: [0x806079CC, 0x80607B9C] .rodata: [0x8064BE18, 0x8064BE20] .data: [0x806D2070, 0x806D2088] +ef_clacker.c: + .text: [0x80607B9C, 0x80608060] + .rodata: [0x8064BE20, 0x8064BE48] + .data: [0x806D2088, 0x806D20C0] ef_coin.c: .text: [0x80608060, 0x806087EC] .rodata: [0x8064BE48, 0x8064BEA0] diff --git a/src/ef_clacker.c b/src/ef_clacker.c index 649025aa..870e661a 100644 --- a/src/ef_clacker.c +++ b/src/ef_clacker.c @@ -1,4 +1,5 @@ #include "ef_effect_control.h" +#include "m_common_data.h" static void eClacker_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eClacker_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); @@ -17,18 +18,68 @@ eEC_PROFILE_c iam_ef_clacker = { // clang-format on }; +void eClacker_Make_Effect(eEC_Effect_c* effect, GAME* game) { + static s16 angle_tbl[] = {0x071C, 0x58E3, 0xAAAB}; + int i; + + for (i = 0; i < 3; i++) { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TAPE, effect->position, effect->prio, + effect->effect_specific[0] + angle_tbl[i], game, effect->item_name, + effect->effect_specific[0], 0x1000); + } + + for (i = 0; i < 20; i++) { + s16 arg0; + + if (i < 5) { + arg0 = 0; + } else if (i < 10) { + arg0 = 1; + } else if (i < 15) { + arg0 = 2; + } else { + arg0 = 3; + } + eEC_CLIP->effect_make_proc(eEC_EFFECT_KAMIFUBUKI, effect->position, effect->prio, effect->effect_specific[0], + game, effect->item_name, arg0, 0x1000); + } +} + static void eClacker_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eEC_CLIP->effect_make_proc(eEC_EFFECT_DUST, pos, prio, 0, game, item_name, arg0, 3); + + eEC_CLIP->make_effect_proc(eEC_EFFECT_CLACKER, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eClacker_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + s16* arg = ct_arg; + effect->effect_specific[0] = arg[0]; + effect->timer = 0x50; + effect->velocity.x = 4.6f * sin_s(0x1000) * sin_s(effect->effect_specific[0]); + effect->velocity.y = 4.6f * cos_s(0x1000); + effect->velocity.z = 4.6f * sin_s(0x1000) * cos_s(effect->effect_specific[0]); + effect->acceleration = ZeroVec; + effect->acceleration.y = -0.125f; } static void eClacker_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + if (!(effect->timer & 7) && (effect->timer < 68)) { + xyz_t pos = effect->position; + pos.x += RANDOM2_F(100.0f); + pos.y += RANDOM2_F(30.0f); + pos.z += RANDOM2_F(100.0f); + eEC_CLIP->effect_make_proc(eEC_EFFECT_KIGAE_LIGHT, pos, effect->prio, 0, game, effect->item_name, 0, 0); + } + if (effect->timer == 76) { + eClacker_Make_Effect(effect, game); + } + if (effect->timer < 76) { + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); + xyz_t_mult_v(&effect->velocity, sqrtf(0.9)); + } } static void eClacker_dw(eEC_Effect_c* effect, GAME* game) { - // TODO -} + +} \ No newline at end of file