match m_player_main_dash

This commit is contained in:
Prakxo
2024-08-31 23:06:09 +02:00
parent 9b211fdfd3
commit 5606ebc27a
2 changed files with 209 additions and 2 deletions
+207
View File
@@ -0,0 +1,207 @@
static int Player_actor_request_main_dash_all(GAME* game, f32 speed, int flags, int priority) {
PLAYER_ACTOR* player;
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_DASH, priority)) {
player = GET_PLAYER_ACTOR_GAME(game);
Player_actor_request_main_index(game, mPlayer_INDEX_DASH, priority);
player->requested_main_index_data.dash.morph_speed = speed;
player->requested_main_index_data.dash.flags = flags;
return TRUE;
}
return FALSE;
}
static void Player_actor_setup_main_Dash(ACTOR* actor, GAME* game) {
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
int flags = player->requested_main_index_data.dash.flags;
int anim_idx;
int part_table_idx;
f32 speed = player->requested_main_index_data.dash.morph_speed;
f32 absspeed;
f32 frame = player->keyframe0.frame_control.current_frame;
absspeed = ABS(speed);
Player_actor_SetupItem_Base3(actor, mPlayer_ANIM_DASH1, -absspeed, &anim_idx, &part_table_idx);
Player_actor_InitAnimation_Base1(actor, game, mPlayer_ANIM_DASH1, anim_idx, frame, 1.0f, 0.5f, speed,
part_table_idx);
if (flags & 1) {
Player_actor_SetEffect_forTakeout_item(actor, game);
}
Player_actor_setup_main_Base(actor, game);
}
static void Player_actor_CulcAnimation_Dash(ACTOR* actor, f32* frame_calc, f32 frame) {
Player_actor_CulcAnimation_Run(actor, frame_calc, frame);
}
static int Player_actor_SetEffectRemoveFlower_Dash(ACTOR* actor, GAME* game, s16 angle) {
if (RANDOM(4) == 0) {
xyz_t* actor_pos = &actor->world.position;
mActor_name_t* name_p = mFI_GetUnitFG(*actor_pos);
if (name_p != NULL) {
mActor_name_t name = *name_p;
if ((IS_ITEM_FLOWER(name) ? TRUE : FALSE)) {
xyz_t pos;
if (mFI_Wpos2UtCenterWpos(&pos, *actor_pos)) {
pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(pos, 0.0f);
Common_Get(clip).effect_clip->effect_make_proc(eEC_EFFECT_HANATIRI, pos, 2, angle, game, 0xFFFF,
(s16)name, 0);
if (Common_Get(clip).bg_item_clip != NULL) {
if (Common_Get(clip).bg_item_clip->fade_entry_proc != NULL) {
Common_Get(clip).bg_item_clip->fade_entry_proc(name, actor_pos);
}
}
mISL_SetNowPlayerAction(mISL_PLAYER_ACTION_TRAMPLE_FLOWER);
mISL_SetNowPlayerAction(mISL_PLAYER_ACTION_TRAMPLE_ALL_FLOWERS);
return TRUE;
}
}
}
}
return FALSE;
}
static void Player_actor_SetEffect_Dash(ACTOR* actor, GAME* game, f32 left_target_frame, f32 right_target_frame) {
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
cKF_FrameControl_c* fc = &player->keyframe0.frame_control;
if (Player_actor_Check_AnimationFrame(fc, left_target_frame) != FALSE) {
if (!Player_actor_SetEffectRemoveFlower_Dash(actor, game, player->left_foot_angle.y)) {
Common_Get(clip).effect_clip->effect_make_proc(eEC_EFFECT_DASH_ASIMOTO, player->left_foot_pos, 2,
player->left_foot_angle.y, game, 0xFFFF,
actor->bg_collision_check.result.unit_attribute, 0);
}
} else if (Player_actor_Check_AnimationFrame(fc, right_target_frame) != FALSE) {
if (!Player_actor_SetEffectRemoveFlower_Dash(actor, game, player->right_foot_angle.y)) {
Common_Get(clip).effect_clip->effect_make_proc(eEC_EFFECT_DASH_ASIMOTO, player->right_foot_pos, 2,
player->right_foot_angle.y, game, 0xFFFF,
actor->bg_collision_check.result.unit_attribute, 0);
}
}
}
static void Player_actor_SearchAnimation_Dash(ACTOR* actor, GAME* game, f32 frame) {
if (!Player_actor_Check_AnimationFrame_PerfectEquel(actor, game, frame)) {
Player_actor_Set_FootMark_Base1(actor, game, FALSE, FALSE);
Player_actor_SetEffect_Dash(actor, game, 1.0f, 9.0f);
}
}
static void Player_actor_Movement_Dash(ACTOR* actor, GAME* game, f32* frame) {
Player_actor_Movement_Run(actor, game, frame);
}
static void Player_actor_ObjCheck_Dash(ACTOR* actor, GAME* game) {
Player_actor_Excute_Corect_forStand(actor, game);
}
static void Player_actor_BGcheck_Dash(ACTOR* actor) {
Player_actor_BGcheck_common_type1(actor);
}
static int Player_actor_Check_FlatPlace(ACTOR* actor) {
static xy_t offset[] = {
{0.0f, 0.0f}, {20.0f, 0.0f}, {-20.0f, 0.0f}, {0.0f, 28.284271f},
{20.0f, 28.284271f}, {-20.0f, 28.284271f}, {0.0f, 56.568542f}, {20.0f, 56.568542f},
{-20, 56.568542f}, {0.0f, 84.85281f}, {20.0f, 84.85281f}, {-20.0f, 84.85281f},
};
xyz_t norm;
s16 angle = actor->shape_info.rotation.y;
xyz_t pos = actor->world.position;
f32 sin = sin_s(angle);
f32 cos = cos_s(angle);
int i;
for (i = 0; i < 12; i++) {
f32 x = offset[i].x;
f32 y = offset[i].y;
pos.x = actor->world.position.x + (y * sin) + (x * cos);
pos.z = actor->world.position.z + (y * cos) - (x * sin);
mCoBG_GetBgNorm_FromWpos(&norm, pos);
if (norm.x != 0.0f || norm.z != 0.0f) {
return 0;
}
}
return 1;
}
static void Player_actor_request_proc_index_fromDash_common(ACTOR* actor, GAME* game) {
f32 speed;
GAME_PLAY* play;
PLAYER_ACTOR* player;
player = (PLAYER_ACTOR*)actor;
play = (GAME_PLAY*)game;
Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_CheckTitleDemo() <= 0);
if (!player->actor_class.bg_collision_check.result.on_ground) {
Player_actor_request_main_fall_all(game, -5.0f, 1, mPlayer_REQUEST_PRIORITY_1);
}
Player_actor_CheckAndRequest_main_axe_all(game, mPlayer_REQUEST_PRIORITY_4);
if (Player_actor_CheckController_forNet(game) != 0) {
Player_actor_request_main_slip_net(game, mPlayer_REQUEST_PRIORITY_4);
}
if (Player_actor_CheckController_forRod(game) != 0) {
Player_actor_request_main_ready_rod(game, mPlayer_REQUEST_PRIORITY_4);
}
Player_actor_CheckAndRequest_main_scoop_all(game, mPlayer_REQUEST_PRIORITY_4);
Player_actor_CheckAndRequest_main_umbrella_all(game, mPlayer_REQUEST_PRIORITY_4);
Player_actor_CheckAndRequest_main_fan_all(game, 1, 1, mPlayer_REQUEST_PRIORITY_4);
Player_actor_CheckAndRequest_main_shake_tree_all(game);
Player_actor_CheckAndRequest_main_pickup_all(game);
speed = (player->keyframe0.frame_control.speed * player->keyframe0.frame_control.speed) / 0.048f;
if (Player_actor_Get_DiffWorldAngleToControllerAngle(actor) >= 18204) {
Player_actor_request_main_turn_dash_all(game, Player_actor_Get_ControllerAngle(game), mPlayer_REQUEST_PRIORITY_3);
}
if (speed < 4.875f) {
Player_actor_request_main_run_all(game, -5.0f, 0, mPlayer_REQUEST_PRIORITY_1);
}
if (mEv_CheckTitleDemo() <= 0 &&
(Common_Get(now_private)->destiny.type == 3 && Player_actor_Check_FlatPlace(actor))) {
if (player->actor_class.speed / 7.5f >= 0.75f && !((int)(RANDOM_F(32768) * 2.0f) % 600)) {
Player_actor_request_main_tumble(game, mPlayer_REQUEST_PRIORITY_6);
}
}
}
static void Player_actor_request_proc_index_fromDash(ACTOR* actor, GAME* game) {
Player_actor_request_proc_index_fromDash_common(actor, game);
}
static void Player_actor_main_Dash(ACTOR* actor, GAME* game) {
f32 frame;
f32 frame_calc;
Player_actor_Movement_Dash(actor, game, &frame);
Player_actor_Reinput_force_position_angle(actor, game);
Player_actor_CulcAnimation_Dash(actor, &frame_calc, frame);
Player_actor_SearchAnimation_Dash(actor, game, frame_calc);
Player_actor_set_lean_angle(actor);
Player_actor_set_eye_pattern_normal(actor);
Player_actor_ObjCheck_Dash(actor, game);
Player_actor_BGcheck_Dash(actor);
Player_actor_Item_main(actor, game);
Player_actor_request_proc_index_fromDash(actor, game);
}
+2 -2
View File
@@ -53,8 +53,8 @@ static void Player_actor_SearchAnimation_Run(ACTOR* actor, GAME* game, f32 frame
}
}
static void Player_actor_Movement_Run(ACTOR* actor, GAME* game, f32*) {
Player_actor_Movement_Walk(actor, game);
static void Player_actor_Movement_Run(ACTOR* actor, GAME* game, f32* frame) {
Player_actor_Movement_Walk(actor, game, frame);
}
static void Player_actor_ObjCheck_Run(ACTOR* actor, GAME* game) {