diff --git a/src/effect/ef_tape.c b/src/effect/ef_tape.c index ece008b3..ee7b28e8 100644 --- a/src/effect/ef_tape.c +++ b/src/effect/ef_tape.c @@ -23,44 +23,36 @@ eEC_PROFILE_c iam_ef_tape = { }; extern Gfx ef_tape01_01_model[]; - static void eTape_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { (*eEC_CLIP->make_effect_proc)(eEC_EFFECT_TAPE, pos, NULL, game, &angle, item_name, prio, arg0, arg1); } static void eTape_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - s16 temp; - f32 dVar2; - f32 fVar3; - xyz_t local_28; - f32 local_24; - f32 local_20; + s16 angle; + f32 ofs_x; + xyz_t pos; - temp = *(s16*)ct_arg; + angle = *(s16*)ct_arg; effect->timer = 80; - effect->effect_specific[0] = 3640; - effect->effect_specific[1] = temp; - fVar3 = sin_s(effect->effect_specific[0]); - dVar2 = fVar3 * 2.0f; - fVar3 = sin_s(effect->effect_specific[1]); - local_28.x = (dVar2 * fVar3); - fVar3 = cos_s(effect->effect_specific[1]); - local_28.z = dVar2 * fVar3; - local_24 = cos_s(effect->effect_specific[0]); - local_28.y = local_24 * 2.0f; + effect->effect_specific[0] = DEG2SHORT_ANGLE2(20.0f); //3640; + effect->effect_specific[1] = angle; + ofs_x = sin_s(effect->effect_specific[0]) * 2.0f; + pos.x = ofs_x * sin_s(effect->effect_specific[1]); + pos.z = ofs_x * cos_s(effect->effect_specific[1]); + pos.y = cos_s(effect->effect_specific[0]) * 2.0f; Matrix_RotateY(effect->arg0, 0); - Matrix_RotateX(effect->arg1 ,1); - Matrix_Position(&local_28,&effect->velocity); + Matrix_RotateX(effect->arg1, 1); + Matrix_Position(&pos, &effect->velocity); effect->acceleration = ZeroVec; - effect->acceleration.y = -0.025f; + effect->acceleration.y = -0.025f; } static void eTape_mv(eEC_Effect_c* effect, GAME* game) { if (effect->timer < 74) { xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity); xyz_t_add(&effect->position, &effect->velocity, &effect->position); - effect->velocity.x *= sqrtf(0.9f); - effect->velocity.y *= sqrtf(0.9f); + effect->velocity.x *= sqrtf(0.9f); + effect->velocity.y *= sqrtf(0.9f); effect->velocity.z *= sqrtf(0.9f); } } @@ -72,24 +64,23 @@ static void eTape_dw(eEC_Effect_c* effect, GAME* game) { f32 scale; u8 a; - if (now_timer > 68) { - scale_y = eEC_CLIP->calc_adjust_proc(now_timer,0x44, 0x50, 1.0f, 0.0f) * 0.01f; + scale_y = eEC_CLIP->calc_adjust_proc(now_timer, 68, 80, 1.0f, 0.0f) * 0.01f; scale_z = 0.0f; - } else if (now_timer > 0x38) { + } else if (now_timer > 56) { scale_y = 0.01f; scale_z = 0.0f; } else { - scale_y = eEC_CLIP->calc_adjust_proc(now_timer,0, 56, 0.7f, 1.0f) * 0.01f; - scale_z = eEC_CLIP->calc_adjust_proc(effect->timer,0, 56, 1.0f, 0.0f) * 0.01f; + scale_y = eEC_CLIP->calc_adjust_proc(now_timer, 0, 56, 0.7f, 1.0f) * 0.01f; + scale_z = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 56, 1.0f, 0.0f) * 0.01f; } if (effect->timer > 14) { a = 255; } else { - a = (int)eEC_CLIP->calc_adjust_proc(effect->timer,0, 28, 0.0f, 255.0f); + a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 28, 0.0f, 255.0f); } - + OPEN_DISP(game->graph); _texture_z_light_fog_prim_xlu(game->graph); Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0); @@ -103,4 +94,3 @@ static void eTape_dw(eEC_Effect_c* effect, GAME* game) { gSPDisplayList(NEXT_POLY_XLU_DISP, ef_tape01_01_model); CLOSE_DISP(game->graph); } - diff --git a/src/effect/ef_turi_mizu.c b/src/effect/ef_turi_mizu.c index acd70dfd..99459f05 100644 --- a/src/effect/ef_turi_mizu.c +++ b/src/effect/ef_turi_mizu.c @@ -9,7 +9,6 @@ static void eTM_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, static void eTM_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg); static void eTM_mv(eEC_Effect_c* effect, GAME* game); static void eTM_dw(eEC_Effect_c* effect, GAME* game); -static void eTM_CallEffect(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1); eEC_PROFILE_c iam_ef_turi_mizu = { // clang-format off @@ -23,6 +22,56 @@ eEC_PROFILE_c iam_ef_turi_mizu = { // clang-format on }; +static void eTM_CallEffect(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { + switch (arg0) { + case 0: { + xyz_t hane_pos; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, 0, 0); + + hane_pos = pos; + hane_pos.y += 3.0f; + hane_pos.z += 5.0f; + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HANE0, hane_pos, 1, angle, game, EMPTY_NO, 0, 0); + break; + } + + case 1: { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, 1, 0); + break; + } + + case 2: { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, 0, 0); + break; + } + + case 3: { + xyz_t hane_pos; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, 0, 0); + + hane_pos = pos; + hane_pos.y += 3.0f; + hane_pos.z += 5.0f; + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HANE1, hane_pos, 1, angle, game, EMPTY_NO, 0, 0); + break; + } + + case 4: + case 5: + case 6: + case 7: + case 8: { + s16 type = arg0 - 4; + s16 hamon_type[] = { 1, 0, 0, 1, 2 }; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, hamon_type[type], 0); + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HANE0, pos, 1, angle, game, EMPTY_NO, type, 0); + break; + } + } +} static void eTM_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { if (eEC_CLIP != NULL) { @@ -33,16 +82,78 @@ static void eTM_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, } static void eTM_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { - // TODO + s16 i; + s16 n_drops = 4; + s16* angle_p = (s16*)ct_arg; + s16 angle = *angle_p; + + effect->effect_specific[5] = angle; + switch (effect->arg0) { + case 0: + case 2: + effect->timer = 16; + break; + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + if (effect->arg0 == 4) { + n_drops = 3; + } else if (effect->arg0 == 7 || effect->arg0 == 8) { + n_drops = 2; + } + + effect->timer = 20; + for (i = 0; i < n_drops; i++) { + effect->effect_specific[i] = RANDOM(10); + } + break; + } } static void eTM_mv(eEC_Effect_c* effect, GAME* game) { - // TODO + s16 i; + s16 timer = 16 - effect->timer; + s16 n_drops = 4; + GAME_PLAY* play = (GAME_PLAY*)game; + + // hack for 30FPS->60FPS + if (play->game_frame & 1) { + return; + } + + switch (effect->arg0) { + case 0: + case 2: + if (effect->timer == 1) { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, effect->position, 1, effect->effect_specific[5], game, 0, 2, 0); + } + break; + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + if (effect->arg0 == 4) { + n_drops = 3; + } else if (effect->arg0 == 7 || effect->arg0 == 8) { + n_drops = 2; + } + + for (i = 0; i < n_drops; i++) { + if (effect->effect_specific[i] == timer) { + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_SUITEKI, effect->position, 1, 0, game, 0, i, n_drops); + } + } + break; + } } static void eTM_dw(eEC_Effect_c* effect, GAME* game) { - // TODO + // nothing } -static void eTM_CallEffect(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) { - // TODO -} \ No newline at end of file