From 7a6c0932918845a984d678e2f910967381f77e90 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Sat, 29 Mar 2025 11:42:18 -0400 Subject: [PATCH] Link a bunch of effects --- configure.py | 14 +-- src/effect/ef_dust.c | 185 +++++++++++++++++++++++++++++++++- src/effect/ef_night13_moon.c | 113 ++++++++++++++++++++- src/effect/ef_night15_moon.c | 113 ++++++++++++++++++++- src/effect/ef_shooting_kira.c | 77 +++++++++++++- src/effect/ef_wait_asimoto.c | 14 ++- src/effect/ef_walk_asimoto.c | 10 +- src/effect/ef_warau.c | 55 +++++++++- src/effect/ef_yajirushi.c | 31 +++++- 9 files changed, 572 insertions(+), 40 deletions(-) diff --git a/configure.py b/configure.py index a1f44f7a..a121033e 100644 --- a/configure.py +++ b/configure.py @@ -1248,7 +1248,7 @@ config.libs = [ Object(Matching, "effect/ef_dig_scoop.c"), Object(Matching, "effect/ef_douzou_light.c"), Object(Matching, "effect/ef_doyon.c"), - Object(NonMatching, "effect/ef_dust.c"), + Object(Matching, "effect/ef_dust.c"), Object(Matching, "effect/ef_effect_control.c"), Object(Matching, "effect/ef_flash.c"), Object(Matching, "effect/ef_footprint.c"), @@ -1300,8 +1300,8 @@ config.libs = [ Object(NonMatching, "effect/ef_neboke.c"), Object(NonMatching, "effect/ef_neboke_akubi.c"), Object(NonMatching, "effect/ef_neboke_awa.c"), - Object(NonMatching, "effect/ef_night13_moon.c"), - Object(NonMatching, "effect/ef_night15_moon.c"), + Object(Matching, "effect/ef_night13_moon.c"), + Object(Matching, "effect/ef_night15_moon.c"), Object(NonMatching, "effect/ef_ongen.c"), Object(NonMatching, "effect/ef_otikomi.c"), Object(Matching, "effect/ef_otosiana.c"), @@ -1317,7 +1317,7 @@ config.libs = [ Object(NonMatching, "effect/ef_sandsplash.c"), Object(NonMatching, "effect/ef_shock.c"), Object(NonMatching, "effect/ef_shooting.c"), - Object(NonMatching, "effect/ef_shooting_kira.c"), + Object(Matching, "effect/ef_shooting_kira.c"), Object(NonMatching, "effect/ef_shooting_set.c"), Object(NonMatching, "effect/ef_siawase_hana.c"), Object(NonMatching, "effect/ef_siawase_hana_ch.c"), @@ -1350,10 +1350,10 @@ config.libs = [ Object(NonMatching, "effect/ef_turn_asimoto.c"), Object(NonMatching, "effect/ef_turn_footprint.c"), Object(NonMatching, "effect/ef_uranai.c"), - Object(NonMatching, "effect/ef_wait_asimoto.c"), + Object(Matching, "effect/ef_wait_asimoto.c"), Object(Matching, "effect/ef_walk_asimoto.c"), - Object(NonMatching, "effect/ef_warau.c"), - Object(NonMatching, "effect/ef_yajirushi.c"), + Object(Matching, "effect/ef_warau.c"), + Object(Matching, "effect/ef_yajirushi.c"), Object(Matching, "effect/ef_young_tree.c"), Object(Matching, "effect/ef_yukidama.c"), Object(Matching, "effect/ef_yukidaruma.c"), diff --git a/src/effect/ef_dust.c b/src/effect/ef_dust.c index 05b06ac2..b2ed37f5 100644 --- a/src/effect/ef_dust.c +++ b/src/effect/ef_dust.c @@ -1,5 +1,19 @@ #include "ef_effect_control.h" +#include "m_common_data.h" + +extern u8 ef_dust01_0[]; +extern u8 ef_dust01_1[]; +extern u8 ef_dust01_2[]; +extern u8 ef_dust01_3[]; + +static u8* eDT_texture_table[] = { + ef_dust01_0, + ef_dust01_1, + ef_dust01_2, + ef_dust01_3, +}; + static void eDT_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eDT_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eDT_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +31,181 @@ eEC_PROFILE_c iam_ef_dust = { // clang-format on }; +static rgba_t eDT_prim_table[] = { + // clang-format off + {255, 255, 255, 255}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + {230, 150, 100, 255}, + {100, 100, 255, 255}, + {230, 230, 100, 255}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + // clang-format on +}; + +typedef struct { + xyz_t velocity; + xyz_t acceleration; + f32 scale; + s16 angle_y; +} eDT_data_c; + static void eDT_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + eDT_data_c data; + f32 rad_angle_y = SHORT2RAD_ANGLE2(angle); + + data.velocity.x = 0.0f; + + if (arg1 != 4) { + data.velocity.y = 1.0f; + } else { + data.velocity.y = 0.0f; + pos.y += 5.0f; + } + + if (arg1 == 8) { + data.velocity.z = -2.0f; + } else if (arg1 == 1) { + data.velocity.z = -1.5f; + } else if (arg1 == 2) { + data.velocity.z = -1.0f; + } else if (arg1 == 3 || arg1 == 5) { + data.velocity.z = 0.0f; + } else if (arg1 == 0) { + data.velocity.z = 0.5f; + pos.x += 15.0f * sin_s(angle); + pos.z += 15.0f * cos_s(angle); + pos.y += -15.0f; + } else if (arg1 == 9) { + data.velocity.z = 0.75f; + pos.x += 25.0f * sin_s(angle); + pos.z += 25.0f * cos_s(angle); + } else { + data.velocity.z = 0.25f; + } + + if (arg1 == 4) { + data.acceleration.x = 0.0f; + data.acceleration.y = 0.1f; + data.acceleration.z = 0.0f; + } else if (arg1 == 0) { + data.acceleration = ZeroVec; + } else { + data.acceleration.x = 0.0f; + data.acceleration.y = -0.05f; + data.acceleration.z = 0.075f; + } + + if (arg1 == 4) { + data.scale = 0.015f; + } else if (arg1 == 0 || arg1 == 9) { + data.scale = 0.007f; + } else { + data.scale = 0.01f; + } + + eEC_CLIP->vector_rotate_y_proc(&data.velocity, rad_angle_y); + eEC_CLIP->vector_rotate_y_proc(&data.acceleration, rad_angle_y); + eEC_CLIP->make_effect_proc(eEC_EFFECT_DUST, pos, NULL, game, &data, item_name, prio, arg0, arg1); } static void eDT_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + eDT_data_c* data = (eDT_data_c*)ct_arg; + + effect->scale.x = data->scale; + effect->scale.y = data->scale; + effect->scale.z = data->scale; + effect->timer = 18; + effect->acceleration = data->acceleration; + effect->velocity = data->velocity; } static void eDT_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + if (effect->arg1 == 4) { + s16 counter = 18 - effect->timer; + + effect->scale.x = eEC_CLIP->calc_adjust_proc(counter, 0, 17, 0.012f, 0.015f); + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; + } else if (effect->arg1 == 0 || effect->arg1 == 9) { + effect->velocity.x *= sqrtf(0.85f); + effect->velocity.y *= sqrtf(0.85f); + effect->velocity.z *= sqrtf(0.85f); + } + + xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); + xyz_t_add(&effect->position, &effect->velocity, &effect->position); } +typedef struct { + u8 tex0; + u8 tex1; +} eDT_2tile_c; + +static eDT_2tile_c eDT_2tile_texture_idx[] = { + {0, 0}, + {0, 1}, + {1, 1}, + {1, 2}, + {2, 2}, + {2, 3}, + {3, 3}, + {3, 3}, + {3, 3}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, +}; + +static u8 eDT_AlphaPtn[18] = { + 0xFF, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, +}; + +static u8 eDT_prim_f[18] = { + 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, +}; + +extern Gfx ef_dust01_modelT[]; + static void eDT_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 counter = (18 - effect->timer) >> 1; + xyz_t* pos = &effect->position; + xyz_t* scale = &effect->scale; + int tex0; + int tex1; + + counter = CLAMP(counter, 0, 9); + + + tex0 = eDT_2tile_texture_idx[counter].tex0; + tex1 = eDT_2tile_texture_idx[counter].tex1; + + OPEN_DISP(game->graph); + + eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, eDT_texture_table[tex0]); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_2_TXT_SEG, eDT_texture_table[tex1]); + + if (effect->arg1 >= 0 && effect->arg1 < 10) { + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, eDT_prim_f[counter], eDT_prim_table[effect->arg1].r, eDT_prim_table[effect->arg1].g, eDT_prim_table[effect->arg1].b, eDT_AlphaPtn[counter]); + } else { + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, eDT_prim_f[counter], 255, 255, 255, eDT_AlphaPtn[counter]); + } + + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_dust01_modelT); + + CLOSE_DISP(game->graph); } diff --git a/src/effect/ef_night13_moon.c b/src/effect/ef_night13_moon.c index 45718819..c7f485a5 100644 --- a/src/effect/ef_night13_moon.c +++ b/src/effect/ef_night13_moon.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 eNight13Moon_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eNight13Moon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eNight13Moon_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +21,119 @@ eEC_PROFILE_c iam_ef_night13_moon = { // clang-format on }; +static int eNight13Moon_GetPoolBlockCenter(xyz_t* center_pos) { + xyz_t base = { 0.0f, 0.0f, 0.0f }; + int bx = 0; + int bz = 0; + + *center_pos = base; + + if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL) && mFI_BkNum2WposXZ(&base.x, &base.z, bx, bz)) { + center_pos->x = base.x + mFI_BK_WORLDSIZE_HALF_X_F; + center_pos->z = base.z + mFI_BK_WORLDSIZE_HALF_Z_F; + center_pos->y = mFI_BkNum2BaseHeight(bx, bz) + 19.0f; + return TRUE; + } + + return FALSE; +} + +static xyz_t eNight13Moon_GetNowMoonPos(xyz_t center_pos) { + f32 right_x = center_pos.x + 100.0f; + lbRTC_time_c rtc_time = Common_Get(time.rtc_time); + xyz_t pos = { 0.0f, 0.0f, 0.0f }; + + if (rtc_time.hour >= 18 && rtc_time.hour < 21) { + f32 sec = (rtc_time.min * 60.0f + rtc_time.sec) * (1.0f / 54.0f); + + pos.x = right_x - (rtc_time.hour - 18) * 66.666666f; + pos.x -= sec; + } else if (rtc_time.hour < 18) { + pos.x = right_x; + } else { + pos.x = center_pos.x - 100.0f; + } + + pos.z = center_pos.z; + pos.y = center_pos.y; + return pos; +} + static void eNight13Moon_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_NIGHT13_MOON, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eNight13Moon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + xyz_t pos = { 0.0f, 0.0f, 0.0f }; + + effect->effect_specific[3] = 0; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.0f; + effect->offset.y = 0.0f; + effect->offset.z = 0.0f; + + if (eNight13Moon_GetPoolBlockCenter(&pos)) { + effect->timer = 20000; + effect->effect_specific[3] = 1; + } else { + effect->timer = 0; + } + + effect->acceleration = pos; + effect->position = eNight13Moon_GetNowMoonPos(effect->acceleration); } static void eNight13Moon_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + f32 sin = sin_s(effect->effect_specific[2]); + + if (effect->effect_specific[3] == 0 && effect->timer == 0) { + xyz_t pos; + + if (eNight13Moon_GetPoolBlockCenter(&pos)) { + effect->effect_specific[3] = 1; + effect->acceleration = pos; + } + } + + effect->effect_specific[0] += 150; + effect->effect_specific[1] -= 100; + effect->effect_specific[2] += 256; + + eEC_CLIP->set_continious_env_proc(effect, 20000, 20000); + effect->position = eNight13Moon_GetNowMoonPos(effect->acceleration); + effect->offset.x = 1.5f * sin; + effect->offset.z = -1.5f * sin; } +extern EVW_ANIME_DATA ef_moon01_01_evw_anime; +extern Gfx ef_moon01_01_modelT[]; + static void eNight13Moon_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + + if (eEC_CLIP->check_lookat_block_proc(effect->position) || effect->state == eEC_STATE_FINISHED) { + s16 angle0 = effect->effect_specific[0]; + s16 angle1 = effect->effect_specific[1]; + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x + effect->offset.x, effect->position.y + effect->offset.y, effect->position.z + effect->offset.z, 0); + Matrix_RotateY(-angle0, 1); + Matrix_scale(1.075f, 1.0f, 1.0f, 1); + Matrix_RotateY(angle0, 1); + Matrix_RotateY(-angle1, 1); + Matrix_scale(1.0f, 1.0f, 1.075f, 1); + Matrix_RotateY(angle1, 1); + Matrix_scale(0.049f, 1.0f, 0.049f, 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, 40, 255, 255, 100, 170); + Evw_Anime_Set(play, &ef_moon01_01_evw_anime); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_moon01_01_modelT); + + CLOSE_DISP(game->graph); + } } diff --git a/src/effect/ef_night15_moon.c b/src/effect/ef_night15_moon.c index 525d03ae..25672ff4 100644 --- a/src/effect/ef_night15_moon.c +++ b/src/effect/ef_night15_moon.c @@ -1,5 +1,9 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_rcp.h" + static void eNight15Moon_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eNight15Moon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eNight15Moon_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +21,119 @@ eEC_PROFILE_c iam_ef_night15_moon = { // clang-format on }; +static int eNight15Moon_GetPoolBlockCenter(xyz_t* center_pos) { + xyz_t base = { 0.0f, 0.0f, 0.0f }; + int bx = 0; + int bz = 0; + + *center_pos = base; + + if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL) && mFI_BkNum2WposXZ(&base.x, &base.z, bx, bz)) { + center_pos->x = base.x + mFI_BK_WORLDSIZE_HALF_X_F; + center_pos->z = base.z + mFI_BK_WORLDSIZE_HALF_Z_F; + center_pos->y = mFI_BkNum2BaseHeight(bx, bz) + 19.0f; + return TRUE; + } + + return FALSE; +} + +static xyz_t eNight15Moon_GetNowMoonPos(xyz_t center_pos) { + f32 right_x = center_pos.x + 100.0f; + lbRTC_time_c rtc_time = Common_Get(time.rtc_time); + xyz_t pos; + + if (rtc_time.hour >= 18 && rtc_time.hour < 21) { + f32 sec = (rtc_time.min * 60.0f + rtc_time.sec) * (1.0f / 54.0f); + + pos.x = right_x - (rtc_time.hour - 18) * 66.666666f; + pos.x -= sec; + } else if (rtc_time.hour < 18) { + pos.x = right_x; + } else { + pos.x = center_pos.x - 100.0f; + } + + pos.z = center_pos.z; + pos.y = center_pos.y; + return pos; +} + static void eNight15Moon_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_NIGHT15_MOON, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eNight15Moon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + xyz_t pos = { 0.0f, 0.0f, 0.0f }; + + effect->effect_specific[3] = 0; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.0f; + effect->offset.y = 0.0f; + effect->offset.z = 0.0f; + + if (eNight15Moon_GetPoolBlockCenter(&pos)) { + effect->timer = 20000; + effect->effect_specific[3] = 1; + } else { + effect->timer = 0; + } + + effect->acceleration = pos; + effect->position = eNight15Moon_GetNowMoonPos(effect->acceleration); } static void eNight15Moon_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + f32 sin = sin_s(effect->effect_specific[2]); + + if (effect->effect_specific[3] == 0 && effect->timer == 0) { + xyz_t pos; + + if (eNight15Moon_GetPoolBlockCenter(&pos)) { + effect->effect_specific[3] = 1; + effect->acceleration = pos; + } + } + + effect->effect_specific[0] += 150; + effect->effect_specific[1] -= 100; + effect->effect_specific[2] += 256; + + eEC_CLIP->set_continious_env_proc(effect, 20000, 20000); + effect->position = eNight15Moon_GetNowMoonPos(effect->acceleration); + effect->offset.x = 1.5f * sin; + effect->offset.z = -1.5f * sin; } +extern EVW_ANIME_DATA ef_moon01_00_evw_anime; +extern Gfx ef_moon01_00_modelT[]; + static void eNight15Moon_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + + if (eEC_CLIP->check_lookat_block_proc(effect->position) || effect->state == eEC_STATE_FINISHED) { + s16 angle0 = effect->effect_specific[0]; + s16 angle1 = effect->effect_specific[1]; + + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + Matrix_translate(effect->position.x + effect->offset.x, effect->position.y + effect->offset.y, effect->position.z + effect->offset.z, 0); + Matrix_RotateY(-angle0, 1); + Matrix_scale(1.075f, 1.0f, 1.0f, 1); + Matrix_RotateY(angle0, 1); + Matrix_RotateY(-angle1, 1); + Matrix_scale(1.0f, 1.0f, 1.075f, 1); + Matrix_RotateY(angle1, 1); + Matrix_scale(0.049f, 1.0f, 0.049f, 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, 40, 255, 255, 100, 170); + Evw_Anime_Set(play, &ef_moon01_00_evw_anime); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_moon01_00_modelT); + + CLOSE_DISP(game->graph); + } } diff --git a/src/effect/ef_shooting_kira.c b/src/effect/ef_shooting_kira.c index e063b7c7..abcfee7b 100644 --- a/src/effect/ef_shooting_kira.c +++ b/src/effect/ef_shooting_kira.c @@ -1,5 +1,10 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_rcp.h" +#include "m_debug.h" + static void eShootingKira_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eShootingKira_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eShootingKira_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +23,81 @@ eEC_PROFILE_c iam_ef_shooting_kira = { }; static void eShootingKira_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_SHOOTING_KIRA, pos, NULL, game, NULL, item_name, prio, arg0, angle); } static void eShootingKira_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + static xyz_t scale0 = { 0.0f, 0.0f, 0.0f }; + f32 speed_scale = effect->arg0 * 0.01f; + + effect->timer = 42 + GETREG(MYKREG, 32); + effect->scale = scale0; + + effect->acceleration = effect->position; + effect->acceleration.x -= 115.0f * speed_scale * sin_s(effect->arg1); + effect->acceleration.z -= 115.0f * speed_scale * cos_s(effect->arg1); + + effect->velocity = effect->position; + effect->velocity.x += 115.0f * speed_scale * sin_s(effect->arg1); + effect->velocity.z += 115.0f * speed_scale * cos_s(effect->arg1); } static void eShootingKira_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 max = 42 + GETREG(MYKREG, 32); + s16 counter = max - effect->timer; + s16 fadein = max * 0.7f; + f32 scale; + + if (counter < fadein) { + scale = eEC_CLIP->calc_adjust_proc(counter, 0, max * 0.7f, 0.0f, 0.0065f); + } else { + s16 fadein2 = max * 0.87f; + + if (counter < fadein2) { + scale = eEC_CLIP->calc_adjust_proc(counter, max * 0.7f, max * 0.87f, 0.0065f, 0.00975f); + } else { + scale = eEC_CLIP->calc_adjust_proc(counter, max * 0.7f, max, 0.00975f, 0.0f); + } + } + + effect->scale.x = scale; + effect->scale.y = scale; + effect->scale.z = scale; + + effect->position.x = eEC_CLIP->calc_adjust_proc(counter, 0, 42 + GETREG(MYKREG, 32), effect->acceleration.x, effect->velocity.x); + effect->position.z = eEC_CLIP->calc_adjust_proc(counter, 0, 42 + GETREG(MYKREG, 32), effect->acceleration.z, effect->velocity.z); } +extern Gfx ef_takurami01_normal_render_mode[]; +extern Gfx ef_takurami01_kira_modelT[]; + static void eShootingKira_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + GAME_PLAY* play = (GAME_PLAY*)game; + s16 max = 42 + GETREG(MYKREG, 32); + s16 counter = max - effect->timer; + s16 fadeout = max * 0.87f; + f32 alpha; + s16 angle_z; + + if (counter <= fadeout) { + alpha = eEC_CLIP->calc_adjust_proc(counter, 0, max * 0.87f, 100.0f, 150.0f); + } else { + alpha = eEC_CLIP->calc_adjust_proc(counter, max * 0.87f, max, 150.0f, 100.0f); + } + + angle_z = eEC_CLIP->calc_adjust_proc(counter, 0, 42 + GETREG(MYKREG, 32), 0.0f, 0x20000); + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0); + Matrix_mult(&play->billboard_matrix, 1); + Matrix_RotateZ(angle_z, 1); + Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1); + _texture_z_light_fog_prim_xlu(game->graph); + + OPEN_DISP(game->graph); + + 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, (int)alpha); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, ef_takurami01_normal_render_mode); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_takurami01_kira_modelT); + + CLOSE_DISP(game->graph); } diff --git a/src/effect/ef_wait_asimoto.c b/src/effect/ef_wait_asimoto.c index f2ae7bda..a0d66a3e 100644 --- a/src/effect/ef_wait_asimoto.c +++ b/src/effect/ef_wait_asimoto.c @@ -1,5 +1,7 @@ #include "ef_effect_control.h" +#include "m_common_data.h" + static void eWait_Asimoto_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eWait_Asimoto_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eWait_Asimoto_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +20,21 @@ eEC_PROFILE_c iam_ef_wait_asimoto = { }; static void eWait_Asimoto_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + if (arg0 == mCoBG_ATTRIBUTE_WAVE || arg0 == mCoBG_ATTRIBUTE_SEA) { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, prio, 0, game, item_name, 3, 0); + } + + eEC_CLIP->make_effect_proc(eEC_EFFECT_WAIT_ASIMOTO, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eWait_Asimoto_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 0; } static void eWait_Asimoto_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + // nothing } static void eWait_Asimoto_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + // nothing } diff --git a/src/effect/ef_walk_asimoto.c b/src/effect/ef_walk_asimoto.c index 039b3a2d..cec07345 100644 --- a/src/effect/ef_walk_asimoto.c +++ b/src/effect/ef_walk_asimoto.c @@ -34,7 +34,7 @@ static void eWalkAsimoto_RainDay(xyz_t pos, int prio, s16 angle_y, GAME* game, u int count; switch (arg0) { - case 9: + case mCoBG_ATTRIBUTE_BUSH: count = 1; do { eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, make_pos, prio, angle_y, game, name, arg0, arg1); @@ -52,7 +52,7 @@ static void eWalkAsimoto_FineDay(xyz_t pos, int prio, s16 angle_y, GAME* game, u switch (season) { case mTM_SEASON_WINTER: switch (arg0) { - case 9: + case mCoBG_ATTRIBUTE_BUSH: happa_count = 1; do { eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, make_pos, prio, angle_y, game, name, arg0, arg1); @@ -63,8 +63,8 @@ static void eWalkAsimoto_FineDay(xyz_t pos, int prio, s16 angle_y, GAME* game, u eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_YUKI, make_pos, prio, angle_y, game, name, arg0, 0); } while (yuki_count-- != 0); break; - case 1: - case 2: + case mCoBG_ATTRIBUTE_GRASS1: + case mCoBG_ATTRIBUTE_GRASS2: break; } break; @@ -72,7 +72,7 @@ static void eWalkAsimoto_FineDay(xyz_t pos, int prio, s16 angle_y, GAME* game, u case mTM_SEASON_SUMMER: case mTM_SEASON_AUTUMN: switch (arg0) { - case 9: + case mCoBG_ATTRIBUTE_BUSH: happa_count = 1; do { eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, make_pos, prio, angle_y, game, name, arg0, arg1); diff --git a/src/effect/ef_warau.c b/src/effect/ef_warau.c index 3de70ec9..f8023275 100644 --- a/src/effect/ef_warau.c +++ b/src/effect/ef_warau.c @@ -1,5 +1,7 @@ #include "ef_effect_control.h" +#include "m_common_data.h" + static void eWU_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eWU_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eWU_mv(eEC_Effect_c* effect, GAME* game); @@ -18,17 +20,62 @@ eEC_PROFILE_c iam_ef_warau = { }; static void eWU_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_WARAU, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eWU_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->scale.x = 0.0045f; + effect->scale.y = 0.0045f; + effect->scale.z = 0.0045f; + effect->offset.x = 0.0f; + effect->offset.y = 0.0f; + effect->offset.z = 0.0f; + effect->timer = 24; } static void eWU_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + sAdo_OngenPos((u32)effect, 15, &effect->position); + eEC_CLIP->set_continious_env_proc(effect, 24, 24); } +extern Gfx ef_warau01_00_modelT[]; +extern Gfx ef_warau01_01_modelT[]; +extern Gfx ef_warau01_02_modelT[]; +extern Gfx ef_warau01_03_modelT[]; + +static Gfx* eWU_DispTable[12] = { + // clang-format off + NULL, + NULL, + ef_warau01_00_modelT, + ef_warau01_00_modelT, + ef_warau01_01_modelT, + ef_warau01_01_modelT, + ef_warau01_02_modelT, + ef_warau01_02_modelT, + ef_warau01_03_modelT, + ef_warau01_03_modelT, + NULL, + NULL, + // clang-format on +}; + static void eWU_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 counter = (24 - effect->timer) >> 1; + xyz_t* pos = &effect->position; + xyz_t* ofs = &effect->offset; + xyz_t* scale = &effect->scale; + + counter = CLAMP(counter, 0, 11); + + if (eWU_DispTable[counter] != NULL) { + OPEN_DISP(game->graph); + + eEC_CLIP->auto_matrix_xlu_offset_proc(game, pos, scale, ofs); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, 255); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, 0, 0, 255, 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, eWU_DispTable[counter]); + + CLOSE_DISP(game->graph); + } } diff --git a/src/effect/ef_yajirushi.c b/src/effect/ef_yajirushi.c index 83a168bd..c1a280b5 100644 --- a/src/effect/ef_yajirushi.c +++ b/src/effect/ef_yajirushi.c @@ -1,5 +1,8 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" + static void eYajirushi_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eYajirushi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eYajirushi_mv(eEC_Effect_c* effect, GAME* game); @@ -17,18 +20,38 @@ eEC_PROFILE_c iam_ef_yajirushi = { // clang-format on }; +#define eYajirushi_ALPHA effect->effect_specific[0] + static void eYajirushi_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_YAJIRUSHI, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eYajirushi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + eYajirushi_ALPHA = 0; + effect->timer = 4; } static void eYajirushi_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + eEC_CLIP->set_continious_env_proc(effect, 4, 60); + + if (effect->state == eEC_STATE_NORMAL) { + eYajirushi_ALPHA = eEC_CLIP->calc_adjust_proc(4 - effect->timer, 0, 3, 0.0f, 255.0f); + } else if (effect->state == eEC_STATE_CONTINUOUS) { + eYajirushi_ALPHA = 255; + } else if (effect->state == eEC_STATE_FINISHED) { + eYajirushi_ALPHA = eEC_CLIP->calc_adjust_proc(6 - effect->timer, 0, 6, 255.0f, 0.0f); + } } +extern Gfx ef_kore_modelT[]; + static void eYajirushi_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + OPEN_DISP(game->graph); + + _texture_z_light_fog_prim_xlu(game->graph); + eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 80, 30, eYajirushi_ALPHA); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_kore_modelT); + + CLOSE_DISP(game->graph); }