static int Player_actor_CheckController_forPickup(GAME* game) {
    if (mEv_CheckTitleDemo() > 0) {
        mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p();
        ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
        PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
        s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

        return !mPlayer_ITEM_KIND_CHECK(kind, 0, mPlayer_ITEM_KIND_NUM) && (data->on != 0) && (data->unk3B != 0);
    }

    return chkTrigger(BUTTON_B);
}

static int Player_actor_CheckController_forAxe(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_AXE(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            return mPlib_Get_controller_data_for_title_demo_p()->on;
        }
        return chkTrigger(BUTTON_A);
    }

    return FALSE;
}

static int Player_actor_CheckController_forNet(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_NET(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            return mPlib_Get_controller_data_for_title_demo_p()->now;
        }
        return chkButton(BUTTON_A);
    }

    return FALSE;
}

static int Player_actor_CheckController_forRod(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_ROD(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            return mPlib_Get_controller_data_for_title_demo_p()->on;
        }
        return chkTrigger(BUTTON_A);
    }

    return FALSE;
}

static int Player_actor_CheckController_forScoop(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_SHOVEL(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            return mPlib_Get_controller_data_for_title_demo_p()->on;
        }
        return chkTrigger(BUTTON_A);
    }

    return FALSE;
}

static int Player_actor_CheckController_forUmbrella(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_UMBRELLA(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            return mPlib_Get_controller_data_for_title_demo_p()->on;
        }
        return chkTrigger(BUTTON_A);
    }

    return FALSE;
}

static int Player_actor_CheckController_forFan(GAME* game, int type) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (mPlayer_ITEM_IS_FAN(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p();
            if (type != 0) {
                return data->on;
            } else {
                return data->now;
            }
        }
        if (type != 0) {
            return chkTrigger(BUTTON_A);
        } else {
            return chkButton(BUTTON_A);
        }
    }

    return FALSE;
}

static int Player_actor_CheckController_forShake_tree(GAME* game) {
    ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
    PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
    s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);

    if (!mPlayer_ITEM_KIND_CHECK(kind, 0, mPlayer_ITEM_KIND_NUM) || mPlayer_ITEM_IS_NOT_TOOL(kind) != FALSE) {
        if (mEv_CheckTitleDemo() > 0) {
            mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p();
            return (data->on != 0) && (data->unk3B == 0);
        } else {
            return chkTrigger(BUTTON_A);
        }
    }
    return FALSE;
}

static f32 Player_actor_CheckController_forStruggle_pitfall(void) {
    return (chkTrigger(BUTTON_A) != 0) ? 1.0f : 0.0f;
}

static int Player_actor_CheckController_forDush(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->unk3B
                                      : mPlib_CheckButtonOnly_forDush();
}

static f32 Player_actor_GetController_move_percentX(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pX
                                      : gamePT->mcon.move_pX;
}

static f32 Player_actor_GetController_move_percentY(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pY
                                      : gamePT->mcon.move_pY;
}

static f32 Player_actor_GetController_move_percentR(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pR
                                      : gamePT->mcon.move_pR;
}

static s16 Player_actor_GetController_move_angle(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_angle
                                      : gamePT->mcon.move_angle;
}

static s16 Player_actor_GetController_old_move_angle(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_move_angle
                                      : gamePT->mcon.last_move_angle;
}

static f32 Player_actor_GetController_recognize_percentR(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.adjusted_pR
                                      : gamePT->mcon.adjusted_pR;
}

static f32 Player_actor_GetController_old_recognize_percentR(void) {
    return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_adjusted_pR
                                      : gamePT->mcon.last_adjusted_pR;
}

static int Player_actor_CheckController_forRadio_exercise(GAME* game) {
    if (mEv_CheckTitleDemo() > 0) {
        return -1;
    }

    if ((mPlib_Check_now_handin_item() != 0) || (Player_actor_GetController_old_recognize_percentR() != 0.0f) ||
        (Player_actor_CheckController_forPickup(game) != 0) ||
        (Player_actor_CheckController_forShake_tree(game) != 0)) {
        return -1;
    }

    if (JW_JUTGamepad_getSubStickValue() > 0.6f) {
        s16 angle = JW_JUTGamepad_getSubStickAngle();

        if (angle >= 0) {
            if (angle < DEG2SHORT_ANGLE2(22.5f)) {
                return 6;
            } else if (angle < DEG2SHORT_ANGLE2(67.5f)) {
                return 7;
            } else if (angle < DEG2SHORT_ANGLE2(112.5f)) {
                return 1;
            } else if (angle < DEG2SHORT_ANGLE2(157.5f)) {
                return 4;
            } else {
                return 3;
            }
        } else {
            if (angle > -DEG2SHORT_ANGLE2(22.5f)) {
                return 6;
            } else if (angle > -DEG2SHORT_ANGLE2(67.5f)) {
                return 8;
            } else if (angle > -DEG2SHORT_ANGLE2(112.5f)) {
                return 2;
            } else if (angle > -DEG2SHORT_ANGLE2(157.5f)) {
                return 5;
            } else {
                return 3;
            }
        }
    } else {
        return 0;
    }
}
