diff --git a/configure.py b/configure.py index 4cdc7b8d..eb2cf7b4 100644 --- a/configure.py +++ b/configure.py @@ -1343,9 +1343,9 @@ config.libs = [ Object(NonMatching, "effect/ef_tumble.c"), Object(NonMatching, "effect/ef_tumble_bodyprint.c"), Object(NonMatching, "effect/ef_tumble_dust.c"), - Object(NonMatching, "effect/ef_turi_hamon.c"), - Object(NonMatching, "effect/ef_turi_hane0.c"), - Object(NonMatching, "effect/ef_turi_hane1.c"), + Object(Matching, "effect/ef_turi_hamon.c"), + Object(Matching, "effect/ef_turi_hane0.c"), + Object(Matching, "effect/ef_turi_hane1.c"), Object(Matching, "effect/ef_turi_mizu.c"), Object(Matching, "effect/ef_turi_suiteki.c"), Object(NonMatching, "effect/ef_turn_asimoto.c"), diff --git a/src/effect/ef_turi_hamon.c b/src/effect/ef_turi_hamon.c index 05e6e22c..9c3617d2 100644 --- a/src/effect/ef_turi_hamon.c +++ b/src/effect/ef_turi_hamon.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_turi_hamon01_00_modelT[]; + static void eTH_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eTH_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eTH_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +25,94 @@ eEC_PROFILE_c iam_ef_turi_hamon = { }; static void eTH_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_TURI_HAMON, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eTH_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->effect_specific[2] = *(s16*)ct_arg; + + switch (effect->arg0) { + case 0: + effect->velocity.x = 0.036f; + break; + case 1: + effect->velocity.x = 0.032f; + break; + case 2: + effect->velocity.x = 0.024f; + break; + case 3: + effect->velocity.x = 0.02f; + break; + case 4: + effect->velocity.x = 0.014f; + break; + default: + effect->velocity.x = ((effect->arg1 / 100.0f) * 0.06f) + 0.02f; + break; + } + + if (effect->velocity.x > 0.03f) { + effect->effect_specific[0] = DEG2SHORT_ANGLE(1.1f); + effect->effect_specific[3] = DEG2SHORT_ANGLE(1.1f); + } else { + effect->effect_specific[0] = DEG2SHORT_ANGLE(0.825f); + effect->effect_specific[3] = DEG2SHORT_ANGLE(0.825f); + } + + if (effect->arg0 == 7) { + effect->timer = 32; + effect->scale.x = 0.001f; + effect->velocity.y = (GETREG(TAKREG, 0x39) * 0.1f + 3.0f) * 0.5f; + effect->velocity.z = 1.0f / 32.0f; + } + if (effect->arg0 == 6) { + effect->timer = 52; + effect->scale.x = 0.001f; + effect->velocity.y = 0.05f; + effect->velocity.z = 1.0f / 52.0f; + } else if (effect->arg0 != 4) { + effect->timer = 32; + effect->scale.x = 0.001f; + effect->velocity.y = 0.125f; + effect->velocity.z = 1.0f / 32.0f; + } else { + effect->timer = 52; + effect->scale.x = 0.003f; + effect->velocity.y = 0.35f; + effect->velocity.z = 1.0f / 52.0f; + } + + effect->effect_specific[1] = effect->timer; + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; } static void eTH_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + add_calc2(&effect->scale.x, effect->velocity.x, 1.0f - sqrtf(1.0f - effect->velocity.z), 0.005f); + + effect->effect_specific[0] = + eEC_CLIP->calc_adjust_proc(effect->timer, 0, effect->effect_specific[1], 0.0f, effect->effect_specific[3]); + + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; + + effect->position.x += effect->velocity.y * sin_s(effect->effect_specific[2]); + effect->position.z += effect->velocity.y * cos_s(effect->effect_specific[2]); } static void eTH_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t scale = effect->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); + Matrix_scale(scale.x, scale.y, 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, 255, 255, effect->effect_specific[0]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_turi_hamon01_00_modelT); + + CLOSE_DISP(game->graph); } diff --git a/src/effect/ef_turi_hane0.c b/src/effect/ef_turi_hane0.c index aa014e4e..f8b2db5e 100644 --- a/src/effect/ef_turi_hane0.c +++ b/src/effect/ef_turi_hane0.c @@ -1,5 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" + +extern Gfx ef_turi_hane01_00_modelT[]; + +extern u8 ef_turi_hane01_0_int_i4[]; +extern u8 ef_turi_hane01_1_int_i4[]; +extern u8 ef_turi_hane01_2_int_i4[]; +extern u8 ef_turi_hane01_3_int_i4[]; + static void eTH0_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eTH0_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eTH0_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +28,62 @@ eEC_PROFILE_c iam_ef_turi_hane0 = { // clang-format on }; +static u8* eTuri_Hane0Ptn[] = { + ef_turi_hane01_0_int_i4, ef_turi_hane01_0_int_i4, ef_turi_hane01_1_int_i4, ef_turi_hane01_1_int_i4, + ef_turi_hane01_2_int_i4, ef_turi_hane01_2_int_i4, ef_turi_hane01_3_int_i4, ef_turi_hane01_3_int_i4, +}; + static void eTH0_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_TURI_HANE0, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eTH0_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + f32 scale; + + effect->timer = 16; + + switch (effect->arg0) { + case 1: + scale = 0.013f; + break; + case 2: + scale = 0.014f; + break; + case 3: + scale = 0.009f; + break; + case 4: + scale = 0.007f; + break; + default: + scale = 0.01f; + break; + } + + effect->scale.x = scale; + effect->scale.y = scale; + effect->scale.z = scale; } static void eTH0_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + return; } static void eTH0_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t scale = effect->scale; + s16 counter = (s16)(16 - effect->timer) >> 1; + counter = CLAMP(counter, 0, 8); + + 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_scale(scale.x, scale.y, scale.z, TRUE); + + 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, eTuri_Hane0Ptn[counter]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_turi_hane01_00_modelT); + + CLOSE_DISP(game->graph); } diff --git a/src/effect/ef_turi_hane1.c b/src/effect/ef_turi_hane1.c index 75c3acec..290934f7 100644 --- a/src/effect/ef_turi_hane1.c +++ b/src/effect/ef_turi_hane1.c @@ -1,5 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" + +extern Gfx ef_turi_hane02_00_modelT[]; + +extern u8 ef_turi_hane02_0_int_i4[]; +extern u8 ef_turi_hane02_1_int_i4[]; +extern u8 ef_turi_hane02_2_int_i4[]; +extern u8 ef_turi_hane02_3_int_i4[]; + static void eTH0_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eTH0_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eTH0_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +28,42 @@ eEC_PROFILE_c iam_ef_turi_hane1 = { // clang-format on }; +static u8* eTuri_Hane1Ptn[] = { + ef_turi_hane02_0_int_i4, ef_turi_hane02_0_int_i4, ef_turi_hane02_1_int_i4, ef_turi_hane02_1_int_i4, + ef_turi_hane02_2_int_i4, ef_turi_hane02_2_int_i4, ef_turi_hane02_3_int_i4, ef_turi_hane02_3_int_i4, +}; + static void eTH0_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_TURI_HANE1, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eTH0_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 16; + + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; } static void eTH0_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + return; } static void eTH0_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + xyz_t scale = effect->scale; + s16 counter = (s16)(16 - effect->timer) >> 1; + counter = CLAMP(counter, 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_scale(scale.x, scale.y, scale.z, TRUE); + + 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, eTuri_Hane1Ptn[counter]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_turi_hane02_00_modelT); + + CLOSE_DISP(game->graph); }