Merge pull request #492 from Norgesnerd/master

Implement & link ef_shooting, ef_shooting_set
This commit is contained in:
Cuyler36
2025-06-12 21:24:39 -04:00
committed by GitHub
3 changed files with 151 additions and 10 deletions
+2 -2
View File
@@ -1317,9 +1317,9 @@ config.libs = [
Object(Matching, "effect/ef_room_sunshine_posthouse.c"),
Object(NonMatching, "effect/ef_sandsplash.c"),
Object(NonMatching, "effect/ef_shock.c"),
Object(NonMatching, "effect/ef_shooting.c"),
Object(Matching, "effect/ef_shooting.c"),
Object(Matching, "effect/ef_shooting_kira.c"),
Object(NonMatching, "effect/ef_shooting_set.c"),
Object(Matching, "effect/ef_shooting_set.c"),
Object(NonMatching, "effect/ef_siawase_hana.c"),
Object(NonMatching, "effect/ef_siawase_hana_ch.c"),
Object(NonMatching, "effect/ef_siawase_hikari.c"),
+46 -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_nagare01_modelT[];
static void eShooting_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eShooting_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eShooting_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +25,52 @@ eEC_PROFILE_c iam_ef_shooting = {
};
static void eShooting_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_SHOOTING, pos, NULL, game, NULL, item_name, prio, arg0, angle);
}
static void eShooting_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 320;
effect->effect_specific[0] = RANDOM_F(30.0f) + 70.0f;
effect->effect_specific[1] = 0;
}
static void eShooting_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
s16 timer = 320 - effect->timer;
effect->effect_specific[1] += 256;
if (timer == (GETREG(MYKREG, 6) + 76)) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_SHOOTING_KIRA, effect->position, effect->prio, effect->arg1, game,
(u16)effect->item_name, effect->effect_specific[0], 0);
}
}
static Gfx* eShooting_GetTwoTileGfx(int x, int y, GAME* game) {
return two_tex_scroll_dolphin(game->graph, 0, x, y, 8, 256, 1, 0, 0, 8, 32);
}
static void eShooting_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
GRAPH* graph;
f32 scale_z = effect->effect_specific[0] * 0.01f;
s16 timer = 320 - effect->timer;
Gfx* two_tile = eShooting_GetTwoTileGfx(0, -((timer - 120) * 6), game);
graph = game->graph;
OPEN_DISP(graph);
_texture_z_light_fog_prim_xlu(graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, FALSE);
Matrix_RotateY(-effect->effect_specific[1], TRUE);
Matrix_scale(1.035f, 1.0f, 1.0f, TRUE);
Matrix_RotateY(effect->effect_specific[1], TRUE);
Matrix_RotateY(effect->arg1, TRUE);
Matrix_scale(0.01f, 0.01f, 0.01f * scale_z, TRUE);
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_9, two_tile);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_nagare01_modelT);
CLOSE_DISP(graph);
}
+103 -4
View File
@@ -1,5 +1,8 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_player_lib.h"
static void eShootingSet_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eShootingSet_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eShootingSet_mv(eEC_Effect_c* effect, GAME* game);
@@ -17,18 +20,114 @@ eEC_PROFILE_c iam_ef_shooting_set = {
// clang-format on
};
static void eShootingSet_SearchNicePos(xyz_t* out_pos, GAME* game) {
int bx, bz;
xyz_t zero_vec = { 0.0f, 0.0f, 0.0f };
xyz_t wpos = { 0.0f, 0.0f, 0.0f };
*out_pos = zero_vec;
if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL) && mFI_BkNum2WposXZ(&wpos.x, &wpos.z, bx, bz)) {
out_pos->x = wpos.x + 320.0f;
out_pos->y = mFI_BkNum2BaseHeight(bx, bz) + 20.0f;
out_pos->z = wpos.z + 320.0f;
}
}
static void eShootingSet_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
xyz_t out_pos;
eShootingSet_SearchNicePos(&out_pos, game);
eEC_CLIP->make_effect_proc(eEC_EFFECT_SHOOTING_SET, out_pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static f32 eShooting_AdjustValue(int now, int start, int end, f32 start_val, f32 end_val) {
if (start == end) {
return start_val;
}
if (now <= start) {
return start_val;
}
if (now >= end) {
return end_val;
}
return start_val + (now - start) * ((end_val - start_val) / (end - start));
}
static s16 eShootingSet_GetFrame_MakeNextShooting() {
s16 adjust;
if ((Common_Get(time).now_sec < 64800) || (Common_Get(time).now_sec >= 75600)) {
adjust = 600;
} else if (Common_Get(time).now_sec < 70200) {
adjust = eShooting_AdjustValue(Common_Get(time).now_sec, 64800, 70200, 600.0f, 120.0f);
} else {
adjust = eShooting_AdjustValue(Common_Get(time).now_sec, 70200, 75600, 120.0f, 600.0f);
}
return adjust + (RANDOM_F(120.0f) - 60.0f);
}
static void eShootingSet_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 100;
effect->effect_specific[0] = 0;
effect->effect_specific[1] = eShootingSet_GetFrame_MakeNextShooting();
}
static void eShootingSet_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
f32 temp;
s16 rng, rnd_angle;
int angle;
PLAYER_ACTOR* actor;
xyz_t pos, pos2;
eEC_CLIP->set_continious_env_proc(effect, 100, 100);
if (mEv_CheckTitleDemo() != -9) {
if (effect->effect_specific[0] >= effect->effect_specific[1]) {
effect->effect_specific[0] = 0;
effect->effect_specific[1] = eShootingSet_GetFrame_MakeNextShooting();
if (eEC_CLIP->check_lookat_block_proc(effect->position)) {
rng = RANDOM(10.0f) & 1;
if (rng == 1) {
angle = DEG2SHORT_ANGLE(315.0f) + (s16)RANDOM_F(6144.0f);
} else {
angle = DEG2SHORT_ANGLE(315.0f) - (s16)RANDOM_F(6144.0f);
}
pos = effect->position;
actor = GET_PLAYER_ACTOR_GAME(game);
temp = RANDOM_F(80.0f);
rnd_angle = RANDOM_F(65535.0f);
pos.x += actor->actor_class.world.position.x;
pos.z += actor->actor_class.world.position.z;
pos.x *= 0.5f;
pos.z *= 0.5f;
pos.x += temp * cos_s(rnd_angle);
pos.z += temp * cos_s(rnd_angle);
eEC_CLIP->effect_make_proc(eEC_EFFECT_SHOOTING, pos, effect->prio, angle, game, (u16)effect->item_name,
0, 0);
}
}
effect->effect_specific[0]++;
if (eEC_CLIP->check_lookat_block_proc(effect->position)) {
pos2 = effect->position;
pos2.y += 200.0f;
NPC_CLIP->set_attention_request_proc(aNPC_ATTENTION_TYPE_POSITION, NULL, &pos2);
}
}
}
static void eShootingSet_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
return;
}