void Player_actor_Item_net_CulcJointAngle_dummy_net_base(s_xyz* angle, const s_xyz* base, s16 min, s16 max, f32 frac){
    
    add_calc_short_angle2(&angle->x, base->x, 1.0f - sqrtf(1.0f - frac), min >> 1, max >> 1);
    add_calc_short_angle2(&angle->y, base->y, 1.0f - sqrtf(1.0f - frac), min >> 1, max >> 1);
    add_calc_short_angle2(&angle->z, base->z, 1.0f - sqrtf(1.0f - frac), min >> 1, max >> 1);
}

void Player_actor_Item_net_CulcJointAngle_dummy_net_reset(ACTOR* actor){
    static const s_xyz basic_angle = {0, 182, -7281};
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
    
    Player_actor_Item_net_CulcJointAngle_dummy_net_base(&player->net_angle,&basic_angle, 2730, 100, 0.2f);
}

void Player_actor_Item_net_CulcJointAngle_dummy_net_ready(ACTOR* actor){
    static s_xyz basic_angle = {0, 364, -11832};
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
    
    Player_actor_Item_net_CulcJointAngle_dummy_net_base(&player->net_angle,&basic_angle, 2730, 100, 0.2f);
}

void Player_actor_Item_net_CulcJointAngle_dummy_net_common(ACTOR* actor, const xyz_t* start_angle, const xyz_t* arg2, const xyz_t* end_left_angle, const xyz_t* end_right_angle){
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
    f32 sp = (player->keyframe0.frame_control.speed - 0.22f) / 0.38f;
    s_xyz base;
    f32 angle_y;
    f32 fac;
    s_xyz* net_angle = &player->net_angle;

    if(sp > 1.0f){
        sp = 1.0f;
    }
    else if(sp < 0.0f){
        sp = 0.0f;
    }

    base.x = (s16)(int)(start_angle->x + (sp * (arg2->x - start_angle->x)));
    base.y = (s16)(int)(start_angle->y + (sp * (arg2->y - start_angle->y)));
    base.z = (s16)(int)(start_angle->z + (sp * (arg2->z - start_angle->z)));

    angle_y = player->shape_angle_delta.y;

    if(angle_y > 0.0f){
        if(angle_y > 32768.0f){
            angle_y = -(65536.0f - angle_y);
        }
    }
    else if (angle_y < -32768.0f) {
        angle_y = angle_y + 65536.0f;
    }

    fac = angle_y / 1820.0f;
    
    if(fac > 1.0f){
        fac = 1.0f;
    }
    else if(fac < -1.0f){
        fac = -1.0f;
    }

    if(fac > 0.0f){ 
        base.x += (s16)(int)(fac * (end_left_angle->x - start_angle->x));
        base.y += (s16)(int)(fac * (end_left_angle->y - start_angle->y));
        base.z += (s16)(int)(fac * (end_left_angle->z - start_angle->z));
        
    }
    else if(fac < 0.0f){
        base.x += (s16)(int)(-fac * (end_right_angle->x - start_angle->x));
        base.y += (s16)(int)(-fac * (end_right_angle->y - start_angle->y));
        base.z += (s16)(int)(-fac * (end_right_angle->z - start_angle->z)); 
    }

    Player_actor_Item_net_CulcJointAngle_dummy_net_base(net_angle, &base, 2730, 100, 0.2f);
}

void Player_actor_Item_net_CulcJointAngle_dummy_net_walk(ACTOR* actor){
    static const xyz_t basic_start_move_angle = {0, 182.0f, -7281.0f};
    static const xyz_t basic_end_left_turn_angle = {0, -4551.0f, -4551.0f};
    static const xyz_t basic_end_right_turn_angle = {0, 4551.0f, -4551.0f};
    
 
    Player_actor_Item_net_CulcJointAngle_dummy_net_common(actor, &basic_start_move_angle, &ZeroVec, &basic_end_left_turn_angle, &basic_end_right_turn_angle);
}


void Player_actor_Item_net_CulcJointAngle_dummy_net_zero(ACTOR* actor){
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;

    Player_actor_Item_net_CulcJointAngle_dummy_net_base(&player->net_angle,&ZeroSVec, 2730, 100, 0.2f); 
    
}


void Player_actor_Item_net_CulcJointAngle_dummy_net_ready_walk(ACTOR* actor){
    static const xyz_t basic_start_move_angle = { 0.0f, 364.0f, -11832.0f };
    static const xyz_t basic_end_left_turn_angle = {0, -4551.0f, -4551.0f};
    static const xyz_t basic_end_right_turn_angle = {0, 4551.0f, -4551.0f};
    
 
    Player_actor_Item_net_CulcJointAngle_dummy_net_common(actor, &basic_start_move_angle, &ZeroVec, &basic_end_left_turn_angle, &basic_end_right_turn_angle);
}



void Player_actor_Item_net_CulcJointAngle_dummy_net_turn(ACTOR* actor){
    static const xyz_t basic_angle = { 0.0f, -4551.0f, -4551.0f };
    
    Player_actor_Item_net_CulcJointAngle_dummy_net_common(actor, &basic_angle, &basic_angle, &basic_angle, &basic_angle);
}



void Player_actor_Item_net_CulcJointAngle_dummy_net_slip(ACTOR* actor){
    static const xyz_t basic_angle = {0.0f, 0.0f, -11832.0f};
    
 
    Player_actor_Item_net_CulcJointAngle_dummy_net_common(actor, &basic_angle, &basic_angle, &basic_angle, &basic_angle);
}

void Player_actor_Item_net_CulcJointAngle_dummy_net_swing(ACTOR* actor){
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;

    if(player->keyframe0.frame_control.current_frame >= 0.5f){
        Player_actor_Item_net_CulcJointAngle_dummy_net_zero(actor);
    }
    else{
        Player_actor_Item_net_CulcJointAngle_dummy_net_ready(actor);
    }
}

typedef void (*mPlayer_item_net_proc)(ACTOR*);

void Player_actor_Item_net_CulcJointAngle_dummy_net(ACTOR* actor) {
    static mPlayer_item_net_proc proc[] = {
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_walk,  Player_actor_Item_net_CulcJointAngle_dummy_net_walk,
        Player_actor_Item_net_CulcJointAngle_dummy_net_walk,  Player_actor_Item_net_CulcJointAngle_dummy_net_zero,
        Player_actor_Item_net_CulcJointAngle_dummy_net_zero,  Player_actor_Item_net_CulcJointAngle_dummy_net_turn,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_slip,
        Player_actor_Item_net_CulcJointAngle_dummy_net_ready, Player_actor_Item_net_CulcJointAngle_dummy_net_ready_walk,
        Player_actor_Item_net_CulcJointAngle_dummy_net_swing, Player_actor_Item_net_CulcJointAngle_dummy_net_zero,
        Player_actor_Item_net_CulcJointAngle_dummy_net_zero,  Player_actor_Item_net_CulcJointAngle_dummy_net_zero,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_walk,  Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_zero,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset, Player_actor_Item_net_CulcJointAngle_dummy_net_reset,
        Player_actor_Item_net_CulcJointAngle_dummy_net_reset,

    };
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
    int valid = FALSE;
    int index = player->now_main_index;

    if (mPlayer_MAIN_INDEX_VALID(index)) {
        valid = TRUE;
    }

    if (valid == FALSE || proc[index] == NULL) {
        return;
    }else{
       proc[index](actor);
    }
}

int Player_actor_Item_main_net_normal(ACTOR* actor){
    Player_actor_Item_CulcAnimation_Base(actor);
    Player_actor_Item_net_CulcJointAngle_dummy_net(actor);
    return 0;
}

int Player_actor_Item_main_net_stop(ACTOR* actor){
    int ret = Player_actor_Item_CulcAnimation_Base2(actor);
    
    Player_actor_Item_net_CulcJointAngle_dummy_net(actor);
    return ret;
}
 
void Player_actor_Item_draw_net_After_dummy_net(ACTOR* actor){
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;

    Matrix_rotateXYZ(player->net_angle.x, player->net_angle.y, player->net_angle.z, 1);
}
 
typedef void (*mPlayer_item_net_draw_proc)(void* arg, GAME* game, cKF_SkeletonInfo_R_c* keyframe, Gfx** joint_shape,
                                           u8* joint_flags, s_xyz* joint_rot, xyz_t* joint_pos);

int Player_actor_Item_draw_net_After(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) {
    static const mPlayer_item_net_draw_proc proc[] = {
        NULL, NULL, (mPlayer_item_net_draw_proc)Player_actor_Item_draw_net_After_dummy_net, NULL, NULL, NULL,
    };

    if (joint_idx >= 0 && joint_idx < 6) {
        if (proc[joint_idx] != NULL) {
            proc[joint_idx](arg, game, keyframe, joint_shape, joint_flags, joint_rot, joint_pos);
        }
    }

    return TRUE;
}

void Player_actor_Item_draw_net(ACTOR* actor, GAME* game){
    GAME_PLAY* play = (GAME_PLAY*)game;
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
    
    Matrix_push();
    Matrix_rotateXYZ(0, 3000, 0, 1);
    Matrix_Position_VecZ(&player->net_start_pos, -2400.0f);
    Matrix_Position_VecZ(&player->net_end_pos,  5500.0f);
    Matrix_Position_VecZ(&player->net_pos,  4000.0f);
    Matrix_Position_VecZ(&player->net_top_col_pos,  4000.0f);
    Matrix_Position_VecZ(&player->net_bot_col_pos,  4000.0f);
    Matrix_pull();
    cKF_Si3_draw_R_SV(&play->game, &player->item_keyframe, player->item_work_mtx[game->frame_counter % 2], NULL, Player_actor_Item_draw_net_After, &player->actor_class);
    player->update_item_rod_top_pos = FALSE;
    player->balloon_start_pos_set_flag = FALSE;
}
