static 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(void) { if (mEv_CheckTitleDemo() > 0) { return mPlib_Get_controller_data_for_title_demo_p()->equiped_item; } else { return Common_Get(now_private)->equipment; } } static s8 Player_actor_Get_ItemKind_from_submenu(void) { return mPlib_Get_ItemNoToItemKind(Player_actor_Get_ItemNoSubmenu()); } static s8 Player_actor_Get_ItemKind_fromScene(void) { if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no)) != 0) { return Player_actor_Get_ItemKind_from_submenu(); } return -1; } static 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; } static 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; } } static 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; } static int Player_actor_Item_CulcAnimation_Base(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; return cKF_SkeletonInfo_R_play(&player->item_keyframe); } static int Player_actor_Item_CulcAnimation_Base2(ACTOR* actor) { return Player_actor_Item_CulcAnimation_Base(actor) == 1; } static 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; } static 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); } } static 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; } } static 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; } } } static 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; } } } static 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; } } static 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; } } static 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); } } static 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); } } static 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; } } static 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; }