Merge pull request #496 from Norgesnerd/master

Implement & link 5 effects
This commit is contained in:
Cuyler36
2025-06-15 19:09:46 -04:00
committed by GitHub
6 changed files with 405 additions and 27 deletions
+5 -5
View File
@@ -1309,14 +1309,14 @@ config.libs = [
Object(Matching, "effect/ef_pun.c"),
Object(Matching, "effect/ef_pun_sekimen.c"),
Object(Matching, "effect/ef_pun_yuge.c"),
Object(NonMatching, "effect/ef_reset_hole.c"),
Object(Matching, "effect/ef_reset_hole.c"),
Object(Matching, "effect/ef_room_sunshine.c"),
Object(Matching, "effect/ef_room_sunshine_minsect.c"),
Object(Matching, "effect/ef_room_sunshine_museum.c"),
Object(Matching, "effect/ef_room_sunshine_police.c"),
Object(Matching, "effect/ef_room_sunshine_posthouse.c"),
Object(NonMatching, "effect/ef_sandsplash.c"),
Object(NonMatching, "effect/ef_shock.c"),
Object(Matching, "effect/ef_sandsplash.c"),
Object(Matching, "effect/ef_shock.c"),
Object(Matching, "effect/ef_shooting.c"),
Object(Matching, "effect/ef_shooting_kira.c"),
Object(Matching, "effect/ef_shooting_set.c"),
@@ -1324,7 +1324,7 @@ config.libs = [
Object(Matching, "effect/ef_siawase_hana_ch.c"),
Object(Matching, "effect/ef_siawase_hikari.c"),
Object(Matching, "effect/ef_sibuki.c"),
Object(NonMatching, "effect/ef_situren.c"),
Object(Matching, "effect/ef_situren.c"),
Object(NonMatching, "effect/ef_slip.c"),
Object(NonMatching, "effect/ef_slip_footprint.c"),
Object(NonMatching, "effect/ef_soba_yuge.c"),
@@ -1334,7 +1334,7 @@ config.libs = [
Object(NonMatching, "effect/ef_swing_axe.c"),
Object(NonMatching, "effect/ef_swing_net.c"),
Object(NonMatching, "effect/ef_swing_rod.c"),
Object(NonMatching, "effect/ef_taberu.c"),
Object(Matching, "effect/ef_taberu.c"),
Object(Matching, "effect/ef_takurami.c"),
Object(Matching, "effect/ef_takurami_kira.c"),
Object(Matching, "effect/ef_tamaire.c"),
+98 -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_reset_hole_modelT[];
static void eReset_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eReset_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eReset_Hole_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +25,104 @@ eEC_PROFILE_c iam_ef_reset_hole = {
};
static void eReset_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
pos.y += 1.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_RESET_HOLE, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eReset_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 16;
if (effect->arg0 == 1) {
if (effect->arg1 == 0) {
effect->scale.x = effect->scale.y = effect->scale.z = 0.01f;
} else {
effect->scale.x = effect->scale.y = effect->scale.z = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f;
}
} else {
effect->scale = ZeroVec;
}
effect->effect_specific[0] = *(s16*)ct_arg;
}
static void eReset_Hole_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 angle;
f32 scale;
int i;
eEC_CLIP->set_continious_env_proc(effect, 16, 120);
if ((effect->state == eEC_STATE_NORMAL) && (effect->arg0 != 1)) {
if (effect->arg1 == 0) {
scale = 0.01f;
} else {
scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f;
}
effect->scale.x = effect->scale.y = effect->scale.z =
eEC_CLIP->calc_adjust_proc(effect->timer, 0, 16, scale, 0.0f);
if ((effect->timer & 7) == 0) {
for (i = 0; i < 3; i++) {
static s16 angle_tbl[] = { DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(135.0f), DEG2SHORT_ANGLE(270.0f) };
xyz_t pos = effect->position;
angle = angle_tbl[i];
if ((effect->timer & 15) == 0) {
angle += DEG2SHORT_ANGLE2(180.0f);
}
eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, effect->prio, angle, game, effect->item_name,
effect->arg0, DEG2SHORT_ANGLE(-179.965f));
}
}
} else if (effect->state == eEC_STATE_FINISHED) {
if (effect->arg1 == 0) {
scale = 0.01f;
} else {
scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f;
}
effect->scale.x = effect->scale.y = effect->scale.z =
eEC_CLIP->calc_adjust_proc(effect->timer, 0, 24, 0.0f, scale);
if (((effect->timer & 7) == 0) && (effect->timer > 8)) {
for (i = 0; i < 3; i++) {
static s16 angle_tbl[] = { DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(135.0f), DEG2SHORT_ANGLE(270.0f) };
xyz_t pos = effect->position;
angle = angle_tbl[i];
if ((effect->timer & 15) == 0) {
angle += DEG2SHORT_ANGLE2(180.0f);
}
eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, effect->prio, angle, game, effect->item_name,
effect->arg0, DEG2SHORT_ANGLE(-179.965f));
}
}
} else {
if (effect->arg1 == 0) {
scale = 0.01f;
} else {
scale = (GETREG(TAKREG, 0x32) * 0.01f + 0.93f) * 0.01f;
}
effect->scale.x = effect->scale.y = effect->scale.z = scale;
}
}
static void eReset_Hole_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
f32 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);
scale = GETREG(MYKREG, 0x1b) * 0.01f + 1.0f;
Matrix_scale(effect->scale.x * scale, effect->scale.y * scale, effect->scale.z * scale, 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_reset_hole_modelT);
CLOSE_DISP(game->graph);
}
+88 -4
View File
@@ -1,10 +1,22 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_debug.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eSandsplash_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eSandsplash_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eSandsplash_mv(eEC_Effect_c* effect, GAME* game);
static void eSandsplash_dw(eEC_Effect_c* effect, GAME* game);
extern Gfx ef_sunahane01_00_modelT[];
extern u8 ef_sunahane01_0_inta_ia8[];
extern u8 ef_sunahane01_1_inta_ia8[];
extern u8 ef_sunahane01_2_inta_ia8[];
extern u8 ef_sunahane01_3_inta_ia8[];
eEC_PROFILE_c iam_ef_sandsplash = {
// clang-format off
&eSandsplash_init,
@@ -17,18 +29,90 @@ eEC_PROFILE_c iam_ef_sandsplash = {
// clang-format on
};
static u8* eSunahane_pattern_table[] = {
ef_sunahane01_0_inta_ia8, ef_sunahane01_0_inta_ia8, ef_sunahane01_1_inta_ia8, ef_sunahane01_1_inta_ia8,
ef_sunahane01_2_inta_ia8, ef_sunahane01_2_inta_ia8, ef_sunahane01_3_inta_ia8, ef_sunahane01_3_inta_ia8,
};
static void eSandsplash_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
pos.y -= 3.0f;
pos.z += 5.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_SANDSPLASH, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eSandsplash_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->velocity.x = 0.0f;
effect->velocity.y = 0.5f;
effect->velocity.z = 0.0f;
effect->acceleration.x = 0.0f;
effect->acceleration.y = -0.01f;
effect->acceleration.z = 0.0f;
if (effect->arg0 == 2) {
effect->velocity.x = sin_s(*(s16*)ct_arg);
effect->velocity.z = cos_s(*(s16*)ct_arg);
effect->acceleration = ZeroVec;
effect->offset.x = 0.005f;
effect->offset.y = 0.01f;
} else if (effect->arg0 == 1) {
effect->velocity.x = sin_s(*(s16*)ct_arg);
effect->velocity.z = cos_s(*(s16*)ct_arg);
effect->acceleration = ZeroVec;
effect->acceleration.y = -0.075;
effect->offset.x = 0.008f;
effect->offset.y = 0.012999999f;
} else if (effect->arg0 == 3) {
effect->velocity.x = sin_s(*(s16*)ct_arg) * 0.25f;
effect->velocity.z = cos_s(*(s16*)ct_arg);
effect->velocity.y = 0.0f;
effect->acceleration = ZeroVec;
effect->acceleration.y = -0.05;
effect->offset.x = 0.006f;
effect->offset.y = 0.012f;
} else {
effect->offset.x = 0.005f;
effect->offset.y = 0.01f;
}
effect->timer = 16;
}
static void eSandsplash_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->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 16, effect->offset.y, effect->offset.x);
effect->scale.y = effect->scale.z = effect->scale.x;
}
static void eSandsplash_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
float scale;
s16 idx = (16 - effect->timer) >> 1;
idx = CLAMP(idx, 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_RotateX(DEG2SHORT_ANGLE2(-45.0f), TRUE);
scale = GETREG(MYKREG, 0x1b) * 0.01f + 1.0f;
Matrix_scale(effect->scale.x * scale, effect->scale.y * scale, effect->scale.z * scale, TRUE);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 130, 20, 20, 20, 255);
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 205, 180, 140, 255);
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, eSunahane_pattern_table[idx]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_sunahane01_00_modelT);
CLOSE_DISP(game->graph);
}
+86 -6
View File
@@ -1,12 +1,16 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
extern Gfx ef_shock01_00_modelT[];
static void eSK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eSK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eSK_mv(eEC_Effect_c* effect, GAME* game);
static void eSK_dw(eEC_Effect_c* effect, GAME* game);
// clang-format off
eEC_PROFILE_c iam_ef_shock = {
// clang-format off
&eSK_init,
&eSK_ct,
&eSK_mv,
@@ -14,21 +18,97 @@ eEC_PROFILE_c iam_ef_shock = {
eEC_IGNORE_DEATH,
eEC_NO_CHILD_ID,
eEC_DEFAULT_DEATH_DIST,
// clang-format on
};
static rgba_t eSK_prim_table[] = {
{ 255, 0, 0, 200 },
{ 255, 128, 0, 227 },
{ 255, 255, 0, 255 },
{ 255, 191, 0, 191 },
{ 255, 128, 0, 128 },
{ 255, 63, 0, 63 },
{ 255, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
};
static f32 eSK_scale_table[] = {
0.019f, 0.02375f, 0.028499999f, 0.026124999f, 0.02375f, 0.021374999f, 0.019f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
};
// clang-format on
typedef struct {
xyz_t velocity;
xyz_t acceleration;
f32 scale;
} eSK_dt_c;
static void eSK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
xyz_t ofs;
eSK_dt_c data;
data.velocity.x = 0.0f;
data.velocity.y = 1.0f;
data.velocity.z = 0.0f;
data.acceleration.x = 0.0f;
data.acceleration.y = -0.1f;
data.acceleration.z = 0.0f;
data.scale = 1.0f;
ofs.x = 0.0f;
ofs.y = 4.0f;
ofs.z = 6.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_SHOCK, pos, &ofs, game, &data, item_name, prio, 0, 0);
}
static void eSK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
eSK_dt_c* data = (eSK_dt_c*)ct_arg;
effect->scale.x = data->scale;
effect->scale.y = data->scale;
effect->scale.z = data->scale;
effect->timer = 14;
effect->acceleration = data->acceleration;
effect->velocity = data->velocity;
}
static void eSK_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 timer = 14 - effect->timer;
if (timer == 0) {
sAdo_OngenTrgStart(0x2d, &effect->position);
}
}
static void eSK_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
xyz_t* pos = &effect->position;
xyz_t* scale = &effect->scale;
xyz_t* ofs = &effect->offset;
s16 idx = (14 - effect->timer) >> 1;
idx = CLAMP(idx, 0, 6);
scale->x = eSK_scale_table[idx];
scale->y = eSK_scale_table[idx];
scale->z = eSK_scale_table[idx];
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_offset_proc(game, pos, scale, ofs);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, eSK_prim_table[idx].r, eSK_prim_table[idx].g, eSK_prim_table[idx].b,
eSK_prim_table[idx].a);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_shock01_00_modelT);
CLOSE_DISP(game->graph);
}
+78 -4
View File
@@ -1,5 +1,18 @@
#include "audio.h"
#include "ef_effect_control.h"
#include "graph.h"
#include "libu64/u64types.h"
#include "m_common_data.h"
#include "m_lib.h"
#include "m_rcp.h"
#include "sys_math3d.h"
#include "sys_matrix.h"
extern Gfx ef_situren01_00_modelT[];
extern Gfx ef_situren01_01_modelT[];
extern Gfx ef_situren01_02_modelT[];
static void eSN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eSN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eSN_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +31,78 @@ eEC_PROFILE_c iam_ef_situren = {
};
static void eSN_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
xyz_t vec = { 0.0f, 10.0f, 7.0f };
sMath_RotateY(&vec, SHORT2RAD_ANGLE2(angle));
pos.x += vec.x;
pos.y += vec.y;
pos.z += vec.z;
eEC_CLIP->make_effect_proc(eEC_EFFECT_SITUREN, pos, NULL, game, NULL, item_name, prio, 0, 0);
}
static void eSN_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 128;
effect->scale = ZeroVec;
effect->offset = ZeroVec;
effect->effect_specific[0] = 0;
sAdo_OngenTrgStart(0x13d, &effect->position);
}
static void eSN_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 timer = 128 - effect->timer;
effect->effect_specific[0] += DEG2SHORT_ANGLE2(30.94f);
if (timer < 8) {
effect->position.y += 1.6f;
}
}
static void eSN_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
Gfx* gfx;
s16 angle, timer;
f32 s, c, temp1, temp2, temp3;
u8 alpha;
angle = effect->effect_specific[0];
timer = 128 - effect->timer;
s = sin_s(angle);
c = cos_s(angle);
temp1 = eEC_CLIP->calc_adjust_proc(timer, 0, 6, 0.0f, 0.0075f);
temp2 = eEC_CLIP->calc_adjust_proc(timer, 0, 42, 1.4f, 1.0f);
temp3 = eEC_CLIP->calc_adjust_proc(timer, 0, 42, 0.6f, 1.0f);
alpha = (int)eEC_CLIP->calc_adjust_proc(timer, 108, 128, 255.0f, 0.0f);
effect->scale.x = temp1 * (temp3 + ((s + 1.0f) * 0.5f * (temp2 - temp3)));
effect->scale.y = temp1 * (temp3 + ((c + 1.0f) * 0.5f * (temp2 - temp3)));
effect->scale.z = 0.0075f;
if (timer == 60) {
gfx = ef_situren01_01_modelT;
} else if (timer > 60) {
gfx = ef_situren01_02_modelT;
} else {
gfx = ef_situren01_00_modelT;
}
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_mult(&((GAME_PLAY*)game)->billboard_matrix, TRUE);
Matrix_translate(effect->offset.x, effect->offset.y, effect->offset.z, 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, 255, 255, 200, 255, alpha);
gSPDisplayList(NEXT_POLY_XLU_DISP, gfx);
CLOSE_DISP(game->graph);
}
+50 -4
View File
@@ -1,10 +1,24 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
static void eTaberu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eTaberu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eTaberu_mv(eEC_Effect_c* effect, GAME* game);
static void eTaberu_dw(eEC_Effect_c* effect, GAME* game);
extern Gfx ef_taberu01_00_modelT[];
extern Gfx ef_taberu01_01_modelT[];
extern Gfx ef_taberu01_02_modelT[];
extern Gfx ef_taberu01_03_modelT[];
static Gfx* eTaberu_model_table[] = {
ef_taberu01_00_modelT,
ef_taberu01_01_modelT,
ef_taberu01_02_modelT,
ef_taberu01_03_modelT,
};
eEC_PROFILE_c iam_ef_taberu = {
// clang-format off
&eTaberu_init,
@@ -18,17 +32,49 @@ eEC_PROFILE_c iam_ef_taberu = {
};
static void eTaberu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
xyz_t ofs;
ofs.x = 0.0f;
ofs.y = 0.0f;
ofs.z = 0.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_TABERU, pos, &ofs, game, &angle, item_name, prio, 0, 0);
}
static void eTaberu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 angle = *(s16*)ct_arg;
if (effect->item_name == SP_NPC_ARTIST) {
effect->position.x += sin_s(angle) * 15.0f;
effect->position.y += -15.0f;
effect->position.z += cos_s(angle) * 15.0f;
} else {
effect->position.x += sin_s(angle) * 13.0f;
effect->position.y += -10.0f;
effect->position.z += cos_s(angle) * 13.0f;
}
effect->scale.x = 0.0045f;
effect->scale.y = 0.0045f;
effect->scale.z = 0.0045f;
effect->effect_specific[0] = 0;
effect->timer = 44;
}
static void eTaberu_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
effect->effect_specific[0] += 1;
}
static void eTaberu_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 idx = ((u16)effect->effect_specific[0] >> 2) & 3;
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset);
gSPDisplayList(NEXT_POLY_XLU_DISP, eTaberu_model_table[idx]);
CLOSE_DISP(game->graph);
}