More player states

This commit is contained in:
Cuyler36
2024-08-30 01:45:57 -04:00
parent 412d2e2d1f
commit 6be3b1885f
22 changed files with 1414 additions and 305 deletions
+79 -110
View File
@@ -1,128 +1,97 @@
int Player_actor_CheckController_forPickup(GAME* game) {
GAME_PLAY* play = (GAME_PLAY*)game;
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();
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
s8 kind = Player_actor_Get_ItemKind(actor, player->now_main_index);
int ret = 0;
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_VALID(kind) && (data->on != 0) && (data->unk3B != 0)) {
ret = 1;
}
return ret;
return !mPlayer_ITEM_KIND_CHECK(kind, 0, mPlayer_ITEM_KIND_NUM) && (data->on != 0) && (data->unk3B != 0);
}
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;
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)) {
check = 1;
}
if (check != 0) {
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 0;
return FALSE;
}
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;
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)) {
check = 1;
}
if (check != 0) {
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 0;
return FALSE;
}
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;
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)) {
check = 1;
}
if (check != 0) {
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 0;
return FALSE;
}
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;
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)) {
check = 1;
}
if (check != 0) {
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 0;
return FALSE;
}
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;
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)) {
check = 1;
}
if (check != 0) {
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 0;
return FALSE;
}
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;
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)) {
check = 1;
}
if (check != 0) {
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) {
@@ -138,17 +107,15 @@ int Player_actor_CheckController_forFan(GAME* game, int type) {
}
}
return 0;
return FALSE;
}
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;
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_VALID(kind) || (mPlayer_ITEM_IS_UMBRELLA(kind) || mPlayer_ITEM_IS_BALLOON(kind) ||
mPlayer_ITEM_IS_WINDMILL(kind) || mPlayer_ITEM_IS_FAN(kind)) != FALSE) {
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);
@@ -156,57 +123,58 @@ int Player_actor_CheckController_forShake_tree(GAME* game) {
return chkTrigger(BUTTON_A);
}
}
return 0;
return FALSE;
}
f32 Player_actor_CheckController_forStruggle_pitfall() {
static f32 Player_actor_CheckController_forStruggle_pitfall(void) {
return (chkTrigger(BUTTON_A) != 0) ? 1.0f : 0.0f;
}
int Player_actor_CheckController_forDush() {
static int Player_actor_CheckController_forDush(void) {
return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->unk3B
: mPlib_CheckButtonOnly_forDush();
}
f32 Player_actor_GetController_move_percentX() {
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;
}
f32 Player_actor_GetController_move_percentY() {
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;
}
f32 Player_actor_GetController_move_percentR() {
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;
}
s16 Player_actor_GetController_move_angle() {
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;
}
s16 Player_actor_GetController_old_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;
}
f32 Player_actor_GetController_recognize_percentR() {
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;
}
f32 Player_actor_GetController_old_recognize_percentR() {
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;
}
int Player_actor_CheckController_forRadio_exercise(GAME* game) {
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)) {
@@ -215,32 +183,33 @@ int Player_actor_CheckController_forRadio_exercise(GAME* game) {
if (JW_JUTGamepad_getSubStickValue() > 0.6f) {
s16 angle = JW_JUTGamepad_getSubStickAngle();
if (angle >= 0) {
if (angle < 0x1000) {
if (angle < DEG2SHORT_ANGLE2(22.5f)) {
return 6;
} else if (angle < 0x3000) {
} else if (angle < DEG2SHORT_ANGLE2(67.5f)) {
return 7;
} else if (angle < 0x5000) {
} else if (angle < DEG2SHORT_ANGLE2(112.5f)) {
return 1;
} else if (angle < DEG2SHORT_ANGLE2(157.5f)) {
return 4;
} else {
return (0x7000 > angle) + 3;
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;
}
}
if (angle > -0x1000) {
return 6;
}
if (angle > -0x3000) {
return 8;
}
if (angle > -0x5000) {
return 2;
}
if (angle > -0x7000) {
return 5;
}
return 3;
} else {
return 0;
}
return 0;
}