Files
ac-decomp/src/m_player_controller.c_inc
T
2024-09-12 08:04:10 -04:00

217 lines
7.6 KiB
Plaintext

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->trigger_btn_a != 0) &&
(data->btn_b != 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()->trigger_btn_a;
}
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()->btn_a;
}
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()->trigger_btn_a;
}
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()->trigger_btn_a;
}
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()->trigger_btn_a;
}
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->trigger_btn_a;
} else {
return data->btn_a;
}
}
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->trigger_btn_a != 0) && (data->btn_b == 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()->btn_b
: 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;
}
}