From 6a6fa3a8badb3c5cbc3aedc0a3b56adbe9ddac73 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Mon, 19 Aug 2024 23:32:49 +0200 Subject: [PATCH] Match m_player_item_common.c_inc --- include/ac_uki.h | 12 + include/m_player.h | 27 ++ include/m_player_lib.h | 2 + src/m_player_item_common.c_inc | 723 +++++++++++++++++++++++++++++++++ 4 files changed, 764 insertions(+) diff --git a/include/ac_uki.h b/include/ac_uki.h index fa52ce6a..6f3005b9 100644 --- a/include/ac_uki.h +++ b/include/ac_uki.h @@ -10,6 +10,18 @@ extern "C" { extern ACTOR_PROFILE Uki_Profile; +typedef struct actor_uki_s { + ACTOR actor_class; + u8 pad[0xA4]; + xyz_t right_hand_pos; + xyz_t position_speed; + int angle_speed_y; + int command; + u8 pad2[0x10]; + xyz_t rod_top_position; + xyz_t left_hand_pos; +} UKI_ACTOR; + #ifdef __cplusplus } #endif diff --git a/include/m_player.h b/include/m_player.h index 8bad75dd..11be4170 100644 --- a/include/m_player.h +++ b/include/m_player.h @@ -469,6 +469,23 @@ enum { mPlayer_ITEM_KIND_NUM /* Are there more? */ }; +#define mPlayer_ITEM_KIND_CHECK(kind, min, max) ((kind) >= (min) && (kind) < ((max) + 1)) +#define mPlayer_ITEM_IS_AXE(kind) mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_AXE, mPlayer_ITEM_KIND_GOLD_AXE) +#define mPlayer_ITEM_IS_NET(kind) mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_NET, mPlayer_ITEM_KIND_GOLD_NET) +#define mPlayer_ITEM_IS_ROD(kind) mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_ROD, mPlayer_ITEM_KIND_GOLD_ROD) +#define mPlayer_ITEM_IS_SHOVEL(kind) \ + mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_SHOVEL, mPlayer_ITEM_KIND_GOLD_SHOVEL) +#define mPlayer_ITEM_IS_UMBRELLA(kind) \ + mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_UMBRELLA00, mPlayer_ITEM_KIND_ORG_UMBRELLA07) +#define mPlayer_ITEM_IS_BALLOON(kind) \ + mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_RED_BALLOON, mPlayer_ITEM_KIND_BUNNY_O_BALLOON) +#define mPlayer_ITEM_IS_WINDMILL(kind) \ + mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_YELLOW_PINWHEEL, mPlayer_ITEM_KIND_FANCY_PINWHEEL) +#define mPlayer_ITEM_IS_FAN(kind) \ + mPlayer_ITEM_KIND_CHECK(kind, mPlayer_ITEM_KIND_BLUEBELL_FAN, mPlayer_ITEM_KIND_LEAF_FAN) + +#define mPlayer_ITEM_KIND_VALID(kind) ((kind) >= 0 && kind < mPlayer_ITEM_KIND_NUM) + enum { mPlayer_ITEM_DATA_AXE, // model mPlayer_ITEM_DATA_AXE_B, // model @@ -1355,6 +1372,16 @@ typedef struct { mPlayer_request_main_data request_main_data; } mPlayer_change_data_from_submenu_c; +typedef struct controller_data_s { + MCON mcon; + s8 on; + s8 now; + s8 unk3A; + s8 unk3B; + mActor_name_t equiped_item; +} mPlayer_Controller_Data_c; + + /* sizeof(struct player_actor_s) == 0x13A8 */ struct player_actor_s { /* 0x0000 */ ACTOR actor_class; diff --git a/include/m_player_lib.h b/include/m_player_lib.h index 3ff376e0..1dd97404 100644 --- a/include/m_player_lib.h +++ b/include/m_player_lib.h @@ -12,6 +12,7 @@ extern "C" { extern void mPlib_Object_Exchange_keep_Player_dt(GAME_PLAY*); extern PLAYER_ACTOR* get_player_actor_withoutCheck(GAME_PLAY* play); +extern mPlayer_Controller_Data_c* mPlib_Get_controller_data_for_title_demo_p(); extern void mPlib_SetData1_controller_data_for_title_demo(f32 stick_x, f32 stick_y, int btn_a, int btn_b); extern void mPlib_SetData2_controller_data_for_title_demo(mActor_name_t tool); extern void mPlib_Clear_controller_data_for_title_demo(); @@ -54,6 +55,7 @@ extern int mPlib_Check_tree_shaken_little(const xyz_t* pos); extern int mPlib_request_main_recieve_wait_type1(GAME* game, mActor_name_t item, int counter_flag); extern int mPlib_able_player_warp_forEvent(); extern int mPlib_Get_unable_wade(); +extern s8 mPlib_Get_ItemNoToItemKind(mActor_name_t); extern void mPlib_Set_boat_angleZ(s16 angleZ); extern int mPlib_Get_end_player_demo_walk(); extern int mPlib_request_main_demo_geton_boat_type1(f32 goal_x, f32 goal_z, s16 angleY); diff --git a/src/m_player_item_common.c_inc b/src/m_player_item_common.c_inc index e69de29b..6a02eef3 100644 --- a/src/m_player_item_common.c_inc +++ b/src/m_player_item_common.c_inc @@ -0,0 +1,723 @@ +void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) { + if (mEv_CheckTitleDemo() <= 0) { + Common_Get(now_private)->equipment = item; + } +} + +mActor_name_t Player_actor_Get_ItemNoSubmenu() { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->equiped_item; + } else { + return Common_Get(now_private)->equipment; + } +} + +s8 Player_actor_Get_ItemKind_from_submenu() { + return mPlib_Get_ItemNoToItemKind(Player_actor_Get_ItemNoSubmenu()); +} + +s8 Player_actor_Get_ItemKind_fromScene() { + if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no)) != 0) { + return Player_actor_Get_ItemKind_from_submenu(); + } + return -1; +} + + +s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int able = Player_actor_CheckPlayer_AbleLoadItem(kind); + s8 scene_kind = Player_actor_Get_ItemKind_fromScene(); + + if (player->unable_hand_item_in_demo != FALSE) { + return -1; + } else if (player->able_hand_all_item_in_demo != FALSE) { + return scene_kind; + } else { + if (able == 0) { + return scene_kind; + } else if (able == 1) { + int holdable = mPlayer_ITEM_IS_UMBRELLA(scene_kind) || mPlayer_ITEM_IS_BALLOON(scene_kind) || + mPlayer_ITEM_IS_WINDMILL(scene_kind) || mPlayer_ITEM_IS_FAN(scene_kind) + + ? TRUE + : FALSE; + + if (holdable) { + return scene_kind; + } + } + } + return -1; +} + +int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) { + static s8 data[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 20, + 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, + }; + + if (mPlayer_ITEM_KIND_VALID(kind)) { + return data[kind]; + } else { + return 0; + } +} + + +void Player_actor_birth_umbrella(ACTOR* actor, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int is_umbrella; + aTOL_Clip_c* tools; + s8 kind; + + if (player->umbrella_actor == NULL) { + tools = Common_Get(clip).tools_clip; + if (tools != NULL && + (player->umbrella_state == 1 || player->umbrella_state == 4 || player->umbrella_state == 2)) { + is_umbrella = FALSE; + kind = player->item_kind; + if (mPlayer_ITEM_IS_UMBRELLA(kind)) { + is_umbrella = TRUE; + } + + if (is_umbrella) { + player->umbrella_actor = tools->aTOL_birth_proc(kind - mPlayer_ITEM_KIND_UMBRELLA00, + player->umbrella_state, actor, game, -1, 0); + + if (player->umbrella_actor != NULL) { + player->umbrella_actor->world.position = actor->world.position; + player->umbrella_actor->skip_drawing = TRUE; + } + } + } + } +} + +ACTOR* Player_actor_Get_umbrella_p(ACTOR* actor, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + ACTOR* umbrella; + Player_actor_birth_umbrella(actor, game); + + umbrella = player->umbrella_actor; + if (umbrella != NULL) { + umbrella->skip_drawing = FALSE; + return umbrella; + } + + return NULL; +} + +int Player_actor_Item_CulcAnimation_Base(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + + return cKF_SkeletonInfo_R_play(&player->item_keyframe); +} + +int Player_actor_Item_CulcAnimation_Base2(ACTOR* actor) { + return Player_actor_Item_CulcAnimation_Base(actor) == 1; +} + +void Player_actor_Item_SetAnimation_Base(ACTOR* actor, f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + cKF_SkeletonInfo_R_c* keyf = &player->item_keyframe; + + keyf->frame_control.current_frame = frame; + cKF_SkeletonInfo_R_play(keyf); + keyf->frame_control.current_frame = frame; +} + +void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int change_bank = Player_actor_Change_ItemBank(); + + if ((skl_idx >= 0) && (mPlib_Get_Item_DataPointerType(skl_idx) != 0)) { + cKF_Skeleton_R_c* skeleton; + cKF_SkeletonInfo_R_c* keyf; + s_xyz* joint_work; + s_xyz* morph_work; + cKF_SkeletonInfo_R_c* key2; + + keyf = &player->item_keyframe; + joint_work = player->item_joint_data; + morph_work = player->item_morph_data; + skeleton = mPlib_Get_Item_DataPointer(skl_idx); + + if (frame >= 0.0f) { + cKF_SkeletonInfo_R_ct(keyf, skeleton, NULL, joint_work, morph_work); + keyf->frame_control.current_frame = frame; + } else if (change_bank != 0) { + keyf->skeleton = skeleton; + keyf->animation = NULL; + } else { + cKF_SkeletonInfo_R_ct(keyf, skeleton, NULL, joint_work, morph_work); + } + key2 = &player->item_keyframe; + cKF_SkeletonInfo_R_init_standard_setframeandspeedandmorphandmode(key2, mPlib_Get_Item_DataPointer(anim_idx), + NULL, key2->frame_control.current_frame, speed, + morph_speed, mode); + } +} + + +void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + rod->command = command; + } +} + + +void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + s16 rot; + xyz_t pos; + f32 sin; + f32 cos; + switch (arg0) { + case 0x35: + case 0x36: + case 0x37: + pos = actor->world.position; + rot = actor->shape_info.rotation.y; + + cos = cos_s(rot); + sin = sin_s(rot); + + pos.z += (-2.0f * cos) - (12.0f * sin); + pos.x += (12.0f * cos) + (-2.0f * sin); + pos.y += 17.5f; + + rod->right_hand_pos = pos; + break; + default: + rod->right_hand_pos = player->right_hand_pos; + break; + } + } +} + + +void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + s16 rot; + xyz_t pos; + f32 sin; + f32 cos; + switch (arg0) { + case 0x35: + case 0x36: + case 0x37: + pos = actor->world.position; + rot = actor->shape_info.rotation.y; + + cos = cos_s(rot); + sin = sin_s(rot); + + pos.z += (-2.0f * cos) - (12.0f * sin); + pos.x += (12.0f * cos) + (-2.0f * sin); + pos.y += 17.5f; + + rod->left_hand_pos = pos; + break; + default: + rod->left_hand_pos = player->left_hand_pos; + break; + } + } +} + + +void Player_actor_Item_Set_PosSpeed_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + rod->position_speed = actor->position_speed; + } +} + +void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + int y = player->shape_angle_delta.y; + + if (y > 0) { + if (y > 0x8000) { + y = -(0x10000 - y); + } + } else if (y < -0x8000) { + y += 0x10000; + } + + rod->angle_speed_y = y; + } +} + +void Player_actor_Item_Set_RodTopPos_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + Player_actor_Get_ItemRodTopInitPos(actor, &rod->rod_top_position); + } +} + + +void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int umbrella; + int rod; + + if (kind >= 0) { + Player_actor_Item_DMA_Data(actor, mPlib_Get_BasicItemShapeIndex_fromItemKind(kind), anim_idx, mode, speed, + morph_speed, frame); + } + umbrella = FALSE; + if (mPlayer_ITEM_IS_UMBRELLA(kind)) { + umbrella = TRUE; + } + + if (!umbrella) { + if (player->umbrella_actor != NULL && Common_Get(clip).tools_clip != NULL) { + Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3); + player->umbrella_actor = NULL; + } + + player->umbrella_state = 4; + } else { + TOOLS_ACTOR* tool = (TOOLS_ACTOR*)player->umbrella_actor; + if (tool != NULL && (kind - mPlayer_ITEM_KIND_UMBRELLA00) != tool->tool_name) { + if (Common_Get(clip).tools_clip != NULL) { + Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3); + player->umbrella_actor = NULL; + } + + player->umbrella_state = 4; + } + } + + rod = FALSE; + if (mPlayer_ITEM_IS_ROD(kind)) { + rod = TRUE; + } + + if (!rod) { + Player_actor_Item_Set_Command_forUki(actor, 0); + } +} + + +void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label; + + if (label != NULL && player->item_net_catch_type == 0) { + Matrix_push(); + Matrix_translate(pos->x, pos->y, pos->z, FALSE); + Matrix_get(&label->matrix_work); + Matrix_pull(); + label->init_matrix = TRUE; + } +} + +int Player_actor_Check_ItemAnimationToItemKind(int kind, int anim) { + int res; + + if (mPlayer_ITEM_IS_AXE(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_NET(kind) != FALSE) { + res = mPlib_Get_Item_DataPointerType(anim) == mPlayer_ITEM_DATA_TYPE_NET_ANIMATION; + } else if (mPlayer_ITEM_IS_UMBRELLA(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_ROD(kind) != FALSE) { + res = mPlib_Get_Item_DataPointerType(anim) == mPlayer_ITEM_DATA_TYPE_ROD_ANIMATION; + } else if (mPlayer_ITEM_IS_SHOVEL(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_BALLOON(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_WINDMILL(kind) != FALSE) { + res = anim < 0; + } else { + res = FALSE; + } + + return res; +}samalv@debpc:~/ac-decomp/ac-decomp$ clang-format-14 ./src/m_player_item_common.c_inc > ./src/m_player_item_common.c_inc +samalv@debpc:~/ac-decomp/ac-decomp$ clang-format-14 ./src/m_player_item_common.c_inc | ./src/m_player_item_common.c_inc +bash: ./src/m_player_item_common.c_inc: Permission denied +samalv@debpc:~/ac-decomp/ac-decomp$ clang-format-14 ./src/m_player_item_common.c_inc +samalv@debpc:~/ac-decomp/ac-decomp$ clang-format-14 ./src/m_player_item_common.c_inc + +void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) { + if (mEv_CheckTitleDemo() <= 0) { + Common_Get(now_private)->equipment = item; + } +} + +mActor_name_t Player_actor_Get_ItemNoSubmenu() { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->equiped_item; + } else { + return Common_Get(now_private)->equipment; + } +} + +s8 Player_actor_Get_ItemKind_from_submenu() { + return mPlib_Get_ItemNoToItemKind(Player_actor_Get_ItemNoSubmenu()); +} + +s8 Player_actor_Get_ItemKind_fromScene() { + if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no)) != 0) { + return Player_actor_Get_ItemKind_from_submenu(); + } + return -1; +} + + +s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int able = Player_actor_CheckPlayer_AbleLoadItem(kind); + s8 scene_kind = Player_actor_Get_ItemKind_fromScene(); + + if (player->unable_hand_item_in_demo != FALSE) { + return -1; + } else if (player->able_hand_all_item_in_demo != FALSE) { + return scene_kind; + } else { + if (able == 0) { + return scene_kind; + } else if (able == 1) { + int holdable = mPlayer_ITEM_IS_UMBRELLA(scene_kind) || mPlayer_ITEM_IS_BALLOON(scene_kind) || + mPlayer_ITEM_IS_WINDMILL(scene_kind) || mPlayer_ITEM_IS_FAN(scene_kind) + + ? TRUE + : FALSE; + + if (holdable) { + return scene_kind; + } + } + } + return -1; +} + +int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) { + static s8 data[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 20, + 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, + }; + + if (mPlayer_ITEM_KIND_VALID(kind)) { + return data[kind]; + } else { + return 0; + } +} + + +void Player_actor_birth_umbrella(ACTOR* actor, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int is_umbrella; + aTOL_Clip_c* tools; + s8 kind; + + if (player->umbrella_actor == NULL) { + tools = Common_Get(clip).tools_clip; + if (tools != NULL && + (player->umbrella_state == 1 || player->umbrella_state == 4 || player->umbrella_state == 2)) { + is_umbrella = FALSE; + kind = player->item_kind; + if (mPlayer_ITEM_IS_UMBRELLA(kind)) { + is_umbrella = TRUE; + } + + if (is_umbrella) { + player->umbrella_actor = tools->aTOL_birth_proc(kind - mPlayer_ITEM_KIND_UMBRELLA00, + player->umbrella_state, actor, game, -1, 0); + + if (player->umbrella_actor != NULL) { + player->umbrella_actor->world.position = actor->world.position; + player->umbrella_actor->skip_drawing = TRUE; + } + } + } + } +} + +ACTOR* Player_actor_Get_umbrella_p(ACTOR* actor, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + ACTOR* umbrella; + Player_actor_birth_umbrella(actor, game); + + umbrella = player->umbrella_actor; + if (umbrella != NULL) { + umbrella->skip_drawing = FALSE; + return umbrella; + } + + return NULL; +} + +int Player_actor_Item_CulcAnimation_Base(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + + return cKF_SkeletonInfo_R_play(&player->item_keyframe); +} + +int Player_actor_Item_CulcAnimation_Base2(ACTOR* actor) { + return Player_actor_Item_CulcAnimation_Base(actor) == 1; +} + +void Player_actor_Item_SetAnimation_Base(ACTOR* actor, f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + cKF_SkeletonInfo_R_c* keyf = &player->item_keyframe; + + keyf->frame_control.current_frame = frame; + cKF_SkeletonInfo_R_play(keyf); + keyf->frame_control.current_frame = frame; +} + +void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int change_bank = Player_actor_Change_ItemBank(); + + if ((skl_idx >= 0) && (mPlib_Get_Item_DataPointerType(skl_idx) != 0)) { + cKF_Skeleton_R_c* skeleton; + cKF_SkeletonInfo_R_c* keyf; + s_xyz* joint_work; + s_xyz* morph_work; + cKF_SkeletonInfo_R_c* key2; + + keyf = &player->item_keyframe; + joint_work = player->item_joint_data; + morph_work = player->item_morph_data; + skeleton = mPlib_Get_Item_DataPointer(skl_idx); + + if (frame >= 0.0f) { + cKF_SkeletonInfo_R_ct(keyf, skeleton, NULL, joint_work, morph_work); + keyf->frame_control.current_frame = frame; + } else if (change_bank != 0) { + keyf->skeleton = skeleton; + keyf->animation = NULL; + } else { + cKF_SkeletonInfo_R_ct(keyf, skeleton, NULL, joint_work, morph_work); + } + key2 = &player->item_keyframe; + cKF_SkeletonInfo_R_init_standard_setframeandspeedandmorphandmode(key2, mPlib_Get_Item_DataPointer(anim_idx), + NULL, key2->frame_control.current_frame, speed, + morph_speed, mode); + } +} + + +void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + rod->command = command; + } +} + + +void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + s16 rot; + xyz_t pos; + f32 sin; + f32 cos; + switch (arg0) { + case 0x35: + case 0x36: + case 0x37: + pos = actor->world.position; + rot = actor->shape_info.rotation.y; + + cos = cos_s(rot); + sin = sin_s(rot); + + pos.z += (-2.0f * cos) - (12.0f * sin); + pos.x += (12.0f * cos) + (-2.0f * sin); + pos.y += 17.5f; + + rod->right_hand_pos = pos; + break; + default: + rod->right_hand_pos = player->right_hand_pos; + break; + } + } +} + + +void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + s16 rot; + xyz_t pos; + f32 sin; + f32 cos; + switch (arg0) { + case 0x35: + case 0x36: + case 0x37: + pos = actor->world.position; + rot = actor->shape_info.rotation.y; + + cos = cos_s(rot); + sin = sin_s(rot); + + pos.z += (-2.0f * cos) - (12.0f * sin); + pos.x += (12.0f * cos) + (-2.0f * sin); + pos.y += 17.5f; + + rod->left_hand_pos = pos; + break; + default: + rod->left_hand_pos = player->left_hand_pos; + break; + } + } +} + + +void Player_actor_Item_Set_PosSpeed_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + rod->position_speed = actor->position_speed; + } +} + +void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + int y = player->shape_angle_delta.y; + + if (y > 0) { + if (y > 0x8000) { + y = -(0x10000 - y); + } + } else if (y < -0x8000) { + y += 0x10000; + } + + rod->angle_speed_y = y; + } +} + +void Player_actor_Item_Set_RodTopPos_forUki(ACTOR* actor) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; + + if (rod != NULL) { + Player_actor_Get_ItemRodTopInitPos(actor, &rod->rod_top_position); + } +} + + +void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + int umbrella; + int rod; + + if (kind >= 0) { + Player_actor_Item_DMA_Data(actor, mPlib_Get_BasicItemShapeIndex_fromItemKind(kind), anim_idx, mode, speed, + morph_speed, frame); + } + umbrella = FALSE; + if (mPlayer_ITEM_IS_UMBRELLA(kind)) { + umbrella = TRUE; + } + + if (!umbrella) { + if (player->umbrella_actor != NULL && Common_Get(clip).tools_clip != NULL) { + Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3); + player->umbrella_actor = NULL; + } + + player->umbrella_state = 4; + } else { + TOOLS_ACTOR* tool = (TOOLS_ACTOR*)player->umbrella_actor; + if (tool != NULL && (kind - mPlayer_ITEM_KIND_UMBRELLA00) != tool->tool_name) { + if (Common_Get(clip).tools_clip != NULL) { + Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3); + player->umbrella_actor = NULL; + } + + player->umbrella_state = 4; + } + } + + rod = FALSE; + if (mPlayer_ITEM_IS_ROD(kind)) { + rod = TRUE; + } + + if (!rod) { + Player_actor_Item_Set_Command_forUki(actor, 0); + } +} + + +void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; + TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label; + + if (label != NULL && player->item_net_catch_type == 0) { + Matrix_push(); + Matrix_translate(pos->x, pos->y, pos->z, FALSE); + Matrix_get(&label->matrix_work); + Matrix_pull(); + label->init_matrix = TRUE; + } +} + +int Player_actor_Check_ItemAnimationToItemKind(int kind, int anim) { + int res; + + if (mPlayer_ITEM_IS_AXE(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_NET(kind) != FALSE) { + res = mPlib_Get_Item_DataPointerType(anim) == mPlayer_ITEM_DATA_TYPE_NET_ANIMATION; + } else if (mPlayer_ITEM_IS_UMBRELLA(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_ROD(kind) != FALSE) { + res = mPlib_Get_Item_DataPointerType(anim) == mPlayer_ITEM_DATA_TYPE_ROD_ANIMATION; + } else if (mPlayer_ITEM_IS_SHOVEL(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_BALLOON(kind) != FALSE) { + res = anim < 0; + } else if (mPlayer_ITEM_IS_WINDMILL(kind) != FALSE) { + res = anim < 0; + } else { + res = FALSE; + } + + return res; +} \ No newline at end of file