Merge pull request #495 from Norgesnerd/master

Implement & link 5 effects
This commit is contained in:
Cuyler36
2025-06-14 18:31:55 -04:00
committed by GitHub
6 changed files with 362 additions and 25 deletions
+5 -5
View File
@@ -1297,14 +1297,14 @@ config.libs = [
Object(NonMatching, "effect/ef_motiyuge.c"),
Object(Matching, "effect/ef_muka.c"),
Object(Matching, "effect/ef_naku.c"),
Object(NonMatching, "effect/ef_namida.c"),
Object(Matching, "effect/ef_namida.c"),
Object(Matching, "effect/ef_neboke.c"),
Object(NonMatching, "effect/ef_neboke_akubi.c"),
Object(NonMatching, "effect/ef_neboke_awa.c"),
Object(Matching, "effect/ef_neboke_akubi.c"),
Object(Matching, "effect/ef_neboke_awa.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_ongen.c"),
Object(Matching, "effect/ef_otikomi.c"),
Object(Matching, "effect/ef_otosiana.c"),
Object(Matching, "effect/ef_pun.c"),
Object(Matching, "effect/ef_pun_sekimen.c"),
+74 -4
View File
@@ -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_namida01_modelT[];
static void eNamida_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eNamida_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eNamida_mv(eEC_Effect_c* effect, GAME* game);
@@ -17,18 +24,81 @@ eEC_PROFILE_c iam_ef_namida = {
// clang-format on
};
typedef struct {
s16 angle;
s16 arg0;
} eNamida_dt_c;
static void eNamida_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
xyz_t ofs;
eNamida_dt_c data;
data.angle = angle;
data.arg0 = arg0;
ofs.x = GETREG(MYKREG, 0x18);
ofs.y = GETREG(MYKREG, 0x19);
ofs.z = GETREG(MYKREG, 0x1a) + 10.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_NAMIDA, pos, &ofs, game, &data, item_name, prio, 0, 0);
}
static void eNamida_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
eNamida_dt_c* data = (eNamida_dt_c*)ct_arg;
effect->timer = 30;
effect->effect_specific[0] = data->angle;
effect->effect_specific[1] = data->arg0;
eEC_CLIP->random_first_speed_proc(&effect->velocity, 1.85f, 40.0f, 40.0f);
if (effect->effect_specific[1] == 0) {
sMath_RotateZ(&effect->velocity, DEG2RAD(55.0f));
} else if (effect->effect_specific[1] == 1) {
sMath_RotateZ(&effect->velocity, DEG2RAD(-55.0f));
}
effect->acceleration.x = 0.0f;
effect->acceleration.y = -0.0675f;
effect->acceleration.z = 0.0f;
effect->scale.x = 0.0f;
effect->scale.y = 0.0f;
effect->scale.z = 0.0f;
}
static void eNamida_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 timer = 30 - effect->timer;
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->offset, &effect->velocity, &effect->offset);
if (timer < 20) {
effect->scale.x = eEC_CLIP->calc_adjust_proc(timer, 0, 18, 0.0f, 0.0027f);
} else {
effect->scale.x = eEC_CLIP->calc_adjust_proc(timer, 20, 30, 0.0027f, 0.0f);
}
effect->scale.y = effect->scale.x;
effect->scale.z = effect->scale.x;
}
static void eNamida_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 angle = effect->effect_specific[0];
xyz_t vec = effect->offset;
sMath_RotateY(&vec, SHORT2RAD_ANGLE2(angle));
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_translate(vec.x, vec.y, vec.z, TRUE);
Matrix_mult(&((GAME_PLAY*)game)->billboard_matrix, 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);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_namida01_modelT);
CLOSE_DISP(game->graph);
}
+55 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
extern Gfx ef_neboke_awa01_modelT[];
static void eNeboke_Akubi_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eNeboke_Akubi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eNeboke_Akubi_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,64 @@ eEC_PROFILE_c iam_ef_neboke_akubi = {
};
static void eNeboke_Akubi_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_NEBOKE_AKUBI, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eNeboke_Akubi_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
xyz_t vec = { 0.0f, 7.0f, 13.5f };
f32 x, y, z;
x = RANDOM2_F(3.0f);
y = RANDOM2_F(3.0f);
z = RANDOM2_F(3.0f);
effect->timer = 80;
effect->effect_specific[0] = *(s16*)ct_arg;
effect->effect_specific[1] = qrand();
sMath_RotateY(&vec, SHORT2RAD_ANGLE2(effect->effect_specific[0]));
effect->position.x += vec.x + x;
effect->position.y += vec.y + y;
effect->position.z += vec.z + z;
eEC_CLIP->random_first_speed_proc(&effect->velocity, 0.15f, 30.0f, 0.0f);
sMath_RotateX(&effect->velocity, DEG2RAD(20.0f));
sMath_RotateY(&effect->velocity, SHORT2RAD_ANGLE2(effect->effect_specific[0]));
effect->acceleration.x = 0.0f;
effect->acceleration.y = 0.003425f;
effect->acceleration.z = 0.0f;
}
static void eNeboke_Akubi_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->effect_specific[1] += DEG2SHORT_ANGLE2(11.25f);
}
static void eNeboke_Akubi_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
static f32 scale_base[] = { 0.005f, 0.0015f };
s16 timer = 80 - effect->timer;
effect->scale.x = eEC_CLIP->calc_adjust_proc(timer, 0, 4, 0.0f, scale_base[effect->arg0]);
if (timer == 79) {
effect->effect_specific[2] = 200;
effect->scale.x *= 1.2f;
} else {
effect->effect_specific[2] = 255;
}
effect->scale.z = effect->scale.y = effect->scale.x;
effect->scale.x *= sin_s(effect->effect_specific[1]) * 0.2f + 1.0f;
effect->scale.y *= cos_s(effect->effect_specific[1]) * 0.2f + 1.0f;
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, effect->effect_specific[2]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_neboke_awa01_modelT);
CLOSE_DISP(game->graph);
}
+84 -4
View File
@@ -1,5 +1,12 @@
#include "ef_effect_control.h"
#include "libultra/libultra.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
extern Gfx ef_sleep01_modelT[];
static void eSleep_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eSleep_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eSleep_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +25,90 @@ eEC_PROFILE_c iam_ef_neboke_awa = {
};
static void eSleep_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_NEBOKE_AWA, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eSleep_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
xyz_t vec;
u16 angle = *(s16*)ct_arg;
effect->effect_specific[0] = angle;
if (angle < DEG2SHORT_ANGLE2(180.0f)) {
vec.x = 5.0f;
vec.y = 10.0f;
vec.z = 13.0f;
} else {
vec.x = -5.0f;
vec.y = 10.0f;
vec.z = 13.0f;
}
effect->timer = 64;
sMath_RotateY(&vec, SHORT2RAD_ANGLE2(effect->effect_specific[0]));
effect->position.x += vec.x;
effect->position.y += vec.y;
effect->position.z += vec.z;
bzero(&effect->velocity, 12);
effect->velocity.y = 0.18f;
bzero(&effect->acceleration, 12);
effect->acceleration.y = 0.008f;
bzero(&effect->scale, 12);
effect->offset = effect->position;
}
static void eSleep_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 timer = 64 - effect->timer;
effect->effect_specific[2] += DEG2SHORT_ANGLE2(11.25f);
effect->effect_specific[3] += DEG2SHORT_ANGLE2(6.33f);
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
if (timer >= 62) {
effect->scale.x = 0.0036000002f;
effect->scale.y = 0.0036000002f;
effect->scale.z = 0.0036000002f;
effect->effect_specific[1] = 200;
} else {
effect->scale.x = eEC_CLIP->calc_adjust_proc(timer, 0, 40, 0.0f, 0.003f);
effect->scale.y = effect->scale.x;
effect->scale.z = effect->scale.x;
effect->effect_specific[1] = 255;
}
effect->scale.x *= sin_s(effect->effect_specific[2]) * 0.3f + 1.0f;
effect->scale.x *= cos_s(effect->effect_specific[2]) * 0.3f + 1.0f;
}
static void eSleep_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 atan;
xyz_t vec;
vec.x = effect->position.x + sin_s(effect->effect_specific[3]) * 2.7f;
vec.y = effect->position.y;
vec.z = effect->position.z;
OPEN_DISP(game->graph);
_texture_z_light_fog_prim_xlu(game->graph);
Matrix_translate(vec.x, vec.y, vec.z, FALSE);
Matrix_mult(&((GAME_PLAY*)game)->billboard_matrix, TRUE);
atan = atans_table(vec.y - effect->offset.y, vec.x - effect->offset.x);
Matrix_RotateZ(-(atan + DEG2SHORT_ANGLE2(180.0f)), 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, 128, 255, 255, 255, effect->effect_specific[1]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_sleep01_modelT);
effect->offset = vec;
CLOSE_DISP(game->graph);
}
+39 -4
View File
@@ -1,5 +1,12 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
extern Gfx ef_ongen_mouth_model[];
extern Gfx ef_ongen_mic_model[];
static void eOngen_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eOngen_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eOngen_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +25,45 @@ eEC_PROFILE_c iam_ef_ongen = {
};
static void eOngen_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_ONGEN, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static void eOngen_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
static s16 timer_table[] = { 2, 1, 10 };
effect->timer = timer_table[effect->arg0];
}
static void eOngen_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
return;
}
static void eOngen_TidyArgData(s16* arg0) {
if (*arg0 < 0) {
*arg0 = 0;
} else if (*arg0 >= 3) {
*arg0 = 2;
}
}
static void eOngen_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
static f32 scale_table[] = { 0.027f, 0.0139999999f, 0.027f };
static Gfx* disp_table[] = { ef_ongen_mouth_model, ef_ongen_mic_model, ef_ongen_mouth_model };
f32 scale;
OPEN_DISP(game->graph);
eOngen_TidyArgData(&effect->arg0);
scale = scale_table[effect->arg0];
_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_scale(scale, scale, scale, 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, 128, 255, 255, 255, 190);
gSPDisplayList(NEXT_POLY_XLU_DISP, disp_table[effect->arg0]);
CLOSE_DISP(game->graph);
}
+105 -4
View File
@@ -1,5 +1,13 @@
#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_doyon01_00_modelT[];
extern Gfx ef_otikomi_us2_model[];
static void eOMN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eOMN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eOMN_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +26,110 @@ eEC_PROFILE_c iam_ef_otikomi = {
};
static void eOMN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
static xyz_t offset = { 0.0f, 0.0f, 19.0f };
eEC_CLIP->make_effect_proc(eEC_EFFECT_OTIKOMI, pos, &offset, game, NULL, item_name, prio, 0, 0);
}
static void eOMN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 22;
effect->effect_specific[0] = 0;
effect->effect_specific[1] = 0;
effect->acceleration.x = 10000.0f;
effect->velocity.x = 0.4f;
effect->velocity.y = 0.0f;
effect->velocity.z = 0.0f;
effect->position.y += 17.0f;
}
static void eOMN_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
float vel;
effect->effect_specific[0] += DEG2SHORT_ANGLE2(2.29f);
effect->effect_specific[1] += (int)effect->acceleration.x;
vel = effect->velocity.x * sin_s(effect->effect_specific[1]);
effect->velocity.y = 1.0f - vel;
effect->velocity.z = 1.0f + vel;
add_calc(&effect->velocity.x, 0.025f, 0.022f, 0.1f, 0.001f);
add_calc(&effect->acceleration.x, 2000.0f, 0.022f, 6000.0f, 0.01f);
eEC_CLIP->set_continious_env_proc(effect, 22, 100);
}
static void eOMN_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
Gfx* gfx;
s16 timer;
u8 alpha, alpha2;
f32 scale_m, scale_y;
GAME_PLAY* play = (GAME_PLAY*)game;
gfx = two_tex_scroll_dolphin(game->graph, 0, 0, 0, 16, 16, 1, 0, play->game_frame * 25, 64, 32);
switch (effect->state) {
case eEC_STATE_NORMAL:
timer = 22 - effect->timer;
scale_m = eEC_CLIP->calc_adjust_proc(timer, 0, 10, 0.0f, 0.01f);
scale_y = eEC_CLIP->calc_adjust_proc(timer, 10, 21, 0.0f, 0.0135f);
alpha = 255;
alpha2 = 100;
sAdo_OngenPos((u32)effect, 0x59, &effect->position);
break;
case eEC_STATE_CONTINUOUS:
sAdo_OngenPos((u32)effect, 0x59, &effect->position);
scale_m = 0.01f;
alpha = 255;
scale_y = 0.0135f;
alpha2 = 100;
break;
default:
timer = 10 - effect->timer;
scale_m = 0.01f;
scale_y = 0.0135f;
alpha = (int)eEC_CLIP->calc_adjust_proc(timer, 0, 9, 255.0f, 0.0f);
alpha2 = (int)eEC_CLIP->calc_adjust_proc(timer, 0, 9, 100.0f, 0.0f);
break;
}
_texture_z_light_fog_prim_xlu(game->graph);
OPEN_DISP(game->graph);
Matrix_translate(effect->position.x, effect->position.y + 4.0f, effect->position.z, FALSE);
Matrix_mult(&play->billboard_matrix, TRUE);
Matrix_translate(effect->offset.x + GETREG(MYKREG, 0x18), effect->offset.y + GETREG(MYKREG, 0x19),
effect->offset.z + 2.0f + GETREG(MYKREG, 0x1a), TRUE);
if (GETREG(MYKREG, 0)) {
Matrix_RotateZ(-effect->effect_specific[0], TRUE);
Matrix_scale(scale_m * 1.025f, scale_m, scale_m, TRUE);
Matrix_RotateZ(effect->effect_specific[0], TRUE);
} else {
Matrix_scale(0.01f, 0.01f, 0.01f, TRUE);
}
Matrix_scale(effect->velocity.z * 1.3f, effect->velocity.y, 1.0f, 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, 40, 30, 40, alpha);
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 100, 100, 255, 255);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_doyon01_00_modelT);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE);
Matrix_mult(&play->billboard_matrix, TRUE);
Matrix_translate(effect->offset.x + GETREG(MYKREG, 0x18), effect->offset.y + GETREG(MYKREG, 0x19),
effect->offset.z + GETREG(MYKREG, 0x1a), TRUE);
Matrix_scale(0.015f, scale_y, 0.01f, 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, 0, 255, 255, alpha2);
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_9, gfx);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_otikomi_us2_model);
CLOSE_DISP(game->graph);
}