From 8befa9a41205bc8aa3db589457cdc10726cb8b58 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Mon, 19 Aug 2024 23:45:41 +0200 Subject: [PATCH] Match m_player_controller.c_inc --- src/m_player_controller.c_inc | 246 ++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) diff --git a/src/m_player_controller.c_inc b/src/m_player_controller.c_inc index e69de29b..7e350794 100644 --- a/src/m_player_controller.c_inc +++ b/src/m_player_controller.c_inc @@ -0,0 +1,246 @@ + +int Player_actor_CheckController_forPickup(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + + if (mEv_CheckTitleDemo() > 0) { + mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p(); + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(actor, player->now_main_index); + int ret = 0; + + if (mPlayer_ITEM_KIND_VALID(kind) && (data->on != 0) && (data->unk3B != 0)) { + ret = 1; + } + + return ret; + } + + return chkTrigger(BUTTON_B); +} + +int Player_actor_CheckController_forAxe(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(actor, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_AXE(kind)) { + check = 1; + } + if (check != 0) { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->on; + } + return chkTrigger(BUTTON_A); + } + + return 0; +} + +int Player_actor_CheckController_forNet(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(actor, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_NET(kind)) { + check = 1; + } + if (check != 0) { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->now; + } + return chkButton(BUTTON_A); + } + + return 0; +} + +int Player_actor_CheckController_forRod(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(actor, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_ROD(kind)) { + check = 1; + } + if (check != 0) { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->on; + } + return chkTrigger(BUTTON_A); + } + + return 0; +} + +int Player_actor_CheckController_forScoop(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(player, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_SHOVEL(kind)) { + check = 1; + } + if (check != 0) { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->on; + } + return chkTrigger(BUTTON_A); + } + + return 0; +} + +int Player_actor_CheckController_forUmbrella(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(player, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_UMBRELLA(kind)) { + check = 1; + } + if (check != 0) { + if (mEv_CheckTitleDemo() > 0) { + return mPlib_Get_controller_data_for_title_demo_p()->on; + } + return chkTrigger(BUTTON_A); + } + + return 0; +} + +int Player_actor_CheckController_forFan(GAME* game, int type) { + GAME_PLAY* play = (GAME_PLAY*)game;{ + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(player, player->now_main_index); + int check = 0; + + if (mPlayer_ITEM_IS_FAN(kind)) { + check = 1; + } + if (check != 0) { + 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 0; +} + +int Player_actor_CheckController_forShake_tree(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + s8 kind = Player_actor_Get_ItemKind(player, player->now_main_index); + int check; + + if (mPlayer_ITEM_KIND_VALID(kind) || (mPlayer_ITEM_IS_UMBRELLA(kind) || mPlayer_ITEM_IS_BALLOON(kind) || + mPlayer_ITEM_IS_WINDMILL(kind) || mPlayer_ITEM_IS_FAN(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 0; +} + +f32 Player_actor_CheckController_forStruggle_pitfall() { + return (chkTrigger(BUTTON_A) != 0) ? 1.0f : 0.0f; +} + +int Player_actor_CheckController_forDush() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->unk3B + : mPlib_CheckButtonOnly_forDush(); +} + +f32 Player_actor_GetController_move_percentX() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pX + : gamePT->mcon.move_pX; +} + +f32 Player_actor_GetController_move_percentY() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pY + : gamePT->mcon.move_pY; +} + +f32 Player_actor_GetController_move_percentR() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pR + : gamePT->mcon.move_pR; +} + +s16 Player_actor_GetController_move_angle() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_angle + : gamePT->mcon.move_angle; +} + +s16 Player_actor_GetController_old_move_angle() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_move_angle + : gamePT->mcon.last_move_angle; +} + +f32 Player_actor_GetController_recognize_percentR() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.adjusted_pR + : gamePT->mcon.adjusted_pR; +} + +f32 Player_actor_GetController_old_recognize_percentR() { + return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_adjusted_pR + : gamePT->mcon.last_adjusted_pR; +} + +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 < 0x1000) { + return 6; + } else if (angle < 0x3000) { + return 7; + } else if (angle < 0x5000) { + return 1; + } else { + return (0x7000 > angle) + 3; + } + } + if (angle > -0x1000) { + return 6; + } + if (angle > -0x3000) { + return 8; + } + if (angle > -0x5000) { + return 2; + } + if (angle > -0x7000) { + return 5; + } + + return 3; + } + + return 0; +}