From 9903d809da340baf08168a01f17eaefb10c12476 Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 13:08:09 -0400 Subject: [PATCH 1/7] link ef_hanabi_hoshi --- configure.py | 2 +- src/effect/ef_hanabi_hoshi.c | 89 ++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index bc167cb2..3bb908a9 100644 --- a/configure.py +++ b/configure.py @@ -1262,7 +1262,7 @@ config.libs = [ Object(Matching, "effect/ef_hanabi_botan1.c"), Object(Matching, "effect/ef_hanabi_botan2.c"), Object(Matching, "effect/ef_hanabi_dummy.c"), - Object(NonMatching, "effect/ef_hanabi_hoshi.c"), + Object(Matching, "effect/ef_hanabi_hoshi.c"), Object(NonMatching, "effect/ef_hanabi_set.c"), Object(NonMatching, "effect/ef_hanabi_switch.c"), Object(NonMatching, "effect/ef_hanabi_yanagi.c"), diff --git a/src/effect/ef_hanabi_hoshi.c b/src/effect/ef_hanabi_hoshi.c index 67e6907f..74231e0b 100644 --- a/src/effect/ef_hanabi_hoshi.c +++ b/src/effect/ef_hanabi_hoshi.c @@ -1,10 +1,17 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eHanabiHoshi_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiHoshi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiHoshi_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiHoshi_dw(eEC_Effect_c* effect, GAME* game); +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) +#define EFFECT_LIFETIME 80 + eEC_PROFILE_c iam_ef_hanabi_hoshi = { // clang-format off &eHanabiHoshi_init, @@ -18,17 +25,91 @@ eEC_PROFILE_c iam_ef_hanabi_hoshi = { }; static void eHanabiHoshi_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_HANABI_HOSHI, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eHanabiHoshi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.f; + effect->offset.y = 0.f; + effect->offset.z = 0.f; + effect->effect_specific[3] = (u16)RANDOM_F(10.f) & 1; } static void eHanabiHoshi_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 framesAlive = EFFECT_LIFETIME - effect->timer; + effect->effect_specific[0] += 0x300; + effect->effect_specific[1] += 0x100; + effect->effect_specific[2] += 0x80; + effect->offset.x = sin_s(effect->effect_specific[1]) * 2.f; + effect->offset.z = sin_s(-effect->effect_specific[1]) * 2.f; + add_calc2(&effect->scale.x, 0.024999999f, CALC_EASE(0.2f), 5.f); + effect->scale.y = effect->scale.x; + effect->scale.z = effect->scale.x; + if (framesAlive == 10) { + static rgba_t hoshi_light[] = { { 0x3c, 0x1e, 0x1e, 255 }, { 0x1e, 0x3c, 0x1e, 255 } }; + rgba_t resultColor; + eEC_CLIP->decide_light_power_proc(&resultColor, hoshi_light[effect->effect_specific[3]], effect->position, game, + 2.f, 0.f, 480.f); + if (effect->arg0) { + // `resultColor.r *= (4.f/3.f);` does not match + resultColor.r = resultColor.r * (4.f / 3.f); + resultColor.g = resultColor.g * (4.f / 3.f); + resultColor.b = resultColor.b * (4.f / 3.f); + } + eEC_CLIP->regist_effect_light(resultColor, 20, 50, TRUE); + } + if (framesAlive == 72) { + xyz_t p = effect->position; + p.y += 200.f; + sAdo_OngenTrgStart(NA_SE_HANABI2, &p); + } } +eEC_morph_data_c eHanabiHoshi_morph_data1[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 200.f, 200.f }, { 0, 0, FALSE, 200.f, 200.f }, + { 29, 39, TRUE, 150.f, 0.f }, { 10, 24, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 0, 0, FALSE, 100.f, 100.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; + +eEC_morph_data_c eHanabiHoshi_morph_data2[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 29, 39, TRUE, 150.f, 0.f }, { 10, 24, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 0.f, 0.f }, + { 0, 0, FALSE, 255.f, 255.f }, { 0, 0, FALSE, 0.f, 0.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; + +eEC_morph_data_c* eHanabiHoshi_morph_table[] = { eHanabiHoshi_morph_data1, eHanabiHoshi_morph_data2 }; + +extern Gfx ef_hanabi_h_00_modelT[]; + static void eHanabiHoshi_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + u8 result[9]; + f32 v2, v; + s16 index; + s16 active_frames = EFFECT_LIFETIME - effect->timer; + v = (sin_s(effect->effect_specific[0]) + 1.f) * 0.5f * 0.14000005f + 0.93f; + index = effect->effect_specific[3]; + v2 = eEC_CLIP->calc_adjust_proc(active_frames, 0, EFFECT_LIFETIME - 1, 0.0f, 0.01f) + effect->scale.x; + eEC_CLIP->morph_combine_proc(result, eHanabiHoshi_morph_table[index], active_frames); + 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, FALSE); + Matrix_RotateX(DEG2SHORT_ANGLE2(270), TRUE); + Matrix_RotateZ(-effect->effect_specific[1], TRUE); + Matrix_scale(v, 1.f, 1.f, TRUE); + Matrix_RotateZ(effect->effect_specific[1], TRUE); + Matrix_scale(v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), 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, result[4], result[0], result[1], result[2], result[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, result[5], result[6], result[7], 255); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_h_00_modelT); + CLOSE_DISP(game->graph); } From 8665cafadffd499e86f405e380b6a037b6f601c4 Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 15:14:56 -0400 Subject: [PATCH 2/7] link ef_hanabi_set --- configure.py | 2 +- src/effect/ef_hanabi_set.c | 142 +++++++++++++++++++++++++++++++++++-- 2 files changed, 139 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 3bb908a9..9d26fa13 100644 --- a/configure.py +++ b/configure.py @@ -1263,7 +1263,7 @@ config.libs = [ Object(Matching, "effect/ef_hanabi_botan2.c"), Object(Matching, "effect/ef_hanabi_dummy.c"), Object(Matching, "effect/ef_hanabi_hoshi.c"), - Object(NonMatching, "effect/ef_hanabi_set.c"), + Object(Matching, "effect/ef_hanabi_set.c"), Object(NonMatching, "effect/ef_hanabi_switch.c"), Object(NonMatching, "effect/ef_hanabi_yanagi.c"), Object(NonMatching, "effect/ef_hanabira.c"), diff --git a/src/effect/ef_hanabi_set.c b/src/effect/ef_hanabi_set.c index f070053f..2fcb37a9 100644 --- a/src/effect/ef_hanabi_set.c +++ b/src/effect/ef_hanabi_set.c @@ -1,10 +1,14 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_player_lib.h" static void eHanabiSet_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiSet_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiSet_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiSet_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 200 + eEC_PROFILE_c iam_ef_hanabi_set = { // clang-format off &eHanabiSet_init, @@ -17,18 +21,148 @@ eEC_PROFILE_c iam_ef_hanabi_set = { // clang-format on }; +typedef struct { + s16 frame; + s16 effect_id; +} eHanabiSet_sqdt; + +typedef struct { + eHanabiSet_sqdt* frame_effects; + int count; +} eHanabiSet_set; + +eHanabiSet_sqdt eHanabiSet_sqdt1[] = { { 0, eEC_EFFECT_HANABI_HOSHI }, + { 30, eEC_EFFECT_HANABI_HOSHI }, + { 50, eEC_EFFECT_HANABI_HOSHI }, + { 120, eEC_EFFECT_HANABI_BOTAN1 }, + { 190, eEC_EFFECT_HANABI_BOTAN1 } }; + +eHanabiSet_set eHanabiSet_set1 = { eHanabiSet_sqdt1, ARRAY_COUNT(eHanabiSet_sqdt1) }; + +eHanabiSet_sqdt eHanabiSet_sqdt2[] = { { 0, eEC_EFFECT_HANABI_BOTAN1 }, + { 50, eEC_EFFECT_HANABI_BOTAN1 }, + { 80, eEC_EFFECT_HANABI_BOTAN1 }, + { 140, eEC_EFFECT_HANABI_BOTAN2 }, + { 190, eEC_EFFECT_HANABI_BOTAN2 } }; + +eHanabiSet_set eHanabiSet_set2 = { eHanabiSet_sqdt2, ARRAY_COUNT(eHanabiSet_sqdt2) }; + +eHanabiSet_sqdt eHanabiSet_sqdt3[] = { { 0, eEC_EFFECT_HANABI_YANAGI }, + { 50, eEC_EFFECT_HANABI_YANAGI }, + { 80, eEC_EFFECT_HANABI_YANAGI }, + { 140, eEC_EFFECT_HANABI_BOTAN2 }, + { 190, eEC_EFFECT_HANABI_BOTAN2 } }; + +eHanabiSet_set eHanabiSet_set3 = { eHanabiSet_sqdt3, ARRAY_COUNT(eHanabiSet_sqdt3) }; + +eHanabiSet_sqdt eHanabiSet_sqdt4[] = { { 0, eEC_EFFECT_HANABI_HOSHI }, + { 50, eEC_EFFECT_HANABI_YANAGI }, + { 80, eEC_EFFECT_HANABI_YANAGI }, + { 140, eEC_EFFECT_HANABI_BOTAN1 }, + { 190, eEC_EFFECT_HANABI_BOTAN1 } }; + +eHanabiSet_set eHanabiSet_set4 = { eHanabiSet_sqdt4, ARRAY_COUNT(eHanabiSet_sqdt4) }; + +eHanabiSet_sqdt eHanabiSet_sqdt5[] = { { 0, eEC_EFFECT_HANABI_HOSHI }, { 20, eEC_EFFECT_HANABI_HOSHI }, + { 50, eEC_EFFECT_HANABI_BOTAN2 }, { 90, eEC_EFFECT_HANABI_BOTAN2 }, + { 140, eEC_EFFECT_HANABI_HOSHI }, { 160, eEC_EFFECT_HANABI_BOTAN1 }, + { 170, eEC_EFFECT_HANABI_BOTAN1 }, { 170, eEC_EFFECT_HANABI_BOTAN1 } }; + +eHanabiSet_set eHanabiSet_set5 = { eHanabiSet_sqdt5, ARRAY_COUNT(eHanabiSet_sqdt5) }; + +eHanabiSet_sqdt eHanabiSet_sqdt6[] = { { 0, eEC_EFFECT_HANABI_BOTAN1 }, { 20, eEC_EFFECT_HANABI_BOTAN2 }, + { 50, eEC_EFFECT_HANABI_BOTAN2 }, { 90, eEC_EFFECT_HANABI_YANAGI }, + { 140, eEC_EFFECT_HANABI_YANAGI }, { 160, eEC_EFFECT_HANABI_HOSHI }, + { 170, eEC_EFFECT_HANABI_BOTAN2 }, { 170, eEC_EFFECT_HANABI_BOTAN2 } }; + +eHanabiSet_set eHanabiSet_set6 = { eHanabiSet_sqdt6, ARRAY_COUNT(eHanabiSet_sqdt6) }; + +eHanabiSet_sqdt eHanabiSet_sqdt7[] = { { 0, eEC_EFFECT_HANABI_BOTAN2 }, { 20, eEC_EFFECT_HANABI_BOTAN2 }, + { 50, eEC_EFFECT_HANABI_HOSHI }, { 90, eEC_EFFECT_HANABI_HOSHI }, + { 140, eEC_EFFECT_HANABI_YANAGI }, { 160, eEC_EFFECT_HANABI_YANAGI }, + { 170, eEC_EFFECT_HANABI_YANAGI }, { 170, eEC_EFFECT_HANABI_YANAGI } }; + +eHanabiSet_set eHanabiSet_set7 = { eHanabiSet_sqdt7, ARRAY_COUNT(eHanabiSet_sqdt7) }; + +eHanabiSet_sqdt eHanabiSet_sqdt8[] = { { 0, eEC_EFFECT_HANABI_YANAGI }, { 10, eEC_EFFECT_HANABI_YANAGI }, + { 20, eEC_EFFECT_HANABI_YANAGI }, { 30, eEC_EFFECT_HANABI_YANAGI }, + { 140, eEC_EFFECT_HANABI_BOTAN2 }, { 160, eEC_EFFECT_HANABI_BOTAN2 }, + { 170, eEC_EFFECT_HANABI_BOTAN2 }, { 190, eEC_EFFECT_HANABI_BOTAN2 } }; + +eHanabiSet_set eHanabiSet_set8 = { eHanabiSet_sqdt8, ARRAY_COUNT(eHanabiSet_sqdt8) }; + +eHanabiSet_set* eHanabiSet_set_table[] = { &eHanabiSet_set1, &eHanabiSet_set2, &eHanabiSet_set3, &eHanabiSet_set4, + &eHanabiSet_set5, &eHanabiSet_set6, &eHanabiSet_set7, &eHanabiSet_set8 }; + +static void eHanabiSet_SearchNicePos(xyz_t* outPos, GAME* game) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + xyz_t zerovec = { 0.f, 0.f, 0.f }; + *outPos = zerovec; + if (player) { + xyz_t playerPos = player->actor_class.world.position; + xyz_t wpos = { 0.f, 0.f, 0.f }; + int bx, bz; + if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL) && mFI_BkNum2WposXZ(&wpos.x, &wpos.z, bx, bz)) { + wpos.x += 320.f; + wpos.y = 0.f; + wpos.z += 320.f; + outPos->x = (wpos.x + playerPos.x) * 0.5f; + outPos->y = mFI_BkNum2BaseHeight(bx, bz) + 20.f; + outPos->z = (wpos.z + playerPos.z) * 0.5f - 40.f; + } + } +} + static void eHanabiSet_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO + xyz_t outPos; + eHanabiSet_SearchNicePos(&outPos, game); + eEC_CLIP->make_effect_proc(eEC_EFFECT_HANABI_SET, outPos, NULL, game, NULL, item_name, prio, 0, 0); } static void eHanabiSet_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + int f = RANDOM(1000.f) % 4; + int hourEndMinusOne = mEv_get_end_time(mEv_EVENT_FIREWORKS_SHOW) - 1; + lbRTC_hour_t hour = Common_Get(time.rtc_time.hour); + effect->timer = EFFECT_LIFETIME; + if (hour > hourEndMinusOne && hour <= mEv_get_end_time(mEv_EVENT_FIREWORKS_SHOW)) { + effect->effect_specific[1] = TRUE; + effect->effect_specific[0] = f + 4; + } else { + effect->effect_specific[1] = FALSE; + effect->effect_specific[0] = f; + } } static void eHanabiSet_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 alive_frames = EFFECT_LIFETIME - effect->timer; + int idx = effect->effect_specific[0]; + eHanabiSet_set* set = eHanabiSet_set_table[idx]; + eHanabiSet_sqdt* frame_effect = set->frame_effects; + int i; + int count = set->count; + eHanabiSet_SearchNicePos(&effect->position, game); + for (i = 0; i < count; frame_effect++, i++) { + if (frame_effect->frame == alive_frames) { + xyz_t effect_position = effect->position; + int effect_id = frame_effect->effect_id; + int bx, bz; + s16 arg = 0; + if (effect->effect_specific[1] == 1) { + arg = 1; + } + effect_position.x += RANDOM_F(250.f) - 125.f; + effect_position.z += RANDOM_F(250.f) - 125.f; + mFI_Wpos2BlockNum(&bx, &bz, effect_position); + if (!eEC_CLIP->check_lookat_block_proc(effect->position) || + mFI_CheckBlockKind_OR(bx, bz, mRF_BLOCKKIND_SLOPE | mRF_BLOCKKIND_CLIFF)) { + effect_id = eEC_EFFECT_HANABI_DUMMY; + } + eEC_CLIP->effect_make_proc(effect_id, effect_position, effect->prio, 0, game, + (mActor_name_t)effect->item_name, arg, 0); + } + } } static void eHanabiSet_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + return; } From e9685df604574f37327d86d13d9977c430b7955d Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 16:18:00 -0400 Subject: [PATCH 3/7] link ef_hanabi_switch --- configure.py | 2 +- src/effect/ef_hanabi_switch.c | 48 ++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 9d26fa13..ff0a89a6 100644 --- a/configure.py +++ b/configure.py @@ -1264,7 +1264,7 @@ config.libs = [ Object(Matching, "effect/ef_hanabi_dummy.c"), Object(Matching, "effect/ef_hanabi_hoshi.c"), Object(Matching, "effect/ef_hanabi_set.c"), - Object(NonMatching, "effect/ef_hanabi_switch.c"), + Object(Matching, "effect/ef_hanabi_switch.c"), Object(NonMatching, "effect/ef_hanabi_yanagi.c"), Object(NonMatching, "effect/ef_hanabira.c"), Object(Matching, "effect/ef_hanatiri.c"), diff --git a/src/effect/ef_hanabi_switch.c b/src/effect/ef_hanabi_switch.c index 005ef222..29823985 100644 --- a/src/effect/ef_hanabi_switch.c +++ b/src/effect/ef_hanabi_switch.c @@ -1,10 +1,14 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_player_lib.h" static void eHanabiSwitch_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiSwitch_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiSwitch_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiSwitch_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 300 + eEC_PROFILE_c iam_ef_hanabi_switch = { // clang-format off &eHanabiSwitch_init, @@ -17,18 +21,54 @@ eEC_PROFILE_c iam_ef_hanabi_switch = { // clang-format on }; +static void eHanabiSwitch_SearchLakePos(xyz_t* pos) { + int bx, bz; + xyz_t a = ZeroVec; + *pos = ZeroVec; + if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL) && mFI_BkNum2WposXZ(&a.x, &a.z, bx, bz)) { + a.x += 320.f; + a.y = 0.f; + a.z += 320.f; + pos->x = a.x; + pos->y = mFI_BkNum2BaseHeight(bx, bz) + 20.f; + pos->z = a.z; + } +} + static void eHanabiSwitch_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_HANABI_SWITCH, pos, NULL, game, NULL, item_name, prio, 0, 0); } static void eHanabiSwitch_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = 300; + eHanabiSwitch_SearchLakePos(&effect->position); + effect->offset = effect->position; } static void eHanabiSwitch_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + eEC_CLIP->set_continious_env_proc(effect, 300, 300); + if (mEv_CheckTitleDemo() != -9) { + s16 alive_frames; + if (effect->state == 0) { + alive_frames = EFFECT_LIFETIME - effect->timer; + } else { + alive_frames = EFFECT_LIFETIME - effect->timer; + } + if (alive_frames == 40) { + eEC_CLIP->effect_make_proc(eEC_EFFECT_HANABI_SET, effect->position, effect->prio, 0, game, + (mActor_name_t)effect->item_name, 0, 0); + } + if (alive_frames == 0 && eEC_CLIP->check_lookat_block_proc(effect->position)) { + effect->offset = effect->position; + } + if (alive_frames < 240 && eEC_CLIP->check_lookat_block_proc(effect->position)) { + effect->offset.y = + eEC_CLIP->calc_adjust_proc(alive_frames, 0, 40, effect->position.y, effect->position.y + 200.f); + NPC_CLIP->set_attention_request_proc(aNPC_ATTENTION_TYPE_POSITION, NULL, &effect->offset); + } + } } static void eHanabiSwitch_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + return; } From 1ee1660c4055e1d22f8181800905facf4c43d5fe Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 16:37:40 -0400 Subject: [PATCH 4/7] link ef_hanabi_yanagi --- configure.py | 2 +- src/effect/ef_hanabi_yanagi.c | 88 +++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index ff0a89a6..8bda1d96 100644 --- a/configure.py +++ b/configure.py @@ -1265,7 +1265,7 @@ config.libs = [ Object(Matching, "effect/ef_hanabi_hoshi.c"), Object(Matching, "effect/ef_hanabi_set.c"), Object(Matching, "effect/ef_hanabi_switch.c"), - Object(NonMatching, "effect/ef_hanabi_yanagi.c"), + Object(Matching, "effect/ef_hanabi_yanagi.c"), Object(NonMatching, "effect/ef_hanabira.c"), Object(Matching, "effect/ef_hanatiri.c"), Object(Matching, "effect/ef_hirameki_den.c"), diff --git a/src/effect/ef_hanabi_yanagi.c b/src/effect/ef_hanabi_yanagi.c index 41bfe5bb..c5c3376b 100644 --- a/src/effect/ef_hanabi_yanagi.c +++ b/src/effect/ef_hanabi_yanagi.c @@ -1,10 +1,17 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eHanabiYanagi_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabiYanagi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabiYanagi_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiYanagi_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 110 +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) + eEC_PROFILE_c iam_ef_hanabi_yanagi = { // clang-format off &eHanabiYanagi_init, @@ -18,17 +25,90 @@ eEC_PROFILE_c iam_ef_hanabi_yanagi = { }; static void eHanabiYanagi_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_HANABI_YANAGI, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eHanabiYanagi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + effect->timer = EFFECT_LIFETIME; + effect->scale.x = 0.01f; + effect->scale.y = 0.01f; + effect->scale.z = 0.01f; + effect->effect_specific[0] = 0; + effect->effect_specific[1] = 0; + effect->effect_specific[2] = 0; + effect->offset.x = 0.f; + effect->offset.y = 0.f; + effect->offset.z = 0.f; } static void eHanabiYanagi_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 alive_frames = EFFECT_LIFETIME - effect->timer; + effect->effect_specific[0] += 0x300; + effect->effect_specific[1] += 0x100; + effect->effect_specific[2] += 0x80; + effect->offset.x = sin_s(effect->effect_specific[2]) * 2.f; + effect->offset.z = cos_s(-effect->effect_specific[2]) * 2.f; + add_calc2(&effect->scale.x, 0.06f, CALC_EASE(0.2f), 5.f); + if (alive_frames == 10) { + rgba_t resultColor; + static rgba_t yanagi_light = { 90, 90, 45, 255 }; + eEC_CLIP->decide_light_power_proc(&resultColor, yanagi_light, effect->position, game, 2.f, 0.f, 480.f); + if (effect->arg0) { + // `resultColor.r *= (4.f/3.f);` does not match + resultColor.r = resultColor.r * (4.f / 3.f); + resultColor.g = resultColor.g * (4.f / 3.f); + resultColor.b = resultColor.b * (4.f / 3.f); + } + eEC_CLIP->regist_effect_light(resultColor, 20, 50, TRUE); + } + if (alive_frames == 72) { + xyz_t p = effect->position; + p.y += 200.f; + sAdo_OngenTrgStart(NA_SE_HANABI3, &p); + } } +eEC_morph_data_c eHanabiYanagi_morph_data_out[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 34, 54, TRUE, 255.f, 200.f }, { 34, 54, TRUE, 50.f, 100.f }, + { 34, 54, TRUE, 150.f, 0.f }, { 5, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 0, 0, FALSE, 200.f, 200.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; +eEC_morph_data_c eHanabiYanagi_morph_data_in[] = { + { 0, 0, FALSE, 255.f, 255.f }, { 34, 49, TRUE, 255.f, 200.f }, { 34, 49, TRUE, 50.f, 100.f }, + { 34, 49, TRUE, 180.f, 0.f }, { 5, 34, TRUE, 0.f, 255.f }, { 0, 0, FALSE, 255.f, 255.f }, + { 0, 0, FALSE, 0.f, 0.f }, { 0, 0, FALSE, 200.f, 200.f }, { 0, 0, FALSE, 255.f, 255.f }, +}; +extern Gfx ef_hanabi_y_00_modelT[]; static void eHanabiYanagi_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + u8 res1[9]; + u8 res2[9]; + s16 now_timer = EFFECT_LIFETIME - effect->timer; + f32 v2; + f32 v = (sin_s(effect->effect_specific[0]) + 1.f) * 0.5f * 0.14000005f + 0.93f; + eEC_CLIP->morph_combine_proc(res1, eHanabiYanagi_morph_data_out, now_timer); + eEC_CLIP->morph_combine_proc(res2, eHanabiYanagi_morph_data_in, now_timer); + v2 = effect->scale.x + eEC_CLIP->calc_adjust_proc(now_timer, 0, EFFECT_LIFETIME - 1, 0.f, 0.01); + 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, FALSE); + Matrix_RotateX(DEG2SHORT_ANGLE2(270), TRUE); + Matrix_RotateZ(-effect->effect_specific[1], TRUE); + Matrix_scale(v, 1.f, 1.f, TRUE); + Matrix_RotateZ(effect->effect_specific[1], TRUE); + Matrix_push(); + Matrix_scale(v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + v2 * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), 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, res1[4], res1[0], res1[1], res1[2], res1[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, res1[5], res1[6], res1[7], res1[8]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_y_00_modelT); + Matrix_pull(); + Matrix_scale(v2 * 0.6f, v2 * 0.6f, v2 * 0.6f, TRUE); + gDPPipeSync(NEXT_POLY_XLU_DISP); + 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, res2[4], res2[0], res2[1], res2[2], res2[3]); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, res2[5], res2[6], res2[7], res2[8]); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabi_y_00_modelT); + CLOSE_DISP(game->graph); } From bf33a8f7137d0341b853a8000f1ca3f1c5fbb481 Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 17:11:09 -0400 Subject: [PATCH 5/7] link ef_hanabira --- configure.py | 2 +- src/effect/ef_hanabira.c | 78 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/configure.py b/configure.py index 8bda1d96..29fe43d6 100644 --- a/configure.py +++ b/configure.py @@ -1266,7 +1266,7 @@ config.libs = [ Object(Matching, "effect/ef_hanabi_set.c"), Object(Matching, "effect/ef_hanabi_switch.c"), Object(Matching, "effect/ef_hanabi_yanagi.c"), - Object(NonMatching, "effect/ef_hanabira.c"), + Object(Matching, "effect/ef_hanabira.c"), Object(Matching, "effect/ef_hanatiri.c"), Object(Matching, "effect/ef_hirameki_den.c"), Object(Matching, "effect/ef_hirameki_hikari.c"), diff --git a/src/effect/ef_hanabira.c b/src/effect/ef_hanabira.c index 93c9930d..a7092821 100644 --- a/src/effect/ef_hanabira.c +++ b/src/effect/ef_hanabira.c @@ -1,10 +1,17 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eHanabira_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eHanabira_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eHanabira_mv(eEC_Effect_c* effect, GAME* game); static void eHanabira_dw(eEC_Effect_c* effect, GAME* game); - +#define EFFECT_LIFETIME 60 +extern Gfx ef_hana01_pa_a_modelT[], ef_hana01_co_a_modelT[], ef_hana01_tu_a_modelT[], ef_hana01_ha_a_modelT[]; +Gfx* ef_hanabira_model_tbl[] = { ef_hana01_pa_a_modelT, ef_hana01_co_a_modelT, ef_hana01_tu_a_modelT, + ef_hana01_ha_a_modelT }; eEC_PROFILE_c iam_ef_hanabira = { // clang-format off &eHanabira_init, @@ -18,17 +25,78 @@ eEC_PROFILE_c iam_ef_hanabira = { }; static void eHanabira_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_HANABIRA, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eHanabira_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + f32 v; + effect->effect_specific[0] = effect->arg0 / 3; + effect->effect_specific[1] = effect->arg0 % 3; + effect->timer = EFFECT_LIFETIME; + v = RANDOM_F(0.5f) + 3.f; + + if (effect->arg1 == 2 || effect->arg1 == 3 || effect->arg1 == 1) { + v *= 1.5f; + } + + eEC_CLIP->random_first_speed_proc(&effect->velocity, v, 32.f, 32.f); + effect->acceleration.x = 0.f; + effect->acceleration.y = -effect->velocity.y * 0.05f; + effect->acceleration.z = 0.f; + effect->offset = ZeroVec; + effect->effect_specific[4] = qrand(); + effect->effect_specific[2] = qrand(); + effect->effect_specific[3] = qrand(); + effect->scale.x = effect->scale.y = effect->scale.z = 0.009f; + effect->effect_specific[5] = FALSE; } static void eHanabira_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); + if (effect->effect_specific[5] == FALSE) { + effect->effect_specific[4] += 0xa00; + effect->effect_specific[2] += 0x280; + effect->effect_specific[3] += 0x280; + if (effect->velocity.y <= 0.f) { + effect->effect_specific[5] = TRUE; + effect->acceleration.y = -0.05f; + } + + } else { + f32 s = sin_s(effect->effect_specific[4]) * 2.f; + effect->offset.x = s; + effect->offset.y = 0.f; + effect->offset.z = -s; + effect->effect_specific[4] += 0xa00; + effect->effect_specific[2] += 0x662; + effect->effect_specific[3] += 0x662; + } } static void eHanabira_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + Mtx* m = GRAPH_ALLOC(game->graph, 0x40); + int v = (u8)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 20, 0.f, 255.f); + OPEN_DISP(game->graph); + _texture_z_light_fog_prim_xlu(game->graph); + suMtxMakeSRT_ZXY(m, effect->scale.x * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.y * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.z * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), effect->effect_specific[2], 0, + effect->effect_specific[3], effect->position.x + effect->offset.x, + effect->position.y + effect->offset.y, effect->position.z + effect->offset.z); + switch (effect->effect_specific[1]) { + case 0: { + gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, g_fdinfo->field_palette.flower0_pal); + } break; + case 1: { + gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, g_fdinfo->field_palette.flower1_pal); + } break; + default: { + gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, g_fdinfo->field_palette.flower2_pal); + } break; + } + gSPMatrix(NEXT_POLY_XLU_DISP, m, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, v); + gSPDisplayList(NEXT_POLY_XLU_DISP, ef_hanabira_model_tbl[effect->effect_specific[0]]); + CLOSE_DISP(game->graph); } From 394aea505e2c5479ad42a071486c579be336626c Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 18:24:08 -0400 Subject: [PATCH 6/7] link ef_kagu_happa --- configure.py | 2 +- src/effect/ef_hanabi_botan1.c | 1 - src/effect/ef_kagu_happa.c | 54 ++++++++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/configure.py b/configure.py index 29fe43d6..7c5babf7 100644 --- a/configure.py +++ b/configure.py @@ -1272,7 +1272,7 @@ config.libs = [ Object(Matching, "effect/ef_hirameki_hikari.c"), Object(Matching, "effect/ef_ikigire.c"), Object(Matching, "effect/ef_impact_star.c"), - Object(NonMatching, "effect/ef_kagu_happa.c"), + Object(Matching, "effect/ef_kagu_happa.c"), Object(NonMatching, "effect/ef_kamifubuki.c"), Object(Matching, "effect/ef_kangaeru.c"), Object(Matching, "effect/ef_kantanhu.c"), diff --git a/src/effect/ef_hanabi_botan1.c b/src/effect/ef_hanabi_botan1.c index fc4fbbe9..dd4f1bf6 100644 --- a/src/effect/ef_hanabi_botan1.c +++ b/src/effect/ef_hanabi_botan1.c @@ -10,7 +10,6 @@ static void eHanabiBotan1_mv(eEC_Effect_c* effect, GAME* game); static void eHanabiBotan1_dw(eEC_Effect_c* effect, GAME* game); #define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) - #define EFFECT_LIFETIME 110 eEC_PROFILE_c iam_ef_hanabi_botan1 = { diff --git a/src/effect/ef_kagu_happa.c b/src/effect/ef_kagu_happa.c index cab6939a..ea755b0a 100644 --- a/src/effect/ef_kagu_happa.c +++ b/src/effect/ef_kagu_happa.c @@ -1,10 +1,19 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_malloc.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" +#include "m_player_lib.h" static void eKagu_Happa_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKagu_Happa_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKagu_Happa_mv(eEC_Effect_c* effect, GAME* game); static void eKagu_Happa_dw(eEC_Effect_c* effect, GAME* game); +#define CALC_EASE(x) (1.0f - sqrtf(1.0f - (x))) +#define EFFECT_LIFETIME 36 + eEC_PROFILE_c iam_ef_kagu_happa = { // clang-format off &eKagu_Happa_init, @@ -18,17 +27,54 @@ eEC_PROFILE_c iam_ef_kagu_happa = { }; static void eKagu_Happa_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_KAGU_HAPPA, pos, NULL, game, NULL, item_name, prio, arg0, arg1); } static void eKagu_Happa_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + effect->offset = effect->position; + effect->position = player->actor_class.world.position; + effect->position.y += 20.f; + effect->position.x += sin_s(player->actor_class.world.angle.y) * 10.f; + effect->position.z += cos_s(player->actor_class.world.angle.y) * 10.f; + effect->acceleration = effect->position; + effect->scale = ZeroVec; + effect->timer = EFFECT_LIFETIME; + effect->effect_specific[0] = 0; } static void eKagu_Happa_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + effect->position.x = + eEC_CLIP->calc_adjust_proc(effect->timer, 8, EFFECT_LIFETIME, effect->offset.x, effect->acceleration.x); + effect->position.y = + eEC_CLIP->calc_adjust_proc(effect->timer, 8, EFFECT_LIFETIME, effect->offset.y, effect->acceleration.y); + effect->position.z = eEC_CLIP->calc_adjust_proc(effect->timer, 8, 0x1c, effect->offset.z, effect->acceleration.z); + add_calc(&effect->scale.x, 0.01f, CALC_EASE(0.25f), 0.0015f, 5e-5f); + effect->scale.y = effect->scale.z = effect->scale.x; + if (effect->timer > 10) { + effect->position.y += ((effect->timer - 14.f) - 4.f) * (-10.f / 98.f) * ((effect->timer - 14.f) - 4.f) + 20.f; + effect->effect_specific[0] += 0x924; + } else if (effect->timer == 2) { + effect->position.y += 5.f; + eEC_CLIP->effect_make_proc(1, effect->position, effect->prio, 0, game, effect->item_name, 0, 3); + } } static void eKagu_Happa_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 s = sin_s(effect->effect_specific[0]) * 5120.f; + GAME_PLAY* play = (GAME_PLAY*)game; + OPEN_DISP(game->graph); + _texture_z_light_fog_prim(game->graph); + Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE); + if (!effect->arg0) { + Matrix_RotateZ(s, TRUE); + Matrix_mult(&play->billboard_matrix, TRUE); + } + Matrix_scale(effect->scale.x * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.y * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), + effect->scale.z * (GETREG(MYKREG, 0x1b) * 0.01f + 1.f), TRUE); + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(NEXT_POLY_OPA_DISP, aMR_IconNo2Gfx1(effect->arg0)); + gSPDisplayList(NEXT_POLY_OPA_DISP, aMR_IconNo2Gfx2(effect->arg0)); + CLOSE_DISP(game->graph); } From dd804d4ef9b9772230eb84ac024edfdbbeef4a42 Mon Sep 17 00:00:00 2001 From: roeming Date: Sun, 1 Jun 2025 19:13:08 -0400 Subject: [PATCH 7/7] link ef_kamifubuki --- configure.py | 2 +- src/effect/ef_kamifubuki.c | 78 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 7c5babf7..931c1242 100644 --- a/configure.py +++ b/configure.py @@ -1273,7 +1273,7 @@ config.libs = [ Object(Matching, "effect/ef_ikigire.c"), Object(Matching, "effect/ef_impact_star.c"), Object(Matching, "effect/ef_kagu_happa.c"), - Object(NonMatching, "effect/ef_kamifubuki.c"), + Object(Matching, "effect/ef_kamifubuki.c"), Object(Matching, "effect/ef_kangaeru.c"), Object(Matching, "effect/ef_kantanhu.c"), Object(Matching, "effect/ef_kasamizu.c"), diff --git a/src/effect/ef_kamifubuki.c b/src/effect/ef_kamifubuki.c index 0c5e4da8..531c8079 100644 --- a/src/effect/ef_kamifubuki.c +++ b/src/effect/ef_kamifubuki.c @@ -1,10 +1,16 @@ #include "ef_effect_control.h" +#include "m_common_data.h" +#include "m_rcp.h" +#include "sys_matrix.h" +#include "m_debug.h" static void eKamifubuki_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); static void eKamifubuki_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eKamifubuki_mv(eEC_Effect_c* effect, GAME* game); static void eKamifubuki_dw(eEC_Effect_c* effect, GAME* game); +#define EFFECT_LIFETIME 90 + eEC_PROFILE_c iam_ef_kamifubuki = { // clang-format off &eKamifubuki_init, @@ -18,17 +24,81 @@ eEC_PROFILE_c iam_ef_kamifubuki = { }; static void eKamifubuki_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_KAMIFUBUKI, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eKamifubuki_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + s16 d = DEG2SHORT_ANGLE2(RANDOM_F(35.f)); + s16 r = qrand(); + s16 a = *(s16*)ct_arg; + static xyz_t unit_axis = { 0.f, 0.f, 1.f }; + xyz_t p; + f32 s; + s = sin_s(d) * 7.f; + Matrix_RotateY(a, FALSE); + Matrix_RotateX(effect->arg1, TRUE); + p.x = s * sin_s(r); + p.y = cos_s(d) * 7.f; + p.z = s * cos_s(r); + Matrix_Position(&p, &effect->velocity); + effect->scale = effect->position; + d = DEG2SHORT_ANGLE2(RANDOM_F(40.f)); + r = qrand(); + s = sin_s(d) * 7.f; + p.x = s * sin_s(r); + p.y = cos_s(d) * 7.f; + p.z = s * cos_s(r); + Matrix_Position(&p, &effect->acceleration); + effect->effect_specific[0] = qrand(); + effect->effect_specific[1] = DEG2SHORT_ANGLE2(RANDOM2_F(15.f) + 15.f); + Matrix_rotateXYZ(qrand(), qrand(), qrand(), FALSE); + Matrix_Position(&unit_axis, &effect->offset); + effect->timer = EFFECT_LIFETIME - RANDOM(5.f); } static void eKamifubuki_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + effect->position.x += effect->velocity.x; + effect->position.y += effect->velocity.y; + effect->position.z += effect->velocity.z; + effect->velocity.y += -0.1f; + xyz_t_mult_v(&effect->velocity, sqrtf(0.9f)); + effect->scale.x += effect->acceleration.x; + effect->scale.y += effect->acceleration.y; + effect->scale.z += effect->acceleration.z; + effect->acceleration.y += -0.1f; + xyz_t_mult_v(&effect->acceleration, sqrtf(0.9f)); + effect->velocity.x += RANDOM_F(0.15f) * sin_s(effect->effect_specific[0]); + effect->acceleration.x += RANDOM_F(0.15f) * sin_s(effect->effect_specific[0]); + effect->effect_specific[0] += effect->effect_specific[1]; +} +extern Gfx ef_kamihubuki01_00_model[]; +static void eKamifubuki_one_draw(eEC_Effect_c* effect, xyz_t* pos, GAME* game) { + OPEN_DISP(game->graph); + Matrix_translate(pos->x, pos->y, pos->z, FALSE); + Matrix_RotateVector(effect->effect_specific[0], &effect->offset, TRUE); + Matrix_scale((GETREG(MYKREG, 0x1b) * 0.01f + 1.f) * 0.003f, (GETREG(MYKREG, 0x1b) * 0.01f + 1.f) * 0.003f, + (GETREG(MYKREG, 0x1b) * 0.01f + 1.f) * 0.003f, 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_kamihubuki01_00_model); + CLOSE_DISP(game->graph); } static void eKamifubuki_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + int i; + int v = (u8)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 10, 0.f, 255.f); + static rgb8_t rgb_tbl[4][2] = { { { 100, 20, 20 }, { 155, 30, 30 } }, + { { 20, 100, 20 }, { 30, 155, 30 } }, + { { 20, 20, 100 }, { 30, 30, 155 } }, + { { 100, 100, 100 }, { 155, 155, 155 } } }; + OPEN_DISP(game->graph); + i = effect->arg0; + _texture_z_light_fog_prim_xlu(game->graph); + if (i > ARRAY_COUNT(rgb_tbl) - 1) { + i = ARRAY_COUNT(rgb_tbl) - 1; + } + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, rgb_tbl[i][0].r, rgb_tbl[i][0].g, rgb_tbl[i][0].b, (u8)v); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, rgb_tbl[i][1].r, rgb_tbl[i][1].g, rgb_tbl[i][1].b, 255); + eKamifubuki_one_draw(effect, &effect->position, game); + eKamifubuki_one_draw(effect, &effect->scale, game); + CLOSE_DISP(game->graph); }