mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Implement & link ef_make_hem
This commit is contained in:
@@ -891,6 +891,10 @@ ac_weather_leaf.c:
|
||||
.text: [0x8060420C, 0x806048B8]
|
||||
.rodata: [0x8064BBE8, 0x8064BC40]
|
||||
.data: [0x806D1E28, 0x806D1E48]
|
||||
ef_make_hem.c:
|
||||
.text: [0x806162B0, 0x8061710C]
|
||||
.rodata: [0x8064C818, 0x8064C860]
|
||||
.data: [0x806D3160, 0x806D31B8]
|
||||
m_select.c:
|
||||
.text: [0x80627F88, 0x80629CA8]
|
||||
.rodata: [0x8064D1B0, 0x8064D1B8]
|
||||
@@ -931,12 +935,12 @@ audio.c:
|
||||
.rodata: [0x8064D340, 0x8064D360]
|
||||
.data: [0x806D4CB0, 0x806D4D40]
|
||||
.bss: [0x8148DA78, 0x8148DA7C]
|
||||
ac_weather_fine.c:
|
||||
.data: [0x806D1DA0, 0x806D1DB8]
|
||||
f_furniture.c:
|
||||
.text: [0x8062E96C, 0x80641254]
|
||||
.rodata: [0x8064D360, 0x8064D4D0]
|
||||
.data: [0x806D4D40, 0x806E02A0]
|
||||
ac_weather_fine.c:
|
||||
.data: [0x806D1DA0, 0x806D1DB8]
|
||||
|
||||
|
||||
# dataobject.obj files
|
||||
|
||||
@@ -151,6 +151,8 @@ enum effect_type {
|
||||
eEC_EFFECT_NUM
|
||||
};
|
||||
|
||||
typedef struct effect_profile_s eEC_PROFILE_c;
|
||||
|
||||
extern eEC_PROFILE_c iam_ef_ami_mizu;
|
||||
extern eEC_PROFILE_c iam_ef_anahikari;
|
||||
extern eEC_PROFILE_c iam_ef_ase;
|
||||
@@ -287,6 +289,14 @@ enum {
|
||||
eEC_LIGHT_COLOR_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
eEC_STATE_NORMAL, // playing
|
||||
eEC_STATE_CONTINUOUS, // continuously playing
|
||||
eEC_STATE_FINISHED, // finished playing
|
||||
|
||||
eEC_STATE_NUM
|
||||
};
|
||||
|
||||
typedef struct effect_s eEC_Effect_c;
|
||||
|
||||
struct effect_s {
|
||||
@@ -312,7 +322,7 @@ typedef void (*eEC_EFFECT_CT_PROC)(eEC_Effect_c*, GAME*, void*);
|
||||
typedef void (*eEC_EFFECT_MOVE_PROC)(eEC_Effect_c*, GAME*);
|
||||
typedef void (*eEC_EFFECT_DRAW_PROC)(eEC_Effect_c*, GAME*);
|
||||
|
||||
typedef struct effect_profile_s {
|
||||
struct effect_profile_s {
|
||||
eEC_EFFECT_INIT_PROC init_proc;
|
||||
eEC_EFFECT_CT_PROC ct_proc;
|
||||
eEC_EFFECT_MOVE_PROC move_proc;
|
||||
@@ -320,7 +330,7 @@ typedef struct effect_profile_s {
|
||||
s16 n_frames;
|
||||
s16 child_effect_id;
|
||||
f32 max_dist;
|
||||
} eEC_PROFILE_c;
|
||||
};
|
||||
|
||||
typedef struct morph_data_s {
|
||||
u8 start_frame;
|
||||
@@ -350,7 +360,7 @@ typedef void (*eEC_SETCONTINIOUSENV_PROC)(eEC_Effect_c* effect, s16 unused, s16
|
||||
typedef f32 (*eEC_CALCADJUST_PROC)(s16 now_timer, s16 start_timer, s16 end_timer, f32 start_val, f32 end_val);
|
||||
typedef void (*eEC_AUTOMATRIXXLU_PROC)(GAME* game, xyz_t* pos, xyz_t* scale);
|
||||
typedef void (*eEC_AUTOMATRIXXLU_OFFSET_PROC)(GAME* game, xyz_t* pos, xyz_t* scale, xyz_t* offset);
|
||||
typedef eEC_Effect_c* (*eEC_MAKEEFFECT_PROC)(s16 effect_id, xyz_t* pos, xyz_t* ofs, GAME* game, void* ct_arg,
|
||||
typedef eEC_Effect_c* (*eEC_MAKEEFFECT_PROC)(s16 effect_id, xyz_t pos, xyz_t* ofs, GAME* game, void* ct_arg,
|
||||
u16 item_name, int prio, s16 arg0, s16 arg1);
|
||||
typedef void (*eEC_MORPHCOMBINE_PROC)(u8* result, eEC_morph_data_c* morph_data, s16 now_timer);
|
||||
typedef void (*eEC_REGISTEFFECTLIGHT_PROC)(rgba_t color, s16 max_frames, s16 n_frames, int shadow_flag);
|
||||
@@ -406,8 +416,13 @@ struct effect_control_s {
|
||||
eEC_EffectControl_Clip_c clip;
|
||||
};
|
||||
|
||||
extern int eMH_special_point_light_num;
|
||||
|
||||
extern ACTOR_PROFILE Effect_Control_Profile;
|
||||
|
||||
/* NOTE: you must include 'm_common_data.h' to use this macro */
|
||||
#define eEC_CLIP (Common_Get(clip).effect_clip)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+240
-23
@@ -1,19 +1,134 @@
|
||||
#include "ef_effect_control.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
#include "m_debug.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_rcp.h"
|
||||
|
||||
#define eHM_TIMER 2000
|
||||
|
||||
static void eMH_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_MAKE_HEM, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eMH_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
effect->timer = eHM_TIMER;
|
||||
effect->scale.x = 0.0f;
|
||||
effect->scale.y = 0.0f;
|
||||
effect->scale.z = 0.0f;
|
||||
|
||||
if (effect->arg0 == 1) {
|
||||
effect->position.y += 30.0f;
|
||||
} else {
|
||||
effect->position.y += 20.0f;
|
||||
}
|
||||
|
||||
if (effect->arg0 == 1) {
|
||||
int* const point_light_num = &eMH_special_point_light_num;
|
||||
|
||||
if (*point_light_num == -1) {
|
||||
xyz_t pos = effect->position;
|
||||
|
||||
pos.z += 20.0f;
|
||||
*point_light_num = mEnv_ReservePointLight((GAME_PLAY*)game, &pos, 0, 0, 0, GETREG(MYKREG, 0) + 100);
|
||||
}
|
||||
|
||||
(*eEC_CLIP->effect_make_proc)(eEC_EFFECT_MAKE_HEM_LIGHT, effect->position, 2, 0, game, RSV_NO, 0, 0);
|
||||
sAdo_OngenTrgStart(0x468, &effect->position);
|
||||
} else {
|
||||
(*eEC_CLIP->effect_kill_proc)(eEC_EFFECT_MAKE_HEM_LIGHT, RSV_NO);
|
||||
sAdo_OngenTrgStart(0x469, &effect->position);
|
||||
}
|
||||
}
|
||||
|
||||
static void eMH_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
f32 default_col = 255.0f;
|
||||
s16 elapsed_time = eHM_TIMER - effect->timer;
|
||||
f32 light_intensity;
|
||||
u8 col;
|
||||
int i;
|
||||
|
||||
if (elapsed_time <= 120) {
|
||||
if (effect->arg0 == 1) {
|
||||
light_intensity = (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 0, 120, 0.0f, 1.0f);
|
||||
} else {
|
||||
light_intensity = 1.0f;
|
||||
}
|
||||
|
||||
effect->effect_specific[0] = (int)(255.0f * (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 0, 120, 0.0f, 1.0f));
|
||||
} else if (elapsed_time <= 150) {
|
||||
light_intensity = 1.0f;
|
||||
effect->effect_specific[0] = (int)default_col;
|
||||
|
||||
if (elapsed_time == 150) {
|
||||
if (Common_Get(hem_visible) == FALSE) {
|
||||
Common_Set(hem_visible, TRUE);
|
||||
} else {
|
||||
Common_Set(hem_visible, FALSE);
|
||||
}
|
||||
|
||||
/* Spawn 16 twinkle effects at random points around the central effect */
|
||||
for (i = 0; i < 16; i++) {
|
||||
xyz_t pos = effect->position;
|
||||
s16 rnd_angle = RANDOM_F(66536.0f); // lol nice typo here.. should be 65536.0f
|
||||
f32 z = 20.0f * cos_s(rnd_angle);
|
||||
f32 x = 20.0f * sin_s(rnd_angle);
|
||||
f32 y = -10.0f + RANDOM_F(25.0f);
|
||||
|
||||
pos.x += x;
|
||||
pos.y += y;
|
||||
pos.z += z;
|
||||
|
||||
(*eEC_CLIP->effect_make_proc)(eEC_EFFECT_MAKE_HEM_KIRA, pos, 2, 0, game, RSV_NO, 0, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (effect->arg0 == 1) {
|
||||
light_intensity = 1.0f;
|
||||
} else {
|
||||
light_intensity = (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 151, 195, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
effect->effect_specific[0] = (int)(255.0f * (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 151, 195, 1.0f, 0.0f));
|
||||
|
||||
if (elapsed_time == 196) {
|
||||
effect->timer = 0;
|
||||
|
||||
if (effect->arg0 == 0) {
|
||||
int* const point_light_num = &eMH_special_point_light_num;
|
||||
|
||||
if (*point_light_num != -1) {
|
||||
*point_light_num = mEnv_CancelReservedPointLight(*point_light_num, (GAME_PLAY*)game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_calc(&effect->scale.x, 0.575f, 0.05f, 0.1f, 0.001f);
|
||||
col = (int)(255.0f * light_intensity);
|
||||
mEnv_OperateReservedPointLight_Color(eMH_special_point_light_num, col, col, col);
|
||||
}
|
||||
|
||||
extern Gfx ef_sphere_light_model[];
|
||||
|
||||
static void eMH_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
xyz_t* pos = &effect->position;
|
||||
u8 alpha = effect->effect_specific[0];
|
||||
f32 scale = effect->scale.x * 0.01f;
|
||||
|
||||
Setpos_HiliteReflect_xlu_init(pos, play);
|
||||
Matrix_translate(pos->x, pos->y, pos->z, 0);
|
||||
Matrix_scale(scale, scale, scale, 1);
|
||||
_texture_z_light_fog_prim(game->graph);
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, alpha);
|
||||
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_sphere_light_model);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
eEC_PROFILE_c iam_ef_make_hem = {
|
||||
@@ -28,21 +143,10 @@ eEC_PROFILE_c iam_ef_make_hem = {
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static void eMHK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void eMHK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void eMHK_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void eMHK_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
}
|
||||
static void eMHK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
|
||||
static void eMHK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
|
||||
static void eMHK_mv(eEC_Effect_c* effect, GAME* game);
|
||||
static void eMHK_dw(eEC_Effect_c* effect, GAME* game);
|
||||
|
||||
eEC_PROFILE_c iam_ef_make_hem_kira = {
|
||||
// clang-format off
|
||||
@@ -56,20 +160,133 @@ eEC_PROFILE_c iam_ef_make_hem_kira = {
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static void eMHK_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
|
||||
(*eEC_CLIP->make_effect_proc)(eEC_EFFECT_MAKE_HEM_KIRA, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eMHK_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
static xyz_t xyz0 = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
effect->timer = 500.0f;
|
||||
|
||||
effect->acceleration = xyz0;
|
||||
effect->velocity = xyz0;
|
||||
effect->scale = xyz0;
|
||||
|
||||
effect->velocity.y = -(RANDOM_F(0.1f) + 0.2f);
|
||||
effect->effect_specific[0] = RANDOM(32);
|
||||
}
|
||||
|
||||
static void eMHK_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
s16 elapsed_time = (effect->timer + effect->effect_specific[0]) & 15;
|
||||
f32 scale;
|
||||
|
||||
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
|
||||
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
|
||||
|
||||
/* Shrink then scale */
|
||||
if (elapsed_time <= 7) {
|
||||
scale = (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 0, 7, 0.0f, 0.0064999999f);
|
||||
} else {
|
||||
scale = (*eEC_CLIP->calc_adjust_proc)(elapsed_time, 8, 15, 0.0064999999f, 0.0f);
|
||||
}
|
||||
|
||||
effect->scale.x = scale;
|
||||
effect->scale.y = scale;
|
||||
effect->scale.z = scale;
|
||||
|
||||
if (elapsed_time == 0) {
|
||||
f32 bg_y = mCoBG_GetBgY_OnlyCenter_FromWpos2(effect->position, 0.0f);
|
||||
|
||||
if (effect->position.y < bg_y) {
|
||||
effect->timer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx ef_takurami01_normal_render_mode[];
|
||||
extern Gfx ef_takurami01_kira_modelT[];
|
||||
|
||||
static void eMHK_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
|
||||
Matrix_mult(&play->billboard_matrix, 1);
|
||||
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
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, 255, 200);
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, ef_takurami01_normal_render_mode);
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_takurami01_kira_modelT);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
static void eMHL_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_MAKE_HEM_LIGHT, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eMHL_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
effect->timer = 195;
|
||||
effect->effect_specific[0] = 0;
|
||||
effect->position.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(effect->position, 0.0f);
|
||||
}
|
||||
|
||||
static void eMHL_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
(*eEC_CLIP->set_continious_env_proc)(effect, 195, 195);
|
||||
|
||||
switch (effect->state) {
|
||||
case eEC_STATE_NORMAL: {
|
||||
s16 elapsed_time = 195 - effect->timer;
|
||||
|
||||
if (elapsed_time < 120) {
|
||||
effect->effect_specific[0] = (int)(*eEC_CLIP->calc_adjust_proc)(elapsed_time, 0, 119, 170.0f, 0.0f);
|
||||
} else if (elapsed_time < 150) {
|
||||
effect->effect_specific[0] = 0;
|
||||
} else {
|
||||
effect->effect_specific[0] = (int)(*eEC_CLIP->calc_adjust_proc)(elapsed_time, 151, 175, 0.0f, 50.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case eEC_STATE_FINISHED: {
|
||||
s16 elapsed_time = 195 - effect->timer;
|
||||
|
||||
if (elapsed_time < 120) {
|
||||
effect->effect_specific[0] = (int)(*eEC_CLIP->calc_adjust_proc)(elapsed_time, 0, 119, 50.0f, 0.0f);
|
||||
} else if (elapsed_time < 150) {
|
||||
effect->effect_specific[0] = 0;
|
||||
} else {
|
||||
effect->effect_specific[0] = (int)(*eEC_CLIP->calc_adjust_proc)(elapsed_time, 151, 195, 0.0f, 170.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
effect->effect_specific[0] = 50;
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx ef_circle_light_model[];
|
||||
|
||||
static void eMHL_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
u8 alpha = effect->effect_specific[0];
|
||||
|
||||
Matrix_translate(effect->position.x, effect->position.y + 0.1f, effect->position.z, 0);
|
||||
Matrix_scale(0.01f, 0.01f, 0.01f, 1);
|
||||
_texture_z_light_fog_prim_shadow(game->graph);
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPMatrix(NEXT_SHADOW_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(NEXT_SHADOW_DISP, 0, 0, 255, 255, 220, alpha);
|
||||
gDPSetEnvColor(NEXT_SHADOW_DISP, 255, 255, 255, 100);
|
||||
gSPDisplayList(NEXT_SHADOW_DISP, ef_circle_light_model);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
eEC_PROFILE_c iam_ef_make_hem_light = {
|
||||
|
||||
Reference in New Issue
Block a user