This commit is contained in:
Prakxo
2024-08-25 22:25:29 +02:00
2 changed files with 138 additions and 8 deletions
+71 -4
View File
@@ -18,17 +18,84 @@ eEC_PROFILE_c iam_ef_halloween_smoke = {
};
static void eHalloween_Smoke_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_HALLOWEEN_SMOKE, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eHalloween_Smoke_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 angle = *(s16*)ct_arg;
effect->timer = 18;
(effect->scale).x= (effect->scale).y= (effect->scale).z = 0.01f;
(effect->velocity).y = 0.25f;
(effect->velocity).x = 0.0f * sin_s(angle);
(effect->velocity).z = 0.0f * cos_s(angle);
(effect->acceleration).y = 0.075f;
(effect->acceleration).x = (effect->acceleration).z = 0.0f;
}
static void eHalloween_Smoke_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);
}
extern Gfx ef_haro01_00_modelT[];
extern u8 ef_dust01_0[];
extern u8 ef_dust01_1[];
extern u8 ef_dust01_2[];
extern u8 ef_dust01_3[];
static u8* eHalloween_texture_table[] = {
ef_dust01_0,
ef_dust01_1,
ef_dust01_2,
ef_dust01_3,
};
// clang-format off
static u8 eHalloween_2tile_texture_idx[][2] = {
{0, 0},
{0, 1},
{1, 1},
{1, 2},
{2, 2},
{2, 3},
{3, 3},
{3, 3},
{3, 3},
};
// clang-format on
// clang-format off
static u8 eHalloween_prim_f[] = {
0,
128,
255,
128,
0,
128,
255,
128,
0,
};
// clang-format on
static void eHalloween_Smoke_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 frame = 18 - effect->timer;
int tex_idx = frame >> 1;
int tile_idx0 = eHalloween_2tile_texture_idx[tex_idx][0];
int tile_idx1 = eHalloween_2tile_texture_idx[tex_idx][1];
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale);
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, eHalloween_texture_table[tile_idx0]);
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_9, eHalloween_texture_table[tile_idx1]);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, eHalloween_prim_f[tex_idx], 200, 0, 255, 120);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_haro01_00_modelT);
CLOSE_DISP(game->graph);
}
+67 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
extern Gfx ef_star01_00_modelT[];
static void eImpact_Star_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eImpact_Star_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eImpact_Star_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,76 @@ eEC_PROFILE_c iam_ef_impact_star = {
};
static void eImpact_Star_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_IMPACT_STAR, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eImpact_Star_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
f32 mul;
s16* angle_y_p = (s16*)ct_arg;
if (effect->arg1 == 0) {
s16 angle_y = *angle_y_p;
s16 angle_x = DEG2SHORT_ANGLE2(-70.0f);
mul = 6.0f + (f32)RANDOM_F(0.0f);
angle_y += DEG2SHORT_ANGLE2(RANDOM_F(20.0f));
angle_x += DEG2SHORT_ANGLE2(RANDOM_F(20.0f));
effect->scale.x = 0.01f;
effect->offset.x = 0.01f;
effect->offset.y = 0.004f;
effect->velocity.y = mul * cos_s(angle_x);
effect->velocity.x = mul * sin_s(angle_x) * sin_s(angle_y);
effect->velocity.z = mul * sin_s(angle_x) * cos_s(angle_y);
} else {
s16 angle_y = *angle_y_p + DEG2SHORT_ANGLE2(10.0f);
s16 angle_x = DEG2SHORT_ANGLE2(-60.0f);
mul = 6.0f + (f32)RANDOM_F(0.0f);
angle_y += -DEG2SHORT_ANGLE2(RANDOM_F(20.0f));
angle_x += -DEG2SHORT_ANGLE2(RANDOM_F(20.0f));
effect->scale.x = 0.012f;
effect->offset.x = 0.012f;
effect->offset.y = 0.006f;
effect->velocity.y = mul * cos_s(angle_x);
effect->velocity.x = mul * sin_s(angle_x) * sin_s(angle_y);
effect->velocity.z = mul * sin_s(angle_x) * cos_s(angle_y);
}
effect->effect_specific[0] = qrand();
effect->timer = 40;
}
static void eImpact_Star_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->velocity.x *= sqrtf(0.85f);
effect->velocity.y *= sqrtf(0.85f);
effect->velocity.z *= sqrtf(0.85f);
}
static void eImpact_Star_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
GAME_PLAY* play = (GAME_PLAY*)game;
u8 alpha = (int)eEC_CLIP->calc_adjust_proc(effect->timer,0,10, 0.0f, 255.0f);
effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 26, 40, effect->offset.y, effect->offset.x);
effect->scale.y= effect->scale.z= effect->scale.x;
OPEN_DISP(game->graph);
_texture_z_light_fog_prim_xlu (game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_mult(&play->billboard_matrix, 1);
Matrix_RotateZ(effect->effect_specific[0], 1);
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 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, 255, 255, 255, 100, alpha);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_star01_00_modelT);
CLOSE_DISP(game->graph);
}