mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
match kuwagata
This commit is contained in:
@@ -25,7 +25,15 @@ typedef void (*PRIV_INSECT_PROCESS)(struct _MUSEUM_INSECT_PRIVATE_DATA*, GAME*);
|
||||
|
||||
typedef struct _MUSEUM_INSECT_SKELETON {
|
||||
cKF_SkeletonInfo_R_c _00;
|
||||
artificial_padding(0, 0x2ac, cKF_SkeletonInfo_R_c);
|
||||
Mtx _70;
|
||||
artificial_padding(0x70, 0x170, Mtx);
|
||||
Mtx _170;
|
||||
artificial_padding(0x170, 0x270, Mtx);
|
||||
s_xyz _270;
|
||||
artificial_padding(0x270, 0x288, s_xyz);
|
||||
s_xyz _288;
|
||||
artificial_padding(0x288, 0x2A8, s_xyz);
|
||||
cKF_Skeleton_R_c* _2A8;
|
||||
cKF_Animation_R_c* _2AC;
|
||||
} MUSEUM_INSECT_SKELETON;
|
||||
|
||||
@@ -73,9 +81,10 @@ typedef struct _INSECT_DISPLAY_MSG_INFO {
|
||||
} INSECT_DISPLAY_MSG_INFO;
|
||||
|
||||
typedef struct _MUSEUM_INSECT_ACTOR {
|
||||
ACTOR actor; // offset: 0x0
|
||||
MUSEUM_INSECT_PRIVATE_DATA privInsects[aINS_INSECT_TYPE_NUM];
|
||||
artificial_padding(0x174, 0x2F78, MUSEUM_INSECT_PRIVATE_DATA[aINS_INSECT_TYPE_NUM]);
|
||||
ACTOR actor; // offset: 0x0
|
||||
MUSEUM_INSECT_PRIVATE_DATA privInsects[aINS_INSECT_TYPE_NUM]; // offset 0x174
|
||||
artificial_padding(0x174, 0x24b8, MUSEUM_INSECT_PRIVATE_DATA[aINS_INSECT_TYPE_NUM]);
|
||||
MUSEUM_INSECT_SKELETON _24B8[4];
|
||||
int _2F78; // offset: 0x2F78
|
||||
int _2F7C; // offset: 0x2F7C
|
||||
INSECT_DISPLAY_MSG_INFO _2F80[7]; // offset: 0x2F82
|
||||
|
||||
@@ -66,10 +66,130 @@ void mi_kuwagata_battle_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
|
||||
void mi_kuwagata_battle(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
MUSEUM_INSECT_PRIVATE_DATA* priv;
|
||||
f32 v;
|
||||
switch (actor->_00) {
|
||||
case 0x15:
|
||||
priv = &MI_Control_Actor->privInsects[0x1d];
|
||||
break;
|
||||
case 0x1d:
|
||||
priv = &MI_Control_Actor->privInsects[0x15];
|
||||
break;
|
||||
case 0x1e:
|
||||
priv = &MI_Control_Actor->privInsects[0x1f];
|
||||
break;
|
||||
case 0x1f:
|
||||
priv = &MI_Control_Actor->privInsects[0x1e];
|
||||
break;
|
||||
}
|
||||
if (actor->_7C == 0) {
|
||||
actor->_7C = -1;
|
||||
priv->_8C &= ~0xc;
|
||||
if (actor->_40 >= 0.0f) {
|
||||
priv->_8C |= 4;
|
||||
} else if (actor->_40 < 0.0f) {
|
||||
priv->_8C |= 8;
|
||||
}
|
||||
|
||||
if (priv->_04 != mi_kuwagata_battle) {
|
||||
mi_kuwagata_setupAction(priv, 3, game);
|
||||
}
|
||||
}
|
||||
actor->_6E--;
|
||||
actor->_7C--;
|
||||
actor->_72 += DEG2SHORT_ANGLE(GETREG(TAKREG, 0x14) + 30.f) >> 1;
|
||||
actor->_68.z = DEG2SHORT_ANGLE2(GETREG(TAKREG, 0x15) * 0.1f + 2.0f) * sin_s(actor->_72);
|
||||
v = actor->_1C.y - kuwagata_base_pos[actor->_70].y;
|
||||
if (sin_s(actor->_72) <= 0.1 && sin_s(actor->_72) >= -0.1) {
|
||||
if (actor->_7A) {
|
||||
actor->_7A = 0;
|
||||
} else {
|
||||
actor->_7A = DEG2SHORT_ANGLE(-7);
|
||||
}
|
||||
}
|
||||
actor->_1C.y += actor->_40 * (cos_s(actor->_72) * 0.5f + 0.5f);
|
||||
actor->_1C.x = kuwagata_base_pos[actor->_70].x + (v * sin_s(actor->_74));
|
||||
if (actor->_1C.y > actor->_44.y + 2.0f) {
|
||||
actor->_1C.y = actor->_44.y + 2.0f;
|
||||
actor->_8C &= ~0xc;
|
||||
actor->_8C |= 0x8;
|
||||
mi_kuwagata_setupAction(actor, 0, game);
|
||||
priv->_6E = 0x10;
|
||||
}
|
||||
|
||||
if (actor->_1C.y < actor->_44.y - 2.0f) {
|
||||
actor->_1C.y = actor->_44.y - 2.0f;
|
||||
actor->_8C &= ~0xc;
|
||||
actor->_8C |= 0x4;
|
||||
mi_kuwagata_setupAction(actor, 0, game);
|
||||
priv->_6E = 0x10;
|
||||
}
|
||||
if (actor->_6E < 0) {
|
||||
mi_kuwagata_setupAction(actor, 0, game);
|
||||
priv->_6E = 0x10;
|
||||
} else {
|
||||
actor->_76--;
|
||||
if (actor->_76 < 0) {
|
||||
cKF_SkeletonInfo_R_play(&actor->_08->_00);
|
||||
if ((int)actor->_08->_00.frame_control.current_frame == 14) {
|
||||
actor->_76 = (s16)RANDOM_F(356.f) + 4;
|
||||
if (actor->_8E == 0) {
|
||||
actor->_76 *= 10;
|
||||
}
|
||||
} else if ((int)actor->_08->_00.frame_control.current_frame == 1) {
|
||||
actor->_76 = (s16)RANDOM_F(1760.f) + 40;
|
||||
if (actor->_8E == 0) {
|
||||
actor->_76 *= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
add_calc_short_angle2(&actor->_78, actor->_7A, CALC_EASE2(0.4f), DEG2SHORT_ANGLE(0.75f),
|
||||
DEG2SHORT_ANGLE(0.25F));
|
||||
}
|
||||
}
|
||||
|
||||
void mi_kuwagata_menace_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
actor->_7A = 3640 - DEG2SHORT_ANGLE(GETREG(NMREG, 0) * 0.01f);
|
||||
actor->_6E = (s16)((s16)RANDOM_F(200.f) + 40) * 5;
|
||||
actor->_76 = 10;
|
||||
cKF_SkeletonInfo_R_init_standard_repeat_speedsetandmorph(&actor->_08->_00, actor->_08->_2AC, NULL, 0.75f, 0.0f);
|
||||
}
|
||||
|
||||
void mi_kuwagata_menace(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
actor->_6E--;
|
||||
if (actor->_7A) {
|
||||
add_calc(&actor->_1C.z, actor->_44.z + 3.f + GETREG(NMREG, 0xf) * 0.01f, CALC_EASE(0.3f), 0.75f, 0.05f);
|
||||
} else {
|
||||
add_calc(&actor->_1C.z, actor->_44.z, CALC_EASE(0.3f), 0.75f, 0.05f);
|
||||
}
|
||||
|
||||
if (actor->_6E < 0) {
|
||||
actor->_7A = 0;
|
||||
if (actor->_78 == 0) {
|
||||
if (RANDOM_F(1.f) > 0.7f || GETREG(NMREG, 1)) {
|
||||
mi_kuwagata_setupAction(actor, 3, game);
|
||||
return;
|
||||
} else {
|
||||
mi_kuwagata_setupAction(actor, 0, game);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actor->_76--;
|
||||
if (actor->_76 < 0) {
|
||||
cKF_SkeletonInfo_R_play(&actor->_08->_00);
|
||||
if ((int)actor->_08->_00.frame_control.current_frame == 1) {
|
||||
cKF_Animation_R_c* anim = actor->_08->_2AC;
|
||||
cKF_SkeletonInfo_R_init_standard_repeat_speedsetandmorph(&actor->_08->_00, anim, NULL,
|
||||
(RANDOM_F(1.f) + 1.5f) * 0.5f, 0.f);
|
||||
if (RANDOM_F(1.f) > 0.9f) {
|
||||
actor->_76 = (s16)RANDOM_F(1760.f) + 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
add_calc_short_angle2(&actor->_78, actor->_7A, CALC_EASE2(GETREG(NMREG, 0x5e) * 0.01f + 0.8f),
|
||||
(s16)(DEG2SHORT_ANGLE(GETREG(NMREG, 0x5f) * 0.01f + 4.f) >> 1) >> 1, DEG2SHORT_ANGLE(0.25f));
|
||||
}
|
||||
|
||||
void mi_kuwagata_attack_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
@@ -81,10 +201,98 @@ void mi_kuwagata_attack(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
|
||||
void mi_kuwagata_setupAction(MUSEUM_INSECT_PRIVATE_DATA* actor, int r4, GAME* game) {
|
||||
static PRIV_INSECT_PROCESS init_proc[] = {
|
||||
mi_kuwagata_wait_init, mi_kuwagata_move_init, mi_kuwagata_menace_init,
|
||||
mi_kuwagata_battle_init, mi_kuwagata_attack_init, mi_kuwagata_rensa_init,
|
||||
};
|
||||
static PRIV_INSECT_PROCESS move_proc[] = {
|
||||
mi_kuwagata_wait, mi_kuwagata_move, mi_kuwagata_menace,
|
||||
mi_kuwagata_battle, mi_kuwagata_attack, mi_kuwagata_rensa,
|
||||
};
|
||||
actor->_04 = move_proc[r4];
|
||||
init_proc[r4](actor, game);
|
||||
}
|
||||
|
||||
void minsect_kuwagata_ct(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
switch (actor->_00) {
|
||||
case 0x15:
|
||||
actor->_70 = 0;
|
||||
break;
|
||||
case 0x1d:
|
||||
case 0x1e:
|
||||
default:
|
||||
actor->_70 = actor->_00 - 0x1c;
|
||||
break;
|
||||
}
|
||||
if (actor->_00 == 0x1e) {
|
||||
if (mMmd_InsectInfo(0x1f)) {
|
||||
actor->_8C |= 0x10;
|
||||
}
|
||||
} else if (actor->_00 == 0x15) {
|
||||
if (mMmd_InsectInfo(0x1d)) {
|
||||
actor->_8C |= 0x10;
|
||||
}
|
||||
} else if (actor->_00 == 0x1f) {
|
||||
if (mMmd_InsectInfo(0x1e)) {
|
||||
actor->_8C |= 0x10;
|
||||
}
|
||||
} else if (actor->_00 == 0x1d) {
|
||||
if (mMmd_InsectInfo(0x15)) {
|
||||
actor->_8C |= 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (actor->_8C & 0x10) {
|
||||
if (actor->_00 == 0x1e || actor->_00 == 0x15) {
|
||||
xyz_t p;
|
||||
xyz_t_sub(&kuwagata_base_pos[actor->_70 + 1], &kuwagata_base_pos[actor->_70], &p);
|
||||
actor->_74 = atans_table(p.y, -p.x);
|
||||
} else {
|
||||
xyz_t p;
|
||||
xyz_t_sub(&kuwagata_base_pos[actor->_70 - 1], &kuwagata_base_pos[actor->_70], &p);
|
||||
actor->_74 = atans_table(p.y, -p.x);
|
||||
}
|
||||
}
|
||||
actor->_08 = &MI_Control_Actor->_24B8[actor->_70];
|
||||
actor->_08->_2A8 = kuwagata_model_tbl[actor->_70];
|
||||
actor->_08->_2AC = kuwagata_anim_tbl[actor->_70];
|
||||
cKF_SkeletonInfo_R_ct(&actor->_08->_00, actor->_08->_2A8, actor->_08->_2AC, &actor->_08->_270, &actor->_08->_288);
|
||||
cKF_SkeletonInfo_R_init_standard_repeat_speedsetandmorph(&actor->_08->_00, actor->_08->_2AC, NULL, 0.5f, 0.0f);
|
||||
cKF_SkeletonInfo_R_play(&actor->_08->_00);
|
||||
actor->_76 = (s16)RANDOM_F(1760.f) + 40;
|
||||
actor->_1C = kuwagata_base_pos[actor->_70];
|
||||
actor->_44 = actor->_1C;
|
||||
actor->_34 = ZeroVec;
|
||||
actor->_40 = 0.05f;
|
||||
actor->_68 = ZeroSVec;
|
||||
actor->_72 = qrand();
|
||||
actor->_6E = (s16)RANDOM_F(120.f) + 60;
|
||||
mi_kuwagata_setupAction(actor, 0, game);
|
||||
}
|
||||
|
||||
void minsect_kuwagata_mv(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
actor->_04(actor, game);
|
||||
}
|
||||
|
||||
void minsect_kuwagata_dw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
Mtx* mtx;
|
||||
_texture_z_light_fog_prim(game->graph);
|
||||
if (game->frame_counter & 1) {
|
||||
mtx = &actor->_08->_70;
|
||||
} else {
|
||||
mtx = &actor->_08->_170;
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
Matrix_translate(actor->_1C.x, actor->_1C.y, actor->_1C.z + 1.5f + GETREG(NMREG, 0xe) * 0.01f, FALSE);
|
||||
Matrix_rotateXYZ(actor->_68.x, actor->_68.y, actor->_68.z, TRUE);
|
||||
Matrix_rotateXYZ(-0xe38, 0, 0, TRUE);
|
||||
Matrix_rotateXYZ(0, 0, actor->_74, TRUE);
|
||||
Matrix_rotateXYZ(actor->_78, 0, 0, TRUE);
|
||||
Matrix_scale(actor->_14, actor->_14, actor->_14, TRUE);
|
||||
Matrix_rotateXYZ(DEG2SHORT_ANGLE(90), 0, DEG2SHORT_ANGLE2(180), TRUE);
|
||||
|
||||
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
cKF_Si3_draw_R_SV(game, &actor->_08->_00, mtx, NULL, NULL, actor);
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user