From bb209a8ed48a3092290f06bda654fae349c04b53 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:54:37 +0200 Subject: [PATCH 1/5] Implement & link ef_reset_hole --- configure.py | 2 +- src/effect/ef_reset_hole.c | 102 +++++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 82b79d88..e12a2589 100644 --- a/configure.py +++ b/configure.py @@ -1309,7 +1309,7 @@ config.libs = [ Object(Matching, "effect/ef_pun.c"), Object(Matching, "effect/ef_pun_sekimen.c"), Object(Matching, "effect/ef_pun_yuge.c"), - Object(NonMatching, "effect/ef_reset_hole.c"), + Object(Matching, "effect/ef_reset_hole.c"), Object(Matching, "effect/ef_room_sunshine.c"), Object(Matching, "effect/ef_room_sunshine_minsect.c"), Object(Matching, "effect/ef_room_sunshine_museum.c"), diff --git a/src/effect/ef_reset_hole.c b/src/effect/ef_reset_hole.c index 670936c0..57382e78 100644 --- a/src/effect/ef_reset_hole.c +++ b/src/effect/ef_reset_hole.c @@ -1,5 +1,12 @@ #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_reset_hole_modelT[]; + static void eReset_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eReset_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eReset_Hole_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +25,104 @@ eEC_PROFILE_c iam_ef_reset_hole = { }; static void eReset_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + pos.y += 1.0f; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_RESET_HOLE, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eReset_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 16; + + if (effect->arg0 == 1) { + if (effect->arg1 == 0) { + effect->scale.x = effect->scale.y = effect->scale.z = 0.01f; + } else { + effect->scale.x = effect->scale.y = effect->scale.z = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f; + } + } else { + effect->scale = ZeroVec; + } + + effect->effect_specific[0] = *(s16*)ct_arg; } static void eReset_Hole_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 angle; + f32 scale; + int i; + + eEC_CLIP->set_continious_env_proc(effect, 16, 120); + + if ((effect->state == eEC_STATE_NORMAL) && (effect->arg0 != 1)) { + if (effect->arg1 == 0) { + scale = 0.01f; + } else { + scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f; + } + effect->scale.x = effect->scale.y = effect->scale.z = + eEC_CLIP->calc_adjust_proc(effect->timer, 0, 16, scale, 0.0f); + + if ((effect->timer & 7) == 0) { + for (i = 0; i < 3; i++) { + static s16 angle_tbl[] = { DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(135.0f), DEG2SHORT_ANGLE(270.0f) }; + xyz_t pos = effect->position; + + angle = angle_tbl[i]; + if ((effect->timer & 15) == 0) { + angle += DEG2SHORT_ANGLE2(180.0f); + } + + eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, effect->prio, angle, game, effect->item_name, + effect->arg0, DEG2SHORT_ANGLE(-179.965f)); + } + } + } else if (effect->state == eEC_STATE_FINISHED) { + if (effect->arg1 == 0) { + scale = 0.01f; + } else { + scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f; + } + effect->scale.x = effect->scale.y = effect->scale.z = + eEC_CLIP->calc_adjust_proc(effect->timer, 0, 24, 0.0f, scale); + + if (((effect->timer & 7) == 0) && (effect->timer > 8)) { + for (i = 0; i < 3; i++) { + static s16 angle_tbl[] = { DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(135.0f), DEG2SHORT_ANGLE(270.0f) }; + xyz_t pos = effect->position; + + angle = angle_tbl[i]; + if ((effect->timer & 15) == 0) { + angle += DEG2SHORT_ANGLE2(180.0f); + } + + eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, effect->prio, angle, game, effect->item_name, + effect->arg0, DEG2SHORT_ANGLE(-179.965f)); + } + } + } else { + if (effect->arg1 == 0) { + scale = 0.01f; + } else { + scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f; + } + effect->scale.x = effect->scale.y = effect->scale.z = scale; + } } static void eReset_Hole_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + f32 scale; + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + + scale = GETREG(MYKREG, 0x1b) * 0.01f + 1.0f; + Matrix_scale(effect->scale.x * scale, effect->scale.y * scale, effect->scale.z * scale, TRUE); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_reset_hole_modelT); + + CLOSE_DISP(game->graph); } From 5df895550296cc66a666471a0d66c52d8b641ed6 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:56:29 +0200 Subject: [PATCH 2/5] Implement & link ef_sandsplash --- configure.py | 2 +- src/effect/ef_sandsplash.c | 92 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index e12a2589..c86f6fc3 100644 --- a/configure.py +++ b/configure.py @@ -1315,7 +1315,7 @@ config.libs = [ Object(Matching, "effect/ef_room_sunshine_museum.c"), Object(Matching, "effect/ef_room_sunshine_police.c"), Object(Matching, "effect/ef_room_sunshine_posthouse.c"), - Object(NonMatching, "effect/ef_sandsplash.c"), + Object(Matching, "effect/ef_sandsplash.c"), Object(NonMatching, "effect/ef_shock.c"), Object(Matching, "effect/ef_shooting.c"), Object(Matching, "effect/ef_shooting_kira.c"), diff --git a/src/effect/ef_sandsplash.c b/src/effect/ef_sandsplash.c index 07b65b06..cf2e61fc 100644 --- a/src/effect/ef_sandsplash.c +++ b/src/effect/ef_sandsplash.c @@ -1,10 +1,22 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_debug.h" +#include "m_rcp.h" +#include "sys_matrix.h" + static void eSandsplash_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eSandsplash_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eSandsplash_mv(eEC_Effect_c* effect, GAME* game); static void eSandsplash_dw(eEC_Effect_c* effect, GAME* game); +extern Gfx ef_sunahane01_00_modelT[]; + +extern u8 ef_sunahane01_0_inta_ia8[]; +extern u8 ef_sunahane01_1_inta_ia8[]; +extern u8 ef_sunahane01_2_inta_ia8[]; +extern u8 ef_sunahane01_3_inta_ia8[]; + eEC_PROFILE_c iam_ef_sandsplash = { // clang-format off &eSandsplash_init, @@ -17,18 +29,90 @@ eEC_PROFILE_c iam_ef_sandsplash = { // clang-format on }; +static u8* eSunahane_pattern_table[] = { + ef_sunahane01_0_inta_ia8, ef_sunahane01_0_inta_ia8, ef_sunahane01_1_inta_ia8, ef_sunahane01_1_inta_ia8, + ef_sunahane01_2_inta_ia8, ef_sunahane01_2_inta_ia8, ef_sunahane01_3_inta_ia8, ef_sunahane01_3_inta_ia8, +}; + static void eSandsplash_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + pos.y -= 3.0f; + pos.z += 5.0f; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_SANDSPLASH, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eSandsplash_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->velocity.x = 0.0f; + effect->velocity.y = 0.5f; + effect->velocity.z = 0.0f; + + effect->acceleration.x = 0.0f; + effect->acceleration.y = -0.01f; + effect->acceleration.z = 0.0f; + + if (effect->arg0 == 2) { + effect->velocity.x = sin_s(*(s16*)ct_arg); + effect->velocity.z = cos_s(*(s16*)ct_arg); + + effect->acceleration = ZeroVec; + + effect->offset.x = 0.005f; + effect->offset.y = 0.01f; + } else if (effect->arg0 == 1) { + effect->velocity.x = sin_s(*(s16*)ct_arg); + effect->velocity.z = cos_s(*(s16*)ct_arg); + + effect->acceleration = ZeroVec; + effect->acceleration.y = -0.075; + + effect->offset.x = 0.008f; + effect->offset.y = 0.012999999f; + } else if (effect->arg0 == 3) { + effect->velocity.x = sin_s(*(s16*)ct_arg) * 0.25f; + effect->velocity.z = cos_s(*(s16*)ct_arg); + effect->velocity.y = 0.0f; + + effect->acceleration = ZeroVec; + effect->acceleration.y = -0.05; + + effect->offset.x = 0.006f; + effect->offset.y = 0.012f; + } else { + effect->offset.x = 0.005f; + effect->offset.y = 0.01f; + } + + effect->timer = 16; } static void eSandsplash_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); + + effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 16, effect->offset.y, effect->offset.x); + effect->scale.y = effect->scale.z = effect->scale.x; } static void eSandsplash_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + float scale; + s16 idx = (16 - effect->timer) >> 1; + idx = CLAMP(idx, 0, 7); + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + Matrix_RotateX(DEG2SHORT_ANGLE2(-45.0f), TRUE); + + scale = GETREG(MYKREG, 0x1b) * 0.01f + 1.0f; + Matrix_scale(effect->scale.x * scale, effect->scale.y * scale, effect->scale.z * scale, TRUE); + + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 130, 20, 20, 20, 255); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, 205, 180, 140, 255); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, eSunahane_pattern_table[idx]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_sunahane01_00_modelT); + + CLOSE_DISP(game->graph); } From ed41b6180f9894d71a935e7bd189b093f40d417a Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:58:39 +0200 Subject: [PATCH 3/5] Implement & link ef_shock --- configure.py | 2 +- src/effect/ef_shock.c | 92 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index c86f6fc3..7c379b74 100644 --- a/configure.py +++ b/configure.py @@ -1316,7 +1316,7 @@ config.libs = [ Object(Matching, "effect/ef_room_sunshine_police.c"), Object(Matching, "effect/ef_room_sunshine_posthouse.c"), Object(Matching, "effect/ef_sandsplash.c"), - Object(NonMatching, "effect/ef_shock.c"), + Object(Matching, "effect/ef_shock.c"), Object(Matching, "effect/ef_shooting.c"), Object(Matching, "effect/ef_shooting_kira.c"), Object(Matching, "effect/ef_shooting_set.c"), diff --git a/src/effect/ef_shock.c b/src/effect/ef_shock.c index 60196607..6feaac8d 100644 --- a/src/effect/ef_shock.c +++ b/src/effect/ef_shock.c @@ -1,12 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" + +extern Gfx ef_shock01_00_modelT[]; + static void eSK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eSK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eSK_mv(eEC_Effect_c* effect, GAME* game); static void eSK_dw(eEC_Effect_c* effect, GAME* game); +// clang-format off eEC_PROFILE_c iam_ef_shock = { - // clang-format off &eSK_init, &eSK_ct, &eSK_mv, @@ -14,21 +18,97 @@ eEC_PROFILE_c iam_ef_shock = { eEC_IGNORE_DEATH, eEC_NO_CHILD_ID, eEC_DEFAULT_DEATH_DIST, - // clang-format on }; +static rgba_t eSK_prim_table[] = { + { 255, 0, 0, 200 }, + { 255, 128, 0, 227 }, + { 255, 255, 0, 255 }, + { 255, 191, 0, 191 }, + { 255, 128, 0, 128 }, + { 255, 63, 0, 63 }, + { 255, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, +}; + +static f32 eSK_scale_table[] = { + 0.019f, 0.02375f, 0.028499999f, 0.026124999f, 0.02375f, 0.021374999f, 0.019f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, +}; +// clang-format on + +typedef struct { + xyz_t velocity; + xyz_t acceleration; + f32 scale; +} eSK_dt_c; + static void eSK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t ofs; + eSK_dt_c data; + + data.velocity.x = 0.0f; + data.velocity.y = 1.0f; + data.velocity.z = 0.0f; + + data.acceleration.x = 0.0f; + data.acceleration.y = -0.1f; + data.acceleration.z = 0.0f; + + data.scale = 1.0f; + + ofs.x = 0.0f; + ofs.y = 4.0f; + ofs.z = 6.0f; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_SHOCK, pos, &ofs, game, &data, item_name, prio, 0, 0); } static void eSK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + eSK_dt_c* data = (eSK_dt_c*)ct_arg; + + effect->scale.x = data->scale; + effect->scale.y = data->scale; + effect->scale.z = data->scale; + + effect->timer = 14; + + effect->acceleration = data->acceleration; + + effect->velocity = data->velocity; } static void eSK_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 timer = 14 - effect->timer; + if (timer == 0) { + sAdo_OngenTrgStart(0x2d, &effect->position); + } } static void eSK_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t* pos = &effect->position; + xyz_t* scale = &effect->scale; + xyz_t* ofs = &effect->offset; + s16 idx = (14 - effect->timer) >> 1; + idx = CLAMP(idx, 0, 6); + + scale->x = eSK_scale_table[idx]; + scale->y = eSK_scale_table[idx]; + scale->z = eSK_scale_table[idx]; + + OPEN_DISP(game->graph); + + eEC_CLIP->auto_matrix_xlu_offset_proc(game, pos, scale, ofs); + + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, eSK_prim_table[idx].r, eSK_prim_table[idx].g, eSK_prim_table[idx].b, + eSK_prim_table[idx].a); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_shock01_00_modelT); + + CLOSE_DISP(game->graph); } From 6838a77062789376ae28a6bb904c993c0970a3a6 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:59:57 +0200 Subject: [PATCH 4/5] Implement & link ef_situren --- configure.py | 2 +- src/effect/ef_situren.c | 82 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 7c379b74..e9150700 100644 --- a/configure.py +++ b/configure.py @@ -1324,7 +1324,7 @@ config.libs = [ Object(Matching, "effect/ef_siawase_hana_ch.c"), Object(Matching, "effect/ef_siawase_hikari.c"), Object(Matching, "effect/ef_sibuki.c"), - Object(NonMatching, "effect/ef_situren.c"), + Object(Matching, "effect/ef_situren.c"), Object(NonMatching, "effect/ef_slip.c"), Object(NonMatching, "effect/ef_slip_footprint.c"), Object(NonMatching, "effect/ef_soba_yuge.c"), diff --git a/src/effect/ef_situren.c b/src/effect/ef_situren.c index 1a3793ee..8cbafbda 100644 --- a/src/effect/ef_situren.c +++ b/src/effect/ef_situren.c @@ -1,5 +1,18 @@ +#include "audio.h" #include "ef_effect_control.h" +#include "graph.h" +#include "libu64/u64types.h" +#include "m_common_data.h" +#include "m_lib.h" +#include "m_rcp.h" +#include "sys_math3d.h" +#include "sys_matrix.h" + +extern Gfx ef_situren01_00_modelT[]; +extern Gfx ef_situren01_01_modelT[]; +extern Gfx ef_situren01_02_modelT[]; + static void eSN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eSN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eSN_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +31,78 @@ eEC_PROFILE_c iam_ef_situren = { }; static void eSN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t vec = { 0.0f, 10.0f, 7.0f }; + + sMath_RotateY(&vec, SHORT2RAD_ANGLE2(angle)); + pos.x += vec.x; + pos.y += vec.y; + pos.z += vec.z; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_SITUREN, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eSN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 128; + + effect->scale = ZeroVec; + effect->offset = ZeroVec; + + effect->effect_specific[0] = 0; + + sAdo_OngenTrgStart(0x13d, &effect->position); } static void eSN_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 timer = 128 - effect->timer; + + effect->effect_specific[0] += DEG2SHORT_ANGLE2(30.94f); + + if (timer < 8) { + effect->position.y += 1.6f; + } } static void eSN_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + Gfx* gfx; + s16 angle, timer; + f32 s, c, temp1, temp2, temp3; + u8 alpha; + + angle = effect->effect_specific[0]; + timer = 128 - effect->timer; + + s = sin_s(angle); + c = cos_s(angle); + + temp1 = eEC_CLIP->calc_adjust_proc(timer, 0, 6, 0.0f, 0.0075f); + temp2 = eEC_CLIP->calc_adjust_proc(timer, 0, 42, 1.4f, 1.0f); + temp3 = eEC_CLIP->calc_adjust_proc(timer, 0, 42, 0.6f, 1.0f); + alpha = (int)eEC_CLIP->calc_adjust_proc(timer, 108, 128, 255.0f, 0.0f); + + effect->scale.x = temp1 * (temp3 + ((s + 1.0f) * 0.5f * (temp2 - temp3))); + effect->scale.y = temp1 * (temp3 + ((c + 1.0f) * 0.5f * (temp2 - temp3))); + effect->scale.z = 0.0075f; + + if (timer == 60) { + gfx = ef_situren01_01_modelT; + } else if (timer > 60) { + gfx = ef_situren01_02_modelT; + } else { + gfx = ef_situren01_00_modelT; + } + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + Matrix_mult(&((GAME_PLAY*)game)->billboard_matrix, TRUE); + Matrix_translate(effect->offset.x, effect->offset.y, effect->offset.z, TRUE); + Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 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, 255, 200, 255, alpha); + gSPDisplayList(NEXT_POLY_XLU_DISP, gfx); + + CLOSE_DISP(game->graph); } From 8418ca564f89627680fa8af87f48cd5087a74e79 Mon Sep 17 00:00:00 2001 From: Norgesnerd <5824576+Norgesnerd@users.noreply.github.com> Date: Sun, 15 Jun 2025 17:01:19 +0200 Subject: [PATCH 5/5] Implement & link ef_taberu --- configure.py | 2 +- src/effect/ef_taberu.c | 54 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index e9150700..141930ab 100644 --- a/configure.py +++ b/configure.py @@ -1334,7 +1334,7 @@ config.libs = [ Object(NonMatching, "effect/ef_swing_axe.c"), Object(NonMatching, "effect/ef_swing_net.c"), Object(NonMatching, "effect/ef_swing_rod.c"), - Object(NonMatching, "effect/ef_taberu.c"), + Object(Matching, "effect/ef_taberu.c"), Object(Matching, "effect/ef_takurami.c"), Object(Matching, "effect/ef_takurami_kira.c"), Object(Matching, "effect/ef_tamaire.c"), diff --git a/src/effect/ef_taberu.c b/src/effect/ef_taberu.c index d579e518..b37a1b26 100644 --- a/src/effect/ef_taberu.c +++ b/src/effect/ef_taberu.c @@ -1,10 +1,24 @@ #include "ef_effect_control.h" +#include "m_common_data.h" + static void eTaberu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eTaberu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eTaberu_mv(eEC_Effect_c* effect, GAME* game); static void eTaberu_dw(eEC_Effect_c* effect, GAME* game); +extern Gfx ef_taberu01_00_modelT[]; +extern Gfx ef_taberu01_01_modelT[]; +extern Gfx ef_taberu01_02_modelT[]; +extern Gfx ef_taberu01_03_modelT[]; + +static Gfx* eTaberu_model_table[] = { + ef_taberu01_00_modelT, + ef_taberu01_01_modelT, + ef_taberu01_02_modelT, + ef_taberu01_03_modelT, +}; + eEC_PROFILE_c iam_ef_taberu = { // clang-format off &eTaberu_init, @@ -18,17 +32,49 @@ eEC_PROFILE_c iam_ef_taberu = { }; static void eTaberu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t ofs; + + ofs.x = 0.0f; + ofs.y = 0.0f; + ofs.z = 0.0f; + + eEC_CLIP->make_effect_proc(eEC_EFFECT_TABERU, pos, &ofs, game, &angle, item_name, prio, 0, 0); } static void eTaberu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + s16 angle = *(s16*)ct_arg; + + if (effect->item_name == SP_NPC_ARTIST) { + effect->position.x += sin_s(angle) * 15.0f; + effect->position.y += -15.0f; + effect->position.z += cos_s(angle) * 15.0f; + } else { + effect->position.x += sin_s(angle) * 13.0f; + effect->position.y += -10.0f; + effect->position.z += cos_s(angle) * 13.0f; + } + + effect->scale.x = 0.0045f; + effect->scale.y = 0.0045f; + effect->scale.z = 0.0045f; + + effect->effect_specific[0] = 0; + + effect->timer = 44; } static void eTaberu_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + effect->effect_specific[0] += 1; } static void eTaberu_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 idx = ((u16)effect->effect_specific[0] >> 2) & 3; + + OPEN_DISP(game->graph); + + eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset); + + gSPDisplayList(NEXT_POLY_XLU_DISP, eTaberu_model_table[idx]); + + CLOSE_DISP(game->graph); }