mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-31 00:45:27 -04:00
match m_player_main_wait_bed
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
static int Player_actor_Check_able_request_main_wait_bed(GAME* game) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
int index = player->now_main_index;
|
||||
|
||||
switch (index) {
|
||||
case mPlayer_INDEX_LIE_BED:
|
||||
case mPlayer_INDEX_ROLL_BED:
|
||||
return TRUE;
|
||||
default:
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static int Player_actor_request_main_hold(GAME* game, int priority) {
|
||||
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_WAIT_BED, priority) &&
|
||||
Player_actor_Check_able_request_main_wait_bed(game)) {
|
||||
Player_actor_request_main_index(game, mPlayer_INDEX_WAIT_BED, priority);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void Player_actor_setup_main_Wait_bed(ACTOR* actor, GAME* game) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
mPlayer_main_wait_bed_c* req_wait = &player->main_data.wait_bed;
|
||||
|
||||
req_wait->flags = 0;
|
||||
|
||||
actor->world.angle = actor->shape_info.rotation;
|
||||
|
||||
Player_actor_InitAnimation_Base1(actor, game, mPlayer_ANIM_BED_WAIT1, mPlayer_ANIM_BED_WAIT1, 1.0f, 1.0f, 0.5f,
|
||||
0.0f, 0);
|
||||
Player_actor_set_eye_pattern(actor, 2);
|
||||
Player_actor_setup_main_Base(actor, game);
|
||||
}
|
||||
|
||||
static void Player_actor_Movement_Wait_bed(ACTOR* actor) {
|
||||
Player_actor_Movement_Base_Stop(actor, FALSE);
|
||||
}
|
||||
|
||||
static int Player_actor_CulcAnimation_Wait_bed(ACTOR* actor) {
|
||||
f32 frame_calc;
|
||||
|
||||
return Player_actor_CulcAnimation_Base2(actor, &frame_calc);
|
||||
}
|
||||
|
||||
static void Player_actor_request_proc_index_fromWait_bed(ACTOR* actor, GAME* game) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
|
||||
if (Player_actor_GetController_move_percentR() > 0.5f) {
|
||||
s16 angle = Player_actor_Get_ControllerAngle(game);
|
||||
int dir = 0;
|
||||
int dir_angle = Player_actor_Get_Direction_fromAngle(actor->world.angle.y);
|
||||
int check1 = angle < DEG2SHORT_ANGLE2(-165.005f);
|
||||
int check2 = angle > DEG2SHORT_ANGLE2(165.005f);
|
||||
int check4 = angle < DEG2SHORT_ANGLE2(15.0f);
|
||||
int check3 = angle > DEG2SHORT_ANGLE2(-15.0f);
|
||||
int check6 = angle < DEG2SHORT_ANGLE2(105.0f);
|
||||
int check5 = angle > DEG2SHORT_ANGLE2(75.005f);
|
||||
int check8 = angle < DEG2SHORT_ANGLE2(-75.005f);
|
||||
int check7 = angle > DEG2SHORT_ANGLE2(-105.0f);
|
||||
|
||||
if (dir_angle == 1 || dir_angle == 2) {
|
||||
if (check1 || check2) {
|
||||
dir = 3;
|
||||
} else if (check3 && check4) {
|
||||
dir = 4;
|
||||
}
|
||||
} else if (check5 && check6) {
|
||||
dir = 1;
|
||||
} else if (check7 && check8) {
|
||||
dir = 2;
|
||||
}
|
||||
|
||||
if (dir != 0) {
|
||||
if (player->main_data.wait_bed.flags) {
|
||||
int action = 1;
|
||||
|
||||
if (Common_Get(clip).my_room_clip != NULL) {
|
||||
action = Common_Get(clip).my_room_clip->get_bed_action_proc(actor, dir);
|
||||
}
|
||||
|
||||
if (action == 1) {
|
||||
Player_actor_request_main_roll_bed(game, dir, mPlayer_REQUEST_PRIORITY_22);
|
||||
} else if (action == 2) {
|
||||
Player_actor_request_main_standup_bed(game, dir, mPlayer_REQUEST_PRIORITY_22);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player->main_data.wait_bed.flags = 1;
|
||||
}
|
||||
} else {
|
||||
player->main_data.wait_bed.flags = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_main_Wait_bed(ACTOR* actor, GAME* game) {
|
||||
Player_actor_Movement_Wait_bed(actor);
|
||||
Player_actor_Reinput_force_position_angle(actor, game);
|
||||
Player_actor_CulcAnimation_Wait_bed(actor);
|
||||
Player_actor_Item_main(actor, game);
|
||||
Player_actor_request_proc_index_fromWait_bed(actor, game);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user