mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-09-03 00:53:49 -04:00
match insect_kumo
This commit is contained in:
@@ -305,20 +305,20 @@ void minsect_mino_mv(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
|||||||
void minsect_mino_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
void minsect_mino_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
|
|
||||||
// ac_museum_insect_kumo.c_inc
|
// ac_museum_insect_kumo.c_inc
|
||||||
void minsect_kumo_hide_init(void);
|
void minsect_kumo_hide_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_hide(void);
|
void minsect_kumo_hide(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_up_init(void);
|
void minsect_kumo_up_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_up(void);
|
void minsect_kumo_up(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_down_init(void);
|
void minsect_kumo_down_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_down(void);
|
void minsect_kumo_down(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_move_init(void);
|
void minsect_kumo_move_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_move(void);
|
void minsect_kumo_move(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_check_player(void);
|
void minsect_kumo_check_player(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_furiko(void);
|
void minsect_kumo_furiko(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_wait_init(void);
|
void minsect_kumo_wait_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_wait(void);
|
void minsect_kumo_wait(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_hineri(void);
|
void minsect_kumo_hineri(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_setupAction(void);
|
void minsect_kumo_setupAction(MUSEUM_INSECT_PRIVATE_DATA* actor, int r4, GAME* game);
|
||||||
void minsect_kumo_ct(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
void minsect_kumo_ct(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_mv(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
void minsect_kumo_mv(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
void minsect_kumo_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
void minsect_kumo_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game);
|
||||||
|
|||||||
@@ -1 +1,277 @@
|
|||||||
#include "ac_museum_insect_priv.h"
|
#include "ac_museum_insect_priv.h"
|
||||||
|
|
||||||
|
void minsect_kumo_hide_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_40 = 0.165f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_hide(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_1C.y += actor->_40;
|
||||||
|
if (actor->_1C.y > kumo_top_pos.y + 10.f) {
|
||||||
|
actor->_1C.y = kumo_top_pos.y + 10.f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_up_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_40 = 0.165f;
|
||||||
|
actor->_6E = (s16)RANDOM_F(20.f) + 50;
|
||||||
|
actor->_44.x = 10.f;
|
||||||
|
actor->_7E = actor->_78;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_up(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_6E--;
|
||||||
|
actor->_1C.y += actor->_40;
|
||||||
|
if (actor->_1C.y > kumo_top_pos.y - 10.f) {
|
||||||
|
actor->_1C.y = kumo_top_pos.y - 10.f;
|
||||||
|
minsect_kumo_setupAction(actor, 0, game);
|
||||||
|
} else if (actor->_6E < 0) {
|
||||||
|
actor->_6E = (s16)RANDOM_F(20.f) + 50;
|
||||||
|
actor->_40 = 0.165f;
|
||||||
|
actor->_7E = actor->_78;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_down_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_44.x = 60.f;
|
||||||
|
actor->_7E = DEG2SHORT_ANGLE(90);
|
||||||
|
if (GETREG(NMREG, 0x14)) {
|
||||||
|
actor->_60 = GETREG(NMREG, 0x14) * 0.01f;
|
||||||
|
} else {
|
||||||
|
actor->_60 = 1.8f;
|
||||||
|
}
|
||||||
|
actor->_40 = GETREG(NMREG, 0x13) * 0.01f + 4.0f;
|
||||||
|
actor->_82 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_down(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
if (add_calc(&actor->_40, 0.f, CALC_EASE(GETREG(NMREG, 0x15) * 0.01f + 0.25f),
|
||||||
|
(GETREG(NMREG, 0x16) * 0.01f + 3.0f) * 0.5f, 0.05f) < (GETREG(NMREG, 0x1a) * 0.01f + 0.1f)) {
|
||||||
|
if (!add_calc(&actor->_60, 0.f, CALC_EASE(GETREG(NMREG, 0x17) * 0.01f + 0.5f),
|
||||||
|
(GETREG(NMREG, 0x18) * 0.01f + 0.08f) * 0.5f, 0.005f)) {
|
||||||
|
actor->_44.x = 40.f;
|
||||||
|
minsect_kumo_setupAction(actor, 0, game);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
actor->_1C.y -= actor->_40;
|
||||||
|
}
|
||||||
|
if (actor->_1C.y < kumo_bottom_pos.y) {
|
||||||
|
actor->_1C.y = kumo_bottom_pos.y;
|
||||||
|
} else if (actor->_1C.y > kumo_top_pos.y - 10.f) {
|
||||||
|
actor->_1C.y = kumo_top_pos.y - 10.f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_move_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_move(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_6E--;
|
||||||
|
if (actor->_8C & 2) {
|
||||||
|
if (actor->_40 < 0.f) {
|
||||||
|
actor->_1C.y += actor->_40;
|
||||||
|
if (actor->_1C.y < kumo_bottom_pos.y + 10.f) {
|
||||||
|
actor->_8C |= 8;
|
||||||
|
actor->_8C &= ~2;
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
}
|
||||||
|
} else if (actor->_8C & 0x10) {
|
||||||
|
actor->_1C.y += actor->_40;
|
||||||
|
if (actor->_1C.y > kumo_top_pos.y - 10.f) {
|
||||||
|
actor->_1C.y = kumo_top_pos.y - 10.f;
|
||||||
|
actor->_8C |= 4;
|
||||||
|
actor->_8C &= ~2;
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
}
|
||||||
|
if (actor->_6E % 12 == 0) {
|
||||||
|
actor->_8C &= ~0x10;
|
||||||
|
}
|
||||||
|
} else if (actor->_6E % 12 == 0) {
|
||||||
|
actor->_8C |= 0x10;
|
||||||
|
}
|
||||||
|
if (actor->_6E < 0) {
|
||||||
|
actor->_8C &= ~2;
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
}
|
||||||
|
} else if (actor->_6E < 0) {
|
||||||
|
if (actor->_8C & 4) {
|
||||||
|
if (RANDOM_F(1.f) > 0.5f) {
|
||||||
|
minsect_kumo_setupAction(actor, 3, game);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
actor->_6E = (s16)RANDOM_F(20.f) + 40;
|
||||||
|
actor->_40 = -0.45f;
|
||||||
|
} else if (actor->_8C & 8 || RANDOM_F(1.f) > 0.5f) {
|
||||||
|
if (RANDOM_F(1.f) > 0.9f) {
|
||||||
|
minsect_kumo_setupAction(actor, 2, game);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
actor->_6E = (s16)RANDOM_F(20.f) + 50;
|
||||||
|
actor->_40 = 0.165f;
|
||||||
|
actor->_8C |= 0x10;
|
||||||
|
actor->_44.x += 5.f;
|
||||||
|
actor->_7E = actor->_78;
|
||||||
|
} else {
|
||||||
|
if (RANDOM_F(1.f) > 0.7f) {
|
||||||
|
minsect_kumo_setupAction(actor, 0, game);
|
||||||
|
} else {
|
||||||
|
actor->_6E = (s16)RANDOM_F(20.f) + 40;
|
||||||
|
actor->_40 = -0.45f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actor->_8C &= ~0xc;
|
||||||
|
actor->_8C |= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_check_player(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
PLAYER_ACTOR* player = get_player_actor_withoutCheck((GAME_PLAY*)game);
|
||||||
|
f32 dist = search_position_distance(&actor->_1C, &player->actor_class.world.position);
|
||||||
|
if (dist > 200.f) {
|
||||||
|
minsect_kumo_setupAction(actor, 4, game);
|
||||||
|
} else if (dist < 100.f && actor->_04 == minsect_kumo_hide) {
|
||||||
|
minsect_kumo_setupAction(actor, 3, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_furiko(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
f32 v, v2;
|
||||||
|
if (actor->_44.x) {
|
||||||
|
add_calc(&actor->_5C, actor->_44.x, CALC_EASE(0.7f), 0.75f, 0.05f);
|
||||||
|
} else {
|
||||||
|
add_calc(&actor->_5C, actor->_44.x, CALC_EASE(0.3f), 0.25f, 0.05f);
|
||||||
|
}
|
||||||
|
if (actor->_5C == actor->_44.x) {
|
||||||
|
actor->_44.x = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_calc_short_angle2(&actor->_7C, actor->_7E, CALC_EASE2(0.4f), DEG2SHORT_ANGLE(1.25f), DEG2SHORT_ANGLE(0.25f));
|
||||||
|
if (GETREG(NMREG, 0x10)) {
|
||||||
|
v = GETREG(NMREG, 0x10) * 0.01f;
|
||||||
|
} else {
|
||||||
|
v = 0.2f;
|
||||||
|
}
|
||||||
|
if (GETREG(NMREG, 0x11)) {
|
||||||
|
v2 = GETREG(NMREG, 0x11) * 0.01f;
|
||||||
|
} else {
|
||||||
|
v2 = 1.f;
|
||||||
|
}
|
||||||
|
actor->_58 = MAX(1.f, kumo_top_pos.y - actor->_1C.y);
|
||||||
|
actor->_70 += (s16)DEG2SHORT_ANGLE2(((v2 * actor->_5C + 35.f) / actor->_58) * 1.8f * 0.5f);
|
||||||
|
actor->_68.x = sin_s(actor->_70) * DEG2SHORT_ANGLE2(v * actor->_5C);
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_wait_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_wait(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_6E--;
|
||||||
|
if (actor->_6E < 0) {
|
||||||
|
if (actor->_1C.y >= kumo_top_pos.y - 2.f && (RANDOM_F(1.f) > 0.2f || GETREG(NMREG, 0x14))) {
|
||||||
|
minsect_kumo_setupAction(actor, 3, game);
|
||||||
|
} else if (RANDOM_F(1.f) > 0.5f) {
|
||||||
|
minsect_kumo_setupAction(actor, 1, game);
|
||||||
|
} else {
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_hineri(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_58 = MAX(1.f, kumo_top_pos.y - actor->_1C.y);
|
||||||
|
actor->_72 += (s16)DEG2SHORT_ANGLE2(35.f / actor->_58 * 1.2f * 0.5f);
|
||||||
|
actor->_78 = 5461.f * sin_s(actor->_72);
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_setupAction(MUSEUM_INSECT_PRIVATE_DATA* actor, int r4, GAME* game) {
|
||||||
|
static PRIV_INSECT_PROCESS init_proc[] = { minsect_kumo_wait_init, minsect_kumo_move_init, minsect_kumo_up_init,
|
||||||
|
minsect_kumo_down_init };
|
||||||
|
static PRIV_INSECT_PROCESS move_proc[] = { minsect_kumo_wait, minsect_kumo_move, minsect_kumo_up,
|
||||||
|
minsect_kumo_down };
|
||||||
|
actor->_04 = move_proc[r4];
|
||||||
|
init_proc[r4](actor, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_ct(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
actor->_1C = kumo_base_pos;
|
||||||
|
actor->_34.x = 0.01f;
|
||||||
|
actor->_34.y = 0.01f;
|
||||||
|
actor->_34.z = 0.01f;
|
||||||
|
actor->_5C = 0.f;
|
||||||
|
actor->_44.x = 0.f;
|
||||||
|
actor->_68 = ZeroSVec;
|
||||||
|
actor->_6E = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
actor->_72 = qrand();
|
||||||
|
actor->_76 = (s16)(RANDOM_F(5.f) * 60.f) + 307;
|
||||||
|
actor->_7A = (s16)RANDOM_F(360.f) + 40;
|
||||||
|
minsect_kumo_setupAction(actor, 4, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_mv(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||||
|
minsect_kumo_check_player(actor, game);
|
||||||
|
minsect_kumo_furiko(actor, game);
|
||||||
|
if (actor->_04 != minsect_kumo_hide) {
|
||||||
|
minsect_kumo_hineri(actor, game);
|
||||||
|
}
|
||||||
|
if (GETREG(NMREG, 1) && (play->game_frame & 7) == 0) {
|
||||||
|
xyz_t p = actor->_1C;
|
||||||
|
p = actor->_1C;
|
||||||
|
p.y += GETREG(NMREG, 5) * 0.01f;
|
||||||
|
Common_Get(clip.effect_clip)->effect_make_proc(101, p, 1, 0, game, 0x5843, 2, 0);
|
||||||
|
Common_Get(clip.effect_clip)->effect_make_proc(101, actor->_1C, 1, 0, game, 0x5843, 1, 0);
|
||||||
|
Common_Get(clip.effect_clip)->effect_make_proc(101, kumo_base_pos, 1, 0, game, 0x5843, 3, 0);
|
||||||
|
Common_Get(clip.effect_clip)->effect_make_proc(101, kumo_top_pos, 1, 0, game, 0x5843, 1, 0);
|
||||||
|
}
|
||||||
|
actor->_04(actor, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void minsect_kumo_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||||
|
_texture_z_light_fog_prim(game->graph);
|
||||||
|
OPEN_DISP(game->graph);
|
||||||
|
Matrix_translate(actor->_1C.x, actor->_1C.y + actor->_58, actor->_1C.z, FALSE);
|
||||||
|
Matrix_rotateXYZ(0, actor->_7C, 0, TRUE);
|
||||||
|
Matrix_rotateXYZ(actor->_68.x, actor->_68.y, actor->_68.z, TRUE);
|
||||||
|
Matrix_rotateXYZ(0, -actor->_7C, 0, TRUE);
|
||||||
|
Matrix_translate(0.f, -actor->_58, 0.f, TRUE);
|
||||||
|
Matrix_rotateXYZ(0, actor->_78, 0, TRUE);
|
||||||
|
Matrix_translate(0.f, 0.f, -2.5f, TRUE);
|
||||||
|
Matrix_rotateXYZ(DEG2SHORT_ANGLE(-90), DEG2SHORT_ANGLE2(180), 0, TRUE);
|
||||||
|
Matrix_scale(actor->_34.x, actor->_34.y, actor->_34.z, TRUE);
|
||||||
|
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
|
gDPSetEnvColor(NEXT_POLY_OPA_DISP, 0, 0xff, 0x9b, 0xff);
|
||||||
|
if (actor->_80) {
|
||||||
|
gSPDisplayList(NEXT_POLY_OPA_DISP, minsect_mdl[actor->_00][0]);
|
||||||
|
} else {
|
||||||
|
gSPDisplayList(NEXT_POLY_OPA_DISP, minsect_mdl[actor->_00][1]);
|
||||||
|
}
|
||||||
|
CLOSE_DISP(game->graph);
|
||||||
|
|
||||||
|
OPEN_DISP(game->graph);
|
||||||
|
Matrix_translate(actor->_1C.x, actor->_1C.y + actor->_58, actor->_1C.z + (GETREG(NMREG, 0x5F)) * 0.01f, FALSE);
|
||||||
|
Matrix_rotateXYZ(0, actor->_7C, 0, TRUE);
|
||||||
|
Matrix_rotateXYZ(actor->_68.x, actor->_68.y, actor->_68.z, TRUE);
|
||||||
|
Matrix_rotateXYZ(0, -actor->_7C, 0, TRUE);
|
||||||
|
Matrix_translate(0.0f, -actor->_58, 0.0f, TRUE);
|
||||||
|
Matrix_rotateXYZ(0, actor->_78, 0, TRUE);
|
||||||
|
if (GETREG(NMREG, 5)) {
|
||||||
|
Matrix_translate(GETREG(NMREG, 4) * 0.001f, GETREG(NMREG, 5) * 0.01f, GETREG(NMREG, 6) * 0.01f, TRUE);
|
||||||
|
} else {
|
||||||
|
Matrix_translate(0.0f, 6.5f, 0.f, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GETREG(NMREG, 7)) {
|
||||||
|
Matrix_scale(1.5f, actor->_58 / ((kumo_top_pos.y - kumo_base_pos.y) - (GETREG(NMREG, 7) * 0.01f)), 1.f, TRUE);
|
||||||
|
} else {
|
||||||
|
Matrix_scale(2.f, actor->_58 / ((kumo_top_pos.y - kumo_base_pos.y) - 10.f), 1.f, TRUE);
|
||||||
|
}
|
||||||
|
Matrix_translate(0.f, -8.7f + GETREG(NMREG, 0x5d) * 0.01f, 1.f + GETREG(NMREG, 0x5e) * 0.01f, TRUE);
|
||||||
|
Matrix_rotateXYZ(DEG2SHORT_ANGLE(-90), DEG2SHORT_ANGLE2(180), 0, TRUE);
|
||||||
|
Matrix_scale(actor->_14, actor->_14, actor->_14, TRUE);
|
||||||
|
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
|
gDPSetEnvColor(NEXT_POLY_OPA_DISP, 0, 0xff, 0x9b, 0xff);
|
||||||
|
gSPDisplayList(NEXT_POLY_OPA_DISP, minsect_mdl[actor->_00][2]);
|
||||||
|
minsect_draw_shadow(actor, game);
|
||||||
|
CLOSE_DISP(game->graph);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user