Implement & link ef_break_axe, ef_hanabi_dummy improvements

This commit is contained in:
Cuyler36
2024-08-05 07:14:18 -04:00
parent a370750047
commit e8ffa5eac8
4 changed files with 231 additions and 38 deletions
+4
View File
@@ -1083,6 +1083,10 @@ ef_ase_ch.c:
.text: [0x806052A8, 0x806054F0]
.rodata: [0x8064BCA8, 0x8064BCC0]
.data: [0x806D1EC8, 0x806D1F08]
ef_break_axe.c:
.text: [0x806054F0, 0x8060672C]
.rodata: [0x8064BCC0, 0x8064BD60]
.data: [0x806D1F08, 0x806D1F20]
ef_bubu.c:
.text: [0x8060672C, 0x80606878]
.rodata: [0x8064BD60, 0x8064BD68]
+7 -2
View File
@@ -12,8 +12,9 @@ extern "C" {
#define VOICE_MODE_SILENT 2
/* audio is monophonic */
#define MONO(id) (id | 0x1000)
#define SE_FLAG_15(id) (id | 0x8000)
#define MONO(id) ((id) | 0x1000)
#define HANABI(id) ((id) | 0x2000) /* TODO: better name, this probably is some echo effect modifier */
#define SE_FLAG_15(id) ((id) | 0x8000)
// TODO: Make the rest of Sound Effects with parameters
#define SE_REGISTER MONO(0x50)
@@ -83,6 +84,10 @@ typedef enum audio_sound_effects {
NA_SE_ROD_STROKE = 0x109,
NA_SE_ROD_BACK,
NA_SE_HANABI0 = HANABI(0x10F),
NA_SE_HANABI1 = HANABI(0x110),
NA_SE_HANABI2 = HANABI(0x111),
NA_SE_HANABI3 = HANABI(0x112),
NA_SE_EAT = 0x113,
NA_SE_WEAR = 0x11C,
+172 -4
View File
@@ -1,5 +1,10 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_debug.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eBreak_Axe_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eBreak_Axe_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eBreak_Axe_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +23,180 @@ eEC_PROFILE_c iam_ef_break_axe = {
};
static void eBreak_Axe_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_BREAK_AXE, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eBreak_Axe_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 angle = *(s16*)ct_arg + DEG2SHORT_ANGLE2(180.0f);
f32 speed_xz;
f32 speed_y;
f32 tz;
f32 ty;
f32 tx;
s16 add_angle;
effect->timer = RANDOM(10) * 2 + (35 + GETREG(TAKREG, 60)) * 2;
effect->effect_specific[5] = effect->timer;
if (effect->arg0 > 1) {
effect->scale.x = effect->scale.y = effect->scale.z = (1.0f + fqrand()) * 0.01f;
} else {
effect->scale.x = effect->scale.y = effect->scale.z = 0.01f;
}
effect->offset.x = effect->position.y;
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
if (effect->arg0 == 0) {
angle += (int)((40.0f + GETREG(TAKREG, 56) + RANDOM_F(20.0f + GETREG(TAKREG, 57))) * 182.04445f);
effect->offset.y += 10.0f;
} else if (effect->arg0 == 1) {
angle += (int)((20.0f + GETREG(TAKREG, 58) + RANDOM_F(20.0f + GETREG(TAKREG, 59))) * 182.04445f);
effect->offset.y += 15.0f;
} else {
angle += RANDOM_F(14563.0f);
effect->offset.y += 3.0f;
}
effect->effect_specific[4] = *(s16*)ct_arg;
if (effect->arg0 == 0) {
tx = -17.0f + GETREG(TAKREG, 32);
ty = 34.0f + GETREG(TAKREG, 33);
tz = 20.0f + GETREG(TAKREG, 34);
effect->position.x += tz * sin_s(effect->effect_specific[4]) + tx * cos_s(effect->effect_specific[4]);
effect->position.y += ty;
effect->position.z += tz * cos_s(effect->effect_specific[4]) - tx * sin_s(effect->effect_specific[4]);
effect->effect_specific[0] = (-20.0f + GETREG(TAKREG, 35)) * 182.04445f;
add_angle = (int)((-77.0f + GETREG(TAKREG, 36)) * 182.04445f);
effect->effect_specific[4] += add_angle;
effect->effect_specific[2] = (0.0f + GETREG(TAKREG, 37)) * 182.04445f;
effect->effect_specific[1] = qrand() & 0xFFF;
effect->effect_specific[3] = qrand() & 0xFFF;
speed_xz = (0.5f + GETREG(TAKREG, 48) * 0.1f) * 0.5f + RANDOM_F((1.5f + GETREG(TAKREG, 49) * 0.1f) * 0.5f);
speed_y = (8.0f + GETREG(TAKREG, 50) * 0.1f) * 0.5f + RANDOM_F((2.0f + GETREG(TAKREG, 51) * 0.1f) * 0.5f);
} else if (effect->arg0 == 1) {
tz = -4.0f + GETREG(TAKREG, 38);
ty = 27.0f + GETREG(TAKREG, 39);
tx = 17.0f + GETREG(TAKREG, 40);
effect->position.x += tx * sin_s(effect->effect_specific[4]) + tz * cos_s(effect->effect_specific[4]);
effect->position.y += ty;
effect->position.z += tx * cos_s(effect->effect_specific[4]) - tz * sin_s(effect->effect_specific[4]);
effect->effect_specific[0] = (-20.0f + GETREG(TAKREG, 41)) * 182.04445f;
add_angle = (int)((-77.0f + GETREG(TAKREG, 42)) * 182.04445f);
effect->effect_specific[4] += add_angle;
effect->effect_specific[2] = (0.0f + GETREG(TAKREG, 43)) * 182.04445f;
effect->effect_specific[1] = qrand() & 0xFFF;
effect->effect_specific[3] = qrand() & 0xFFF;
speed_xz = (1.5f + GETREG(TAKREG, 52) * 0.1f) * 0.5f + RANDOM_F((1.0f + GETREG(TAKREG, 53) * 0.1f) * 0.5f);
speed_y = (7.5f + GETREG(TAKREG, 54) * 0.1f) * 0.5f + RANDOM_F((3.0f + GETREG(TAKREG, 55) * 0.1f) * 0.5f);
} else {
effect->position.x += RANDOM2_F(10.0f);
effect->position.y += RANDOM2_F(10.0f);
effect->position.z += RANDOM2_F(10.0f);
effect->effect_specific[0] = qrand();
effect->effect_specific[2] = qrand();
effect->effect_specific[1] = qrand() & 0x1FFF;
effect->effect_specific[3] = qrand() & 0x1FFF;
speed_xz = (2.0f + GETREG(TAKREG, 44) * 0.1f) * 0.5f + RANDOM_F((3.5f + GETREG(TAKREG, 45) * 0.1f) * 0.5f);
speed_y = (8.0f + GETREG(TAKREG, 46) * 0.1f) * 0.5f + RANDOM_F((5.0f + GETREG(TAKREG, 47) * 0.1f) * 0.5f);
}
effect->velocity.x = speed_xz * sin_s(angle);
effect->velocity.z = speed_xz * cos_s(angle);
effect->velocity.y = speed_y;
effect->acceleration.y = -0.25f;
}
static void eBreak_Axe_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
u32 ut_attr = mCoBG_Wpos2Attribute(effect->position, NULL);
effect->offset.x = effect->position.y;
effect->offset.z = effect->offset.y;
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
if (effect->arg0 == 0) {
effect->offset.y += 10.0f;
} else if (effect->arg0 == 1) {
effect->offset.y += 15.0f;
}
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
effect->effect_specific[0] += effect->effect_specific[1];
effect->effect_specific[2] += effect->effect_specific[3];
if (effect->timer <= ((35 + GETREG(TAKREG, 60)) * 2 - 5)) {
if (effect->position.y < effect->offset.y && mCoBG_CheckWaterAttribute(ut_attr)) {
xyz_t_mult_v(&effect->velocity, 0.8f);
add_calc_short_angle2(&effect->effect_specific[1], 0, 1.0f - sqrtf(0.9f), 182, 9);
add_calc_short_angle2(&effect->effect_specific[3], 0, 1.0f - sqrtf(0.9f), 182, 9);
}
if (effect->position.y < effect->offset.y && effect->offset.x >= effect->offset.y &&
effect->velocity.y < 0.0f) {
if (mCoBG_CheckWaterAttribute(ut_attr)) {
if (effect->arg0 < 2) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_AMI_MIZU, effect->position, effect->prio, 0, game,
effect->item_name, 0, 0);
eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, effect->position, effect->prio, 0, game,
effect->item_name, 0, 0);
}
} else {
effect->position.y = effect->offset.y;
effect->velocity.x *= 0.6f;
effect->velocity.y *= -0.6f;
effect->velocity.z *= 0.6f;
effect->effect_specific[1] >>= 1;
effect->effect_specific[3] >>= 1;
}
}
if (effect->position.y < effect->offset.y && effect->position.y >= effect->offset.z) {
effect->position.x -= effect->velocity.x;
effect->position.y -= effect->velocity.y;
effect->position.z -= effect->velocity.z;
effect->velocity.x *= -0.6f;
effect->velocity.z *= -0.6f;
}
}
}
extern Gfx ef_axe1_model[];
extern Gfx ef_axe2_model[];
extern Gfx ef_axe3_model[];
static void eBreak_Axe_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, (15 + GETREG(TAKREG, 61)) * 2, 0.0f, 255.0f);
_texture_z_light_fog_prim_xlu(game->graph);
OPEN_DISP(game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_RotateY(effect->effect_specific[4] + (int)(GETREG(TAKREG, 21) * 182.04445f), 1);
Matrix_rotateXYZ(effect->effect_specific[0] + (int)(GETREG(TAKREG, 20) * 182.04445f), 0,
effect->effect_specific[2] + (int)(GETREG(TAKREG, 22) * 182.04445f), 1);
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, a);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (effect->arg0 == 0) {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe1_model);
} else if (effect->arg0 == 1) {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe2_model);
} else {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe3_model);
}
CLOSE_DISP(game->graph);
}
+48 -32
View File
@@ -2,6 +2,24 @@
#include "m_common_data.h"
#define eHanabiDummy_TIMER 80
#define eHanabiDummy_MIN_POWER 0.0f
#define eHanabiDummy_MAX_POWER 2.0f
#define eHanabiDummy_MAX_DIST (mFI_UNIT_BASE_SIZE_F * 12)
enum {
eHanabiDummy_TYPE0,
eHanabiDummy_TYPE1,
eHanabiDummy_TYPE2,
eHanabiDummy_TYPE3,
eHanabiDummy_TYPE4,
eHanabiDummy_TYPE5,
eHanabiDummy_TYPE_NUM
};
#define eHanabiDummy_TYPE_ARG (effect->effect_specific[0])
static void eHanabiDummy_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eHanabiDummy_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eHanabiDummy_mv(eEC_Effect_c* effect, GAME* game);
@@ -24,63 +42,61 @@ static void eHanabiDummy_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 it
}
static void eHanabiDummy_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
effect->timer = 0x50;
effect->effect_specific[0] = RANDOM(6);
effect->timer = eHanabiDummy_TIMER;
eHanabiDummy_TYPE_ARG = RANDOM(eHanabiDummy_TYPE_NUM);
}
static void eHanabiDummy_mv(eEC_Effect_c* effect, GAME* game) {
rgba_t light_color;
s16 frames_passed = 80 - effect->timer;
s16 frames_passed = eHanabiDummy_TIMER - effect->timer;
if (frames_passed == 10) {
static rgba_t dummy_light[] = {
{ 50, 30, 20, 255 },
{ 20, 60, 20, 255 },
{ 40, 10, 60, 255 },
{ 40, 20, 20, 255 },
{ 20, 40, 20, 255 },
{ 60, 60, 30, 255 },
static rgba_t dummy_light[eHanabiDummy_TYPE_NUM] = {
{ 50, 30, 20, 255 }, { 20, 60, 20, 255 }, { 40, 10, 60, 255 },
{ 40, 20, 20, 255 }, { 20, 40, 20, 255 }, { 60, 60, 30, 255 },
};
eEC_CLIP->decide_light_power_proc(&light_color, dummy_light[effect->effect_specific[0]], effect->position, game, 2.0f, 0.0f, 480.0f);
eEC_CLIP->decide_light_power_proc(&light_color, dummy_light[eHanabiDummy_TYPE_ARG], effect->position, game,
eHanabiDummy_MAX_POWER, eHanabiDummy_MIN_POWER, eHanabiDummy_MAX_DIST);
if (effect->arg0 != 0) {
light_color.r = light_color.r * 2.0f;
light_color.g = light_color.g * 2.0f;
light_color.b = light_color.b * 2.0f;
light_color.r = light_color.r * eHanabiDummy_MAX_POWER;
light_color.g = light_color.g * eHanabiDummy_MAX_POWER;
light_color.b = light_color.b * eHanabiDummy_MAX_POWER;
}
eEC_CLIP->regist_effect_light(light_color, 20, 50, TRUE);
}
if (frames_passed == 72) {
xyz_t pos = effect->position;
u16 sfx_no;
pos.y += 200.0f;
switch (effect->effect_specific[0]) {
case 0:
case 1:
sfx_no = 0x210F;
switch (eHanabiDummy_TYPE_ARG) {
case eHanabiDummy_TYPE0:
case eHanabiDummy_TYPE1:
sfx_no = NA_SE_HANABI0;
break;
case 2:
sfx_no = 0x2110;
case eHanabiDummy_TYPE2:
sfx_no = NA_SE_HANABI1;
break;
case 3:
case 4:
sfx_no = 0x2111;
case eHanabiDummy_TYPE3:
case eHanabiDummy_TYPE4:
sfx_no = NA_SE_HANABI2;
break;
case 5:
sfx_no = 0x2112;
case eHanabiDummy_TYPE5:
sfx_no = NA_SE_HANABI3;
break;
default:
sfx_no = 0x210F;
sfx_no = NA_SE_HANABI0;
break;
}
sAdo_OngenTrgStart(sfx_no, &pos);
}
}
static void eHanabiDummy_dw(eEC_Effect_c* effect, GAME* game) {
// empty
}
}