From 6b40f34d1937843c1316cdef4b0b46c5c9076bdb Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Wed, 6 Mar 2024 04:33:57 -0500 Subject: [PATCH] More furniture actors --- src/f_furniture.c | 17 +++--- src/ftr/ac_iku_turkey_TV.c | 82 ++++++++++++++++++++++++--- src/ftr/ac_sugi_barbecue.c | 25 +++++++-- src/ftr/ac_sugi_kpool.c | 64 ++++++++++++++++++--- src/ftr/ac_sugi_torch.c | 100 ++++++++++++++++++++++++++++++--- src/ftr/ac_yaz_candle.c | 50 ++++++++++++++--- src/ftr/ac_yaz_fish_trophy.c | 23 ++++++-- src/ftr/ac_yaz_turkey_chest.c | 82 ++++++++++++++++++--------- src/ftr/ac_yaz_turkey_closet.c | 82 ++++++++++++++++++--------- 9 files changed, 420 insertions(+), 105 deletions(-) diff --git a/src/f_furniture.c b/src/f_furniture.c index e67fad4a..b4028794 100644 --- a/src/f_furniture.c +++ b/src/f_furniture.c @@ -9,6 +9,7 @@ #include "ac_my_room.h" #include "sys_matrix.h" #include "m_malloc.h" +#include "m_debug.h" static u16 fFTR_myhome_off_pal_table[][16] = { // clang-format off @@ -764,25 +765,25 @@ static Gfx* fFTR_GetTwoTileGfx(int width0, int height0, int scroll_x0, int scrol #include "../src/ftr/ac_iku_turkey_bed.c" #include "../src/ftr/ac_iku_turkey_lamp.c" #include "../src/ftr/ac_iku_turkey_table.c" -// #include "../src/ftr/ac_iku_turkey_TV.c" +#include "../src/ftr/ac_iku_turkey_TV.c" #include "../src/ftr/ac_iku_ukai.c" #include "../src/ftr/ac_iku_work.c" #include "../src/ftr/ac_sugi_alchair.c" -// #include "../src/ftr/ac_sugi_barbecue.c" +#include "../src/ftr/ac_sugi_barbecue.c" #include "../src/ftr/ac_sugi_chesstable.c" -// #include "../src/ftr/ac_sugi_kpool.c" +#include "../src/ftr/ac_sugi_kpool.c" #include "../src/ftr/ac_sugi_radiatorl.c" -// #include "../src/ftr/ac_sugi_torch.c" +#include "../src/ftr/ac_sugi_torch.c" #include "../src/ftr/ac_yaz_b_bath.c" #include "../src/ftr/ac_yaz_b_house.c" -// #include "../src/ftr/ac_yaz_candle.c" -// #include "../src/ftr/ac_yaz_fish_trophy.c" +#include "../src/ftr/ac_yaz_candle.c" +#include "../src/ftr/ac_yaz_fish_trophy.c" #include "../src/ftr/ac_yaz_mario_flower.c" #include "../src/ftr/ac_yaz_telescope.c" #include "../src/ftr/ac_yaz_tub.c" #include "../src/ftr/ac_yaz_turkey_chair.c" -// #include "../src/ftr/ac_yaz_turkey_chest.c" -// #include "../src/ftr/ac_yaz_turkey_closet.c" +#include "../src/ftr/ac_yaz_turkey_chest.c" +#include "../src/ftr/ac_yaz_turkey_closet.c" #include "../src/ftr/ac_yaz_rocket.c" #include "../src/ftr/ac_yaz_wagon.c" #include "../src/ftr/ac_yos_b_feeder.c" diff --git a/src/ftr/ac_iku_turkey_TV.c b/src/ftr/ac_iku_turkey_TV.c index eb583a8d..8acd4366 100644 --- a/src/ftr/ac_iku_turkey_TV.c +++ b/src/ftr/ac_iku_turkey_TV.c @@ -1,17 +1,80 @@ -static void fITT_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fITT_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fITT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fITT_dt(FTR_ACTOR* ftr_actor, u8* data); +static void fITT_ct(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} + +static void fITT_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + if (ftr_actor->switch_bit) { + if (aFTR_CAN_PLAY_SE(ftr_actor)) { + sAdo_OngenPos((u32)ftr_actor, 0x5E, &ftr_actor->position); + } + } + + if (ftr_actor->switch_changed_flag) { + if (ftr_actor->switch_bit) { + sAdo_OngenTrgStart(0x16, &ftr_actor->position); + } else { + sAdo_OngenTrgStart(0x17, &ftr_actor->position); + } + } +} + +extern u8 int_iku_turkey_TV_f_tex_txt[]; +extern u8 int_iku_turkey_TV_g_tex_txt[]; +extern u8 int_iku_turkey_TV_h_tex_txt[]; +extern u8 int_iku_turkey_TV_i_tex_txt[]; + +extern Gfx int_iku_turkey_TV_model_a_model[]; +extern Gfx int_iku_turkey_TV_model_b_model[]; + +static u8* fITT_switch_on_texture_table[] = { + int_iku_turkey_TV_g_tex_txt, + int_iku_turkey_TV_h_tex_txt, + int_iku_turkey_TV_i_tex_txt, + int_iku_turkey_TV_h_tex_txt, +}; + +static void fITT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + u32 ctr_ofs; + + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (ftr_actor->switch_bit) { + u32 ofs; + + if (ftr_actor->ctr_type == aFTR_CTR_TYPE_GAME_PLAY) { + ctr_ofs = play->game_frame; + } else { + ctr_ofs = game->frame_counter; + } + + /* Store TV on texture */ + ofs = (int)ctr_ofs / 6; + gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, + fITT_switch_on_texture_table[ofs % ARRAY_COUNT(fITT_switch_on_texture_table)]); + } else { + /* Store TV off texture */ + gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, int_iku_turkey_TV_f_tex_txt); + } + + gSPDisplayList(NEXT_POLY_OPA_DISP, int_iku_turkey_TV_model_b_model); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_iku_turkey_TV_model_a_model); + + CLOSE_DISP(game->graph); +} + +static void fITT_dt(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} static aFTR_vtable_c fITT_func = { - &fITT_ct, - &fITT_mv, - &fITT_dw, - &fITT_dt, - NULL, + &fITT_ct, &fITT_mv, &fITT_dw, &fITT_dt, NULL, }; aFTR_PROFILE iam_iku_turkey_TV = { + // clang-format off NULL, NULL, NULL, @@ -29,4 +92,5 @@ aFTR_PROFILE iam_iku_turkey_TV = { 0, aFTR_INTERACTION_START_DISABLED, &fITT_func, + // clang-format on }; diff --git a/src/ftr/ac_sugi_barbecue.c b/src/ftr/ac_sugi_barbecue.c index 43f087da..34a14ea2 100644 --- a/src/ftr/ac_sugi_barbecue.c +++ b/src/ftr/ac_sugi_barbecue.c @@ -1,16 +1,28 @@ extern Gfx sugi_barbecue_model[]; extern Gfx sugi_barbecue_b_model[]; -static void gSBBQ_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); + +static void gSBBQ_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + + if (aFTR_CAN_PLAY_SE(ftr_actor)) { + u32 ctr = play->game_frame; + + sAdo_OngenPos((u32)ftr_actor, 0x55, &ftr_actor->position); + if ((ctr & 15) == 0) { + xyz_t pos = ftr_actor->position; + + pos.y += 30.0f; + (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_SOBA_YUGE, pos, 1, 0, game, RSV_NO, 9, 0); + } + } +} static aFTR_vtable_c gSBBQ_func = { - NULL, - &gSBBQ_mv, - NULL, - NULL, - NULL, + NULL, &gSBBQ_mv, NULL, NULL, NULL, }; aFTR_PROFILE iam_sugi_barbecue = { + // clang-format off sugi_barbecue_model, sugi_barbecue_b_model, NULL, @@ -28,4 +40,5 @@ aFTR_PROFILE iam_sugi_barbecue = { 0, 0, &gSBBQ_func, + // clang-format on }; diff --git a/src/ftr/ac_sugi_kpool.c b/src/ftr/ac_sugi_kpool.c index 1ce8e0d6..6b56da25 100644 --- a/src/ftr/ac_sugi_kpool.c +++ b/src/ftr/ac_sugi_kpool.c @@ -1,15 +1,64 @@ -static void fSKP_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fSKP_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); +static void fSKP_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + // nothing +} + +static Gfx* fSKP_GetTwoTileGfx(int x0, int y0, int x1, int y1, GAME* game) { + return two_tex_scroll_dolphin(game->graph, 0, x0, y0, 16, 16, 1, x1, y1, 16, 16); +} + +extern Gfx sugi_kpool_model[]; +extern Gfx sugi_kpool_t_model[]; +extern Gfx sugi_kpool_w_model[]; +extern EVW_ANIME_DATA int_sugi_kpool_evw_anime; + +static void fSKP_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + u32 ctr_ofs; + Gfx* scroll_gfx; + + if (ftr_actor->ctr_type == aFTR_CTR_TYPE_GAME_PLAY) { + ctr_ofs = play->game_frame; + } else { + ctr_ofs = game->frame_counter; + } + + /* This scroll gfx goes unused lol... */ + scroll_gfx = fSKP_GetTwoTileGfx((-ctr_ofs * -1), 0, 0, (-ctr_ofs * -1) * 2, game); + + if (scroll_gfx != NULL) { + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(NEXT_POLY_OPA_DISP, sugi_kpool_t_model); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, /* cmd */ + 0, /* m */ + (160 + GETREG(CRV, 47)), /* l */ + (55 + GETREG(CRV, 48)), /* r */ + (255 + GETREG(CRV, 49)), /* g */ + (255 + GETREG(CRV, 50)), /* b */ + (200 + GETREG(CRV, 51)) /* a */ + ); + gDPSetEnvColor(NEXT_POLY_XLU_DISP, /* cmd */ + (0 + GETREG(CRV, 52)), /* r */ + (155 + GETREG(CRV, 53)), /* g */ + (205 + GETREG(CRV, 54)), /* b */ + (255 + GETREG(CRV, 55)) /* a */ + ); + Evw_Anime_Set(play, &int_sugi_kpool_evw_anime); // scroll next texture + gSPDisplayList(NEXT_POLY_XLU_DISP, sugi_kpool_w_model); + gSPDisplayList(NEXT_POLY_XLU_DISP, sugi_kpool_model); + + CLOSE_DISP(game->graph); + } +} static aFTR_vtable_c fSKP_func = { - NULL, - &fSKP_mv, - &fSKP_dw, - NULL, - NULL, + NULL, &fSKP_mv, &fSKP_dw, NULL, NULL, }; aFTR_PROFILE iam_sugi_kpool = { + // clang-format off NULL, NULL, NULL, @@ -27,4 +76,5 @@ aFTR_PROFILE iam_sugi_kpool = { 0, 0, &fSKP_func, + // clang-format on }; diff --git a/src/ftr/ac_sugi_torch.c b/src/ftr/ac_sugi_torch.c index c32fb3ec..538323ee 100644 --- a/src/ftr/ac_sugi_torch.c +++ b/src/ftr/ac_sugi_torch.c @@ -1,16 +1,99 @@ -static void fSGT_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fSGT_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fSGT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); +extern cKF_Skeleton_R_c cKF_bs_r_int_sugi_torch; +extern cKF_Animation_R_c cKF_ba_r_int_sugi_torch; + +static void fSGT_ct(FTR_ACTOR* ftr_actor, u8* data) { + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + + cKF_SkeletonInfo_R_ct(keyframe, &cKF_bs_r_int_sugi_torch, &cKF_ba_r_int_sugi_torch, ftr_actor->joint, + ftr_actor->morph); + cKF_SkeletonInfo_R_init_standard_repeat(keyframe, &cKF_ba_r_int_sugi_torch, NULL); + keyframe->frame_control.speed = 0.5f; + cKF_SkeletonInfo_R_play(keyframe); +} + +static void fSGT_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + + cKF_SkeletonInfo_R_play(keyframe); + keyframe->frame_control.speed = 0.5f; + sAdo_OngenPos((u32)ftr_actor, 0x57, &ftr_actor->position); +} + +extern Gfx sugi_fireto_model[]; + +static int fSGT_DwAfter(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape, u8* joint_flags, + void* arg, s_xyz* joint_rot, xyz_t* joint_pos) { + FTR_ACTOR* ftr_actor = (FTR_ACTOR*)arg; + GAME_PLAY* play = (GAME_PLAY*)game; + xyz_t pos; + xyz_t zero_pos = { 0.0f, 0.0f, 0.0f }; + + if (joint_idx == 2) { + f32 scale_x = ftr_actor->scale.x * 0.01f; + f32 scale_y = ftr_actor->scale.y * 0.01f; + f32 scale_z = ftr_actor->scale.z * 0.01f; + + OPEN_DISP(game->graph); + + Matrix_Position(&zero_pos, &pos); + Matrix_push(); + Matrix_translate(pos.x, pos.y, pos.z, 0); + Matrix_mult(&play->billboard_matrix, 1); + Matrix_RotateY(DEG2SHORT_ANGLE(90.0f), 1); + Matrix_scale(scale_x, scale_y, scale_z, 1); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_pull(); + gSPDisplayList(NEXT_POLY_XLU_DISP, sugi_fireto_model); + + CLOSE_DISP(game->graph); + } + + return TRUE; +} + +static int fSGT_DwBefore(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape, u8* joint_flags, + void* arg, s_xyz* joint_rot, xyz_t* joint_pos) { + FTR_ACTOR* ftr_actor = (FTR_ACTOR*)arg; + GAME_PLAY* play = (GAME_PLAY*)game; + + if (joint_idx == 2) { + *joint_shape = NULL; + } + + return TRUE; +} + +static Gfx* fSGT_GetTwoTileGfx(int x0, int y0, int x1, int y1, GAME* game) { + return two_tex_scroll_dolphin(game->graph, 0, x0, y0, 32, 32, 1, x1, y1, 32, 64); +} + +static void fSGT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + Mtx* mtx = ftr_actor->skeleton_mtx[game->frame_counter & 1]; + u32 ctr_ofs = ftr_actor->ctr_type == aFTR_CTR_TYPE_GAME_PLAY ? play->game_frame : game->frame_counter; + Gfx* scroll_gfx = fSGT_GetTwoTileGfx(0, 0, 0, -ctr_ofs * 8, game); + + if (scroll_gfx != NULL) { + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + 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, scroll_gfx); // fire scroll microcode commands + + CLOSE_DISP(game->graph); + + cKF_Si3_draw_R_SV(game, keyframe, mtx, &fSGT_DwBefore, &fSGT_DwAfter, ftr_actor); + } +} static aFTR_vtable_c fSGT_func = { - &fSGT_ct, - &fSGT_mv, - &fSGT_dw, - NULL, - NULL, + &fSGT_ct, &fSGT_mv, &fSGT_dw, NULL, NULL, }; aFTR_PROFILE iam_sugi_torch = { + // clang-format off NULL, NULL, NULL, @@ -28,4 +111,5 @@ aFTR_PROFILE iam_sugi_torch = { 0, 0, &fSGT_func, + // clang-format on }; diff --git a/src/ftr/ac_yaz_candle.c b/src/ftr/ac_yaz_candle.c index eff734ba..ad9377e5 100644 --- a/src/ftr/ac_yaz_candle.c +++ b/src/ftr/ac_yaz_candle.c @@ -1,17 +1,48 @@ -static void fYC_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fYC_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYC_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYC_dt(FTR_ACTOR* ftr_actor, u8* data); +static void fYC_ct(FTR_ACTOR* ftr_actor, u8* data) { + ftr_actor->dynamic_work_s[0] = -1; +} + +static void fYC_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + // nothing +} + +extern Gfx int_yaz_candle_body_model[]; +extern Gfx int_yaz_candle_fire_model[]; + +extern u8 int_yaz_candle_fire1_tex_txt[]; +extern u8 int_yaz_candle_fire2_tex_txt[]; + +static void fYC_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + u32 ctr_ofs; + static u8* texture_table[] = { int_yaz_candle_fire1_tex_txt, int_yaz_candle_fire2_tex_txt }; + + if (ftr_actor->ctr_type == aFTR_CTR_TYPE_GAME_PLAY) { + ctr_ofs = play->game_frame; + } else { + ctr_ofs = game->frame_counter; + } + + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_9, texture_table[(ctr_ofs & 2) != 0]); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_yaz_candle_body_model); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_yaz_candle_fire_model); + + CLOSE_DISP(game->graph); +} + +static void fYC_dt(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} static aFTR_vtable_c fYC_func = { - &fYC_ct, - &fYC_mv, - &fYC_dw, - &fYC_dt, - NULL, + &fYC_ct, &fYC_mv, &fYC_dw, &fYC_dt, NULL, }; aFTR_PROFILE iam_yaz_candle = { + // clang-format off NULL, NULL, NULL, @@ -29,4 +60,5 @@ aFTR_PROFILE iam_yaz_candle = { 0, 0, &fYC_func, + // clang-format on }; diff --git a/src/ftr/ac_yaz_fish_trophy.c b/src/ftr/ac_yaz_fish_trophy.c index b63fa7d9..ea51ebb3 100644 --- a/src/ftr/ac_yaz_fish_trophy.c +++ b/src/ftr/ac_yaz_fish_trophy.c @@ -1,14 +1,24 @@ -static void fYFT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); +extern u16 int_yaz_fish_trophy_pal[]; +extern Gfx int_yaz_fish_trophy_cup_model[]; +extern Gfx int_yaz_fish_trophy_base_model[]; + +static void fYFT_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, int_yaz_fish_trophy_pal); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_yaz_fish_trophy_cup_model); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_yaz_fish_trophy_base_model); + + CLOSE_DISP(game->graph); +} static aFTR_vtable_c fYFT_func = { - NULL, - NULL, - &fYFT_dw, - NULL, - NULL, + NULL, NULL, &fYFT_dw, NULL, NULL, }; aFTR_PROFILE iam_yaz_fish_trophy = { + // clang-format off NULL, NULL, NULL, @@ -26,4 +36,5 @@ aFTR_PROFILE iam_yaz_fish_trophy = { 0, 0, &fYFT_func, + // clang-format on }; diff --git a/src/ftr/ac_yaz_turkey_chest.c b/src/ftr/ac_yaz_turkey_chest.c index a7a1dba1..af44e2dd 100644 --- a/src/ftr/ac_yaz_turkey_chest.c +++ b/src/ftr/ac_yaz_turkey_chest.c @@ -1,32 +1,62 @@ -static void fYTCST_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fYTCST_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYTCST_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYTCST_dt(FTR_ACTOR* ftr_actor, u8* data); +extern cKF_Skeleton_R_c cKF_bs_r_int_yaz_turkey_chest; +extern cKF_Animation_R_c cKF_ba_r_int_yaz_turkey_chest; + +static void fYTCST_ct(FTR_ACTOR* ftr_actor, u8* data) { + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + + cKF_SkeletonInfo_R_ct(keyframe, &cKF_bs_r_int_yaz_turkey_chest, &cKF_ba_r_int_yaz_turkey_chest, ftr_actor->joint, + ftr_actor->morph); + cKF_SkeletonInfo_R_init_standard_stop(keyframe, &cKF_ba_r_int_yaz_turkey_chest, NULL); + keyframe->frame_control.speed = 0.0f; + cKF_SkeletonInfo_R_play(keyframe); +} + +static void fYTCST_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + if (Common_Get(clip).my_room_clip != NULL) { + (*Common_Get(clip).my_room_clip->open_close_common_move_proc)(ftr_actor, my_room_actor, game, 1.0f, 10.0f); + } +} + +static void fYTCST_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + Mtx* mtx = ftr_actor->skeleton_mtx[game->frame_counter & 1]; + + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + CLOSE_DISP(game->graph); + + cKF_Si3_draw_R_SV(game, keyframe, mtx, NULL, NULL, NULL); +} + +static void fYTCST_dt(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} static aFTR_vtable_c fYTCST_func = { - &fYTCST_ct, - &fYTCST_mv, - &fYTCST_dw, - &fYTCST_dt, - NULL, + &fYTCST_ct, &fYTCST_mv, &fYTCST_dw, &fYTCST_dt, NULL, }; aFTR_PROFILE iam_yaz_turkey_chest = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - 40.0f, - 0.01f, - aFTR_SHAPE_TYPEB_0, - mCoBG_FTR_TYPEB_0, - 0, - 0, - 0, - aFTR_INTERACTION_STORAGE_DRAWERS, - &fYTCST_func, + // clang-format off + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + 40.0f, + 0.01f, + aFTR_SHAPE_TYPEB_0, + mCoBG_FTR_TYPEB_0, + 0, + 0, + 0, + aFTR_INTERACTION_STORAGE_DRAWERS, + &fYTCST_func, + // clang-format on }; diff --git a/src/ftr/ac_yaz_turkey_closet.c b/src/ftr/ac_yaz_turkey_closet.c index 1f032a7c..2b159121 100644 --- a/src/ftr/ac_yaz_turkey_closet.c +++ b/src/ftr/ac_yaz_turkey_closet.c @@ -1,32 +1,62 @@ -static void fYTC_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fYTC_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYTC_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fYTC_dt(FTR_ACTOR* ftr_actor, u8* data); +extern cKF_Skeleton_R_c cKF_bs_r_int_yaz_turkey_closet; +extern cKF_Animation_R_c cKF_ba_r_int_yaz_turkey_closet; + +static void fYTC_ct(FTR_ACTOR* ftr_actor, u8* data) { + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + + cKF_SkeletonInfo_R_ct(keyframe, &cKF_bs_r_int_yaz_turkey_closet, &cKF_ba_r_int_yaz_turkey_closet, ftr_actor->joint, + ftr_actor->morph); + cKF_SkeletonInfo_R_init_standard_stop(keyframe, &cKF_ba_r_int_yaz_turkey_closet, NULL); + keyframe->frame_control.speed = 0.0f; + cKF_SkeletonInfo_R_play(keyframe); +} + +static void fYTC_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + if (Common_Get(clip).my_room_clip != NULL) { + (*Common_Get(clip).my_room_clip->open_close_common_move_proc)(ftr_actor, my_room_actor, game, 1.0f, 12.0f); + } +} + +static void fYTC_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe; + Mtx* mtx = ftr_actor->skeleton_mtx[game->frame_counter & 1]; + + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + CLOSE_DISP(game->graph); + + cKF_Si3_draw_R_SV(game, keyframe, mtx, NULL, NULL, NULL); +} + +static void fYTC_dt(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} static aFTR_vtable_c fYTC_func = { - &fYTC_ct, - &fYTC_mv, - &fYTC_dw, - &fYTC_dt, - NULL, + &fYTC_ct, &fYTC_mv, &fYTC_dw, &fYTC_dt, NULL, }; aFTR_PROFILE iam_yaz_turkey_closet = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - 40.0f, - 0.01f, - aFTR_SHAPE_TYPEA, - mCoBG_FTR_TYPEA, - 0, - 0, - 0, - aFTR_INTERACTION_STORAGE_WARDROBE, - &fYTC_func, + // clang-format off + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + 40.0f, + 0.01f, + aFTR_SHAPE_TYPEA, + mCoBG_FTR_TYPEA, + 0, + 0, + 0, + aFTR_INTERACTION_STORAGE_WARDROBE, + &fYTC_func, + // clang-format on };