mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-03 11:00:17 -04:00
8548 lines
278 KiB
Plaintext
8548 lines
278 KiB
Plaintext
static int Player_actor_check_request_main_priority(GAME* game, int priority) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
return priority - player->requested_main_index_priority;
|
|
}
|
|
|
|
static void Player_actor_request_main_index(GAME* game, int request_index, int priority) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
player->requested_main_index = request_index;
|
|
player->requested_main_index_priority = priority;
|
|
player->requested_main_index_changed = TRUE;
|
|
}
|
|
|
|
static void Player_actor_Set_start_refuse(ACTOR* actorx, GAME* game) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->now_main_index;
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(idx) != FALSE) {
|
|
if (data[idx]) {
|
|
play->submenu.start_refuse = FALSE;
|
|
} else {
|
|
play->submenu.start_refuse = TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Set_address_able_display(ACTOR* actorx) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_READY_NET,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_MOVEMENT,
|
|
mPlayer_ADDRESSABLE_TRUE,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
mPlayer_ADDRESSABLE_FALSE_TALKING,
|
|
};
|
|
// clang-format on
|
|
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(idx) != FALSE) {
|
|
player->address_able_display = data[idx];
|
|
}
|
|
}
|
|
|
|
static f32 Player_actor_Get_DemoMoveSpeedF(void) {
|
|
return (f32)mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 7) * 0.01f;
|
|
}
|
|
|
|
static void Player_actor_Set_force_shadow_position(ACTOR* actorx, xyz_t* pos) {
|
|
mActorShadow_SetForceShadowPos(actorx, pos);
|
|
}
|
|
|
|
static void Player_actor_Set_force_shadow_position_fromAnimePosition(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0 = &player->keyframe0;
|
|
xyz_t* pos_p = &player->shadow_pos;
|
|
|
|
cKF_SkeletonInfo_R_AnimationMove_CulcTransToWorld(pos_p, &actorx->world.position, 0.0f, 1000.0f, 0.0f,
|
|
actorx->shape_info.rotation.y, &actorx->scale, kf0,
|
|
cKF_ANIMATION_TRANS_XZ | cKF_ANIMATION_TRANS_Y);
|
|
Player_actor_Set_force_shadow_position(actorx, pos_p);
|
|
}
|
|
|
|
static void Player_actor_Set_force_shadow_position_fromWorldPosition(ACTOR* actorx) {
|
|
Player_actor_Set_force_shadow_position(actorx, &actorx->world.position);
|
|
}
|
|
|
|
static void Player_actor_SetupShadow(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(idx) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_WORLD_POS,
|
|
mPlayer_SHADOW_TYPE_ANIME_POS,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NONE,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
mPlayer_SHADOW_TYPE_NORMAL,
|
|
};
|
|
// clang-format on
|
|
|
|
switch (data[idx]) {
|
|
case mPlayer_SHADOW_TYPE_ANIME_POS:
|
|
actorx->shape_info.draw_shadow = TRUE;
|
|
Player_actor_Set_force_shadow_position_fromAnimePosition(actorx);
|
|
break;
|
|
case mPlayer_SHADOW_TYPE_WORLD_POS:
|
|
actorx->shape_info.draw_shadow = TRUE;
|
|
Player_actor_Set_force_shadow_position_fromWorldPosition(actorx);
|
|
break;
|
|
case mPlayer_SHADOW_TYPE_NONE:
|
|
actorx->shape_info.draw_shadow = FALSE;
|
|
break;
|
|
default:
|
|
actorx->shape_info.draw_shadow = TRUE;
|
|
mActorShadow_UnSetForceShadowPos(actorx);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupSpeedF(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(idx) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
if (data[idx] == FALSE) {
|
|
actorx->speed = 0.0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Get_SetupRequestMainIndexPriority(int main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_REQUEST_PRIORITY_41,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_34,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_43,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_11,
|
|
mPlayer_REQUEST_PRIORITY_11,
|
|
mPlayer_REQUEST_PRIORITY_12,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_27,
|
|
mPlayer_REQUEST_PRIORITY_28,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_22,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_27,
|
|
mPlayer_REQUEST_PRIORITY_28,
|
|
mPlayer_REQUEST_PRIORITY_29,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_21,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_37,
|
|
mPlayer_REQUEST_PRIORITY_37,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_43,
|
|
mPlayer_REQUEST_PRIORITY_43,
|
|
mPlayer_REQUEST_PRIORITY_30,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_27,
|
|
mPlayer_REQUEST_PRIORITY_28,
|
|
mPlayer_REQUEST_PRIORITY_29,
|
|
mPlayer_REQUEST_PRIORITY_25,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_38,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_44,
|
|
mPlayer_REQUEST_PRIORITY_43,
|
|
mPlayer_REQUEST_PRIORITY_25,
|
|
mPlayer_REQUEST_PRIORITY_26,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_20,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_19,
|
|
mPlayer_REQUEST_PRIORITY_34,
|
|
mPlayer_REQUEST_PRIORITY_34,
|
|
mPlayer_REQUEST_PRIORITY_33,
|
|
};
|
|
// clang-format on
|
|
|
|
int priority = data[main_index];
|
|
|
|
if (mPlayer_REQUEST_PRIORITY_VALID(priority)) {
|
|
return priority;
|
|
}
|
|
}
|
|
|
|
return mPlayer_REQUEST_PRIORITY_NONE;
|
|
}
|
|
|
|
static void Player_actor_SetupRequestMainIndexPriority(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_index = player->now_main_index;
|
|
int priority = Player_actor_Get_SetupRequestMainIndexPriority(main_index);
|
|
|
|
if (mPlayer_REQUEST_PRIORITY_VALID(priority)) {
|
|
player->requested_main_index_priority = priority;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SettleRequestMainIndexPriority(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_index = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_36,
|
|
mPlayer_REQUEST_PRIORITY_36,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_44,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_18,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_0,
|
|
mPlayer_REQUEST_PRIORITY_NONE,
|
|
};
|
|
// clang-format on
|
|
|
|
int priority = data[main_index];
|
|
|
|
if (mPlayer_REQUEST_PRIORITY_VALID(priority) && player->settled_requested_main_index_priority == FALSE &&
|
|
player->requested_main_index_changed == FALSE) {
|
|
int requested_main_index_priority = player->requested_main_index_priority;
|
|
|
|
if (requested_main_index_priority == Player_actor_Get_SetupRequestMainIndexPriority(main_index)) {
|
|
player->requested_main_index_priority = priority;
|
|
player->settled_requested_main_index_priority = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_set_eye_pattern(ACTOR* actorx, int idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->eye_tex_idx = idx;
|
|
}
|
|
|
|
static void Player_actor_set_eye_pattern_normal(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
mPlayer_eye_pattern_c* eye_pattern_p = &player->eye_pattern_normal;
|
|
s16* timer_p = &eye_pattern_p->timer;
|
|
s16* pattern_p = &eye_pattern_p->pattern;
|
|
int* blink_count_p = &player->blink_count;
|
|
int idx;
|
|
static const s8 pattern_table[] = { 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0 };
|
|
|
|
idx = *timer_p;
|
|
if (idx == 0) {
|
|
idx = 0;
|
|
} else {
|
|
idx = --(*timer_p);
|
|
}
|
|
|
|
if (idx == 0) {
|
|
if (*blink_count_p <= 0) {
|
|
*blink_count_p = get_random_timer(0, 3);
|
|
*timer_p = get_random_timer(60, 120);
|
|
} else {
|
|
*timer_p = 16;
|
|
(*blink_count_p)--;
|
|
}
|
|
}
|
|
|
|
*pattern_p = *timer_p;
|
|
if (*pattern_p >= 16) {
|
|
*pattern_p = 0;
|
|
}
|
|
|
|
Player_actor_set_eye_pattern(actorx, pattern_table[*pattern_p]);
|
|
}
|
|
|
|
static u8* Player_actor_Get_eye_tex_p(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->eye_tex_idx;
|
|
|
|
return mPlib_Get_eye_tex_p(idx);
|
|
}
|
|
|
|
static void Player_actor_set_mouth_pattern(ACTOR* actorx, int idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->mouth_tex_idx = idx;
|
|
}
|
|
|
|
static u8* Player_actor_Get_mouth_tex_p(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int idx = player->mouth_tex_idx;
|
|
|
|
return mPlib_Get_mouth_tex_p(idx);
|
|
}
|
|
|
|
static void Player_actor_set_tex_anime_pattern(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int anim0_idx = player->animation0_idx;
|
|
u8* eye_tex_idx_p = mPlib_Get_PlayerEyeTexAnimation_p(anim0_idx);
|
|
u8* mouth_tex_idx_p = mPlib_Get_PlayerMouthTexAnimation_p(anim0_idx);
|
|
|
|
if (eye_tex_idx_p != NULL || mouth_tex_idx_p != NULL) {
|
|
cKF_SkeletonInfo_R_c* kf_p = &player->keyframe0;
|
|
cKF_FrameControl_c* frame_control_p = &kf_p->frame_control;
|
|
f32 cur_frame = frame_control_p->current_frame;
|
|
f32 max_frame = frame_control_p->max_frames;
|
|
|
|
if (1.0f <= cur_frame && cur_frame <= max_frame) {
|
|
int pattern = (int)(cur_frame - 1.0f);
|
|
|
|
if (eye_tex_idx_p != NULL) {
|
|
Player_actor_set_eye_pattern(actorx, (int)eye_tex_idx_p[pattern]);
|
|
}
|
|
|
|
if (mouth_tex_idx_p != NULL) {
|
|
Player_actor_set_mouth_pattern(actorx, (int)mouth_tex_idx_p[pattern]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupTextureAnimation(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_idx) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_EYE | mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE,
|
|
mPlayer_SETUP_TEXTURE_ANIMATION_NONE
|
|
};
|
|
// clang-format on
|
|
|
|
int flags = data[main_idx];
|
|
|
|
if ((flags & mPlayer_SETUP_TEXTURE_ANIMATION_EYE)) {
|
|
Player_actor_set_eye_pattern(actorx, 0);
|
|
}
|
|
|
|
if ((flags & mPlayer_SETUP_TEXTURE_ANIMATION_MOUTH)) {
|
|
Player_actor_set_mouth_pattern(actorx, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Set_now_item_main_index(ACTOR* actorx, int item_main_index) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int last_item_main_index = player->now_item_main_index;
|
|
|
|
if (item_main_index >= 0 && item_main_index < mPlayer_ITEM_MAIN_NUM) {
|
|
player->now_item_main_index = item_main_index;
|
|
Player_actor_Item_Setup_main(actorx, item_main_index, last_item_main_index);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupItem_common(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_idx = player->now_main_index;
|
|
int item_kind = Player_actor_Get_ItemKind(actorx, main_idx);
|
|
|
|
if (item_kind < 0) {
|
|
Player_actor_LoadOrDestruct_Item(actorx, -1, -1, 0.0f, 0.0f, 1.0f, mPlayer_ITEM_IS_BALLOON(item_kind) == FALSE);
|
|
Player_actor_Set_now_item_main_index(actorx, mPlayer_ITEM_MAIN_NONE);
|
|
player->item_kind = item_kind;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupItemScale(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32* item_scale_p = &player->item_scale;
|
|
|
|
if (mPlib_get_player_actor_main_index(game) != mPlayer_INDEX_TAKEOUT_ITEM) {
|
|
*item_scale_p = 1.0f;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupWeight(ACTOR* actorx) {
|
|
if (mEv_CheckTitleDemo() <= 0) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_idx) != FALSE) {
|
|
// clang-format off
|
|
static const u8 data[] = {
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
255,
|
|
50,
|
|
255,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
254,
|
|
50,
|
|
50,
|
|
254,
|
|
255,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
255,
|
|
50,
|
|
255,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
255,
|
|
255,
|
|
255,
|
|
255,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
255,
|
|
50,
|
|
255,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
50,
|
|
255,
|
|
255,
|
|
255,
|
|
255,
|
|
255,
|
|
255,
|
|
50,
|
|
50,
|
|
50
|
|
};
|
|
// clang-format on
|
|
|
|
u8 weight = data[main_idx];
|
|
u8* weight_p = &actorx->status_data.weight;
|
|
|
|
if (*weight_p != weight) {
|
|
*weight_p = weight;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Get_status_for_bee(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
return player->status_for_bee;
|
|
}
|
|
|
|
static void Player_actor_Set_status_for_bee(ACTOR* actorx, s8 v) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->status_for_bee = v;
|
|
}
|
|
|
|
static void Player_actor_Setup_status_for_bee(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_idx = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_idx) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ENTER_BUILDING,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ATTACK,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_ENTER_BUILDING,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT,
|
|
mPlayer_STATUS_FOR_BEE_WAIT
|
|
};
|
|
// clang-format on
|
|
|
|
player->status_for_bee = data[main_idx];
|
|
}
|
|
}
|
|
|
|
static void Player_actor_setup_main_Base2(ACTOR* actorx, GAME* game, int main_index) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->prev_main_index = player->now_main_index;
|
|
player->now_main_index = main_index;
|
|
player->requested_main_index_changed = FALSE;
|
|
player->settled_requested_main_index_priority = FALSE;
|
|
|
|
Player_actor_Set_start_refuse(actorx, game);
|
|
Player_actor_Set_address_able_display(actorx);
|
|
Player_actor_SetupShadow(actorx);
|
|
Player_actor_SetupSpeedF(actorx);
|
|
Player_actor_SetupRequestMainIndexPriority(actorx);
|
|
Player_actor_SetupTextureAnimation(actorx);
|
|
Player_actor_SetupItem_common(actorx);
|
|
Player_actor_SetupItemScale(actorx, game);
|
|
Player_actor_SetupWeight(actorx);
|
|
Player_actor_Setup_status_for_bee(actorx);
|
|
}
|
|
|
|
static void Player_actor_setup_main_Base(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_setup_main_Base2(actorx, game, player->requested_main_index);
|
|
}
|
|
|
|
/* Common Movement */
|
|
|
|
static void Player_actor_Movement_Base(ACTOR* actorx) {
|
|
Actor_position_moveF(actorx);
|
|
}
|
|
|
|
static int Player_actor_Movement_Base_Braking_common(ACTOR* actorx, f32 brake_amount) {
|
|
f32 speed = actorx->speed;
|
|
|
|
speed -= brake_amount;
|
|
if (speed < 0.0f) {
|
|
speed = 0.0f;
|
|
}
|
|
|
|
actorx->speed = speed;
|
|
Player_actor_Movement_Base(actorx);
|
|
return speed == 0.0f;
|
|
}
|
|
|
|
static int Player_actor_Movement_Base_Braking(ACTOR* actorx) {
|
|
return Player_actor_Movement_Base_Braking_common(actorx, 0.326525f);
|
|
}
|
|
|
|
static void Player_actor_SetPlayerAngle_forUki(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ACTOR* uki_actor = player->fishing_rod_actor_p;
|
|
xyz_t* uki_pos_p = &uki_actor->world.position;
|
|
xyz_t* player_pos_p = &actorx->world.position;
|
|
f32 dx = uki_pos_p->x - player_pos_p->x;
|
|
f32 dz = uki_pos_p->z - player_pos_p->z;
|
|
|
|
if (dx != 0.0f || dz != 0.0f) {
|
|
s16 target_angle_y = atans_table(dz, dx);
|
|
|
|
add_calc_short_angle2(&actorx->shape_info.rotation.y, target_angle_y, 1.0f - sqrtf(0.5f),
|
|
DEG2SHORT_ANGLE2(13.73291015625f), DEG2SHORT_ANGLE2(0.274658203125f));
|
|
actorx->world.angle.y = actorx->shape_info.rotation.y;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Movement_Base_Stop(ACTOR* actorx, int use_position_speed_y) {
|
|
actorx->speed = 0.0f;
|
|
Actor_position_speed_set(actorx);
|
|
|
|
if (use_position_speed_y == FALSE) {
|
|
actorx->position_speed.y = 0.0f;
|
|
}
|
|
|
|
Actor_position_move(actorx);
|
|
}
|
|
|
|
static int Player_actor_Search_exist_npc_inCircle_forWade(GAME* game, xyz_t* origin, f32 radius_sq) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
Actor_info* actor_info_p = &play->actor_info;
|
|
Actor_list* actor_list_p = &actor_info_p->list[ACTOR_PART_NPC];
|
|
ACTOR* actorx_p = actor_list_p->actor;
|
|
f32 origin_x = origin->x;
|
|
f32 origin_z = origin->z;
|
|
|
|
for (actorx_p; actorx_p != NULL; actorx_p = actorx_p->next_actor) {
|
|
xyz_t* pos_p = &actorx_p->world.position;
|
|
f32 dx = pos_p->x - origin_x;
|
|
f32 dz = pos_p->z - origin_z;
|
|
|
|
if (Math3DVecLengthSquare2D(dx, dz) < radius_sq) {
|
|
NPC_ACTOR* npc_actor_p = (NPC_ACTOR*)actorx_p;
|
|
|
|
if (npc_actor_p->condition_info.hide_flg == FALSE) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAbleMoveWadeBG(GAME* game, const xyz_t* pos_p, int dir, int check_for_npc) {
|
|
xyz_t target_pos;
|
|
xyz_t local_border_pos = { 0.0f, 0.0f, 0.0f };
|
|
xyz_t world_border_pos;
|
|
int bx;
|
|
int bz;
|
|
|
|
mFI_Wpos2BlockNum(&bx, &bz, *pos_p);
|
|
mFI_LposInBKtoWpos(&world_border_pos, local_border_pos, bx, bz);
|
|
target_pos = *pos_p;
|
|
switch (dir) {
|
|
case mFI_MOVEDIR_RIGHT:
|
|
target_pos.x = world_border_pos.x + 18.0f + mFI_BK_WORLDSIZE_X_F;
|
|
break;
|
|
case mFI_MOVEDIR_LEFT:
|
|
target_pos.x = world_border_pos.x - 18.0f;
|
|
break;
|
|
case mFI_MOVEDIR_UP:
|
|
target_pos.z = world_border_pos.z - 18.0f;
|
|
break;
|
|
case mFI_MOVEDIR_DOWN:
|
|
target_pos.z = world_border_pos.z + 18.0f + mFI_BK_WORLDSIZE_Z_F;
|
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
|
|
|
if (check_for_npc == FALSE || Player_actor_Search_exist_npc_inCircle_forWade(game, &target_pos, 36.0f) == FALSE) {
|
|
return mCoBG_ScrollCheck(*pos_p, target_pos, 18.0f);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAbleMoveWadeBlock(GAME* game, const xyz_t* pos_p, s16 angle_y, f32 stick_range,
|
|
int angle_range, int npc_check_flag) {
|
|
f32 move_percentX = Player_actor_GetController_move_percentX();
|
|
f32 move_percentY = Player_actor_GetController_move_percentY();
|
|
xyz_t local_pos;
|
|
|
|
mFI_WpostoLposInBK(&local_pos, *pos_p);
|
|
if (move_percentX > stick_range &&
|
|
((DEG2SHORT_ANGLE2(90.0f) - angle_range) < angle_y && angle_y < (DEG2SHORT_ANGLE2(90.0f) + angle_range)) &&
|
|
mFI_ScrollCheck(*pos_p, mFI_MOVEDIR_RIGHT)) {
|
|
f32 border_x = (mFI_BK_WORLDSIZE_X_F - 18.0f);
|
|
|
|
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO) {
|
|
border_x -= mFI_UNIT_BASE_SIZE_F;
|
|
}
|
|
|
|
if (local_pos.x >= border_x) {
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
if (Player_actor_CheckAbleMoveWadeBG(game, pos_p, mFI_MOVEDIR_RIGHT, npc_check_flag)) {
|
|
return mFI_MOVEDIR_RIGHT;
|
|
}
|
|
} else {
|
|
return mFI_MOVEDIR_RIGHT;
|
|
}
|
|
}
|
|
|
|
} else if (move_percentX < -stick_range &&
|
|
(DEG2SHORT_ANGLE2(-90.0f) - angle_range < (int)angle_y &&
|
|
(int)angle_y < DEG2SHORT_ANGLE2(-90.0f) + angle_range) &&
|
|
mFI_ScrollCheck(*pos_p, mFI_MOVEDIR_LEFT)) {
|
|
f32 border_x = 18.0f;
|
|
|
|
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO) {
|
|
border_x += mFI_UNIT_BASE_SIZE_F;
|
|
}
|
|
|
|
if (local_pos.x <= border_x) {
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
if (Player_actor_CheckAbleMoveWadeBG(game, pos_p, mFI_MOVEDIR_LEFT, npc_check_flag)) {
|
|
return mFI_MOVEDIR_LEFT;
|
|
}
|
|
} else {
|
|
return mFI_MOVEDIR_LEFT;
|
|
}
|
|
}
|
|
}
|
|
|
|
else if (move_percentY > stick_range &&
|
|
((DEG2SHORT_ANGLE2(180.0f) - angle_range) < (int)angle_y ||
|
|
(int)angle_y < (DEG2SHORT_ANGLE2(-180.0f) + angle_range)) &&
|
|
mFI_ScrollCheck(*pos_p, mFI_MOVEDIR_UP)) {
|
|
f32 border_z = 18.0f;
|
|
|
|
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO) {
|
|
border_z += mFI_UNIT_BASE_SIZE_F;
|
|
}
|
|
|
|
if (local_pos.z <= border_z) {
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
if (Player_actor_CheckAbleMoveWadeBG(game, pos_p, mFI_MOVEDIR_UP, npc_check_flag)) {
|
|
return mFI_MOVEDIR_UP;
|
|
}
|
|
} else {
|
|
return mFI_MOVEDIR_UP;
|
|
}
|
|
}
|
|
}
|
|
|
|
else if (move_percentY < -stick_range &&
|
|
((-angle_range < (int)angle_y && (int)angle_y <= DEG2SHORT_ANGLE2(0.0f)) ||
|
|
(int)angle_y >= DEG2SHORT_ANGLE2(0.0f) && (int)angle_y < angle_range) &&
|
|
mFI_ScrollCheck(*pos_p, mFI_MOVEDIR_DOWN)) {
|
|
f32 border_z = (mFI_BK_WORLDSIZE_Z_F - 18.0f);
|
|
|
|
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO) {
|
|
border_z -= mFI_UNIT_BASE_SIZE_F;
|
|
}
|
|
|
|
if (local_pos.z >= border_z) {
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
if (Player_actor_CheckAbleMoveWadeBG(game, pos_p, mFI_MOVEDIR_DOWN, npc_check_flag)) {
|
|
return mFI_MOVEDIR_DOWN;
|
|
}
|
|
} else {
|
|
return mFI_MOVEDIR_DOWN;
|
|
}
|
|
}
|
|
}
|
|
|
|
return mFI_MOVEDIR_NONE;
|
|
}
|
|
|
|
static int Player_actor_CheckAbleMoveDemoWadeBlock(ACTOR* actorx) {
|
|
if (actorx->speed != 0.0f) {
|
|
xyz_t local_pos;
|
|
s16 angle_y = actorx->shape_info.rotation.y;
|
|
f32 dir_x = sin_s(angle_y);
|
|
f32 dir_z = cos_s(angle_y);
|
|
|
|
mFI_WpostoLposInBK(&local_pos, actorx->world.position);
|
|
|
|
if (dir_x > 0.0f && local_pos.x >= (mFI_BK_WORLDSIZE_X_F - 18.0f)) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_RIGHT)) {
|
|
return mFI_MOVEDIR_RIGHT;
|
|
}
|
|
}
|
|
|
|
if (dir_x < 0.0f && local_pos.x <= (18.0f)) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_LEFT)) {
|
|
return mFI_MOVEDIR_LEFT;
|
|
}
|
|
}
|
|
|
|
if (dir_z < 0.0f && local_pos.z <= (18.0f)) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_UP)) {
|
|
return mFI_MOVEDIR_UP;
|
|
}
|
|
}
|
|
|
|
if (dir_z > 0.0f && local_pos.z >= (mFI_BK_WORLDSIZE_Z_F - 18.0f)) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_DOWN)) {
|
|
return mFI_MOVEDIR_DOWN;
|
|
}
|
|
}
|
|
}
|
|
|
|
return mFI_MOVEDIR_NONE;
|
|
}
|
|
|
|
static int Player_actor_CheckAbleMoveDemoWadeBoatBlock(ACTOR* actorx, s16 angle_y, f32 border_start) {
|
|
xyz_t local_pos;
|
|
f32 dir_z;
|
|
|
|
dir_z = cos_s(angle_y);
|
|
mFI_WpostoLposInBK(&local_pos, actorx->world.position);
|
|
|
|
if (dir_z < 0.0f && local_pos.z <= border_start) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_UP)) {
|
|
return mFI_MOVEDIR_UP;
|
|
}
|
|
}
|
|
|
|
if (dir_z > 0.0f && local_pos.z >= (mFI_BK_WORLDSIZE_Z_F - border_start)) {
|
|
if (mFI_ScrollCheck(actorx->world.position, mFI_MOVEDIR_DOWN)) {
|
|
return mFI_MOVEDIR_DOWN;
|
|
}
|
|
}
|
|
|
|
return mFI_MOVEDIR_NONE;
|
|
}
|
|
|
|
static void Player_actor_CorrectWadeBlockBorder(ACTOR* actorx) {
|
|
mCoBG_UniqueWallCheck(actorx, 18.0f, 0.0f);
|
|
}
|
|
|
|
/* Animation */
|
|
|
|
static void Player_actor_DMA_Animation(ACTOR* actorx, GAME* game, int anim0_idx, int anim1_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (anim0_idx >= 0 && anim0_idx != player->animation0_idx) {
|
|
player->animation0_idx = anim0_idx;
|
|
}
|
|
|
|
if (anim1_idx >= 0 && anim1_idx != player->animation1_idx) {
|
|
player->animation1_idx = anim1_idx;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_DMA_PartTable(ACTOR* actorx, int part_table_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (part_table_idx != player->part_table_idx) {
|
|
player->part_table_idx = part_table_idx;
|
|
mPlib_DMA_player_Part_Table(player->part_table, part_table_idx);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_CulcAnimation_Base(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s8* part_table = player->part_table;
|
|
|
|
if (part_table == NULL) {
|
|
return cKF_STATE_NONE;
|
|
}
|
|
|
|
return cKF_SkeletonInfo_R_combine_play(&player->keyframe0, &player->keyframe1, part_table);
|
|
}
|
|
|
|
static int Player_actor_CulcAnimation_Base2(ACTOR* actorx, f32* last_anim0_current_frame_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
cKF_FrameControl_c* fc0_p = &kf0_p->frame_control;
|
|
cKF_SkeletonInfo_R_c* kf1_p = &player->keyframe1;
|
|
cKF_FrameControl_c* fc1_p = &kf1_p->frame_control;
|
|
|
|
*last_anim0_current_frame_p = fc0_p->current_frame;
|
|
if (Player_actor_CulcAnimation_Base(actorx) == cKF_STATE_STOPPED) {
|
|
if (fc0_p->speed == 0.0f) {
|
|
return TRUE; /* Animation has stopped */
|
|
}
|
|
|
|
fc0_p->speed = 0.0f;
|
|
fc1_p->speed = 0.0f;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CulcAnimation_Base3(ACTOR* actorx, f32* last_anim0_current_frame_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
cKF_FrameControl_c* fc0_p = &kf0_p->frame_control;
|
|
|
|
*last_anim0_current_frame_p = fc0_p->current_frame;
|
|
if (Player_actor_CulcAnimation_Base(actorx) == cKF_STATE_STOPPED) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckContinueAnimation(ACTOR* actorx, int anim0_idx, int anim1_idx, f32* anim0_frame_p,
|
|
f32* anim1_frame_p, f32* morph_counter_p, int part_table_idx,
|
|
int continue_flag) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int now_anim0_idx;
|
|
int now_anim1_idx;
|
|
f32 now_frame0;
|
|
f32 now_frame1;
|
|
|
|
if (continue_flag == FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (player->keyframe0.morph_counter != 0.0f) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (*morph_counter_p >= 0.0f) {
|
|
return FALSE;
|
|
}
|
|
|
|
now_anim0_idx = player->animation0_idx;
|
|
now_anim1_idx = player->animation1_idx;
|
|
if (anim0_idx != now_anim0_idx || anim1_idx != now_anim1_idx) {
|
|
return FALSE;
|
|
}
|
|
|
|
now_frame0 = *anim0_frame_p;
|
|
now_frame1 = *anim1_frame_p;
|
|
if (now_frame0 != 1.0f || now_frame1 != 1.0f) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (anim0_idx == mPlayer_ANIM_WAIT1) {
|
|
if (part_table_idx == mPlayer_PART_TABLE_NORMAL && anim1_idx != mPlayer_ANIM_WAIT1) {
|
|
return FALSE;
|
|
}
|
|
} else {
|
|
return FALSE;
|
|
}
|
|
|
|
*anim0_frame_p = player->keyframe0.frame_control.current_frame;
|
|
*anim1_frame_p = player->keyframe1.frame_control.current_frame;
|
|
*morph_counter_p = 0.0f;
|
|
return TRUE;
|
|
}
|
|
|
|
static void Player_actor_InitAnimation_Base1(ACTOR* actorx, GAME* game, int anim0_idx, int anim1_idx, f32 anim0_frame,
|
|
f32 anim1_frame, f32 frame_speed, f32 morph_counter, int part_table_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p;
|
|
cKF_SkeletonInfo_R_c* kf1_p;
|
|
|
|
Player_actor_CheckContinueAnimation(actorx, anim0_idx, anim1_idx, &anim0_frame, &anim1_frame, &morph_counter,
|
|
part_table_idx, TRUE);
|
|
Player_actor_DMA_PartTable(actorx, part_table_idx);
|
|
Player_actor_DMA_Animation(actorx, game, anim0_idx, anim1_idx);
|
|
|
|
kf0_p = &player->keyframe0;
|
|
kf1_p = &player->keyframe1;
|
|
|
|
if (anim0_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_standard_repeat_setframeandspeedandmorph(kf0_p, mPlib_Get_Pointer_Animation(anim0_idx),
|
|
NULL, anim0_frame, frame_speed, morph_counter);
|
|
} else {
|
|
kf0_p->morph_counter = morph_counter;
|
|
}
|
|
|
|
if (anim1_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_standard_repeat_setframeandspeedandmorph(kf1_p, mPlib_Get_Pointer_Animation(anim1_idx),
|
|
NULL, anim1_frame, frame_speed, morph_counter);
|
|
} else {
|
|
kf1_p->morph_counter = morph_counter;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_InitAnimation_Base2(ACTOR* actorx, GAME* game, int anim0_idx, int anim1_idx, f32 anim0_frame,
|
|
f32 anim1_frame, f32 frame_speed, f32 morph_counter, int mode,
|
|
int part_table_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p;
|
|
cKF_SkeletonInfo_R_c* kf1_p;
|
|
|
|
Player_actor_CheckContinueAnimation(actorx, anim0_idx, anim1_idx, &anim0_frame, &anim1_frame, &morph_counter,
|
|
part_table_idx, TRUE);
|
|
Player_actor_DMA_Animation(actorx, game, anim0_idx, anim1_idx);
|
|
Player_actor_DMA_PartTable(actorx, part_table_idx);
|
|
|
|
kf0_p = &player->keyframe0;
|
|
kf1_p = &player->keyframe1;
|
|
|
|
if (anim0_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_standard_setframeandspeedandmorphandmode(
|
|
kf0_p, mPlib_Get_Pointer_Animation(anim0_idx), NULL, anim0_frame, frame_speed, morph_counter, mode);
|
|
} else {
|
|
kf0_p->morph_counter = morph_counter;
|
|
}
|
|
|
|
if (anim1_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_standard_setframeandspeedandmorphandmode(
|
|
kf1_p, mPlib_Get_Pointer_Animation(anim1_idx), NULL, anim1_frame, frame_speed, morph_counter, mode);
|
|
} else {
|
|
kf1_p->morph_counter = morph_counter;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_InitAnimation_Base3(ACTOR* actorx, GAME* game, int anim0_idx, int anim1_idx, f32 frame_speed,
|
|
f32 morph_counter, int mode, int part_table_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p;
|
|
cKF_SkeletonInfo_R_c* kf1_p;
|
|
|
|
Player_actor_DMA_Animation(actorx, game, anim0_idx, anim1_idx);
|
|
Player_actor_DMA_PartTable(actorx, part_table_idx);
|
|
|
|
kf0_p = &player->keyframe0;
|
|
kf1_p = &player->keyframe1;
|
|
|
|
/* @BUG - shouldn't this be checking anim0_idx ?? */
|
|
if (anim1_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_reverse_setspeedandmorphandmode(kf0_p, mPlib_Get_Pointer_Animation(anim0_idx), NULL,
|
|
frame_speed, morph_counter, mode);
|
|
} else {
|
|
kf0_p->morph_counter = morph_counter;
|
|
}
|
|
|
|
if (anim1_idx >= 0) {
|
|
cKF_SkeletonInfo_R_init_reverse_setspeedandmorphandmode(kf1_p, mPlib_Get_Pointer_Animation(anim1_idx), NULL,
|
|
frame_speed, morph_counter, mode);
|
|
} else {
|
|
kf1_p->morph_counter = morph_counter;
|
|
}
|
|
}
|
|
|
|
/* Collision */
|
|
|
|
static void Player_actor_Get_player_move_position(ACTOR* actorx, xyz_t* pos_p) {
|
|
*pos_p = actorx->world.position;
|
|
}
|
|
|
|
// clang-format off
|
|
static ClObjPipeData_c Player_actor_OcInfoData_forStand = {
|
|
{ 0x39, 0x08, ClObj_TYPE_PIPE }, /* ClObjData_c */
|
|
{ 0x01 }, /* ClObjElemData_c */
|
|
{ { 20, 60, 0, { 0, 0, 0 } } }, /* ClObjPipeAttrData_c */
|
|
};
|
|
// clang-format on
|
|
|
|
// clang-format off
|
|
static ClObjTrisElemData_c Player_actor_pclobj_tris_base_forItem[1] = {
|
|
{
|
|
{ 0x00 }, /* ClObjElemData_c */
|
|
{ { { -70.0f, 176.0f, 0.0f }, { -70.0f, -4.0f, 0.0f }, { 0.0f, -4.0f, 30.0f } } }, /* ClObjTrisElemAttrData_c */
|
|
},
|
|
};
|
|
// clang-format on
|
|
|
|
// clang-format off
|
|
static ClObjTrisData_c Player_actor_pclobj_tris_data_forItem = {
|
|
{ 0x30, 0x02, ClObj_TYPE_TRIS }, /* ClObjData_c */
|
|
1, /* num */
|
|
Player_actor_pclobj_tris_base_forItem, /* data */
|
|
};
|
|
// clang-format on
|
|
|
|
static void Player_actor_ct_forCorect(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjPipe_c* col_pipe_p = &player->col_pipe;
|
|
ClObjTris_c* axe_tris_p = &player->item_axe_tris;
|
|
ClObjTris_c* net_tris_p = &player->item_net_tris;
|
|
|
|
/* Collision Pipe */
|
|
ClObjPipe_ct(game, col_pipe_p);
|
|
ClObjPipe_set5(game, col_pipe_p, actorx, &Player_actor_OcInfoData_forStand);
|
|
|
|
/* Axe Collision */
|
|
ClObjTris_ct(game, axe_tris_p);
|
|
ClObjTris_set5_nzm(game, axe_tris_p, actorx, &Player_actor_pclobj_tris_data_forItem,
|
|
player->item_axe_tris_elem_tbl);
|
|
|
|
/* Net Collision */
|
|
ClObjTris_ct(game, net_tris_p);
|
|
ClObjTris_set5_nzm(game, net_tris_p, actorx, &Player_actor_pclobj_tris_data_forItem,
|
|
player->item_net_tris_elem_tbl);
|
|
}
|
|
|
|
static void Player_actor_dt_forCorect(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjPipe_c* col_pipe_p = &player->col_pipe;
|
|
ClObjTris_c* axe_tris_p = &player->item_axe_tris;
|
|
ClObjTris_c* net_tris_p = &player->item_net_tris;
|
|
|
|
ClObjPipe_dt(game, col_pipe_p);
|
|
ClObjTris_dt_nzf(game, axe_tris_p);
|
|
ClObjTris_dt_nzf(game, net_tris_p);
|
|
}
|
|
|
|
static void Player_actor_Excute_Corect_forStand(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjPipe_c* col_pipe_p = &player->col_pipe;
|
|
ClObj_c* col_obj_p = &col_pipe_p->collision_obj;
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
CollisionCheck_c* col_check_p = &play->collision_check;
|
|
|
|
CollisionCheck_Uty_ActorWorldPosSetPipeC(actorx, col_pipe_p);
|
|
CollisionCheck_setOC(game, col_check_p, col_obj_p);
|
|
}
|
|
|
|
static void Player_actor_Excute_Corect_forBrake(ACTOR* actorx, GAME* game) {
|
|
f32 speed = actorx->speed;
|
|
u8* weight_p = &actorx->status_data.weight;
|
|
|
|
if (speed != 0.0f) {
|
|
*weight_p = 50;
|
|
} else {
|
|
*weight_p = MASSTYPE_HEAVY;
|
|
}
|
|
|
|
Player_actor_Excute_Corect_forStand(actorx, game);
|
|
}
|
|
|
|
static void Player_actor_Excute_Corect_forOutdoor(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
ClObjPipe_c* col_pipe_p = &player->col_pipe;
|
|
s_xyz* pipe_center_p = &col_pipe_p->attribute.pipe.center;
|
|
ClObj_c* col_obj_p = &col_pipe_p->collision_obj;
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
CollisionCheck_c* col_check_p = &play->collision_check;
|
|
xyz_t world_pos;
|
|
|
|
cKF_SkeletonInfo_R_AnimationMove_CulcTransToWorld(&world_pos, &actorx->world.position, 0.0f, 1000.0f, 0.0f,
|
|
actorx->shape_info.rotation.y, &actorx->scale, kf0_p,
|
|
cKF_ANIMATION_TRANS_XZ);
|
|
|
|
pipe_center_p->x = world_pos.x;
|
|
pipe_center_p->y = actorx->world.position.y;
|
|
pipe_center_p->z = world_pos.z;
|
|
|
|
CollisionCheck_setOC(game, col_check_p, col_obj_p);
|
|
}
|
|
|
|
static int Player_actor_Check_OBJtoLine_forItem_axe(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjTris_c* axe_tris_p = &player->item_axe_tris;
|
|
|
|
return axe_tris_p->collision_obj.collision_flags1 & (1 << 2);
|
|
}
|
|
|
|
static int Player_actor_Check_OBJtoLine_forItem_net(ACTOR* actorx, ACTOR** hit_actor) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjTris_c* net_tris_p = &player->item_net_tris;
|
|
|
|
if ((net_tris_p->collision_obj.collision_flags1 & (1 << 2)) == 0) {
|
|
*hit_actor = NULL;
|
|
return FALSE;
|
|
} else {
|
|
*hit_actor = net_tris_p->collision_obj.collided_actor;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetPosition_OBJtoLine_forItem(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ClObjTris_c* axe_tris_p = &player->item_axe_tris;
|
|
ClObjTris_c* net_tris_p = &player->item_net_tris;
|
|
|
|
/* Process axe collision */
|
|
{
|
|
xyz_t start_pos;
|
|
xyz_t right_pos;
|
|
xyz_t left_pos;
|
|
s16 angle_y = actorx->shape_info.rotation.y;
|
|
s16 right_angle_y = angle_y - DEG2SHORT_ANGLE2(8.0255126953125f);
|
|
s16 left_angle_y = angle_y + DEG2SHORT_ANGLE2(8.0255126953125f);
|
|
|
|
Player_actor_Get_player_move_position(actorx, &start_pos);
|
|
start_pos.y += 31.0f;
|
|
|
|
right_pos = start_pos;
|
|
right_pos.x += 35.0f * sin_s(right_angle_y);
|
|
right_pos.z += 35.0f * cos_s(right_angle_y);
|
|
|
|
left_pos = start_pos;
|
|
left_pos.x += 35.0f * sin_s(left_angle_y);
|
|
left_pos.z += 35.0f * cos_s(left_angle_y);
|
|
|
|
{
|
|
ClObjTrisElem_c* axe_tris_elem_p = axe_tris_p->elements;
|
|
ClObjTrisElemAttr_c* axe_tris_elem_attr_p = &axe_tris_elem_p->attribute;
|
|
xyz_t* vtx_tbl = axe_tris_elem_attr_p->tri.vtx;
|
|
|
|
vtx_tbl[0] = start_pos;
|
|
vtx_tbl[1] = right_pos;
|
|
vtx_tbl[2] = left_pos;
|
|
}
|
|
}
|
|
|
|
/* Process net collision */
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_SWING_NET) {
|
|
xyz_t* net_start_pos_p = &player->net_start_pos;
|
|
xyz_t* net_end_pos_p = &player->net_end_pos;
|
|
xyz_t net_top_pos = *net_end_pos_p;
|
|
|
|
net_top_pos.y += 10.0f;
|
|
|
|
{
|
|
ClObjTrisElem_c* net_tris_elem_p = net_tris_p->elements;
|
|
ClObjTrisElemAttr_c* net_tris_elem_attr_p = &net_tris_elem_p->attribute;
|
|
xyz_t* vtx_tbl = net_tris_elem_attr_p->tri.vtx;
|
|
|
|
vtx_tbl[0] = *net_start_pos_p;
|
|
vtx_tbl[1] = *net_end_pos_p;
|
|
vtx_tbl[2] = net_top_pos;
|
|
}
|
|
}
|
|
|
|
/* Update collision check */
|
|
{
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
CollisionCheck_c* col_check_p = &play->collision_check;
|
|
ClObj_c* axe_col_obj_p = &axe_tris_p->collision_obj;
|
|
ClObj_c* net_col_obj_p = &net_tris_p->collision_obj;
|
|
|
|
CollisionCheck_setOCC(game, col_check_p, axe_col_obj_p);
|
|
CollisionCheck_setOCC(game, col_check_p, net_col_obj_p);
|
|
}
|
|
}
|
|
|
|
static f32 Player_actor_Culc_over_speed_normalize_NoneZero(ACTOR* actorx, const xyz_t* pos_p) {
|
|
f32 over_speed_normalize;
|
|
xyz_t ground_norm;
|
|
|
|
mCoBG_GetBgNorm_FromWpos(&ground_norm, *pos_p);
|
|
over_speed_normalize = 1.0f;
|
|
|
|
if (ground_norm.x != 0.0f || ground_norm.z != 0.0f) {
|
|
xyz_t move_vec;
|
|
s16 angle_y = actorx->world.angle.y;
|
|
|
|
move_vec.x = sin_s(angle_y);
|
|
move_vec.z = cos_s(angle_y);
|
|
|
|
if (ground_norm.y != 0.0f) {
|
|
move_vec.y = (ground_norm.x * move_vec.x + ground_norm.z * move_vec.z) / -ground_norm.y;
|
|
|
|
if (move_vec.y > 0.0f) {
|
|
over_speed_normalize = Math3DVecLengthSquare(&move_vec);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (over_speed_normalize == 0.0f) {
|
|
over_speed_normalize = 1.0f;
|
|
}
|
|
|
|
return over_speed_normalize;
|
|
}
|
|
|
|
static void Player_actor_set_eye_PositionAndAngle(ACTOR* actorx) {
|
|
Actor_world_to_eye(actorx, 33.0f);
|
|
}
|
|
|
|
static void Player_actor_set_lean_angle(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
f32 speed;
|
|
f32 lean_angle;
|
|
|
|
speed = SQ(kf0_p->frame_control.speed) / 0.36f;
|
|
lean_angle = SQ(speed);
|
|
lean_angle = lean_angle * lean_angle * lean_angle * DEG2SHORT_ANGLE2(20.0f);
|
|
if (lean_angle > DEG2SHORT_ANGLE2(20.0f)) {
|
|
lean_angle = DEG2SHORT_ANGLE2(20.0f);
|
|
}
|
|
|
|
add_calc_short_angle2(&actorx->shape_info.rotation.x, lean_angle, 1.0f - sqrtf(0.5f), DEG2SHORT_ANGLE2(10.0f),
|
|
DEG2SHORT_ANGLE2(0.0f));
|
|
}
|
|
|
|
static void Player_actor_recover_lean_angle(ACTOR* actorx) {
|
|
add_calc_short_angle2(&actorx->shape_info.rotation.x, DEG2SHORT_ANGLE2(0.0f), 1.0f - sqrtf(0.5f),
|
|
DEG2SHORT_ANGLE2(10.0f), DEG2SHORT_ANGLE2(0.0f));
|
|
}
|
|
|
|
static const s16 Player_actor_wall_angle[] = {
|
|
DEG2SHORT_ANGLE2(-180.0f),
|
|
DEG2SHORT_ANGLE2(-90.0f),
|
|
DEG2SHORT_ANGLE2(0.0f),
|
|
DEG2SHORT_ANGLE2(90.0f),
|
|
};
|
|
|
|
static s16 Player_actor_Get_Angle_fromIndex(int idx) {
|
|
if (idx >= 0 && idx < aMR_CONTACT_DIR_NUM) {
|
|
return Player_actor_wall_angle[idx];
|
|
}
|
|
|
|
return DEG2SHORT_ANGLE2(0.0f);
|
|
}
|
|
|
|
static s16 Player_actor_Get_Angle_fromDirection(int direction) {
|
|
static const s16 angle[] = {
|
|
DEG2SHORT_ANGLE2(90.0f),
|
|
DEG2SHORT_ANGLE2(-90.0f),
|
|
DEG2SHORT_ANGLE2(-180.0f),
|
|
DEG2SHORT_ANGLE2(0.0f),
|
|
};
|
|
|
|
if (direction > mFI_MOVEDIR_NONE && direction < mFI_MOVEDIR_NUM) {
|
|
return angle[direction - mFI_MOVEDIR_RIGHT];
|
|
}
|
|
|
|
return DEG2SHORT_ANGLE2(0.0f);
|
|
}
|
|
|
|
static int Player_actor_Get_Direction_fromAngle(s16 angle) {
|
|
switch (angle) {
|
|
case DEG2SHORT_ANGLE2(90.0f):
|
|
return mFI_MOVEDIR_RIGHT;
|
|
case DEG2SHORT_ANGLE2(-90.0f):
|
|
return mFI_MOVEDIR_LEFT;
|
|
case DEG2SHORT_ANGLE2(-180.0f):
|
|
return mFI_MOVEDIR_UP;
|
|
case DEG2SHORT_ANGLE2(0.0f):
|
|
return mFI_MOVEDIR_DOWN;
|
|
default:
|
|
return mFI_MOVEDIR_NONE;
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Get_Index_fromAngle(s16 angle) {
|
|
int i;
|
|
|
|
for (i = 0; i < aMR_CONTACT_DIR_NUM; i++) {
|
|
if (angle == Player_actor_wall_angle[i]) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
return aMR_CONTACT_DIR_BACK;
|
|
}
|
|
|
|
static int Player_actor_RecieveDemoOrder_EffectOrder(void) {
|
|
int order = mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 0);
|
|
|
|
if (order > 0) {
|
|
mDemo_Set_OrderValue(mDemo_ORDER_PLAYER, 0, 0);
|
|
}
|
|
|
|
return order;
|
|
}
|
|
|
|
static s16 Player_actor_Get_ControllerAngle(GAME* game) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
int angle = DEG2SHORT_ANGLE2(270.0f) + (s16)Player_actor_GetController_move_angle() + (s16)getCamera2AngleY(play);
|
|
|
|
return angle;
|
|
}
|
|
|
|
static int Player_actor_Get_DiffWorldAngleToControllerAngle(ACTOR* actorx) {
|
|
s16 angle_y = actorx->world.angle.y;
|
|
s16 controller_y = DEG2SHORT_ANGLE2(90.0f) + Player_actor_GetController_move_angle();
|
|
int diff_y = (s16)(angle_y - controller_y);
|
|
|
|
diff_y = diff_y < 0 ? -diff_y : diff_y;
|
|
|
|
return diff_y;
|
|
}
|
|
|
|
static void Player_actor_putin(int slot, mActor_name_t item) {
|
|
if (slot >= 0) {
|
|
mPr_SetPossessionItem(Now_Private, slot, item, mPr_ITEM_COND_NORMAL);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_putin_item(int slot, mActor_name_t item, xyz_t* pos_p) {
|
|
Player_actor_putin(slot, item);
|
|
|
|
if (pos_p != NULL) {
|
|
mFI_SetFG_common(EMPTY_NO, *pos_p, TRUE);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_putin_item_layer2(int slot, mActor_name_t item, xyz_t* pos_p) {
|
|
Player_actor_putin(slot, item);
|
|
|
|
if (pos_p != NULL) {
|
|
mFI_SetFG2(EMPTY_NO, *pos_p);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_putin_furniture(GAME* game, int slot, mActor_name_t item) {
|
|
if (!ITEM_IS_MYMANNIQUIN(item) && !ITEM_IS_MYUMBRELLA(item)) {
|
|
Player_actor_putin(slot, item);
|
|
}
|
|
|
|
if (Common_Get(clip).my_room_clip != NULL) {
|
|
Common_Get(clip).my_room_clip->ftr2itemBag_proc(game);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_AnimationFrame_PerfectEquel(ACTOR* actorx, f32 frame) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
cKF_FrameControl_c* fc_p = &kf0_p->frame_control;
|
|
f32 cur_frame = fc_p->current_frame;
|
|
|
|
return cur_frame == frame;
|
|
}
|
|
|
|
static int Player_actor_Check_AnimationFrame_Common(f32 cur_frame, f32 frame_speed, f32 end_frame, f32 target_frame) {
|
|
f32 last_frame = cur_frame - frame_speed;
|
|
|
|
if (frame_speed > 0.0f) {
|
|
if (last_frame < 1.0f) {
|
|
if (((end_frame + last_frame) - 1.0f < target_frame && target_frame <= end_frame) ||
|
|
(1.0f <= target_frame && target_frame <= cur_frame)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
if (last_frame < target_frame && target_frame <= cur_frame) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
} else if (frame_speed < 0.0f) {
|
|
if (last_frame > end_frame) {
|
|
if (((end_frame - last_frame) + 1.0f < target_frame && target_frame <= cur_frame) ||
|
|
(1.0f <= target_frame && target_frame <= cur_frame)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
if (cur_frame <= target_frame && target_frame < last_frame) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
} else {
|
|
if (cur_frame == target_frame) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_AnimationFrame(cKF_FrameControl_c* fc_p, f32 target_frame) {
|
|
f32 frame_speed = fc_p->speed;
|
|
f32 cur_frame = fc_p->current_frame;
|
|
f32 end_frame = fc_p->end_frame;
|
|
|
|
return Player_actor_Check_AnimationFrame_Common(cur_frame, frame_speed, end_frame, target_frame);
|
|
}
|
|
|
|
static int Player_actor_Check_TradingItemMode(u8 mode) {
|
|
if (Common_Get(clip).handOverItem_clip->request_mode == mode) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_CHange_TradingItemMode(ACTOR* actorx, u8 mode) {
|
|
Common_Get(clip).handOverItem_clip->chg_request_mode_proc(actorx, mode);
|
|
}
|
|
|
|
static void Player_actor_Set_item_matrix_set(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->item_matrix_set = TRUE;
|
|
}
|
|
|
|
static void Player_actor_Unset_item_matrix_set(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->item_matrix_set = FALSE;
|
|
}
|
|
|
|
static void Player_actor_Change_ItemParent(ACTOR* actor) {
|
|
ACTOR* item_actor = Common_Get(clip).handOverItem_clip->chg_master_proc(actor);
|
|
|
|
if (item_actor != NULL) {
|
|
Common_Get(clip).handOverItem_clip->chg_request_mode_proc(actor, aHOI_REQUEST_GET_PULL);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_ItemParent(ACTOR* actor) {
|
|
return Common_Get(clip).handOverItem_clip->master_actor == actor;
|
|
}
|
|
|
|
static void Player_actor_Birth_TradingItem(ACTOR* actor, mActor_name_t item, int mode, int present_flag) {
|
|
if (Common_Get(clip).handOverItem_clip != NULL) {
|
|
ACTOR* item_actor = Common_Get(clip).handOverItem_clip->birth_proc(item, mode, present_flag, actor);
|
|
|
|
if (item_actor != NULL) {
|
|
Player_actor_CHange_TradingItemMode(actor, aHOI_REQUEST_TRANSFER);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_ItemBank_ct(ACTOR* actorx, GAME* game) {
|
|
// stubbed
|
|
}
|
|
|
|
static int Player_actor_Change_ItemBank(ACTOR* actorx, int item_idx, int anim_idx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int last_bank = player->item_bank_idx;
|
|
int cur_bank_idx = last_bank ^ 1;
|
|
int last_item_idx = player->item_shape_type[cur_bank_idx];
|
|
int res = FALSE;
|
|
|
|
player->item_bank_idx = cur_bank_idx;
|
|
|
|
if (item_idx >= 0) {
|
|
if (item_idx != last_item_idx) {
|
|
player->item_shape_type[cur_bank_idx] = item_idx;
|
|
}
|
|
} else {
|
|
player->item_shape_type[cur_bank_idx] = -1;
|
|
player->item_shape_segaddr[cur_bank_idx] = 0;
|
|
}
|
|
|
|
if (anim_idx >= 0) {
|
|
if (anim_idx != player->item_animation_idx[cur_bank_idx]) {
|
|
player->item_animation_idx[cur_bank_idx] = anim_idx;
|
|
}
|
|
|
|
if (player->item_animation_idx[cur_bank_idx] == player->item_animation_idx[cur_bank_idx ^ 1]) {
|
|
res = TRUE;
|
|
}
|
|
} else {
|
|
player->item_anim_addr[cur_bank_idx] = 0;
|
|
player->item_anim_segaddr[cur_bank_idx] = 0;
|
|
player->item_animation_idx[cur_bank_idx] = -1;
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
static void Player_actor_Set_OldAngle(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s_xyz* world_angle_p = &actorx->world.angle;
|
|
s_xyz* shape_rot_p = &actorx->shape_info.rotation;
|
|
s_xyz* old_world_angle_p = &player->old_world_angle;
|
|
s_xyz* old_shape_angle_p = &player->old_shape_angle;
|
|
|
|
player->world_angle_delta.x = (s16)(world_angle_p->x - old_world_angle_p->x);
|
|
player->world_angle_delta.y = (s16)(world_angle_p->y - old_world_angle_p->y);
|
|
player->world_angle_delta.z = (s16)(world_angle_p->z - old_world_angle_p->z);
|
|
|
|
player->shape_angle_delta.x = (s16)(shape_rot_p->x - old_shape_angle_p->x);
|
|
player->shape_angle_delta.y = (s16)(shape_rot_p->y - old_shape_angle_p->y);
|
|
player->shape_angle_delta.z = (s16)(shape_rot_p->z - old_shape_angle_p->z);
|
|
|
|
*old_world_angle_p = *world_angle_p;
|
|
*old_shape_angle_p = *shape_rot_p;
|
|
}
|
|
|
|
static void Player_actor_Reset_Item_net_catch_request_table(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->item_net_catch_request_use_count = 0;
|
|
player->item_net_catch_label_request_force = 0;
|
|
}
|
|
|
|
static int Player_actor_Set_Item_net_catch_request_table(ACTOR* actorx, GAME* game, u32 label, s8 type,
|
|
const xyz_t* pos_p, f32 radius) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_SWING_NET) {
|
|
int catch_num = player->item_net_catch_request_use_count;
|
|
|
|
if ((catch_num >= 0 && catch_num < mPlayer_NET_CATCH_TABLE_COUNT) &&
|
|
(type >= 0 && type < mPlayer_NET_CATCH_TYPE_NUM) && pos_p != NULL && 0.0f <= radius) {
|
|
player->item_net_catch_label_request_table[catch_num] = label;
|
|
player->item_net_catch_type_request_table[catch_num] = type;
|
|
player->item_net_catch_pos_request_table[catch_num] = *pos_p;
|
|
player->item_net_catch_radius_request_table[catch_num] = radius;
|
|
player->item_net_catch_request_use_count = catch_num + 1;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Set_Item_net_catch_request_force(ACTOR* actorx, GAME* game, u32 label, s8 type) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_SWING_NET &&
|
|
player->item_net_catch_label_request_force == 0) {
|
|
player->item_net_catch_label_request_force = label;
|
|
player->item_net_catch_type_request_force = type;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static f32 Player_actor_Get_Item_net_catch_swing_timer(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_SWING_NET) {
|
|
return player->main_data.swing_net.swing_timer;
|
|
}
|
|
|
|
return 0.0f;
|
|
}
|
|
|
|
static void Player_actor_DisappearShadow_fromAnimationFrame(ACTOR* actorx, f32 start_frame, f32 end_frame) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32 cur_frame = player->keyframe0.frame_control.current_frame;
|
|
|
|
if (cur_frame < start_frame) {
|
|
return;
|
|
}
|
|
|
|
if (cur_frame < end_frame) {
|
|
f32 p = 1.0f - ((cur_frame - start_frame) - 1.0f) / ((end_frame - start_frame) - 1.0f);
|
|
|
|
if (p < 0.0f) {
|
|
p = 0.0f;
|
|
} else if (p > 1.0f) {
|
|
p = 1.0f;
|
|
}
|
|
|
|
actorx->shape_info.shadow_size_change_rate = p;
|
|
actorx->shape_info.shadow_alpha_change_rate = p;
|
|
} else {
|
|
actorx->shape_info.shadow_size_change_rate = 0.0f;
|
|
actorx->shape_info.shadow_alpha_change_rate = 0.0f;
|
|
actorx->shape_info.draw_shadow = FALSE;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_AppearShadow_fromAnimationFrame(ACTOR* actorx, f32 appear_start_frame, f32 appear_end_frame) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32 cur_frame = player->keyframe0.frame_control.current_frame;
|
|
f32 end_frame = player->keyframe0.frame_control.end_frame;
|
|
|
|
if (cur_frame > end_frame - appear_end_frame) {
|
|
actorx->shape_info.shadow_size_change_rate = 1.0f;
|
|
actorx->shape_info.shadow_alpha_change_rate = 1.0f;
|
|
} else if (cur_frame > (end_frame - appear_start_frame) - appear_end_frame) {
|
|
f32 p = 1.0f - ((end_frame - cur_frame) - appear_end_frame) / (appear_start_frame - 1.0f);
|
|
|
|
if (p < 0.0f) {
|
|
p = 0.0f;
|
|
} else if (p > 1.0f) {
|
|
p = 1.0f;
|
|
}
|
|
|
|
actorx->shape_info.shadow_size_change_rate = p;
|
|
actorx->shape_info.shadow_alpha_change_rate = p;
|
|
} else {
|
|
actorx->shape_info.shadow_size_change_rate = 0.0f;
|
|
actorx->shape_info.shadow_alpha_change_rate = 0.0f;
|
|
actorx->shape_info.draw_shadow = TRUE;
|
|
}
|
|
}
|
|
|
|
static u32 Player_actor_get_door_label(GAME* game) {
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_DOOR) {
|
|
return GET_PLAYER_ACTOR_GAME(game)->main_data.door.label;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void Player_actor_BGcheck_common_type1(ACTOR* actorx) {
|
|
mCoBG_BgCheckControll(NULL, actorx, 18.0f, 0.0f, TRUE, FALSE, 1);
|
|
Player_actor_CorrectWadeBlockBorder(actorx);
|
|
}
|
|
|
|
static void Player_actor_BGcheck_common_type2(ACTOR* actorx) {
|
|
mCoBG_BgCheckControll(NULL, actorx, 18.0f, 0.0f, TRUE, FALSE, 1);
|
|
}
|
|
|
|
static void Player_actor_BGcheck_common_type3(ACTOR* actorx) {
|
|
mCoBG_GroundCheckOnly(NULL, actorx, 18.0f, 0.0f, 0);
|
|
}
|
|
|
|
static void Player_actor_Set_force_position_angle(GAME* game, const xyz_t* pos_p, const s_xyz* angle_p, u8 flags) {
|
|
if (flags != mPlayer_FORCE_POSITION_ANGLE_NONE) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (pos_p != NULL) {
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSX)) {
|
|
player->force_position.x = pos_p->x;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSY)) {
|
|
player->force_position.y = pos_p->y;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSZ)) {
|
|
player->force_position.z = pos_p->z;
|
|
}
|
|
}
|
|
|
|
if (angle_p != NULL) {
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTX)) {
|
|
player->force_angle.x = angle_p->x;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTY)) {
|
|
player->force_angle.y = angle_p->y;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTZ)) {
|
|
player->force_angle.z = angle_p->z;
|
|
}
|
|
}
|
|
|
|
player->force_position_angle_flag |= flags;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Reset_force_position_angle(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->force_position_angle_flag = mPlayer_FORCE_POSITION_ANGLE_NONE;
|
|
}
|
|
|
|
static u8 Player_actor_Get_force_position_angle(GAME* game, xyz_t* pos_p, s_xyz* angle_p) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
u8 flags = player->force_position_angle_flag;
|
|
|
|
if (flags != mPlayer_FORCE_POSITION_ANGLE_NONE) {
|
|
if (pos_p != NULL) {
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSX)) {
|
|
pos_p->x = player->force_position.x;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSY)) {
|
|
pos_p->y = player->force_position.y;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_POSZ)) {
|
|
pos_p->z = player->force_position.z;
|
|
}
|
|
}
|
|
|
|
if (angle_p != NULL) {
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTX)) {
|
|
angle_p->x = player->force_angle.x;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTY)) {
|
|
angle_p->y = player->force_angle.y;
|
|
}
|
|
|
|
if ((flags & mPlayer_FORCE_POSITION_ANGLE_ROTZ)) {
|
|
angle_p->z = player->force_angle.z;
|
|
}
|
|
}
|
|
}
|
|
|
|
return flags;
|
|
}
|
|
|
|
static void Player_actor_Reinput_force_position_angle(ACTOR* actorx, GAME* game) {
|
|
Player_actor_Get_force_position_angle(game, &actorx->world.position, &actorx->world.angle);
|
|
Player_actor_Get_force_position_angle(game, NULL, &actorx->shape_info.rotation);
|
|
Player_actor_Reset_force_position_angle(actorx);
|
|
}
|
|
|
|
static int Player_actor_Get_DemoOrder(void) {
|
|
return mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 1);
|
|
}
|
|
|
|
static void Player_actor_Set_DemoOrder(u16 value) {
|
|
mDemo_Set_OrderValue(mDemo_ORDER_PLAYER, 1, value);
|
|
}
|
|
|
|
static void Player_actor_Get_DemoPosition(xyz_t* pos_p) {
|
|
f32 x = (s16)mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 2);
|
|
f32 y = (s16)mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 3);
|
|
f32 z = (s16)mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 4);
|
|
|
|
pos_p->x = x;
|
|
pos_p->y = y;
|
|
pos_p->z = z;
|
|
}
|
|
|
|
static int Player_actor_Get_DemoChangeAngleY(void) {
|
|
return mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 5);
|
|
}
|
|
|
|
static void Player_actor_Set_DemoChangeAngleY(u16 value) {
|
|
mDemo_Set_OrderValue(mDemo_ORDER_PLAYER, 5, value);
|
|
}
|
|
|
|
static s16 Player_actor_Get_DemoAngleY(void) {
|
|
return (s16)mDemo_Get_OrderValue(mDemo_ORDER_PLAYER, 6);
|
|
}
|
|
|
|
static int Player_actor_CheckScene_AbleOutItem(int scene_no) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
if (!(scene_no >= 0 && scene_no < SCENE_NUM)) {
|
|
return FALSE;
|
|
}
|
|
|
|
return data[scene_no];
|
|
}
|
|
|
|
static int Player_actor_CheckPlayer_AbleOutItem(int main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) == FALSE) {
|
|
return mPlayer_ABLE_ITEM_CAN_USE_ALL;
|
|
} else {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_RESTRICTED,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[main_index];
|
|
}
|
|
}
|
|
|
|
static int Player_actor_CheckPlayer_AbleLoadItem(int main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) == FALSE) {
|
|
return mPlayer_ABLE_ITEM_CAN_USE_ALL;
|
|
} else {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_NONE,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_ALL,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[main_index];
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_is_demo_mode(int main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[main_index];
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_axe_after(ACTOR* actorx, xyz_t* target_pos_p, mActor_name_t* fg_p,
|
|
ACTOR** reflect_actor_pp) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
*fg_p = EMPTY_NO;
|
|
*reflect_actor_pp = NULL;
|
|
|
|
if (Player_actor_Check_OBJtoLine_forItem_axe(actorx)) {
|
|
ClObjTris_c* axe_tris_p = &player->item_axe_tris;
|
|
ClObjTrisElem_c* axe_tris_elem_p = axe_tris_p->elements;
|
|
ClObjTrisElemAttr_c* axe_tris_elem_attr_p = &axe_tris_elem_p->attribute;
|
|
xyz_t* cross_p = &axe_tris_elem_attr_p->t;
|
|
ACTOR* reflect_actor = axe_tris_p->collision_obj.collided_actor;
|
|
|
|
*target_pos_p = *cross_p;
|
|
*reflect_actor_pp = reflect_actor;
|
|
|
|
if (reflect_actor != NULL) {
|
|
if (reflect_actor->id == mAc_PROFILE_BALL) {
|
|
if (reflect_actor->speed == 0.0f) {
|
|
return mPlayer_AXE_HIT_REFLECT;
|
|
}
|
|
} else {
|
|
return mPlayer_AXE_HIT_REFLECT;
|
|
}
|
|
} else {
|
|
return mPlayer_AXE_HIT_REFLECT;
|
|
}
|
|
}
|
|
|
|
{
|
|
xyz_t* unit_center_p;
|
|
s16 player_angle_y = actorx->shape_info.rotation.y;
|
|
xyz_t player_move_pos;
|
|
int player_pos_x;
|
|
int player_pos_z;
|
|
xyz_t unit_center_pos[8];
|
|
xyz_t unit_pos[8];
|
|
int unit_exist_table[8];
|
|
int unit_center_angle_table[8];
|
|
f32 unit_center_dist_table[8];
|
|
int unit_count;
|
|
int i;
|
|
int right_idx = -1;
|
|
int left_idx = -1;
|
|
int up_idx = -1;
|
|
int down_idx = -1;
|
|
f32 x;
|
|
f32 z;
|
|
|
|
Player_actor_Get_player_move_position(actorx, &player_move_pos);
|
|
player_pos_x = (int)(player_move_pos.x / mFI_UT_WORLDSIZE_X_F);
|
|
player_pos_z = (int)(player_move_pos.z / mFI_UT_WORLDSIZE_Z_F);
|
|
|
|
x = player_pos_x * mFI_UT_WORLDSIZE_X_F;
|
|
z = player_pos_z * mFI_UT_WORLDSIZE_Z_F;
|
|
|
|
if (x == player_move_pos.x && z == player_move_pos.z) {
|
|
return 0;
|
|
} else if (x == player_move_pos.x) {
|
|
unit_count = 4;
|
|
unit_pos[0].x = unit_pos[2].x = player_move_pos.x + mFI_UT_WORLDSIZE_HALF_X_F;
|
|
unit_pos[1].x = unit_pos[3].x = player_move_pos.x - mFI_UT_WORLDSIZE_HALF_X_F;
|
|
unit_pos[0].z = unit_pos[1].z = player_move_pos.z - mFI_UT_WORLDSIZE_Z_F;
|
|
unit_pos[2].z = unit_pos[3].z = player_move_pos.z + mFI_UT_WORLDSIZE_Z_F;
|
|
} else if (z == player_move_pos.z) {
|
|
unit_count = 4;
|
|
unit_pos[0].x = unit_pos[2].x = player_move_pos.x + mFI_UT_WORLDSIZE_X_F;
|
|
unit_pos[1].x = unit_pos[3].x = player_move_pos.x - mFI_UT_WORLDSIZE_X_F;
|
|
unit_pos[0].z = unit_pos[1].z = player_move_pos.z - mFI_UT_WORLDSIZE_HALF_Z_F;
|
|
unit_pos[2].z = unit_pos[3].z = player_move_pos.z + mFI_UT_WORLDSIZE_HALF_Z_F;
|
|
} else {
|
|
right_idx = 3;
|
|
left_idx = 4;
|
|
up_idx = 1;
|
|
down_idx = 6;
|
|
unit_count = 8;
|
|
|
|
unit_pos[6].x = player_move_pos.x;
|
|
unit_pos[1].x = player_move_pos.x;
|
|
unit_pos[4].z = player_move_pos.z;
|
|
unit_pos[0].x = unit_pos[3].x = unit_pos[5].x = player_move_pos.x - mFI_UT_WORLDSIZE_X_F;
|
|
unit_pos[2].x = unit_pos[4].x = unit_pos[7].x = player_move_pos.x + mFI_UT_WORLDSIZE_X_F;
|
|
unit_pos[0].z = unit_pos[1].z = unit_pos[2].z = player_move_pos.z - mFI_UT_WORLDSIZE_Z_F;
|
|
unit_pos[3].z = player_move_pos.z;
|
|
unit_pos[5].z = unit_pos[6].z = unit_pos[7].z = player_move_pos.z + mFI_UT_WORLDSIZE_Z_F;
|
|
}
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
unit_center_p = &unit_center_pos[i];
|
|
unit_exist_table[i] = mFI_Wpos2UtCenterWpos(unit_center_p, unit_pos[i]);
|
|
if (unit_exist_table[i] != FALSE) {
|
|
f32 dx = unit_center_p->x - player_move_pos.x;
|
|
f32 dz = unit_center_p->z - player_move_pos.z;
|
|
f32 dist_center = Math3DVecLength2D(dx, dz);
|
|
int angle_center = atans_table(dz, dx) - player_angle_y;
|
|
int abs_angle_center = ABS(angle_center);
|
|
|
|
if (abs_angle_center > DEG2SHORT_ANGLE2(180.0f)) {
|
|
abs_angle_center = DEG2SHORT_ANGLE2(360.0f) - abs_angle_center;
|
|
}
|
|
|
|
unit_center_angle_table[i] = abs_angle_center;
|
|
unit_center_dist_table[i] = dist_center;
|
|
}
|
|
}
|
|
|
|
{
|
|
int tree_exist_table[8] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE };
|
|
mActor_name_t tree_fg_table[8];
|
|
mActor_name_t* unit_fg_p;
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (unit_exist_table[i] != FALSE) {
|
|
unit_center_p = &unit_center_pos[i];
|
|
unit_fg_p = mFI_GetUnitFG(*unit_center_p);
|
|
|
|
if (unit_fg_p != NULL) {
|
|
mActor_name_t item = *unit_fg_p;
|
|
|
|
if (IS_ITEM_COLLIDEABLE_TREE(item) != FALSE || IS_ITEM_ROCK(item) != FALSE) {
|
|
f32 diff_y = mCoBG_GetBgY_OnlyCenter_FromWpos2(*unit_center_p, 0.0f) - player_move_pos.y;
|
|
f32 abs_diff_y = ABS(diff_y);
|
|
|
|
if (abs_diff_y < (mFI_UNIT_BASE_SIZE_F * 0.5f)) {
|
|
tree_fg_table[i] = item;
|
|
tree_exist_table[i] = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (tree_exist_table[i] != FALSE) {
|
|
if (unit_center_dist_table[i] > (mFI_UNIT_BASE_SIZE_F * 1.5f)) {
|
|
tree_exist_table[i] = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (tree_exist_table[i] != FALSE) {
|
|
if (unit_center_angle_table[i] > DEG2SHORT_ANGLE2(75.0f)) {
|
|
tree_exist_table[i] = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
int selected_idx = -1;
|
|
int min_angle_y = DEG2SHORT_ANGLE2(360.0f);
|
|
|
|
if (right_idx >= 0 && tree_exist_table[right_idx] != FALSE &&
|
|
min_angle_y > unit_center_angle_table[right_idx]) {
|
|
min_angle_y = unit_center_angle_table[right_idx];
|
|
selected_idx = right_idx;
|
|
}
|
|
|
|
if (left_idx >= 0 && tree_exist_table[left_idx] != FALSE &&
|
|
min_angle_y > unit_center_angle_table[left_idx]) {
|
|
min_angle_y = unit_center_angle_table[left_idx];
|
|
selected_idx = left_idx;
|
|
}
|
|
|
|
if (up_idx >= 0 && tree_exist_table[up_idx] != FALSE && min_angle_y > unit_center_angle_table[up_idx]) {
|
|
min_angle_y = unit_center_angle_table[up_idx];
|
|
selected_idx = up_idx;
|
|
}
|
|
|
|
if (down_idx >= 0 && tree_exist_table[down_idx] != FALSE &&
|
|
min_angle_y > unit_center_angle_table[down_idx]) {
|
|
min_angle_y = unit_center_angle_table[down_idx];
|
|
selected_idx = down_idx;
|
|
}
|
|
|
|
if (selected_idx >= 0) {
|
|
mActor_name_t item = tree_fg_table[selected_idx];
|
|
|
|
target_pos_p->x = unit_center_pos[selected_idx].x;
|
|
target_pos_p->y = player_move_pos.y;
|
|
target_pos_p->z = unit_center_pos[selected_idx].z;
|
|
*fg_p = item;
|
|
|
|
if (IS_ITEM_COLLIDEABLE_TREE(item) != FALSE) {
|
|
return mPlayer_AXE_HIT_TREE; /* Hit item was a tree */
|
|
} else {
|
|
return mPlayer_AXE_HIT_REFLECT; /* Hit item was a rock, reflect it */
|
|
}
|
|
} else {
|
|
int selected_idx = -1;
|
|
int min_angle_y = DEG2SHORT_ANGLE2(360.0f);
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (tree_exist_table[i] != FALSE && min_angle_y > unit_center_angle_table[i]) {
|
|
min_angle_y = unit_center_angle_table[i];
|
|
selected_idx = i;
|
|
}
|
|
}
|
|
|
|
if (selected_idx >= 0) {
|
|
mActor_name_t item = tree_fg_table[selected_idx];
|
|
|
|
target_pos_p->x = unit_center_pos[selected_idx].x;
|
|
target_pos_p->y = player_move_pos.y;
|
|
target_pos_p->z = unit_center_pos[selected_idx].z;
|
|
*fg_p = item;
|
|
|
|
if (IS_ITEM_COLLIDEABLE_TREE(item) != FALSE) {
|
|
return mPlayer_AXE_HIT_TREE; /* Hit item was a tree */
|
|
} else {
|
|
return mPlayer_AXE_HIT_REFLECT; /* Hit item was a rock, reflect it */
|
|
}
|
|
} else {
|
|
int exist_table[8] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE };
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (unit_exist_table[i] != FALSE) {
|
|
if (unit_center_dist_table[i] < (mFI_UNIT_BASE_SIZE_F * 1.5f)) {
|
|
exist_table[i] = TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (exist_table[i] != FALSE) {
|
|
if (unit_center_angle_table[i] > DEG2SHORT_ANGLE2(75.0f)) {
|
|
exist_table[i] = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
int selected_idx = -1;
|
|
int min_angle_y = DEG2SHORT_ANGLE2(360.0f);
|
|
|
|
for (i = 0; i < unit_count; i++) {
|
|
if (exist_table[i] != FALSE && min_angle_y > unit_center_angle_table[i]) {
|
|
min_angle_y = unit_center_angle_table[i];
|
|
selected_idx = i;
|
|
}
|
|
}
|
|
|
|
if (selected_idx >= 0) {
|
|
f32 bg_y = mCoBG_Wpos2BgUtCenterHeight_AddColumn(unit_center_pos[selected_idx]);
|
|
f32 diff_y = bg_y - player_move_pos.y;
|
|
|
|
if (diff_y >= 31.0f) {
|
|
target_pos_p->x = unit_center_pos[selected_idx].x;
|
|
target_pos_p->y = player_move_pos.y;
|
|
target_pos_p->z = unit_center_pos[selected_idx].z;
|
|
*reflect_actor_pp = NULL;
|
|
return mPlayer_AXE_HIT_REFLECT;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return mPlayer_AXE_HIT_NONE;
|
|
}
|
|
|
|
static mActor_name_t Player_actor_GetitemNo_forDamageAxe(mActor_name_t itemNo, int reflected) {
|
|
if (mEv_CheckTitleDemo() > 0) {
|
|
return itemNo;
|
|
}
|
|
|
|
if (IS_ITEM_AXE(itemNo) != FALSE) {
|
|
if (IS_ITEM_GOLDEN_TOOL(itemNo) == FALSE) {
|
|
// clang-format off
|
|
static mActor_name_t data[] = {
|
|
ITM_AXE_USE_1,
|
|
ITM_AXE_USE_2,
|
|
ITM_AXE_USE_3,
|
|
ITM_AXE_USE_4,
|
|
ITM_AXE_USE_5,
|
|
ITM_AXE_USE_6,
|
|
ITM_AXE_USE_7,
|
|
EMPTY_NO,
|
|
};
|
|
// clang-format on
|
|
|
|
int prev_damage;
|
|
int axe_damage;
|
|
int damage_idx;
|
|
|
|
switch (itemNo) {
|
|
case ITM_AXE:
|
|
damage_idx = 0;
|
|
break;
|
|
case ITM_AXE_USE_1:
|
|
damage_idx = 1;
|
|
break;
|
|
case ITM_AXE_USE_2:
|
|
damage_idx = 2;
|
|
break;
|
|
case ITM_AXE_USE_3:
|
|
damage_idx = 3;
|
|
break;
|
|
case ITM_AXE_USE_4:
|
|
damage_idx = 4;
|
|
break;
|
|
case ITM_AXE_USE_5:
|
|
damage_idx = 5;
|
|
break;
|
|
case ITM_AXE_USE_6:
|
|
damage_idx = 6;
|
|
break;
|
|
case ITM_AXE_USE_7:
|
|
damage_idx = 7;
|
|
break;
|
|
default:
|
|
return itemNo;
|
|
}
|
|
|
|
if (damage_idx < 0 || damage_idx >= 8) {
|
|
damage_idx = 7;
|
|
}
|
|
|
|
prev_damage = Common_Get(axe_damage);
|
|
if (reflected) {
|
|
axe_damage = prev_damage + 3;
|
|
} else {
|
|
axe_damage = prev_damage + 1;
|
|
}
|
|
|
|
Common_Set(axe_damage, axe_damage);
|
|
|
|
switch (axe_damage >= 9) {
|
|
default:
|
|
return data[damage_idx];
|
|
case FALSE:
|
|
return itemNo;
|
|
}
|
|
}
|
|
}
|
|
|
|
return itemNo;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_axe_all(GAME* game, int prio) {
|
|
xyz_t target_pos;
|
|
mActor_name_t item;
|
|
ACTOR* reflect_actor_p;
|
|
|
|
if (Player_actor_CheckController_forAxe(game)) {
|
|
int result =
|
|
Player_actor_Check_axe_after(GET_PLAYER_ACTOR_GAME_ACTOR(game), &target_pos, &item, &reflect_actor_p);
|
|
|
|
if (result == mPlayer_AXE_HIT_TREE) {
|
|
int tree_ut_x;
|
|
int tree_ut_z;
|
|
|
|
if (mFI_Wpos2UtNum(&tree_ut_x, &tree_ut_z, target_pos)) {
|
|
mActor_name_t damage_itemNo =
|
|
Player_actor_GetitemNo_forDamageAxe(Player_actor_Get_ItemNoSubmenu(), FALSE);
|
|
|
|
if (damage_itemNo == EMPTY_NO) {
|
|
return Player_actor_request_main_broken_axe_type_swing(game, &target_pos, item, tree_ut_x,
|
|
tree_ut_z, prio);
|
|
} else {
|
|
return Player_actor_request_main_swing_axe_all(game, &target_pos, item, damage_itemNo, tree_ut_x,
|
|
tree_ut_z, prio);
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
} else if (result == mPlayer_AXE_HIT_REFLECT) {
|
|
mActor_name_t damage_itemNo = Player_actor_GetitemNo_forDamageAxe(Player_actor_Get_ItemNoSubmenu(), TRUE);
|
|
|
|
if (damage_itemNo == EMPTY_NO) {
|
|
return Player_actor_request_main_broken_axe_type_reflect(game, &target_pos, item, reflect_actor_p,
|
|
prio);
|
|
} else {
|
|
return Player_actor_request_main_reflect_axe_all(game, &target_pos, item, damage_itemNo,
|
|
reflect_actor_p, prio);
|
|
}
|
|
} else {
|
|
return Player_actor_request_main_air_axe_all(game, prio);
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAbleSpeed_forItem(GAME* game) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_WALK:
|
|
case mPlayer_INDEX_RUN:
|
|
case mPlayer_INDEX_DASH:
|
|
if (player->keyframe0.frame_control.speed >= 0.5f) {
|
|
return FALSE;
|
|
}
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_umbrella_all(GAME* game, int prio) {
|
|
if (Player_actor_CheckController_forUmbrella(game) && Player_actor_CheckAbleSpeed_forItem(game)) {
|
|
return Player_actor_request_main_rotate_umbrella_all(game, prio);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_fan_all(GAME* game, int check_trigger, int param_2, int prio) {
|
|
if (Player_actor_CheckController_forFan(game, check_trigger) && Player_actor_CheckAbleSpeed_forItem(game)) {
|
|
return Player_actor_request_main_swing_fan_all(game, param_2, prio);
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_SetEffectStart_axe_common(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (Player_actor_Check_AnimationFrame(&player->keyframe0.frame_control, 12.0f)) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_SWING_AXE, actorx->world.position, 2, actorx->shape_info.rotation.y, game,
|
|
RSV_NO, actorx->bg_collision_check.result.unit_attribute, 1);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Get_WadeEndPos(GAME* game, xyz_t* end_pos_p) {
|
|
if (end_pos_p != NULL) {
|
|
if (Common_Get(player_actor_exists)) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_WADE) {
|
|
*end_pos_p = player->main_data.wade.end_pos;
|
|
return TRUE;
|
|
} else if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_DEMO_WADE) {
|
|
*end_pos_p = player->main_data.demo_wade.end_pos;
|
|
return TRUE;
|
|
} else if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_WADE_SNOWBALL) {
|
|
*end_pos_p = player->main_data.wade_snowball.end_pos;
|
|
return TRUE;
|
|
} else if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_DEMO_GETON_BOAT_WADE) {
|
|
*end_pos_p = player->main_data.demo_geton_boat_wade.end_pos;
|
|
return TRUE;
|
|
}
|
|
|
|
*end_pos_p = GET_PLAYER_ACTOR_GAME_ACTOR(game)->world.position;
|
|
} else {
|
|
*end_pos_p = ZeroVec;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Init_ScrollDemo_forWade(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_request_main_wade_all(gamePT, player->request_wade_dir, mPlayer_REQUEST_PRIORITY_2);
|
|
mPlib_strength_request_main_wade_priority(gamePT);
|
|
}
|
|
|
|
static void Player_actor_Init_ScrollDemo_forDemo_wade(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_request_main_demo_wade_all(gamePT, player->request_wade_dir, mPlayer_REQUEST_PRIORITY_19);
|
|
mPlib_strength_request_main_demo_wade_priority(gamePT);
|
|
}
|
|
|
|
static void Player_actor_Init_ScrollDemo_forDemo_geton_boat_wade(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_request_main_demo_geton_boat_wade_all(
|
|
gamePT, player->request_wade_dir, player->geton_boat_wade_border_start, mPlayer_REQUEST_PRIORITY_19);
|
|
mPlib_strength_request_main_demo_geton_boat_wade_priority(gamePT);
|
|
}
|
|
|
|
static void Player_actor_Init_ScrollDemo_forWade_snowball(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_request_main_wade_snowball_all(gamePT, player->request_wade_dir, &player->snowball_dist,
|
|
mPlayer_REQUEST_PRIORITY_2);
|
|
mPlib_strength_request_main_wade_snowball_priority(gamePT);
|
|
}
|
|
|
|
static int Player_actor_Set_ScrollDemo_forWade(ACTOR* actorx, GAME* game, int npc_check_flag) {
|
|
xyz_t* player_pos_p = &actorx->world.position;
|
|
s16 player_angle_y = actorx->shape_info.rotation.y;
|
|
int dir = Player_actor_CheckAbleMoveWadeBlock(game, player_pos_p, player_angle_y, 0.65f, DEG2SHORT_ANGLE2(40.0f),
|
|
npc_check_flag);
|
|
|
|
if (dir != mFI_MOVEDIR_NONE) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
player->request_wade_dir = dir;
|
|
mDemo_Request(mDemo_TYPE_SCROLL, actorx, &Player_actor_Init_ScrollDemo_forWade);
|
|
return TRUE;
|
|
}
|
|
|
|
player->cancel_wade_timer = player->player_frame_counter;
|
|
player->excute_cancel_wade = TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Set_ScrollDemo_forDemo_wade(ACTOR* actorx) {
|
|
int dir = Player_actor_CheckAbleMoveDemoWadeBlock(actorx);
|
|
|
|
if (dir != mFI_MOVEDIR_NONE) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->request_wade_dir = dir;
|
|
mDemo_Request(mDemo_TYPE_SCROLL2, actorx, &Player_actor_Init_ScrollDemo_forDemo_wade);
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(ACTOR* actorx, s16 angle_y, f32 border_start) {
|
|
int dir = Player_actor_CheckAbleMoveDemoWadeBoatBlock(actorx, angle_y, border_start);
|
|
|
|
if (dir != mFI_MOVEDIR_NONE) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->request_wade_dir = dir;
|
|
player->geton_boat_wade_border_start = border_start;
|
|
mDemo_Request(mDemo_TYPE_SCROLL3, actorx, &Player_actor_Init_ScrollDemo_forDemo_geton_boat_wade);
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Set_ScrollDemo_forWade_snowball(ACTOR* actorx, int request_dir, const xyz_t* snowball_dist) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mPlib_Get_unable_wade() == FALSE) {
|
|
player->request_wade_dir = request_dir;
|
|
player->snowball_dist = *snowball_dist;
|
|
mDemo_Request(mDemo_TYPE_SCROLL, actorx, &Player_actor_Init_ScrollDemo_forWade_snowball);
|
|
return TRUE;
|
|
} else {
|
|
player->cancel_wade_timer = player->player_frame_counter;
|
|
player->excute_cancel_wade = TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_SetForMark_for_settle_main(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_index = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 value[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
if (value[main_index] != FALSE) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_FOOTPRINT, player->left_foot_pos, 2, player->left_foot_angle.y, game,
|
|
RSV_NO, actorx->bg_collision_check.result.unit_attribute, 0);
|
|
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_FOOTPRINT, player->right_foot_pos, 2, player->right_foot_angle.y,
|
|
game, RSV_NO, actorx->bg_collision_check.result.unit_attribute, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupItem_Base0(ACTOR* actorx, int anim1_idx, int item_anim_idx, f32 item_anim_speed,
|
|
f32 item_morph_speed, f32 start_frame, int* anim1_idx_p,
|
|
int* part_table_idx_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int item_kind = Player_actor_Get_ItemKind(actorx, player->requested_main_index);
|
|
|
|
Player_actor_LoadOrDestruct_Item(actorx, item_kind, item_anim_idx, item_anim_speed, item_morph_speed, start_frame,
|
|
mPlayer_ITEM_IS_BALLOON(item_kind) == FALSE);
|
|
|
|
if (item_kind >= 0) {
|
|
*anim1_idx_p = mPlib_Get_BasicPlayerAnimeIndex_fromItemKind(item_kind);
|
|
} else {
|
|
*anim1_idx_p = anim1_idx;
|
|
}
|
|
|
|
Player_actor_Set_now_item_main_index(actorx, Player_actor_Get_BasicItemMainIndex_fromItemKind(item_kind));
|
|
player->item_kind = item_kind;
|
|
*part_table_idx_p = mPlib_Get_BasicPartTableIndex_fromAnimeIndex(*anim1_idx_p);
|
|
}
|
|
|
|
static int Player_actor_SetupItem_Base_windmill(ACTOR* actorx, int requested_item_kind, int current_item_kind,
|
|
int anim1_idx, int* anim1_idx_p, int* part_table_idx_p) {
|
|
if (mPlayer_ITEM_IS_WINDMILL(requested_item_kind) != FALSE) {
|
|
if (requested_item_kind != current_item_kind) {
|
|
Player_actor_SetupItem_Base0(actorx, anim1_idx,
|
|
mPlib_Get_BasicItemAnimeIndex_fromItemKind(requested_item_kind), 0.0f, 0.0f,
|
|
1.0f, anim1_idx_p, part_table_idx_p);
|
|
} else {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_FrameControl_c* item_fc = &player->item_keyframe.frame_control;
|
|
|
|
Player_actor_SetupItem_Base0(actorx, anim1_idx,
|
|
mPlib_Get_BasicItemAnimeIndex_fromItemKind(requested_item_kind),
|
|
item_fc->speed, 0.0f, item_fc->current_frame, anim1_idx_p, part_table_idx_p);
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_SetupItem_Base1(ACTOR* actorx, int anim1_idx, f32 item_morph_speed, int* anim1_idx_p,
|
|
int* part_table_idx_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int item_kind = Player_actor_Get_ItemKind(actorx, player->requested_main_index);
|
|
|
|
if (Player_actor_SetupItem_Base_windmill(actorx, item_kind, player->item_kind, anim1_idx, anim1_idx_p,
|
|
part_table_idx_p) == FALSE) {
|
|
int item_anime_idx = mPlib_Get_BasicItemAnimeIndex_fromItemKind(item_kind);
|
|
|
|
Player_actor_SetupItem_Base0(actorx, anim1_idx, item_anime_idx, 0.5f, item_morph_speed, -1.0f, anim1_idx_p,
|
|
part_table_idx_p);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupItem_Base2(ACTOR* actorx, int item_kind, int anim_idx, int item_main_index,
|
|
f32 morph_speed, f32 start_frame, int mode) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int request_item_kind = Player_actor_Get_ItemKind(actorx, player->requested_main_index);
|
|
|
|
if (item_kind == request_item_kind && Player_actor_Check_ItemAnimationToItemKind(item_kind, anim_idx) != FALSE) {
|
|
Player_actor_LoadOrDestruct_Item(actorx, item_kind, anim_idx, 0.5f, morph_speed, start_frame, mode);
|
|
Player_actor_Set_now_item_main_index(actorx, item_main_index);
|
|
player->item_kind = item_kind;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_SetupItem_Base3(ACTOR* actorx, int anim1_idx, f32 morph_speed, int* anim1_idx_p,
|
|
int* part_table_idx_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int item_kind = Player_actor_Get_ItemKind(actorx, player->requested_main_index);
|
|
|
|
if (Player_actor_SetupItem_Base_windmill(actorx, item_kind, player->item_kind, anim1_idx, anim1_idx_p,
|
|
part_table_idx_p) == FALSE) {
|
|
if (mPlayer_ITEM_IS_ROD(item_kind) == FALSE) {
|
|
int item_anime_idx = mPlib_Get_BasicItemAnimeIndex_fromItemKind(item_kind);
|
|
|
|
Player_actor_SetupItem_Base0(actorx, anim1_idx, item_anime_idx, 0.5f, morph_speed, -1.0f, anim1_idx_p,
|
|
part_table_idx_p);
|
|
} else {
|
|
Player_actor_SetupItem_Base0(actorx, anim1_idx, mPlayer_ITEM_DATA_ROD_MOVE, 0.5f, morph_speed, -1.0f,
|
|
anim1_idx_p, part_table_idx_p);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Get_ItemRodTopInitPos(ACTOR* actorx, xyz_t* pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->item_rod_top_pos_set != FALSE) {
|
|
*pos_p = player->item_rod_top_pos;
|
|
} else {
|
|
xyz_t pos = actorx->world.position;
|
|
s_xyz* player_rot_p = &actorx->shape_info.rotation;
|
|
|
|
pos.x += 25.5456f;
|
|
pos.y += 271.9735f;
|
|
pos.z -= 21.69f;
|
|
|
|
Matrix_push();
|
|
Matrix_translate(pos.x, pos.y, pos.z, 0);
|
|
Matrix_RotateZ(player_rot_p->z, 1);
|
|
Matrix_RotateX(player_rot_p->x, 1);
|
|
Matrix_RotateY(player_rot_p->y, 1);
|
|
Matrix_Position(&pos, pos_p);
|
|
Matrix_pull();
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Get_ItemRodVirtualTopPos(ACTOR* actorx, xyz_t* pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->item_rod_top_pos_set != FALSE) {
|
|
*pos_p = player->item_rod_virtual_top_pos;
|
|
} else {
|
|
Player_actor_Get_ItemRodTopInitPos(actorx, pos_p);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_check_cancel_request_change_proc_index(int requested_main_index) {
|
|
if (mPlib_check_player_warp_forEvent() != FALSE && mPlayer_MAIN_INDEX_VALID(requested_main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 value[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
return value[requested_main_index];
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_able_request_main_index_for_reset(int request_main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(request_main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 value[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
return value[request_main_index];
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_check_able_request_main_index_for_reset(int request_main_index) {
|
|
if (Common_Get(reset_flag) && Now_Private->reset_count == 2 &&
|
|
Player_actor_able_request_main_index_for_reset(request_main_index) != FALSE) {
|
|
if (Common_Get(reset_type) != 3) {
|
|
Common_Set(reset_type, 3);
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_check_request_main_able(GAME* game, int request_main_index, int priority) {
|
|
if (Player_actor_check_cancel_request_change_proc_index(request_main_index) == FALSE &&
|
|
Player_actor_check_able_request_main_index_for_reset(request_main_index) == FALSE &&
|
|
Player_actor_check_request_main_priority(game, priority) > 0) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_cancel_request_change_proc_index(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->requested_main_index_changed != FALSE &&
|
|
Player_actor_check_cancel_request_change_proc_index(player->requested_main_index) != FALSE) {
|
|
player->requested_main_index_priority = mPlayer_REQUEST_PRIORITY_NONE;
|
|
player->requested_main_index_changed = FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_scoop_after(GAME* game, xyz_t* target_pos_p, mActor_name_t* fg_p,
|
|
ACTOR** reflect_actor_pp, int gold_shovel) {
|
|
return mPlib_Check_scoop_after(game, target_pos_p, fg_p, reflect_actor_pp, gold_shovel);
|
|
}
|
|
|
|
static int Player_actor_Search_STONE_TC(ACTOR* actorx, xyz_t* target_pos_p) {
|
|
mActor_name_t* fg_p = mFI_GetUnitFG(*target_pos_p);
|
|
|
|
if (fg_p != NULL && IS_ITEM_STONE_TC(*fg_p) != FALSE && Common_Get(clip).bg_item_clip != NULL &&
|
|
Common_Get(clip).bg_item_clip->ten_coin_entry_ex_proc != NULL) {
|
|
Common_Get(clip).bg_item_clip->ten_coin_entry_ex_proc(target_pos_p, actorx->shape_info.rotation.y);
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_scoop_all(GAME* game, int priority) {
|
|
if (Player_actor_CheckController_forScoop(game) != FALSE) {
|
|
xyz_t target_pos;
|
|
mActor_name_t item;
|
|
ACTOR* reflect_actor_p;
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
int gold_shovel = player->item_kind == mPlayer_ITEM_KIND_GOLD_SHOVEL;
|
|
int scoop_request_index =
|
|
Player_actor_Check_scoop_after(game, &target_pos, &item, &reflect_actor_p, gold_shovel);
|
|
|
|
if (scoop_request_index == mPlayer_INDEX_DIG_SCOOP) {
|
|
if (Player_actor_request_main_dig_scoop_all(game, &target_pos, item, priority)) {
|
|
return TRUE;
|
|
}
|
|
} else if (scoop_request_index == mPlayer_INDEX_FILL_SCOOP) {
|
|
if (Player_actor_request_main_fill_scoop_all(game, &target_pos, priority)) {
|
|
return TRUE;
|
|
}
|
|
} else if (scoop_request_index == mPlayer_INDEX_REFLECT_SCOOP) {
|
|
if (Player_actor_request_main_reflect_scoop_all(game, &target_pos, item, reflect_actor_p, priority)) {
|
|
return TRUE;
|
|
}
|
|
} else if (scoop_request_index == mPlayer_INDEX_AIR_SCOOP) {
|
|
if (Player_actor_request_main_air_scoop_all(game, priority)) {
|
|
return TRUE;
|
|
}
|
|
} else if (scoop_request_index == mPlayer_INDEX_GET_SCOOP) {
|
|
if (Player_actor_request_main_get_scoop_all(game, &target_pos, item, priority)) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_cancel_request_change_proc_index_by_A_btn(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->a_btn_triggers_submenu != FALSE) {
|
|
int request_main_index = player->requested_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(request_main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
if (data[request_main_index] != FALSE) {
|
|
player->requested_main_index_priority = mPlayer_REQUEST_PRIORITY_NONE;
|
|
player->requested_main_index_changed = FALSE;
|
|
}
|
|
}
|
|
|
|
player->a_btn_triggers_submenu = FALSE;
|
|
}
|
|
}
|
|
|
|
static u32 Player_actor_Get_item_net_catch_label(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_SWING_NET:
|
|
case mPlayer_INDEX_PULL_NET:
|
|
case mPlayer_INDEX_NOTICE_NET:
|
|
case mPlayer_INDEX_PUTAWAY_NET:
|
|
return player->item_net_catch_label;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Change_item_net_catch_label(ACTOR* actorx, u32 label, s8 insect_type) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
aINS_INSECT_ACTOR* insect_actor = (aINS_INSECT_ACTOR*)label;
|
|
|
|
if (player->item_net_has_catch == FALSE) {
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_SWING_NET:
|
|
case mPlayer_INDEX_PULL_NET:
|
|
case mPlayer_INDEX_NOTICE_NET:
|
|
case mPlayer_INDEX_PUTAWAY_NET:
|
|
player->item_net_catch_label = label;
|
|
player->item_net_catch_type = insect_type;
|
|
if (insect_type == 0 && insect_actor != NULL) {
|
|
player->item_net_catch_insect_idx = insect_actor->type;
|
|
} else if (insect_actor != NULL) {
|
|
if (insect_actor->tools_actor.actor_class.id == mAc_PROFILE_BEE) {
|
|
player->item_net_catch_insect_idx = aSOI_INSECT_TYPE_BEE;
|
|
} else {
|
|
player->item_net_catch_insect_idx = aSOI_INSECT_TYPE_ANT;
|
|
}
|
|
} else {
|
|
player->item_net_catch_insect_idx = aSOI_INSECT_TYPE_INVALID;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_StopNet(ACTOR* actorx, xyz_t* net_pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->changed_main_index != FALSE) {
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_PULL_NET:
|
|
case mPlayer_INDEX_STOP_NET:
|
|
if (net_pos_p != NULL) {
|
|
*net_pos_p = player->net_pos;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_HitAxe(ACTOR* actorx, xyz_t* axe_pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
mPlayer_main_swing_axe_c* swing_axe_p = NULL;
|
|
mPlayer_main_reflect_axe_c* reflect_axe_p = NULL;
|
|
xyz_t* pos_p;
|
|
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_SWING_AXE:
|
|
swing_axe_p = &player->main_data.swing_axe;
|
|
break;
|
|
case mPlayer_INDEX_REFLECT_AXE:
|
|
reflect_axe_p = &player->main_data.reflect_axe;
|
|
break;
|
|
case mPlayer_INDEX_BROKEN_AXE: {
|
|
mPlayer_main_broken_axe_c* broken_axe_p = &player->main_data.broken_axe;
|
|
|
|
if (broken_axe_p->break_type != mPlayer_AXE_BREAK_FROM_SWING) {
|
|
reflect_axe_p = &broken_axe_p->axe.reflect_axe;
|
|
} else {
|
|
swing_axe_p = &broken_axe_p->axe.swing_axe;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
return FALSE;
|
|
}
|
|
|
|
if (swing_axe_p != NULL) {
|
|
pos_p = &swing_axe_p->target_pos;
|
|
} else {
|
|
pos_p = &reflect_axe_p->target_pos;
|
|
}
|
|
|
|
if (pos_p != NULL && Player_actor_Check_AnimationFrame(&player->keyframe0.frame_control, 15.0f) != FALSE) {
|
|
if (axe_pos_p != NULL) {
|
|
*axe_pos_p = *pos_p;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_VibUnit_OneFrame(ACTOR* actorx, const xyz_t* check_pos_p) {
|
|
xyz_t target_pos;
|
|
|
|
if (Player_actor_Check_HitAxe(actorx, &target_pos)) {
|
|
int check_bx;
|
|
int check_bz;
|
|
int target_bx;
|
|
int target_bz;
|
|
|
|
if (mFI_Wpos2BlockNum(&check_bx, &check_bz, *check_pos_p) == FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (mFI_Wpos2BlockNum(&target_bx, &target_bz, target_pos) == FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (check_bx == target_bx && check_bz == target_bz) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_HitScoop(ACTOR* actorx, xyz_t* scoop_pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
xyz_t* target_pos_p = NULL;
|
|
f32 check_frame = 0.0f;
|
|
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_DIG_SCOOP:
|
|
target_pos_p = &player->main_data.dig_scoop.target_pos;
|
|
check_frame = 20.0f;
|
|
break;
|
|
case mPlayer_INDEX_REFLECT_SCOOP:
|
|
target_pos_p = &player->main_data.reflect_scoop.target_pos;
|
|
check_frame = 20.0f;
|
|
break;
|
|
case mPlayer_INDEX_GET_SCOOP:
|
|
target_pos_p = &player->main_data.get_scoop.target_pos;
|
|
check_frame = 20.0f;
|
|
break;
|
|
case mPlayer_INDEX_FILL_SCOOP:
|
|
target_pos_p = &player->main_data.fill_scoop.target_pos;
|
|
check_frame = 40.0f;
|
|
break;
|
|
case mPlayer_INDEX_PUTIN_SCOOP:
|
|
target_pos_p = &player->main_data.putin_scoop.target_pos;
|
|
check_frame = 47.0f;
|
|
break;
|
|
}
|
|
|
|
if (target_pos_p != NULL && Player_actor_Check_AnimationFrame(&player->keyframe0.frame_control, check_frame)) {
|
|
if (scoop_pos_p != NULL) {
|
|
*scoop_pos_p = *target_pos_p;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_DigScoop(ACTOR* actorx, xyz_t* scoop_pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
xyz_t* target_pos_p = NULL;
|
|
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_DIG_SCOOP:
|
|
target_pos_p = &player->main_data.dig_scoop.target_pos;
|
|
break;
|
|
case mPlayer_INDEX_REFLECT_SCOOP:
|
|
target_pos_p = &player->main_data.reflect_scoop.target_pos;
|
|
break;
|
|
case mPlayer_INDEX_GET_SCOOP:
|
|
target_pos_p = &player->main_data.get_scoop.target_pos;
|
|
break;
|
|
case mPlayer_INDEX_FILL_SCOOP:
|
|
target_pos_p = &player->main_data.fill_scoop.target_pos;
|
|
break;
|
|
case mPlayer_INDEX_PUTIN_SCOOP:
|
|
target_pos_p = &player->main_data.putin_scoop.target_pos;
|
|
break;
|
|
}
|
|
|
|
if (target_pos_p != NULL) {
|
|
if (scoop_pos_p != NULL) {
|
|
*scoop_pos_p = *target_pos_p;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_request_camera2_main_simple_fishing(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
ACTOR* uki_actor = player->fishing_rod_actor_p;
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
|
|
if (uki_actor != NULL) {
|
|
Camera2_change_priority(play, 0);
|
|
Camera2_request_main_simple_fishing(play, &actorx->eye.position, &uki_actor->world.position, 5);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_request_camera2_main_simple_return(ACTOR* actorx, GAME* game) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
|
|
Camera2_change_priority(play, 0);
|
|
Camera2_request_main_simple_fishing_return(play, &actorx->eye.position, 5);
|
|
}
|
|
|
|
static void Player_actor_request_camera2_main_normal(GAME* game) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
|
|
Camera2_change_priority(play, 0);
|
|
Camera2_request_main_normal(play, 0, 5);
|
|
}
|
|
|
|
static void Player_actor_request_camera2_change_priority(GAME* game) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
|
|
Camera2_change_priority(play, 0);
|
|
}
|
|
|
|
static int Player_actor_SearchPosition_npc_forStand(GAME* game, const xyz_t* pos_p) {
|
|
if (pos_p != NULL) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
Actor_info* actor_info = &play->actor_info;
|
|
Actor_list* actor_list = &actor_info->list[ACTOR_PART_NPC];
|
|
ACTOR* actor = actor_list->actor;
|
|
f32 x = pos_p->x;
|
|
f32 z = pos_p->z;
|
|
f32 sq_rad = SQ(30.0f);
|
|
|
|
for (actor; actor != NULL; actor = actor->next_actor) {
|
|
f32 dx = actor->world.position.x - x;
|
|
f32 dz = actor->world.position.z - z;
|
|
|
|
if (Math3DVecLengthSquare2D(dx, dz) < sq_rad) {
|
|
NPC_ACTOR* npc_actor = (NPC_ACTOR*)actor;
|
|
|
|
if (npc_actor->condition_info.hide_flg == FALSE) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_SetEffect_forTakeout_item(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s8 item_kind = player->item_kind;
|
|
|
|
if (mPlayer_ITEM_IS_AXE(item_kind) != FALSE) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_KIGAE_LIGHT, actorx->world.position, 2, actorx->shape_info.rotation.y,
|
|
game, RSV_NO, 1, 0);
|
|
} else if (mPlayer_ITEM_IS_SHOVEL(item_kind) != FALSE) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_KIGAE_LIGHT, actorx->world.position, 2, actorx->shape_info.rotation.y,
|
|
game, RSV_NO, 2, 0);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_check_request_change_item(GAME* game) {
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s8 item_kind = player->item_kind;
|
|
s8 requested_item_kind = Player_actor_Get_ItemKind(actorx, player->now_main_index);
|
|
int idx;
|
|
|
|
if (item_kind != requested_item_kind) {
|
|
switch (player->now_main_index) {
|
|
case mPlayer_INDEX_WAIT:
|
|
case mPlayer_INDEX_WALK:
|
|
case mPlayer_INDEX_RUN:
|
|
case mPlayer_INDEX_DASH:
|
|
return player->now_main_index;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
static int Player_actor_check_item_is_fish(mActor_name_t item) {
|
|
#if defined(BUGFIXES)
|
|
if (ITEM_NAME_GET_TYPE(item) == NAME_TYPE_ITEM1 && ITEM_NAME_GET_CAT(item) == ITEM1_CAT_FISH) {
|
|
return TRUE;
|
|
}
|
|
#else
|
|
// @BUG - these macros should be swapped
|
|
if (ITEM_NAME_GET_CAT(item) == NAME_TYPE_ITEM1 && ITEM_NAME_GET_TYPE(item) == ITEM1_CAT_FISH) {
|
|
return TRUE;
|
|
}
|
|
#endif
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_CommonFootMark_AnimeFrame_fromAnimeIndex(f32 cur_frame, f32 speed, f32 end_frame,
|
|
int anim_idx, const s16** data_table_p,
|
|
const u8* len_table_p) {
|
|
if (anim_idx >= 0 && anim_idx < mPlayer_ANIM_NUM) {
|
|
const s16* data_p = data_table_p[anim_idx];
|
|
|
|
if (data_p != NULL) {
|
|
const int len = len_table_p[anim_idx];
|
|
int i;
|
|
|
|
for (i = 0; i < len; i++) {
|
|
const f32 frame = *data_p;
|
|
|
|
/* Negative frames signal end */
|
|
if (frame < 0.0f) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (Player_actor_Check_AnimationFrame_Common(cur_frame, speed, end_frame, frame)) {
|
|
return TRUE;
|
|
}
|
|
|
|
data_p++;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_RightFootMark_AnimeFrame_fromAnimeIndex(f32 cur_frame, f32 speed, f32 end_frame,
|
|
int anime_index) {
|
|
static const s16 right_data_wait1[] = { -1 };
|
|
static const s16 right_data_walk1[] = { 9 };
|
|
static const s16 right_data_axe1[] = { -1 };
|
|
static const s16 right_data_run1[] = { 9 };
|
|
static const s16 right_data_push1[] = { 23 };
|
|
static const s16 right_data_pull1[] = { 11, 24 };
|
|
static const s16 right_data_hold_wait1[] = { -1 };
|
|
static const s16 right_data_pickup1[] = { -1 };
|
|
static const s16 right_data_Lturn1[] = { -1 };
|
|
static const s16 right_data_Rturn1[] = { -1 };
|
|
static const s16 right_data_get1[] = { -1 };
|
|
static const s16 right_data_get_change1[] = { 26 };
|
|
static const s16 right_data_get_putaway1[] = { -1 };
|
|
static const s16 right_data_open1[] = { -1 };
|
|
static const s16 right_data_putaway1[] = { -1 };
|
|
static const s16 right_data_trans_wait1[] = { -1 };
|
|
static const s16 right_data_transfer1[] = { -1 };
|
|
static const s16 right_data_umb_open1[] = { -1 };
|
|
static const s16 right_data_umbrella1[] = { -1 };
|
|
static const s16 right_data_dash1[] = { 9 };
|
|
static const s16 right_data_run_slip1[] = { -1 };
|
|
static const s16 right_data_get_pull1[] = { -1 };
|
|
static const s16 right_data_get_m1[] = { -1 };
|
|
static const s16 right_data_kamae_move_m1[] = { 9 };
|
|
static const s16 right_data_kamae_wait_m1[] = { -1 };
|
|
static const s16 right_data_kokeru_a1[] = { -1 };
|
|
static const s16 right_data_kokeru_getup_a1[] = { -1 };
|
|
static const s16 right_data_kokeru_getup_n1[] = { -1 };
|
|
static const s16 right_data_kokeru_n1[] = { -1 };
|
|
static const s16 right_data_net1[] = { -1 };
|
|
static const s16 right_data_net_swing1[] = { 10 };
|
|
static const s16 right_data_axe_swing1[] = { 5, 23 };
|
|
static const s16 right_data_kamae_slip_m1[] = { -1 };
|
|
static const s16 right_data_kokeru1[] = { -1 };
|
|
static const s16 right_data_kokeru_getup1[] = { -1 };
|
|
static const s16 right_data_sitdown1[] = { -1 };
|
|
static const s16 right_data_sitdown_wait1[] = { -1 };
|
|
static const s16 right_data_standup1[] = { -1 };
|
|
static const s16 right_data_putaway_m1[] = { -1 };
|
|
static const s16 right_data_bed_wait1[] = { -1 };
|
|
static const s16 right_data_inbed_L1[] = { -1 };
|
|
static const s16 right_data_inbed_R1[] = { -1 };
|
|
static const s16 right_data_intrain1[] = { 8, 28, 50, 71, 88, 111 };
|
|
static const s16 right_data_kagu_open_d1[] = { 12 };
|
|
static const s16 right_data_kagu_open_h1[] = { -1 };
|
|
static const s16 right_data_kagu_open_k1[] = { -1 };
|
|
static const s16 right_data_negaeri_L1[] = { -1 };
|
|
static const s16 right_data_negaeri_R1[] = { -1 };
|
|
static const s16 right_data_outbed_L1[] = { -1 };
|
|
static const s16 right_data_outbed_R1[] = { -1 };
|
|
static const s16 right_data_outtrain1[] = { 21 };
|
|
static const s16 right_data_kagu_close_d1[] = { 16 };
|
|
static const s16 right_data_kagu_close_h1[] = { 6 };
|
|
static const s16 right_data_kagu_close_k1[] = { 6 };
|
|
static const s16 right_data_kagu_wait_d1[] = { -1 };
|
|
static const s16 right_data_kagu_wait_h1[] = { -1 };
|
|
static const s16 right_data_kagu_wait_k1[] = { -1 };
|
|
static const s16 right_data_go_out_o1[] = { -1 };
|
|
static const s16 right_data_go_out_s1[] = { -1 };
|
|
static const s16 right_data_into_s1[] = { -1 };
|
|
static const s16 right_data_axe_hane1[] = { 5, 24, 37 };
|
|
static const s16 right_data_axe_suka1[] = { 5, 40 };
|
|
static const s16 right_data_hold_wait_h1[] = { -1 };
|
|
static const s16 right_data_hold_wait_o1[] = { -1 };
|
|
static const s16 right_data_get_t1[] = { -1 };
|
|
static const s16 right_data_get_t2[] = { 31 };
|
|
static const s16 right_data_putaway_t1[] = { 17 };
|
|
static const s16 right_data_sao1[] = { -1 };
|
|
static const s16 right_data_sao_swing1[] = { -1 };
|
|
static const s16 right_data_turi_hiki1[] = { -1 };
|
|
static const s16 right_data_turi_wait1[] = { -1 };
|
|
static const s16 right_data_not_get_t1[] = { -1 };
|
|
static const s16 right_data_menu_catch1[] = { -1 };
|
|
static const s16 right_data_menu_change1[] = { -1 };
|
|
static const s16 right_data_umb_close1[] = { 13, 27 };
|
|
static const s16 right_data_not_sao_swing1[] = { -1 };
|
|
static const s16 right_data_intrain_wait1[] = { -1 };
|
|
static const s16 right_data_clear_table1[] = { -1 };
|
|
static const s16 right_data_dig1[] = { 13, 41 };
|
|
static const s16 right_data_fill_up1[] = { 14, 41, 51 };
|
|
static const s16 right_data_not_dig1[] = { 13, 29 };
|
|
static const s16 right_data_clear_table_l1[] = { -1 };
|
|
static const s16 right_data_pickup_l1[] = { -1 };
|
|
static const s16 right_data_scoop1[] = { -1 };
|
|
static const s16 right_data_confirm1[] = { 10, 22 };
|
|
static const s16 right_data_dig_suka1[] = { 15, 41 };
|
|
static const s16 right_data_get_d1[] = { 13, 43, 51 };
|
|
static const s16 right_data_putaway_d1[] = { 12 };
|
|
static const s16 right_data_dig_kabu1[] = { 33, 61 };
|
|
static const s16 right_data_fill_up_i1[] = { 21, 48, 58 };
|
|
static const s16 right_data_send_mail1[] = { -1 };
|
|
static const s16 right_data_get_f1[] = { -1 };
|
|
static const s16 right_data_get_pull_f1[] = { -1 };
|
|
static const s16 right_data_get_putaway_f1[] = { -1 };
|
|
static const s16 right_data_trans_wait_f1[] = { -1 };
|
|
static const s16 right_data_transfer_f1[] = { -1 };
|
|
static const s16 right_data_shake1[] = { -1 };
|
|
static const s16 right_data_tired1[] = { -1 };
|
|
static const s16 right_data_wash1[] = { -1 };
|
|
static const s16 right_data_wash2[] = { -1 };
|
|
static const s16 right_data_wash3[] = { -1 };
|
|
static const s16 right_data_wash4[] = { -1 };
|
|
static const s16 right_data_wash5[] = { -1 };
|
|
static const s16 right_data_fukubiki1[] = { -1 };
|
|
static const s16 right_data_omairi1[] = { -1 };
|
|
static const s16 right_data_saisen1[] = { -1 };
|
|
static const s16 right_data_return_mail1[] = { -1 };
|
|
static const s16 right_data_return_mail2[] = { -1 };
|
|
static const s16 right_data_return_mail3[] = { -1 };
|
|
static const s16 right_data_eat1[] = { -1 };
|
|
static const s16 right_data_gaaan1[] = { -1 };
|
|
static const s16 right_data_gaaan2[] = { -1 };
|
|
static const s16 right_data_deru1[] = { -1 };
|
|
static const s16 right_data_guratuku1[] = { -1 };
|
|
static const s16 right_data_mogaku1[] = { -1 };
|
|
static const s16 right_data_otiru1[] = { -1 };
|
|
static const s16 right_data_zassou1[] = { -1 };
|
|
static const s16 right_data_knock1[] = { -1 };
|
|
static const s16 right_data_biku1[] = { -1 };
|
|
static const s16 right_data_hati1[] = { -1 };
|
|
static const s16 right_data_hati2[] = { -1 };
|
|
static const s16 right_data_hati3[] = { -1 };
|
|
static const s16 right_data_push_yuki1[] = { 9 };
|
|
static const s16 right_data_deru2[] = { -1 };
|
|
static const s16 right_data_otiru2[] = { -1 };
|
|
static const s16 right_data_itazura1[] = { -1 };
|
|
static const s16 right_data_umb_rot1[] = { -1 };
|
|
static const s16 right_data_pickup_wait1[] = { -1 };
|
|
static const s16 right_data_yatta1[] = { -1 };
|
|
static const s16 right_data_yatta2[] = { -1 };
|
|
static const s16 right_data_yatta3[] = { -1 };
|
|
static const s16 right_data_kaze1[] = { -1 };
|
|
static const s16 right_data_mosquito1[] = { -1 };
|
|
static const s16 right_data_mosquito2[] = { -1 };
|
|
static const s16 right_data_ride1[] = { 9 };
|
|
static const s16 right_data_ride2[] = { -1 };
|
|
static const s16 right_data_ridewait[] = { -1 };
|
|
static const s16 right_data_getoff1[] = { -1 };
|
|
static const s16 right_data_getoff2[] = { -1 };
|
|
static const s16 right_data_utiwa_wait1[] = { -1 };
|
|
static const s16 right_data_utiwa_d1[] = { -1 };
|
|
static const s16 right_data_axe_break1[] = { 5, 24, 37 };
|
|
static const s16 right_data_axe_breakwait1[] = { -1 };
|
|
static const s16 right_data_light_on1[] = { -1 };
|
|
static const s16 right_data_taisou1[] = { -1 };
|
|
static const s16 right_data_taisou2_1[] = { -1 };
|
|
static const s16 right_data_taisou2_2[] = { -1 };
|
|
static const s16 right_data_taisou3[] = { -1 };
|
|
static const s16 right_data_taisou4_1[] = { -1 };
|
|
static const s16 right_data_taisou4_2[] = { -1 };
|
|
static const s16 right_data_taisou5_1[] = { -1 };
|
|
static const s16 right_data_taisou5_2[] = { -1 };
|
|
static const s16 right_data_taisou6_1[] = { -1 };
|
|
static const s16 right_data_taisou6_2[] = { -1 };
|
|
static const s16 right_data_taisou7_1[] = { -1 };
|
|
static const s16 right_data_taisou7_2[] = { -1 };
|
|
static const s16 right_data_omairi_us1[] = { -1 };
|
|
|
|
static const s16* data_p_table[] = {
|
|
right_data_wait1,
|
|
right_data_walk1,
|
|
right_data_axe1,
|
|
right_data_run1,
|
|
right_data_push1,
|
|
right_data_pull1,
|
|
right_data_hold_wait1,
|
|
right_data_pickup1,
|
|
right_data_Lturn1,
|
|
right_data_Rturn1,
|
|
right_data_get1,
|
|
right_data_get_change1,
|
|
right_data_get_putaway1,
|
|
right_data_open1,
|
|
right_data_putaway1,
|
|
right_data_trans_wait1,
|
|
right_data_transfer1,
|
|
right_data_umb_open1,
|
|
right_data_umbrella1,
|
|
right_data_dash1,
|
|
right_data_run_slip1,
|
|
right_data_get_pull1,
|
|
right_data_get_m1,
|
|
right_data_kamae_move_m1,
|
|
right_data_kamae_wait_m1,
|
|
right_data_kokeru_a1,
|
|
right_data_kokeru_getup_a1,
|
|
right_data_kokeru_getup_n1,
|
|
right_data_kokeru_n1,
|
|
right_data_net1,
|
|
right_data_net_swing1,
|
|
right_data_axe_swing1,
|
|
right_data_kamae_slip_m1,
|
|
right_data_kokeru1,
|
|
right_data_kokeru_getup1,
|
|
right_data_sitdown1,
|
|
right_data_sitdown_wait1,
|
|
right_data_standup1,
|
|
right_data_putaway_m1,
|
|
right_data_bed_wait1,
|
|
right_data_inbed_L1,
|
|
right_data_inbed_R1,
|
|
right_data_intrain1,
|
|
right_data_kagu_open_d1,
|
|
right_data_kagu_open_h1,
|
|
right_data_kagu_open_k1,
|
|
right_data_negaeri_L1,
|
|
right_data_negaeri_R1,
|
|
right_data_outbed_L1,
|
|
right_data_outbed_R1,
|
|
right_data_outtrain1,
|
|
right_data_kagu_close_d1,
|
|
right_data_kagu_close_h1,
|
|
right_data_kagu_close_k1,
|
|
right_data_kagu_wait_d1,
|
|
right_data_kagu_wait_h1,
|
|
right_data_kagu_wait_k1,
|
|
right_data_go_out_o1,
|
|
right_data_go_out_s1,
|
|
right_data_into_s1,
|
|
right_data_axe_hane1,
|
|
right_data_axe_suka1,
|
|
right_data_hold_wait_h1,
|
|
right_data_hold_wait_o1,
|
|
right_data_get_t1,
|
|
right_data_get_t2,
|
|
right_data_putaway_t1,
|
|
right_data_sao1,
|
|
right_data_sao_swing1,
|
|
right_data_turi_hiki1,
|
|
right_data_turi_wait1,
|
|
right_data_not_get_t1,
|
|
right_data_menu_catch1,
|
|
right_data_menu_change1,
|
|
right_data_umb_close1,
|
|
right_data_not_sao_swing1,
|
|
right_data_intrain_wait1,
|
|
right_data_clear_table1,
|
|
right_data_dig1,
|
|
right_data_fill_up1,
|
|
right_data_not_dig1,
|
|
right_data_clear_table_l1,
|
|
right_data_pickup_l1,
|
|
right_data_scoop1,
|
|
right_data_confirm1,
|
|
right_data_dig_suka1,
|
|
right_data_get_d1,
|
|
right_data_putaway_d1,
|
|
right_data_dig_kabu1,
|
|
right_data_fill_up_i1,
|
|
right_data_send_mail1,
|
|
right_data_get_f1,
|
|
right_data_get_pull_f1,
|
|
right_data_get_putaway_f1,
|
|
right_data_trans_wait_f1,
|
|
right_data_transfer_f1,
|
|
right_data_shake1,
|
|
right_data_tired1,
|
|
right_data_wash1,
|
|
right_data_wash2,
|
|
right_data_wash3,
|
|
right_data_wash4,
|
|
right_data_wash5,
|
|
right_data_fukubiki1,
|
|
right_data_omairi1,
|
|
right_data_saisen1,
|
|
right_data_return_mail1,
|
|
right_data_return_mail2,
|
|
right_data_return_mail3,
|
|
right_data_eat1,
|
|
right_data_gaaan1,
|
|
right_data_gaaan2,
|
|
right_data_deru1,
|
|
right_data_guratuku1,
|
|
right_data_mogaku1,
|
|
right_data_otiru1,
|
|
right_data_zassou1,
|
|
right_data_knock1,
|
|
right_data_biku1,
|
|
right_data_hati1,
|
|
right_data_hati2,
|
|
right_data_hati3,
|
|
right_data_push_yuki1,
|
|
right_data_deru2,
|
|
right_data_otiru2,
|
|
right_data_itazura1,
|
|
right_data_umb_rot1,
|
|
right_data_pickup_wait1,
|
|
right_data_yatta1,
|
|
right_data_yatta2,
|
|
right_data_yatta3,
|
|
right_data_kaze1,
|
|
right_data_mosquito1,
|
|
right_data_mosquito2,
|
|
right_data_ride1,
|
|
right_data_ride2,
|
|
right_data_ridewait,
|
|
right_data_getoff1,
|
|
right_data_getoff2,
|
|
right_data_utiwa_wait1,
|
|
right_data_utiwa_d1,
|
|
right_data_axe_break1,
|
|
right_data_axe_breakwait1,
|
|
right_data_light_on1,
|
|
right_data_taisou1,
|
|
right_data_taisou2_1,
|
|
right_data_taisou2_2,
|
|
right_data_taisou3,
|
|
right_data_taisou4_1,
|
|
right_data_taisou4_2,
|
|
right_data_taisou5_1,
|
|
right_data_taisou5_2,
|
|
right_data_taisou6_1,
|
|
right_data_taisou6_2,
|
|
right_data_taisou7_1,
|
|
right_data_taisou7_2,
|
|
right_data_omairi_us1,
|
|
};
|
|
|
|
// clang-format off
|
|
static const u8 size_table[] = {
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
6,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
3,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
3,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
2,
|
|
3,
|
|
1,
|
|
2,
|
|
3,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
3,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
};
|
|
// clang-format on
|
|
|
|
return Player_actor_Check_CommonFootMark_AnimeFrame_fromAnimeIndex(cur_frame, speed, end_frame, anime_index,
|
|
data_p_table, size_table);
|
|
}
|
|
|
|
static int Player_actor_Check_LeftFootMark_AnimeFrame_fromAnimeIndex(f32 cur_frame, f32 speed, f32 end_frame,
|
|
int anime_index) {
|
|
static const s16 left_data_wait1[] = { -1 };
|
|
static const s16 left_data_walk1[] = { 1 };
|
|
static const s16 left_data_axe1[] = { -1 };
|
|
static const s16 left_data_run1[] = { 1 };
|
|
static const s16 left_data_push1[] = { 15 };
|
|
static const s16 left_data_pull1[] = { 6, 17 };
|
|
static const s16 left_data_hold_wait1[] = { -1 };
|
|
static const s16 left_data_pickup1[] = { 9, 20 };
|
|
static const s16 left_data_Lturn1[] = { -1 };
|
|
static const s16 left_data_Rturn1[] = { -1 };
|
|
static const s16 left_data_get1[] = { -1 };
|
|
static const s16 left_data_get_change1[] = { 26 };
|
|
static const s16 left_data_get_putaway1[] = { -1 };
|
|
static const s16 left_data_open1[] = { -1 };
|
|
static const s16 left_data_putaway1[] = { -1 };
|
|
static const s16 left_data_trans_wait1[] = { -1 };
|
|
static const s16 left_data_transfer1[] = { -1 };
|
|
static const s16 left_data_umb_open1[] = { -1 };
|
|
static const s16 left_data_umbrella1[] = { -1 };
|
|
static const s16 left_data_dash1[] = { 1 };
|
|
static const s16 left_data_run_slip1[] = { -1 };
|
|
static const s16 left_data_get_pull1[] = { -1 };
|
|
static const s16 left_data_get_m1[] = { 25, 43 };
|
|
static const s16 left_data_kamae_move_m1[] = { 6 };
|
|
static const s16 left_data_kamae_wait_m1[] = { -1 };
|
|
static const s16 left_data_kokeru_a1[] = { -1 };
|
|
static const s16 left_data_kokeru_getup_a1[] = { -1 };
|
|
static const s16 left_data_kokeru_getup_n1[] = { -1 };
|
|
static const s16 left_data_kokeru_n1[] = { -1 };
|
|
static const s16 left_data_net1[] = { -1 };
|
|
static const s16 left_data_net_swing1[] = { 7 };
|
|
static const s16 left_data_axe_swing1[] = { 13, 29 };
|
|
static const s16 left_data_kamae_slip_m1[] = { -1 };
|
|
static const s16 left_data_kokeru1[] = { -1 };
|
|
static const s16 left_data_kokeru_getup1[] = { -1 };
|
|
static const s16 left_data_sitdown1[] = { -1 };
|
|
static const s16 left_data_sitdown_wait1[] = { -1 };
|
|
static const s16 left_data_standup1[] = { -1 };
|
|
static const s16 left_data_putaway_m1[] = { -1 };
|
|
static const s16 left_data_bed_wait1[] = { -1 };
|
|
static const s16 left_data_inbed_L1[] = { -1 };
|
|
static const s16 left_data_inbed_R1[] = { -1 };
|
|
static const s16 left_data_intrain1[] = { 19, 40, 61, 82, 101 };
|
|
static const s16 left_data_kagu_open_d1[] = { 6 };
|
|
static const s16 left_data_kagu_open_h1[] = { 7 };
|
|
static const s16 left_data_kagu_open_k1[] = { 7 };
|
|
static const s16 left_data_negaeri_L1[] = { -1 };
|
|
static const s16 left_data_negaeri_R1[] = { -1 };
|
|
static const s16 left_data_outbed_L1[] = { -1 };
|
|
static const s16 left_data_outbed_R1[] = { -1 };
|
|
static const s16 left_data_outtrain1[] = { 5, 21 };
|
|
static const s16 left_data_kagu_close_d1[] = { -1 };
|
|
static const s16 left_data_kagu_close_h1[] = { -1 };
|
|
static const s16 left_data_kagu_close_k1[] = { -1 };
|
|
static const s16 left_data_kagu_wait_d1[] = { -1 };
|
|
static const s16 left_data_kagu_wait_h1[] = { -1 };
|
|
static const s16 left_data_kagu_wait_k1[] = { -1 };
|
|
static const s16 left_data_go_out_o1[] = { -1 };
|
|
static const s16 left_data_go_out_s1[] = { -1 };
|
|
static const s16 left_data_into_s1[] = { -1 };
|
|
static const s16 left_data_axe_hane1[] = { 12, 33 };
|
|
static const s16 left_data_axe_suka1[] = { 14 };
|
|
static const s16 left_data_hold_wait_h1[] = { -1 };
|
|
static const s16 left_data_hold_wait_o1[] = { -1 };
|
|
static const s16 left_data_get_t1[] = { 23 };
|
|
static const s16 left_data_get_t2[] = { 21 };
|
|
static const s16 left_data_putaway_t1[] = { 10 };
|
|
static const s16 left_data_sao1[] = { -1 };
|
|
static const s16 left_data_sao_swing1[] = { 18 };
|
|
static const s16 left_data_turi_hiki1[] = { -1 };
|
|
static const s16 left_data_turi_wait1[] = { -1 };
|
|
static const s16 left_data_not_get_t1[] = { 27 };
|
|
static const s16 left_data_menu_catch1[] = { -1 };
|
|
static const s16 left_data_menu_change1[] = { -1 };
|
|
static const s16 left_data_umb_close1[] = { 9, 33 };
|
|
static const s16 left_data_not_sao_swing1[] = { 21 };
|
|
static const s16 left_data_intrain_wait1[] = { -1 };
|
|
static const s16 left_data_clear_table1[] = { -1 };
|
|
static const s16 left_data_dig1[] = { 10, 25 };
|
|
static const s16 left_data_fill_up1[] = { 10, 23, 48 };
|
|
static const s16 left_data_not_dig1[] = { 10, 17, 35 };
|
|
static const s16 left_data_clear_table_l1[] = { -1 };
|
|
static const s16 left_data_pickup_l1[] = { -1 };
|
|
static const s16 left_data_scoop1[] = { -1 };
|
|
static const s16 left_data_confirm1[] = { 15 };
|
|
static const s16 left_data_dig_suka1[] = { 10, 38 };
|
|
static const s16 left_data_get_d1[] = { 10, 27, 51 };
|
|
static const s16 left_data_putaway_d1[] = { 16 };
|
|
static const s16 left_data_dig_kabu1[] = { 30, 45 };
|
|
static const s16 left_data_fill_up_i1[] = { 17, 30, 55 };
|
|
static const s16 left_data_send_mail1[] = { -1 };
|
|
static const s16 left_data_get_f1[] = { -1 };
|
|
static const s16 left_data_get_pull_f1[] = { -1 };
|
|
static const s16 left_data_get_putaway_f1[] = { -1 };
|
|
static const s16 left_data_trans_wait_f1[] = { -1 };
|
|
static const s16 left_data_transfer_f1[] = { -1 };
|
|
static const s16 left_data_shake1[] = { -1 };
|
|
static const s16 left_data_tired1[] = { -1 };
|
|
static const s16 left_data_wash1[] = { -1 };
|
|
static const s16 left_data_wash2[] = { -1 };
|
|
static const s16 left_data_wash3[] = { -1 };
|
|
static const s16 left_data_wash4[] = { -1 };
|
|
static const s16 left_data_wash5[] = { -1 };
|
|
static const s16 left_data_fukubiki1[] = { -1 };
|
|
static const s16 left_data_omairi1[] = { -1 };
|
|
static const s16 left_data_saisen1[] = { -1 };
|
|
static const s16 left_data_return_mail1[] = { -1 };
|
|
static const s16 left_data_return_mail2[] = { -1 };
|
|
static const s16 left_data_return_mail3[] = { -1 };
|
|
static const s16 left_data_eat1[] = { -1 };
|
|
static const s16 left_data_gaaan1[] = { -1 };
|
|
static const s16 left_data_gaaan2[] = { -1 };
|
|
static const s16 left_data_deru1[] = { -1 };
|
|
static const s16 left_data_guratuku1[] = { -1 };
|
|
static const s16 left_data_mogaku1[] = { -1 };
|
|
static const s16 left_data_otiru1[] = { -1 };
|
|
static const s16 left_data_zassou1[] = { -1 };
|
|
static const s16 left_data_knock1[] = { -1 };
|
|
static const s16 left_data_biku1[] = { -1 };
|
|
static const s16 left_data_hati1[] = { -1 };
|
|
static const s16 left_data_hati2[] = { -1 };
|
|
static const s16 left_data_hati3[] = { -1 };
|
|
static const s16 left_data_push_yuki1[] = { 1 };
|
|
static const s16 left_data_deru2[] = { -1 };
|
|
static const s16 left_data_otiru2[] = { -1 };
|
|
static const s16 left_data_itazura1[] = { -1 };
|
|
static const s16 left_data_umb_rot1[] = { -1 };
|
|
static const s16 left_data_pickup_wait1[] = { -1 };
|
|
static const s16 left_data_yatta1[] = { -1 };
|
|
static const s16 left_data_yatta2[] = { -1 };
|
|
static const s16 left_data_yatta3[] = { -1 };
|
|
static const s16 left_data_kaze1[] = { -1 };
|
|
static const s16 left_data_mosquito1[] = { -1 };
|
|
static const s16 left_data_mosquito2[] = { -1 };
|
|
static const s16 left_data_ride1[] = { -1 };
|
|
static const s16 left_data_ride2[] = { -1 };
|
|
static const s16 left_data_ridewait[] = { -1 };
|
|
static const s16 left_data_getoff1[] = { -1 };
|
|
static const s16 left_data_getoff2[] = { -1 };
|
|
static const s16 left_data_utiwa_wait1[] = { -1 };
|
|
static const s16 left_data_utiwa_d1[] = { -1 };
|
|
static const s16 left_data_axe_break1[] = { 12, 33 };
|
|
static const s16 left_data_axe_breakwait1[] = { -1 };
|
|
static const s16 left_data_light_on1[] = { -1 };
|
|
static const s16 left_data_taisou1[] = { -1 };
|
|
static const s16 left_data_taisou2_1[] = { -1 };
|
|
static const s16 left_data_taisou2_2[] = { -1 };
|
|
static const s16 left_data_taisou3[] = { -1 };
|
|
static const s16 left_data_taisou4_1[] = { -1 };
|
|
static const s16 left_data_taisou4_2[] = { -1 };
|
|
static const s16 left_data_taisou5_1[] = { -1 };
|
|
static const s16 left_data_taisou5_2[] = { -1 };
|
|
static const s16 left_data_taisou6_1[] = { -1 };
|
|
static const s16 left_data_taisou6_2[] = { -1 };
|
|
static const s16 left_data_taisou7_1[] = { -1 };
|
|
static const s16 left_data_taisou7_2[] = { -1 };
|
|
static const s16 left_data_omairi_us1[] = { -1 };
|
|
|
|
static const s16* data_p_table[] = {
|
|
left_data_wait1,
|
|
left_data_walk1,
|
|
left_data_axe1,
|
|
left_data_run1,
|
|
left_data_push1,
|
|
left_data_pull1,
|
|
left_data_hold_wait1,
|
|
left_data_pickup1,
|
|
left_data_Lturn1,
|
|
left_data_Rturn1,
|
|
left_data_get1,
|
|
left_data_get_change1,
|
|
left_data_get_putaway1,
|
|
left_data_open1,
|
|
left_data_putaway1,
|
|
left_data_trans_wait1,
|
|
left_data_transfer1,
|
|
left_data_umb_open1,
|
|
left_data_umbrella1,
|
|
left_data_dash1,
|
|
left_data_run_slip1,
|
|
left_data_get_pull1,
|
|
left_data_get_m1,
|
|
left_data_kamae_move_m1,
|
|
left_data_kamae_wait_m1,
|
|
left_data_kokeru_a1,
|
|
left_data_kokeru_getup_a1,
|
|
left_data_kokeru_getup_n1,
|
|
left_data_kokeru_n1,
|
|
left_data_net1,
|
|
left_data_net_swing1,
|
|
left_data_axe_swing1,
|
|
left_data_kamae_slip_m1,
|
|
left_data_kokeru1,
|
|
left_data_kokeru_getup1,
|
|
left_data_sitdown1,
|
|
left_data_sitdown_wait1,
|
|
left_data_standup1,
|
|
left_data_putaway_m1,
|
|
left_data_bed_wait1,
|
|
left_data_inbed_L1,
|
|
left_data_inbed_R1,
|
|
left_data_intrain1,
|
|
left_data_kagu_open_d1,
|
|
left_data_kagu_open_h1,
|
|
left_data_kagu_open_k1,
|
|
left_data_negaeri_L1,
|
|
left_data_negaeri_R1,
|
|
left_data_outbed_L1,
|
|
left_data_outbed_R1,
|
|
left_data_outtrain1,
|
|
left_data_kagu_close_d1,
|
|
left_data_kagu_close_h1,
|
|
left_data_kagu_close_k1,
|
|
left_data_kagu_wait_d1,
|
|
left_data_kagu_wait_h1,
|
|
left_data_kagu_wait_k1,
|
|
left_data_go_out_o1,
|
|
left_data_go_out_s1,
|
|
left_data_into_s1,
|
|
left_data_axe_hane1,
|
|
left_data_axe_suka1,
|
|
left_data_hold_wait_h1,
|
|
left_data_hold_wait_o1,
|
|
left_data_get_t1,
|
|
left_data_get_t2,
|
|
left_data_putaway_t1,
|
|
left_data_sao1,
|
|
left_data_sao_swing1,
|
|
left_data_turi_hiki1,
|
|
left_data_turi_wait1,
|
|
left_data_not_get_t1,
|
|
left_data_menu_catch1,
|
|
left_data_menu_change1,
|
|
left_data_umb_close1,
|
|
left_data_not_sao_swing1,
|
|
left_data_intrain_wait1,
|
|
left_data_clear_table1,
|
|
left_data_dig1,
|
|
left_data_fill_up1,
|
|
left_data_not_dig1,
|
|
left_data_clear_table_l1,
|
|
left_data_pickup_l1,
|
|
left_data_scoop1,
|
|
left_data_confirm1,
|
|
left_data_dig_suka1,
|
|
left_data_get_d1,
|
|
left_data_putaway_d1,
|
|
left_data_dig_kabu1,
|
|
left_data_fill_up_i1,
|
|
left_data_send_mail1,
|
|
left_data_get_f1,
|
|
left_data_get_pull_f1,
|
|
left_data_get_putaway_f1,
|
|
left_data_trans_wait_f1,
|
|
left_data_transfer_f1,
|
|
left_data_shake1,
|
|
left_data_tired1,
|
|
left_data_wash1,
|
|
left_data_wash2,
|
|
left_data_wash3,
|
|
left_data_wash4,
|
|
left_data_wash5,
|
|
left_data_fukubiki1,
|
|
left_data_omairi1,
|
|
left_data_saisen1,
|
|
left_data_return_mail1,
|
|
left_data_return_mail2,
|
|
left_data_return_mail3,
|
|
left_data_eat1,
|
|
left_data_gaaan1,
|
|
left_data_gaaan2,
|
|
left_data_deru1,
|
|
left_data_guratuku1,
|
|
left_data_mogaku1,
|
|
left_data_otiru1,
|
|
left_data_zassou1,
|
|
left_data_knock1,
|
|
left_data_biku1,
|
|
left_data_hati1,
|
|
left_data_hati2,
|
|
left_data_hati3,
|
|
left_data_push_yuki1,
|
|
left_data_deru2,
|
|
left_data_otiru2,
|
|
left_data_itazura1,
|
|
left_data_umb_rot1,
|
|
left_data_pickup_wait1,
|
|
left_data_yatta1,
|
|
left_data_yatta2,
|
|
left_data_yatta3,
|
|
left_data_kaze1,
|
|
left_data_mosquito1,
|
|
left_data_mosquito2,
|
|
left_data_ride1,
|
|
left_data_ride2,
|
|
left_data_ridewait,
|
|
left_data_getoff1,
|
|
left_data_getoff2,
|
|
left_data_utiwa_wait1,
|
|
left_data_utiwa_d1,
|
|
left_data_axe_break1,
|
|
left_data_axe_breakwait1,
|
|
left_data_light_on1,
|
|
left_data_taisou1,
|
|
left_data_taisou2_1,
|
|
left_data_taisou2_2,
|
|
left_data_taisou3,
|
|
left_data_taisou4_1,
|
|
left_data_taisou4_2,
|
|
left_data_taisou5_1,
|
|
left_data_taisou5_2,
|
|
left_data_taisou6_1,
|
|
left_data_taisou6_2,
|
|
left_data_taisou7_1,
|
|
left_data_taisou7_2,
|
|
left_data_omairi_us1,
|
|
};
|
|
|
|
// clang-format off
|
|
static const u8 size_table[] = {
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
5,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
3,
|
|
3,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
3,
|
|
1,
|
|
2,
|
|
3,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
2,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1,
|
|
1.
|
|
};
|
|
// clang-format on
|
|
|
|
return Player_actor_Check_CommonFootMark_AnimeFrame_fromAnimeIndex(cur_frame, speed, end_frame, anime_index,
|
|
data_p_table, size_table);
|
|
}
|
|
|
|
static int Player_actor_Set_FootMark_MarkOnly(ACTOR* actorx, GAME* game, int disable_footprint) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
cKF_SkeletonInfo_R_c* kf0_p = &player->keyframe0;
|
|
cKF_FrameControl_c* fc0_p = &kf0_p->frame_control;
|
|
f32 cur_frame = fc0_p->current_frame;
|
|
f32 speed = fc0_p->speed;
|
|
f32 end_frame = fc0_p->end_frame;
|
|
int anime_index = player->animation0_idx;
|
|
int res = FALSE;
|
|
|
|
if (Player_actor_Check_RightFootMark_AnimeFrame_fromAnimeIndex(cur_frame, speed, end_frame, anime_index)) {
|
|
if (disable_footprint == FALSE) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_FOOTPRINT, player->right_foot_pos, 2, player->right_foot_angle.y,
|
|
game, RSV_NO, actorx->bg_collision_check.result.unit_attribute, 0);
|
|
}
|
|
|
|
res = TRUE;
|
|
}
|
|
|
|
if (Player_actor_Check_LeftFootMark_AnimeFrame_fromAnimeIndex(cur_frame, speed, end_frame, anime_index)) {
|
|
if (disable_footprint == FALSE) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_FOOTPRINT, player->left_foot_pos, 2, player->left_foot_angle.y, game,
|
|
RSV_NO, actorx->bg_collision_check.result.unit_attribute, 0);
|
|
}
|
|
|
|
res = TRUE;
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
static int Player_actor_CheckAble_FootMark_Sound(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int anime_index = player->animation0_idx;
|
|
|
|
if (anime_index >= 0 && anime_index < mPlayer_ANIM_NUM) {
|
|
// clang-format off
|
|
static const u8 data[] = {
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[anime_index];
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Set_FootMark_Base1(ACTOR* actorx, GAME* game, int disable_effect, int disable_sound) {
|
|
int footprint_res = Player_actor_Set_FootMark_MarkOnly(actorx, game, disable_effect);
|
|
|
|
if (disable_sound == FALSE && Player_actor_CheckAble_FootMark_Sound(actorx) && footprint_res) {
|
|
Player_actor_sound_FootStep2(actorx);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Set_FootMark_Base2(ACTOR* actorx, GAME* game, int disable_effect, int type) {
|
|
if (Player_actor_Set_FootMark_MarkOnly(actorx, game, disable_effect) &&
|
|
Player_actor_CheckAble_FootMark_Sound(actorx)) {
|
|
Player_actor_sound_FootStep1(actorx, type);
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_RotateOctagon(GAME* game) {
|
|
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_ROTATE_OCTAGON) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (player->keyframe0.frame_control.current_frame >= 9.0f) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Reset_unable_hand_item_in_demo(ACTOR* actorx, int main_index) {
|
|
if (Player_actor_Check_is_demo_mode(main_index) == FALSE) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->unable_hand_item_in_demo = FALSE;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Reset_able_hand_all_item_in_demo(ACTOR* actorx, int main_index) {
|
|
if (Player_actor_Check_is_demo_mode(main_index) == FALSE) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->able_hand_all_item_in_demo = FALSE;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Set_EffectBgTree(GAME* game, mActor_name_t item, s16 bg_ef_type, int ut_x, int ut_z) {
|
|
xyz_t pos;
|
|
|
|
if (mFI_UtNum2CenterWpos(&pos, ut_x, ut_z)) {
|
|
s16 variant;
|
|
pos.y = mCoBG_UtNum2UtCenterY_Keep(ut_x, ut_z);
|
|
|
|
if (IS_ITEM_XMAS_TREE(item) != FALSE) {
|
|
if (FGTreeType_check(item) == mNT_TREE_TYPE_CEDAR) {
|
|
variant = 12;
|
|
} else {
|
|
variant = 3;
|
|
}
|
|
} else if (IS_ITEM_SMALL_TREE(item) != FALSE) {
|
|
if (FGTreeType_check(item) == mNT_TREE_TYPE_PALM) {
|
|
variant = 4;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_CEDAR) {
|
|
variant = 8;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_GOLD) {
|
|
variant = 13;
|
|
} else {
|
|
variant = -1;
|
|
}
|
|
} else if (IS_ITEM_MED_TREE(item) != FALSE) {
|
|
if (FGTreeType_check(item) == mNT_TREE_TYPE_PALM) {
|
|
variant = 5;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_CEDAR) {
|
|
variant = 9;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_GOLD) {
|
|
variant = 14;
|
|
} else {
|
|
variant = 0;
|
|
}
|
|
} else if (IS_ITEM_LARGE_TREE(item) != FALSE) {
|
|
if (FGTreeType_check(item) == mNT_TREE_TYPE_PALM) {
|
|
variant = 6;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_CEDAR) {
|
|
variant = 10;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_GOLD) {
|
|
variant = 15;
|
|
} else {
|
|
variant = 1;
|
|
}
|
|
} else {
|
|
if (FGTreeType_check(item) == mNT_TREE_TYPE_PALM) {
|
|
variant = 7;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_CEDAR) {
|
|
variant = 11;
|
|
} else if (FGTreeType_check(item) == mNT_TREE_TYPE_GOLD) {
|
|
variant = 16;
|
|
} else {
|
|
variant = 2;
|
|
}
|
|
}
|
|
|
|
if (Common_Get(clip).make_effect_bg_proc != NULL) {
|
|
Common_Get(clip).make_effect_bg_proc(game, bg_ef_type, variant, &pos);
|
|
}
|
|
}
|
|
}
|
|
|
|
static mActor_name_t Player_actor_Get_shake_tree_position_and_itemNo(ACTOR* actorx, xyz_t* pos_p) {
|
|
xyz_t* player_pos_p = &actorx->world.position;
|
|
xyz_t center_pos;
|
|
|
|
if (mFI_Wpos2UtCenterWpos(¢er_pos, *player_pos_p)) {
|
|
static const f32 add_X[] = {
|
|
-mFI_UT_WORLDSIZE_X_F, 0.0f, mFI_UT_WORLDSIZE_X_F, -mFI_UT_WORLDSIZE_X_F, mFI_UT_WORLDSIZE_X_F,
|
|
-mFI_UT_WORLDSIZE_X_F, 0.0f, mFI_UT_WORLDSIZE_X_F,
|
|
};
|
|
static const f32 add_Z[] = {
|
|
-mFI_UT_WORLDSIZE_Z_F, -mFI_UT_WORLDSIZE_Z_F, -mFI_UT_WORLDSIZE_Z_F, 0.0f, 0.0f,
|
|
mFI_UT_WORLDSIZE_Z_F, mFI_UT_WORLDSIZE_Z_F, mFI_UT_WORLDSIZE_Z_F,
|
|
};
|
|
mActor_name_t unit_item[8];
|
|
xyz_t unit_pos[8];
|
|
int select_index = -1;
|
|
int i;
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
unit_pos[i].x = center_pos.x + add_X[i];
|
|
unit_pos[i].z = center_pos.z + add_Z[i];
|
|
}
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
mActor_name_t* fg_p = mFI_GetUnitFG(unit_pos[i]);
|
|
|
|
if (fg_p != NULL) {
|
|
if (IS_ITEM_COLLIDEABLE_TREE(*fg_p) == FALSE) {
|
|
unit_item[i] = EMPTY_NO;
|
|
} else {
|
|
unit_item[i] = *fg_p;
|
|
}
|
|
} else {
|
|
unit_item[i] = EMPTY_NO;
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
if (unit_item[i] != EMPTY_NO) {
|
|
f32 dy;
|
|
|
|
unit_pos[i].y = mCoBG_GetBgY_OnlyCenter_FromWpos2(unit_pos[i], 0.0f);
|
|
dy = ABS(unit_pos[i].y - player_pos_p->y);
|
|
|
|
if (dy > 10.0f) {
|
|
unit_item[i] = EMPTY_NO;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
if (unit_item[i] != EMPTY_NO) {
|
|
f32 dist_sq = Math3DLengthSquare2D(unit_pos[i].x, unit_pos[i].z, player_pos_p->x, player_pos_p->z);
|
|
|
|
if (dist_sq >= SQ(mFI_UNIT_BASE_SIZE_F)) {
|
|
unit_item[i] = EMPTY_NO;
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
int min_angle = DEG2SHORT_ANGLE2(45.0f);
|
|
int player_angle_y = actorx->shape_info.rotation.y;
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
if (unit_item[i] != EMPTY_NO) {
|
|
f32 dx = unit_pos[i].x - player_pos_p->x;
|
|
f32 dz = unit_pos[i].z - player_pos_p->z;
|
|
int angle = (s16)(atans_table(dz, dx) - player_angle_y);
|
|
int abs_angle = ABS(angle);
|
|
|
|
if (abs_angle < min_angle) {
|
|
select_index = i;
|
|
min_angle = abs_angle;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (select_index >= 0 && select_index < 8) {
|
|
*pos_p = unit_pos[select_index];
|
|
return unit_item[select_index];
|
|
}
|
|
}
|
|
|
|
*pos_p = *player_pos_p;
|
|
return EMPTY_NO;
|
|
}
|
|
|
|
static mActor_name_t Player_actor_check_fg_little_shake_tree(ACTOR* actorx, int* ut_x_p, int* ut_z_p, xyz_t* pos_p) {
|
|
mActor_name_t item = Player_actor_Get_shake_tree_position_and_itemNo(actorx, pos_p);
|
|
|
|
if (item != EMPTY_NO && mFI_Wpos2UtNum(ut_x_p, ut_z_p, *pos_p)) {
|
|
return item;
|
|
}
|
|
|
|
*ut_x_p = -1;
|
|
*ut_z_p = -1;
|
|
return EMPTY_NO;
|
|
}
|
|
|
|
static int Player_actor_Check_able_shake_tree_table(ACTOR* actorx, int tree_ut_x, int tree_ut_z, int little_flag,
|
|
f32 time) {
|
|
if (tree_ut_x < 0 || tree_ut_z < 0) {
|
|
return FALSE;
|
|
} else {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32* shake_timer_p = player->shake_tree_timer;
|
|
int* shake_ut_x_p = player->shake_tree_ut_x;
|
|
int* shake_ut_z_p = player->shake_tree_ut_z;
|
|
int i;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
if (tree_ut_x == *shake_ut_x_p && tree_ut_z == *shake_ut_z_p) {
|
|
if (little_flag != FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (*shake_timer_p > time) {
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
shake_timer_p++;
|
|
shake_ut_x_p++;
|
|
shake_ut_z_p++;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
static int Player_actor_Set_shake_tree_table(ACTOR* actorx, GAME* game, mActor_name_t item, int tree_ut_x,
|
|
int tree_ut_z, int little_flag) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (Player_actor_Check_able_shake_tree_table(actorx, tree_ut_x, tree_ut_z, little_flag, 0.0f) == FALSE) {
|
|
return FALSE;
|
|
} else {
|
|
f32* shake_timer_p = player->shake_tree_timer;
|
|
int* shake_ut_x_p = player->shake_tree_ut_x;
|
|
int* shake_ut_z_p = player->shake_tree_ut_z;
|
|
int* shake_tree_little_p = player->shake_tree_little;
|
|
int i;
|
|
|
|
if (little_flag == FALSE) {
|
|
for (i = 0; i < 3; i++) {
|
|
#if defined(BUGFIXES)
|
|
if ((*shake_ut_x_p == tree_ut_x) && (*shake_ut_z_p == tree_ut_z)) {
|
|
Player_actor_Set_EffectBgTree(game, item, EffectBG_EFFECT_SHAKE_LARGE, tree_ut_x, tree_ut_z);
|
|
*shake_timer_p = 84.0f;
|
|
*shake_tree_little_p = FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
#else
|
|
// @BUG - *shake_ut_z_p is missing an = sign
|
|
if ((*shake_ut_x_p == tree_ut_x) && (*shake_ut_z_p = tree_ut_z)) {
|
|
Player_actor_Set_EffectBgTree(game, item, EffectBG_EFFECT_SHAKE_LARGE, tree_ut_x, tree_ut_z);
|
|
*shake_timer_p = 84.0f;
|
|
*shake_tree_little_p = FALSE;
|
|
return TRUE;
|
|
}
|
|
#endif
|
|
|
|
shake_timer_p++;
|
|
shake_ut_x_p++;
|
|
shake_ut_z_p++;
|
|
shake_tree_little_p++;
|
|
}
|
|
|
|
shake_timer_p = player->shake_tree_timer;
|
|
shake_ut_x_p = player->shake_tree_ut_x;
|
|
shake_ut_z_p = player->shake_tree_ut_z;
|
|
shake_tree_little_p = player->shake_tree_little;
|
|
}
|
|
|
|
{
|
|
s16 bg_ef_type;
|
|
int i;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
if (*shake_ut_x_p < 0 || *shake_ut_z_p < 0) {
|
|
bg_ef_type = little_flag ? EffectBG_EFFECT_SHAKE_SMALL : EffectBG_EFFECT_SHAKE_LARGE;
|
|
*shake_ut_x_p = tree_ut_x;
|
|
*shake_ut_z_p = tree_ut_z;
|
|
|
|
if (little_flag) {
|
|
*shake_timer_p = 16.0f;
|
|
} else {
|
|
*shake_timer_p = 84.0f;
|
|
}
|
|
|
|
*shake_tree_little_p = little_flag;
|
|
Player_actor_Set_EffectBgTree(game, item, bg_ef_type, tree_ut_x, tree_ut_z);
|
|
return TRUE;
|
|
}
|
|
|
|
shake_timer_p++;
|
|
shake_ut_x_p++;
|
|
shake_ut_z_p++;
|
|
shake_tree_little_p++;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_check_little_shake_tree(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_index = player->now_main_index;
|
|
int tree_ut_x = -1;
|
|
int tree_ut_z = -1;
|
|
|
|
switch (main_index) {
|
|
default: {
|
|
xyz_t pos;
|
|
mActor_name_t item;
|
|
|
|
item = Player_actor_check_fg_little_shake_tree(actorx, &tree_ut_x, &tree_ut_z, &pos);
|
|
if (item != EMPTY_NO && Player_actor_Set_shake_tree_table(actorx, game, item, tree_ut_x, tree_ut_z, TRUE)) {
|
|
if (IS_ITEM_SHAKEABLE_TREE(item) != FALSE) {
|
|
Player_actor_sound_tree_touch(&pos);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case mPlayer_INDEX_SHAKE_TREE:
|
|
tree_ut_x = player->main_data.shake_tree.tree_ut_x;
|
|
tree_ut_z = player->main_data.shake_tree.tree_ut_z;
|
|
break;
|
|
}
|
|
|
|
{
|
|
f32* shake_timer_p = player->shake_tree_timer;
|
|
int* shake_ut_x_p = player->shake_tree_ut_x;
|
|
int* shake_ut_z_p = player->shake_tree_ut_z;
|
|
int shake_ut_x;
|
|
int shake_ut_z;
|
|
int i;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
if (*shake_timer_p <= 0.0f) {
|
|
shake_ut_x = *shake_ut_x_p;
|
|
shake_ut_z = *shake_ut_z_p;
|
|
|
|
if ((shake_ut_x >= 0 || shake_ut_z >= 0) && (shake_ut_x != tree_ut_x || shake_ut_z != tree_ut_z)) {
|
|
*shake_ut_x_p = -1;
|
|
*shake_ut_z_p = -1;
|
|
}
|
|
}
|
|
|
|
shake_timer_p++;
|
|
shake_ut_x_p++;
|
|
shake_ut_z_p++;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_check_shake_tree_timer(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32* shake_timer_p = player->shake_tree_timer;
|
|
int i;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
if (*shake_timer_p > 0.0f) {
|
|
*shake_timer_p -= 1.0f;
|
|
if (*shake_timer_p < 0.0f) {
|
|
*shake_timer_p = 0.0f;
|
|
}
|
|
}
|
|
|
|
shake_timer_p++;
|
|
}
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_shake_tree_all(GAME* game) {
|
|
if (Player_actor_CheckController_forShake_tree(game)) {
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
|
xyz_t pos;
|
|
mActor_name_t item;
|
|
|
|
item = Player_actor_Get_shake_tree_position_and_itemNo(actorx, &pos);
|
|
if (item != EMPTY_NO) {
|
|
int tree_ut_x;
|
|
int tree_ut_z;
|
|
|
|
if (mFI_Wpos2UtNum(&tree_ut_x, &tree_ut_z, pos) &&
|
|
Player_actor_Check_able_shake_tree_table(actorx, tree_ut_x, tree_ut_z, FALSE, 16.0f)) {
|
|
return Player_actor_request_main_shake_tree_all(game, &pos, item, tree_ut_x, tree_ut_z,
|
|
mPlayer_REQUEST_PRIORITY_5);
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Get_tree_shaken_table_index(ACTOR* actorx, const xyz_t* pos_p) {
|
|
int tree_ut_x;
|
|
int tree_ut_z;
|
|
|
|
if (mFI_Wpos2UtNum(&tree_ut_x, &tree_ut_z, *pos_p)) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
f32* shake_timer_p = player->shake_tree_timer;
|
|
int* shake_ut_x_p = player->shake_tree_ut_x;
|
|
int* shake_ut_z_p = player->shake_tree_ut_z;
|
|
int i;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
if (*shake_timer_p > 0.0f && *shake_ut_x_p == tree_ut_x && *shake_ut_z_p == tree_ut_z) {
|
|
return i;
|
|
}
|
|
|
|
shake_timer_p++;
|
|
shake_ut_x_p++;
|
|
shake_ut_z_p++;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
static int Player_actor_Check_tree_shaken_little(ACTOR* actorx, const xyz_t* pos_p) {
|
|
int idx = Player_actor_Get_tree_shaken_table_index(actorx, pos_p);
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (idx >= 0 && idx < 3 && player->shake_tree_little[idx] != FALSE) {
|
|
return TRUE;
|
|
} else {
|
|
xyz_t scoop_pos;
|
|
|
|
if (Player_actor_Check_HitScoop(actorx, &scoop_pos)) {
|
|
xyz_t ut_center_pos;
|
|
|
|
if (mFI_Wpos2UtCenterWpos(&ut_center_pos, *pos_p)) {
|
|
if (scoop_pos.x == ut_center_pos.x && scoop_pos.z == ut_center_pos.z) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_tree_shaken_big(ACTOR* actorx, const xyz_t* pos_p) {
|
|
int idx = Player_actor_Get_tree_shaken_table_index(actorx, pos_p);
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (idx >= 0 && idx < 3 && player->shake_tree_little[idx] == FALSE) {
|
|
return TRUE;
|
|
} else {
|
|
xyz_t axe_pos;
|
|
|
|
if (Player_actor_Check_HitAxe(actorx, &axe_pos)) {
|
|
xyz_t ut_center_pos;
|
|
|
|
if (mFI_Wpos2UtCenterWpos(&ut_center_pos, *pos_p)) {
|
|
if (axe_pos.x == ut_center_pos.x && axe_pos.z == ut_center_pos.z) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_tree_shaken(ACTOR* actorx, const xyz_t* pos_p) {
|
|
if (Player_actor_Check_tree_shaken_little(actorx, pos_p) || Player_actor_Check_tree_shaken_big(actorx, pos_p)) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_reset_pitfall(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->pitfall_flag) {
|
|
if (Common_Get(clip).bg_item_clip != NULL && Common_Get(clip).bg_item_clip->pit_fall_stop_proc != NULL) {
|
|
xyz_t* pitfall_pos_p = &player->pitfall_pos;
|
|
mActor_name_t* fg_p = mFI_GetUnitFG(*pitfall_pos_p);
|
|
|
|
if (fg_p != NULL) {
|
|
mActor_name_t item = *fg_p;
|
|
|
|
if (ITEM_IS_BURIED_PITFALL_HOLE_RSV(item)) {
|
|
int ut_x;
|
|
int ut_z;
|
|
|
|
if (mFI_Wpos2UtNum(&ut_x, &ut_z, *pitfall_pos_p)) {
|
|
Common_Get(clip).bg_item_clip->pit_fall_stop_proc(item, ut_x, ut_z, EMPTY_NO);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
player->pitfall_flag = FALSE;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_check_pitfall(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Player_actor_reset_pitfall(actorx);
|
|
if (Common_Get(clip).bg_item_clip != NULL && Common_Get(clip).bg_item_clip->pit_fall_proc != NULL) {
|
|
int main_index = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
if (data[main_index] != FALSE) {
|
|
xyz_t* player_pos_p = &actorx->world.position;
|
|
xyz_t pitfall_check_pos;
|
|
|
|
if (mFI_Wpos2UtCenterWpos(&pitfall_check_pos, *player_pos_p)) {
|
|
f32 dist = Math3DLengthSquare2D(pitfall_check_pos.x, pitfall_check_pos.y, player_pos_p->x,
|
|
player_pos_p->y);
|
|
|
|
if (dist <= SQ(19.0f)) {
|
|
mActor_name_t* fg_p = mFI_GetUnitFG(pitfall_check_pos);
|
|
|
|
if (fg_p != NULL) {
|
|
mActor_name_t item = *fg_p;
|
|
|
|
if (ITEM_IS_BURIED_PITFALL_HOLE(item)) {
|
|
pitfall_check_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(pitfall_check_pos, 0.0f);
|
|
if (Player_actor_request_main_ready_pitfall_all(game, &pitfall_check_pos,
|
|
mPlayer_REQUEST_PRIORITY_26)) {
|
|
int ut_x;
|
|
int ut_z;
|
|
|
|
if (mFI_Wpos2UtNum(&ut_x, &ut_z, pitfall_check_pos)) {
|
|
Common_Get(clip).bg_item_clip->pit_fall_proc(item, ut_x, ut_z, EMPTY_NO);
|
|
player->pitfall_pos = pitfall_check_pos;
|
|
player->pitfall_flag = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_end_stung_bee(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->now_main_index == mPlayer_INDEX_STUNG_BEE) {
|
|
if (player->main_data.stung_bee.timer <= 162.0f) {
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
static int Player_actor_Check_BirthBee_common(ACTOR* actorx, mActor_name_t item, int tree_ut_x, int tree_ut_z,
|
|
s16* angle_y_p) {
|
|
if (Common_Get(clip).bg_item_clip != NULL && Common_Get(clip).bg_item_clip->item_tree_fruit_drop_proc != NULL) {
|
|
if (tree_ut_x >= 0 && tree_ut_z >= 0) {
|
|
if (IS_ITEM_BEE_TREE(item)) {
|
|
xyz_t item_drop_pos;
|
|
|
|
Common_Get(clip).bg_item_clip->item_tree_fruit_drop_proc(item, tree_ut_x, tree_ut_z, &item_drop_pos);
|
|
if (item_drop_pos.x >= 0.0f && item_drop_pos.z >= 0.0f) {
|
|
if (angle_y_p != NULL) {
|
|
f32 dx = item_drop_pos.x - actorx->world.position.x;
|
|
f32 dz = item_drop_pos.z - actorx->world.position.z;
|
|
|
|
if (dx != 0.0f || dz != 0.0f) {
|
|
*angle_y_p = atans_table(dz, dx);
|
|
} else {
|
|
*angle_y_p = actorx->shape_info.rotation.y;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_set_ripple(ACTOR* actorx, GAME* game) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (eEC_CLIP != NULL) {
|
|
f32* ripple_timer_p = &player->ripple_timer;
|
|
|
|
*ripple_timer_p += 1.0f;
|
|
if (*ripple_timer_p >= 8.0f) {
|
|
s16 attr = actorx->bg_collision_check.result.unit_attribute;
|
|
|
|
if (player->ripple_foot_idx != 0) {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_WAIT_ASIMOTO, player->right_foot_pos, 2,
|
|
player->right_foot_angle.y, game, RSV_NO, attr, 0);
|
|
player->ripple_foot_idx = 0;
|
|
} else {
|
|
eEC_CLIP->effect_make_proc(eEC_EFFECT_WAIT_ASIMOTO, player->left_foot_pos, 2, player->left_foot_angle.y,
|
|
game, RSV_NO, attr, 0);
|
|
player->ripple_foot_idx = 1;
|
|
}
|
|
|
|
*ripple_timer_p = 0.0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_NecessaryDoorKnock(ACTOR* actorx) {
|
|
mActor_name_t item = actorx->npc_id;
|
|
|
|
if (ITEM_NAME_GET_TYPE(item) == NAME_TYPE_STRUCT) {
|
|
if (ITEM_IS_PLAYER_HOUSE(item)) {
|
|
|
|
if (mEv_CheckFirstIntro()) {
|
|
return TRUE;
|
|
} else {
|
|
int arrange_idx = item - HOUSE0;
|
|
|
|
if (mLd_PlayerManKindCheck() == FALSE) {
|
|
if (arrange_idx != mHS_get_arrange_idx(Common_Get(player_no))) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
return TRUE;
|
|
}
|
|
}
|
|
} else if (ITEM_IS_NPC_HOUSE(item) || ITEM_IS_ISLAND_NPC_HOUSE(item)) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_KnockDoor(ACTOR* actorx, GAME* game, int main_index) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (main_index == mPlayer_INDEX_DOOR) {
|
|
mPlayer_request_door_c* req_door_data_p = &player->requested_main_index_data.door;
|
|
ACTOR* door_actor = (ACTOR*)req_door_data_p->label;
|
|
|
|
if (door_actor != NULL && Player_actor_Check_NecessaryDoorKnock(door_actor)) {
|
|
if (Player_actor_request_main_knock_door(game, &req_door_data_p->player_pos, req_door_data_p->angle_y,
|
|
mPlayer_REQUEST_PRIORITY_38)) {
|
|
return mPlayer_INDEX_KNOCK_DOOR;
|
|
}
|
|
}
|
|
}
|
|
|
|
return main_index;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_ItemInOut(ACTOR* actorx, GAME* game, int main_index) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s8 able_hand_all_item_in_demo = player->able_hand_all_item_in_demo;
|
|
s8 item_kind = Player_actor_Get_ItemKind_fromScene();
|
|
|
|
if (item_kind >= 0 && able_hand_all_item_in_demo == FALSE) {
|
|
int request_main_index = player->requested_main_index;
|
|
int now_main_index = player->now_main_index;
|
|
int request_able_out_item = Player_actor_CheckPlayer_AbleOutItem(request_main_index);
|
|
int main_able_out_item = Player_actor_CheckPlayer_AbleOutItem(now_main_index);
|
|
|
|
if (request_able_out_item == mPlayer_ABLE_ITEM_NONE || main_able_out_item == mPlayer_ABLE_ITEM_NONE) {
|
|
return main_index;
|
|
}
|
|
|
|
if (mPlayer_ITEM_IS_NOT_TOOL(item_kind) == FALSE) {
|
|
if ((request_able_out_item == mPlayer_ABLE_ITEM_RESTRICTED ||
|
|
request_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA) &&
|
|
main_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_ALL) {
|
|
if (Player_actor_request_main_putin_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_PUTIN_ITEM;
|
|
}
|
|
} else if ((request_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_ALL) &&
|
|
(main_able_out_item == mPlayer_ABLE_ITEM_RESTRICTED ||
|
|
main_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA)) {
|
|
if (Player_actor_request_main_takeout_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_TAKEOUT_ITEM;
|
|
}
|
|
}
|
|
} else {
|
|
if (mPlayer_ITEM_IS_NOT_TOOL(item_kind) != FALSE) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); // we already have the player????
|
|
int umbrella_flag = FALSE;
|
|
|
|
if (request_main_index == mPlayer_INDEX_TALK) {
|
|
umbrella_flag = player->requested_main_index_data.talk.umbrella_flag;
|
|
} else if (request_main_index == mPlayer_INDEX_DEMO_WAIT) {
|
|
umbrella_flag = player->requested_main_index_data.demo_wait.umbrella_flag;
|
|
}
|
|
|
|
if (umbrella_flag != FALSE && Player_actor_request_main_putin_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_PUTIN_ITEM;
|
|
}
|
|
}
|
|
|
|
{
|
|
int in_demo_mode = Player_actor_Check_is_demo_mode(now_main_index);
|
|
int will_be_in_demo_mode = Player_actor_Check_is_demo_mode(request_main_index);
|
|
s8 unable_hand_item_in_demo = player->unable_hand_item_in_demo;
|
|
|
|
if (in_demo_mode && !will_be_in_demo_mode && unable_hand_item_in_demo &&
|
|
Player_actor_request_main_takeout_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_TAKEOUT_ITEM;
|
|
} else if (request_able_out_item == mPlayer_ABLE_ITEM_RESTRICTED &&
|
|
(main_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_ALL ||
|
|
main_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA)) {
|
|
if (Player_actor_request_main_putin_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_PUTIN_ITEM;
|
|
}
|
|
} else if ((request_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_ALL ||
|
|
request_able_out_item == mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA) &&
|
|
main_able_out_item == mPlayer_ABLE_ITEM_RESTRICTED) {
|
|
if (Player_actor_request_main_takeout_item(game, mPlayer_REQUEST_PRIORITY_37)) {
|
|
return mPlayer_INDEX_TAKEOUT_ITEM;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return main_index;
|
|
}
|
|
|
|
static void Player_actor_Set_bgm_volume(ACTOR* actorx, int main_index) {
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE && mEv_CheckTitleDemo() <= 0) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_FISHING,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
mPlayer_BGM_VOLUME_MODE_NORMAL,
|
|
};
|
|
// clang-format on
|
|
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
s8 last_bgm_volume_mode = player->bgm_volume_mode;
|
|
s8 next_bgm_volume_mode = data[main_index];
|
|
|
|
if (last_bgm_volume_mode != next_bgm_volume_mode) {
|
|
if (next_bgm_volume_mode == mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS) {
|
|
mBGMPsComp_volume_collect_insects_start();
|
|
} else if (next_bgm_volume_mode == mPlayer_BGM_VOLUME_MODE_FISHING) {
|
|
mBGMPsComp_volume_fishing_start();
|
|
}
|
|
|
|
if (last_bgm_volume_mode == mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS) {
|
|
mBGMPsComp_volume_collect_insects_end();
|
|
} else if (last_bgm_volume_mode == mPlayer_BGM_VOLUME_MODE_FISHING) {
|
|
mBGMPsComp_volume_fishing_end();
|
|
}
|
|
|
|
player->bgm_volume_mode = next_bgm_volume_mode;
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_Label_main_push_snowball(GAME* game, u32 label) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (player->now_main_index == mPlayer_INDEX_PUSH_SNOWBALL && player->main_data.push_snowball.label == label) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_Label_main_wade_snowball(GAME* game, u32 label) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (player->now_main_index == mPlayer_INDEX_WADE_SNOWBALL &&
|
|
player->main_data.wade_snowball.snowball_label == label) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_SetParam_for_push_snowball(GAME* game, const xyz_t* pos_p, s16 angle_y, f32 anim_speed) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
|
|
if (player->now_main_index == mPlayer_INDEX_PUSH_SNOWBALL) {
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(gamePT);
|
|
|
|
actorx->world.position = *pos_p;
|
|
actorx->shape_info.rotation.y = angle_y;
|
|
actorx->world.angle.y = angle_y;
|
|
player->keyframe0.frame_control.speed = anim_speed;
|
|
player->keyframe1.frame_control.speed = anim_speed;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_GetSnowballPos_forWadeSnowball(ACTOR* actorx, xyz_t* pos_p) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->now_main_index == mPlayer_INDEX_WADE_SNOWBALL) {
|
|
xyz_t* snowball_dist_p = &player->main_data.wade_snowball.snowball_dist;
|
|
|
|
pos_p->x = actorx->world.position.x + snowball_dist_p->x;
|
|
pos_p->y = actorx->world.position.y + snowball_dist_p->y;
|
|
pos_p->z = actorx->world.position.z + snowball_dist_p->z;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckCondition_forWadeSnowball(GAME* game, const xyz_t* pos_p, s16 angle_y) {
|
|
return Player_actor_CheckAbleMoveWadeBlock(game, pos_p, angle_y, 0.65f, DEG2SHORT_ANGLE2(5.0f),
|
|
mEv_CheckTitleDemo() <= 0);
|
|
}
|
|
|
|
static void Player_actor_Culc_player_frame_counter(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->player_frame_counter++;
|
|
}
|
|
|
|
static void Player_actor_Reset_excute_cancel_wade(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->excute_cancel_wade) {
|
|
if (mPlib_Get_unable_wade()) {
|
|
int dFrame = player->player_frame_counter - player->cancel_wade_timer;
|
|
|
|
if (dFrame < 0) {
|
|
dFrame = 0xFFFF - dFrame;
|
|
}
|
|
|
|
if (dFrame > 0) {
|
|
player->excute_cancel_wade = FALSE;
|
|
}
|
|
} else {
|
|
player->excute_cancel_wade = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Culc_wade_end_pos(const xyz_t* src_pos_p, xyz_t* wade_end_pos_p, int direction,
|
|
f32 border_adjust) {
|
|
int bx;
|
|
int bz;
|
|
|
|
*wade_end_pos_p = *src_pos_p;
|
|
if (mFI_Wpos2BlockNum(&bx, &bz, *src_pos_p)) {
|
|
xyz_t wpos;
|
|
xyz_t lpos = { 0.0f, 0.0f, 0.0f };
|
|
|
|
mFI_LposInBKtoWpos(&wpos, lpos, bx, bz);
|
|
switch (direction) {
|
|
case mFI_MOVEDIR_RIGHT:
|
|
case mFI_MOVEDIR_LEFT: {
|
|
f32 z_up = (wpos.z + border_adjust);
|
|
f32 z_down = (wpos.z - border_adjust) + mFI_BK_WORLDSIZE_Z_F;
|
|
|
|
if (wade_end_pos_p->z < z_up) {
|
|
wade_end_pos_p->z = z_up;
|
|
} else if (wade_end_pos_p->z > z_down) {
|
|
wade_end_pos_p->z = z_down;
|
|
}
|
|
break;
|
|
}
|
|
|
|
case mFI_MOVEDIR_UP:
|
|
default: {
|
|
f32 x_left = (wpos.x + border_adjust);
|
|
f32 x_right = (wpos.x - border_adjust) + mFI_BK_WORLDSIZE_X_F;
|
|
|
|
if (wade_end_pos_p->x < x_left) {
|
|
wade_end_pos_p->x = x_left;
|
|
} else if (wade_end_pos_p->x > x_right) {
|
|
wade_end_pos_p->x = x_right;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
switch (direction) {
|
|
case mFI_MOVEDIR_RIGHT:
|
|
wade_end_pos_p->x = (wpos.x + border_adjust) + mFI_BK_WORLDSIZE_X_F;
|
|
break;
|
|
case mFI_MOVEDIR_LEFT:
|
|
wade_end_pos_p->x = (wpos.x - border_adjust);
|
|
break;
|
|
case mFI_MOVEDIR_UP:
|
|
wade_end_pos_p->z = (wpos.z - border_adjust);
|
|
break;
|
|
default:
|
|
wade_end_pos_p->z = (wpos.z + border_adjust) + mFI_BK_WORLDSIZE_Z_F;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Get_PickupHandPosition(ACTOR* actorx, xyz_t* pos_p, f32 dist) {
|
|
s16 angle_y = actorx->shape_info.rotation.y;
|
|
f32 x = dist * sin_s(angle_y);
|
|
f32 z = dist * cos_s(angle_y);
|
|
|
|
*pos_p = actorx->world.position;
|
|
pos_p->x += x;
|
|
pos_p->z += z;
|
|
}
|
|
|
|
static void Player_actor_Get_ItemDisplayPos(xyz_t* item_pos_p, xyz_t* center_pos_p) {
|
|
if (Common_Get(clip).bg_item_clip != NULL && Common_Get(clip).bg_item_clip->rand_pos_get_proc != NULL) {
|
|
const xyz_t pos = *center_pos_p;
|
|
|
|
Common_Get(clip).bg_item_clip->rand_pos_get_proc(item_pos_p, &pos);
|
|
} else {
|
|
*item_pos_p = *center_pos_p;
|
|
}
|
|
}
|
|
|
|
static int Player_actor_CheckItemPosition_forPickup(const xyz_t* pos_p, f32 max_dist_sq, f32 max_dist_y,
|
|
xyz_t* target_pos_p, xyz_t* item_pos_p) {
|
|
mFI_Wpos2UtCenterWpos(target_pos_p, *pos_p);
|
|
if (Common_Get(field_type) != mFI_FIELDTYPE2_FG) {
|
|
target_pos_p->y = mCoBG_GetBgY_OnlyCenter_FromWpos2(*target_pos_p, 0.0f);
|
|
} else {
|
|
target_pos_p->y = mCoBG_GetBgY_OnlyCenter_FromWpos2(*target_pos_p, -1.0f);
|
|
}
|
|
|
|
Player_actor_Get_ItemDisplayPos(item_pos_p, target_pos_p);
|
|
|
|
target_pos_p->y = mCoBG_GetBgY_OnlyCenter_FromWpos2(*target_pos_p, 0.0f);
|
|
if (Math3DLengthSquare2D(item_pos_p->x, item_pos_p->z, pos_p->x, pos_p->z) <= max_dist_sq) {
|
|
f32 dy = target_pos_p->y - pos_p->y;
|
|
|
|
if (ABS(dy) <= max_dist_y) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static mActor_name_t* Player_actor_CheckItem_fromPosition(const xyz_t* pos_p, f32 max_dist_sq, f32 max_dist_y,
|
|
xyz_t* target_pos_p, xyz_t* item_pos_p) {
|
|
if (mFI_Wpos2DepositGet(*pos_p) == FALSE) {
|
|
mActor_name_t* fg_p = mFI_GetUnitFG(*pos_p);
|
|
|
|
if (fg_p != NULL) {
|
|
if (IS_ITEM_GRASS(*fg_p) != FALSE) {
|
|
if (Player_actor_CheckItemPosition_forPickup(pos_p, max_dist_sq, max_dist_y, target_pos_p,
|
|
item_pos_p)) {
|
|
return fg_p;
|
|
}
|
|
} else {
|
|
int field_type = Common_Get(field_type);
|
|
|
|
switch (ITEM_NAME_GET_TYPE(*fg_p)) {
|
|
case NAME_TYPE_FTR0:
|
|
case NAME_TYPE_FTR1:
|
|
if (field_type != mFI_FIELDTYPE2_FG) {
|
|
break;
|
|
}
|
|
/* Fallthrough */
|
|
case NAME_TYPE_ITEM1:
|
|
if (Player_actor_CheckItemPosition_forPickup(pos_p, max_dist_sq, max_dist_y, target_pos_p,
|
|
item_pos_p)) {
|
|
return fg_p;
|
|
}
|
|
break;
|
|
default:
|
|
if (ITEM_IS_SIGNBOARD(*fg_p) != FALSE) {
|
|
if (Player_actor_CheckItemPosition_forPickup(pos_p, max_dist_sq, max_dist_y, target_pos_p,
|
|
item_pos_p)) {
|
|
return fg_p;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
static mActor_name_t* Player_actor_Search_putin_item(ACTOR* actorx, xyz_t* target_pos_p, xyz_t* item_pos_p) {
|
|
xyz_t pos;
|
|
mActor_name_t* fg_p;
|
|
|
|
/* Check for signboards first */
|
|
Player_actor_Get_PickupHandPosition(actorx, &pos, 35.0f);
|
|
fg_p = Player_actor_CheckItem_fromPosition(&pos, SQ(15.0f), 15.0f, target_pos_p, item_pos_p);
|
|
if (fg_p != NULL && ITEM_IS_SIGNBOARD(*fg_p) != FALSE) {
|
|
return fg_p;
|
|
}
|
|
|
|
/* Now look for regular items */
|
|
Player_actor_Get_PickupHandPosition(actorx, &pos, 20.0f);
|
|
fg_p = Player_actor_CheckItem_fromPosition(&pos, SQ(15.0f), 15.0f, target_pos_p, item_pos_p);
|
|
if (fg_p != NULL) {
|
|
return fg_p;
|
|
}
|
|
|
|
/* Search even closer */
|
|
Player_actor_Get_PickupHandPosition(actorx, &pos, 10.0f);
|
|
fg_p = Player_actor_CheckItem_fromPosition(&pos, SQ(15.0f), 15.0f, target_pos_p, item_pos_p);
|
|
return fg_p;
|
|
}
|
|
|
|
static int Player_actor_check_putin_item(ACTOR* actorx, mActor_name_t* item_p, xyz_t* target_pos_p, xyz_t* item_pos_p) {
|
|
mActor_name_t* fg_p = Player_actor_Search_putin_item(actorx, target_pos_p, item_pos_p);
|
|
|
|
if (fg_p != NULL) {
|
|
*item_p = *fg_p;
|
|
return TRUE;
|
|
} else {
|
|
*item_p = EMPTY_NO;
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
static mActor_name_t Player_actor_Get_itemNo_forWindow(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int main_index = player->now_main_index;
|
|
|
|
if (main_index == mPlayer_INDEX_WAIT) {
|
|
mActor_name_t itemNo = EMPTY_NO;
|
|
xyz_t item_pos;
|
|
xyz_t target_pos;
|
|
|
|
if (Player_actor_check_putin_item(actorx, &itemNo, &target_pos, &item_pos)) {
|
|
if (IS_ITEM_GRASS(itemNo) == FALSE) {
|
|
return itemNo;
|
|
}
|
|
}
|
|
}
|
|
|
|
return EMPTY_NO;
|
|
}
|
|
|
|
static int Player_actor_able_submenu_request_main_index(GAME* game) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
int res;
|
|
|
|
if (player->requested_main_index_changed) {
|
|
int request_main_index = player->requested_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(request_main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
request_main_index = data[request_main_index];
|
|
return request_main_index;
|
|
}
|
|
} else {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Request_main_refuse_pickup_all(GAME* game, int refuse_pickup_knife_fork) {
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->refuse_pickup_knife_fork_flag = refuse_pickup_knife_fork;
|
|
mDemo_Request(mDemo_TYPE_REPORT, actorx, &Player_actor_Refuse_pickup_demo_ct);
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_pickup_all(GAME* game) {
|
|
int field_type = Common_Get(field_type);
|
|
|
|
if ((field_type == mFI_FIELDTYPE2_FG || field_type == mFI_FIELDTYPE2_PLAYER_ROOM) &&
|
|
Player_actor_CheckController_forPickup(game) &&
|
|
Player_actor_check_request_main_priority(game, mPlayer_REQUEST_PRIORITY_8) > 0 &&
|
|
Player_actor_check_cancel_request_change_proc_index(mPlayer_INDEX_PICKUP) == FALSE) {
|
|
int can_exchange = field_type == mFI_FIELDTYPE2_FG;
|
|
|
|
if (mEv_CheckTitleDemo() <= 0) {
|
|
/* Check for picking up items in your house */
|
|
if (Common_Get(clip).my_room_clip != NULL) {
|
|
mActor_name_t item = Common_Get(clip).my_room_clip->search_pickup_ftr_proc(game);
|
|
int item_slot = mPlib_Get_space_putin_item_forTICKET(&item);
|
|
|
|
if (ITEM_NAME_GET_TYPE(item) == NAME_TYPE_ITEM1) {
|
|
xyz_t item_pos;
|
|
|
|
Common_Get(clip).my_room_clip->leaf_start_pos_proc(&item_pos);
|
|
if (item_slot >= 0 || ITEM_IS_MYMANNIQUIN(item) || ITEM_IS_MYUMBRELLA(item) || can_exchange) {
|
|
if (Player_actor_request_main_pickup_jump(game, item_slot, item, &item_pos, FALSE, FALSE)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
Player_actor_Request_main_refuse_pickup_all(game, FALSE);
|
|
}
|
|
} else if (item != EMPTY_NO) {
|
|
xyz_t ftr_pos;
|
|
|
|
Common_Get(clip).my_room_clip->leaf_start_pos_proc(&ftr_pos);
|
|
if (Common_Get(clip).my_room_clip->pickup_ftr_layer_proc() == mCoBG_LAYER1) {
|
|
if (item_slot >= 0 || ITEM_IS_MYMANNIQUIN(item) || ITEM_IS_MYUMBRELLA(item) || can_exchange) {
|
|
if (Player_actor_request_main_pickup_jump(
|
|
game, item_slot, mRmTp_FtrItemNo2Item1ItemNo(item, TRUE), &ftr_pos, TRUE, FALSE)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
Player_actor_Request_main_refuse_pickup_all(game, FALSE);
|
|
}
|
|
} else {
|
|
if (item_slot >= 0 || ITEM_IS_MYMANNIQUIN(item) || ITEM_IS_MYUMBRELLA(item) || can_exchange) {
|
|
if (Player_actor_request_main_pickup_furniture(
|
|
game, item_slot, mRmTp_FtrItemNo2Item1ItemNo(item, TRUE), &ftr_pos)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
Player_actor_Request_main_refuse_pickup_all(game, FALSE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Check for knife & fork */
|
|
if (Common_Get(clip).htbl_clip != NULL) {
|
|
mActor_name_t htbl_item = Common_Get(clip).htbl_clip->search_pick_up_item_layer2_proc(game);
|
|
|
|
if (htbl_item == ITM_KNIFE_AND_FORK) {
|
|
int item_slot = mPr_GetPossessionItemIdxWithCond(Now_Private, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
|
|
|
if (item_slot >= 0) {
|
|
xyz_t pickup_pos = Common_Get(clip).htbl_clip->pickup_pos;
|
|
|
|
if (Player_actor_request_main_pickup_jump(game, item_slot, htbl_item, &pickup_pos, FALSE,
|
|
TRUE)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
Player_actor_Request_main_refuse_pickup_all(game, TRUE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Check for outdoor items */
|
|
{
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
|
mActor_name_t item;
|
|
xyz_t item_pos;
|
|
xyz_t target_pos;
|
|
|
|
if (Player_actor_check_putin_item(actorx, &item, &target_pos, &item_pos)) {
|
|
int slot_idx = mPlib_Get_space_putin_item_forTICKET(&item);
|
|
|
|
if (IS_ITEM_GRASS(item) != FALSE) {
|
|
if (Player_actor_request_main_remove_grass(game, &target_pos, &item_pos)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
mActor_name_t changed_item = ITEM_IS_SIGNBOARD(item) ? ITM_SIGNBOARD : item;
|
|
int item_is_signboard = item != changed_item;
|
|
|
|
if (mEv_CheckTitleDemo() > 0) {
|
|
if (Player_actor_request_main_pickup(game, changed_item, &target_pos, &item_pos, -1,
|
|
item_is_signboard)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
if (slot_idx >= 0 || can_exchange) {
|
|
if (Player_actor_request_main_pickup(game, changed_item, &target_pos, &item_pos, slot_idx,
|
|
item_is_signboard)) {
|
|
return TRUE;
|
|
}
|
|
} else {
|
|
Player_actor_Request_main_refuse_pickup_all(game, FALSE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_CheckScene_AbleSubmenu(void) {
|
|
int scene_no = Save_Get(scene_no);
|
|
|
|
if (!(scene_no >= 0 && scene_no < SCENE_NUM)) {
|
|
return FALSE;
|
|
} else {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[scene_no];
|
|
}
|
|
}
|
|
|
|
/* Why does this function even exist? It returns FALSE for every player state. */
|
|
static int Player_actor_check_cancel_event_without_priority(GAME* game) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
int main_index = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[main_index];
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_able_force_speak_label(GAME* game, u32 label) {
|
|
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
|
u32 able_force_speak_label = player->able_force_speak_label;
|
|
|
|
if (able_force_speak_label == 0) {
|
|
return TRUE;
|
|
}
|
|
|
|
if (able_force_speak_label == label) {
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Reset_able_force_speak_label(ACTOR* actorx, int main_index) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (Player_actor_Check_is_demo_mode(main_index) == FALSE) {
|
|
player->able_force_speak_label = 0;
|
|
}
|
|
}
|
|
|
|
static int Player_actor_CheckAndSet_UZAI_forNpc(ACTOR* actorx) {
|
|
if (actorx != NULL && actorx->part == ACTOR_PART_NPC) {
|
|
NPC_ACTOR* npc_actor = (NPC_ACTOR*)actorx;
|
|
Animal_c* animal = npc_actor->npc_info.animal;
|
|
|
|
if (animal != NULL &&
|
|
mNpc_GetAnimalMemoryIdx(&Now_Private->player_ID, animal->memories, ANIMAL_MEMORY_NUM) != -1) {
|
|
if (ITEM_NAME_GET_TYPE(actorx->npc_id) == NAME_TYPE_NPC &&
|
|
(npc_actor->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_UZAI_CHECK) == 0) {
|
|
npc_actor->uzai.counter++;
|
|
npc_actor->uzai.flag = TRUE;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_stung_mosquito(GAME* game, u32 label) {
|
|
int main_index = GET_PLAYER_ACTOR_GAME(game)->now_main_index;
|
|
|
|
switch (main_index) {
|
|
case mPlayer_INDEX_STUNG_MOSQUITO: {
|
|
u32 stung_label = GET_PLAYER_ACTOR_GAME(game)->requested_main_index_data.stung_mosquito.label;
|
|
|
|
if (stung_label == label) {
|
|
return TRUE;
|
|
}
|
|
break;
|
|
}
|
|
case mPlayer_INDEX_NOTICE_MOSQUITO: {
|
|
u32 notice_label = GET_PLAYER_ACTOR_GAME(game)->requested_main_index_data.notice_mosquito.label;
|
|
|
|
if (notice_label == label) {
|
|
return TRUE;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Reset_bee_chase(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
Common_Set(player_bee_chase_flag, FALSE);
|
|
if (player->bee_chase_bgm_flag) {
|
|
player->bee_chase_bgm_flag = FALSE;
|
|
mBGMPsComp_delete_ps_happening(BGM_BEE_CHASE, 0);
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_ChangeDay(ACTOR* actorx) {
|
|
if (mEv_CheckTitleDemo() <= 0) {
|
|
mActor_name_t field_id = mFI_GetFieldId();
|
|
|
|
if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) {
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
|
|
if (sunburn->rank > 0) {
|
|
lbRTC_ymd_c now_ymd;
|
|
int days;
|
|
|
|
mTM_set_renew_time(&now_ymd, Common_GetPointer(time.rtc_time));
|
|
days = lbRTC_GetIntervalDays2(&sunburn->last_changed_date, &now_ymd);
|
|
if (days < 0) {
|
|
sunburn->last_changed_date = now_ymd;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_rankdown_interval(ACTOR* actorx) {
|
|
if (mEv_CheckTitleDemo() <= 0) {
|
|
mActor_name_t field_id = mFI_GetFieldId();
|
|
|
|
if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) {
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
|
|
if (sunburn->rank > 0) {
|
|
int rankdown_days = sunburn->rankdown_days;
|
|
|
|
if (rankdown_days > 0) {
|
|
lbRTC_ymd_c now_ymd;
|
|
int days;
|
|
|
|
mTM_set_renew_time(&now_ymd, Common_GetPointer(time.rtc_time));
|
|
days = lbRTC_GetIntervalDays2(&sunburn->last_changed_date, &now_ymd);
|
|
if (days > 0) {
|
|
if (rankdown_days >= 2) {
|
|
lbRTC_time_c add_time = { 0, 0, 0, 1, 0, 0, 0 }; // @BUG - should be 'static'
|
|
lbRTC_time_c last_changed_time;
|
|
|
|
mTM_ymd_2_time(&last_changed_time, &sunburn->last_changed_date);
|
|
lbRTC_Add_Date(&last_changed_time, &add_time);
|
|
mTM_set_renew_time(&sunburn->last_changed_date, &last_changed_time);
|
|
}
|
|
|
|
if (days == 1) {
|
|
rankdown_days -= 1;
|
|
} else {
|
|
rankdown_days -= 2;
|
|
}
|
|
|
|
if (rankdown_days < 0) {
|
|
rankdown_days = 0;
|
|
}
|
|
|
|
sunburn->rankdown_days = rankdown_days;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_rankdown(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (mEv_CheckTitleDemo() <= 0) {
|
|
mActor_name_t field_id = mFI_GetFieldId();
|
|
|
|
if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) {
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
|
|
if (sunburn->rank > 0 && player->player_sunburn_rankdown == FALSE) {
|
|
lbRTC_ymd_c now_ymd;
|
|
int days;
|
|
int diff_days;
|
|
|
|
mTM_set_renew_time(&now_ymd, Common_GetPointer(time.rtc_time));
|
|
days = lbRTC_GetIntervalDays2(&sunburn->last_changed_date, &now_ymd);
|
|
diff_days = days - sunburn->rankdown_days;
|
|
if (diff_days > 0) {
|
|
player->player_sunburn_rankdown = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_rankup(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->player_sunburn_rankup == FALSE && mEv_CheckTitleDemo() <= 0) {
|
|
mActor_name_t field_id = mFI_GetFieldId();
|
|
|
|
if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) {
|
|
if (mEv_CheckFirstIntro() == FALSE && mEnv_NowWeather() == mEnv_WEATHER_CLEAR) {
|
|
int item_kind = mPlib_Check_now_handin_item_kind();
|
|
|
|
/* Player can use umbrellas to prevent sunburn */
|
|
if (mPlayer_ITEM_IS_UMBRELLA(item_kind) == FALSE) {
|
|
lbRTC_time_c* time_p = Common_GetPointer(time.rtc_time);
|
|
int hour = time_p->hour;
|
|
|
|
if (!(hour >= 10 && hour < 17)) {
|
|
return;
|
|
}
|
|
|
|
if (mFI_CheckInIsland() == FALSE) {
|
|
int month = time_p->month;
|
|
int day = time_p->day;
|
|
|
|
/* Sunburn will occur in town between July 16th and September 15th */
|
|
if (month != lbRTC_AUGUST) {
|
|
if (month == lbRTC_JULY) {
|
|
if (day < 16) {
|
|
return;
|
|
}
|
|
} else if (month == lbRTC_SEPTEMBER) {
|
|
if (day > 15) {
|
|
return;
|
|
}
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
{
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
|
|
if (sunburn->rank > 0 && sunburn->rankdown_days >= 2) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (player->player_sunburn_rankdown == FALSE) {
|
|
int last_sunburn_time = Common_Get(sunburn_time);
|
|
int max_sunburn_time = mFI_CheckInIsland() == FALSE ? (s16)mPlayer_SUNBURN_TIME_VILLAGE
|
|
: mPlayer_SUNBURN_TIME_ISLAND;
|
|
if (last_sunburn_time >= max_sunburn_time) {
|
|
player->player_sunburn_rankup = TRUE;
|
|
}
|
|
|
|
Common_Set(sunburn_time, last_sunburn_time + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Set_player_sunburn_rankdown(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->player_sunburn_rankdown != FALSE) {
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
lbRTC_ymd_c now_date;
|
|
int days;
|
|
int diff_days;
|
|
|
|
mTM_set_renew_time(&now_date, Common_GetPointer(time.rtc_time));
|
|
days = lbRTC_GetIntervalDays2(&sunburn->last_changed_date, &now_date);
|
|
diff_days = days - sunburn->rankdown_days;
|
|
|
|
if (diff_days > 0) {
|
|
int i;
|
|
|
|
for (i = 0; i < diff_days; i++) {
|
|
sunburn->rank--;
|
|
|
|
if (sunburn->rank < 0) {
|
|
sunburn->rank = 0;
|
|
break;
|
|
}
|
|
}
|
|
|
|
sunburn->last_changed_date = now_date;
|
|
return TRUE;
|
|
}
|
|
|
|
player->player_sunburn_rankdown = FALSE; /* @BUG? - shouldn't this be set to false in the above case too? */
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Set_player_sunburn_rankup(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->player_sunburn_rankup != FALSE) {
|
|
mPr_sunburn_c* sunburn = &Now_Private->sunburn;
|
|
lbRTC_ymd_c now_date;
|
|
|
|
mTM_set_renew_time(&now_date, Common_GetPointer(time.rtc_time));
|
|
sunburn->rank++;
|
|
if (sunburn->rank >= (mPlayer_SUNBURN_MAX_RANK + 1)) {
|
|
sunburn->rank = mPlayer_SUNBURN_MAX_RANK;
|
|
}
|
|
|
|
sunburn->last_changed_date = now_date;
|
|
sunburn->rankdown_days = 2;
|
|
Common_Set(sunburn_time, 0);
|
|
player->player_sunburn_rankup = FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_for_dt(ACTOR* actorx) {
|
|
Player_actor_Check_player_sunburn_ChangeDay(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown_interval(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown(actorx);
|
|
Player_actor_Set_player_sunburn_rankup(actorx);
|
|
Player_actor_Set_player_sunburn_rankdown(actorx);
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_for_main(ACTOR* actorx) {
|
|
Player_actor_Check_player_sunburn_ChangeDay(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown_interval(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown(actorx);
|
|
Player_actor_Check_player_sunburn_rankup(actorx);
|
|
}
|
|
|
|
static void Player_actor_Check_player_sunburn_for_ct(ACTOR* actorx) {
|
|
Player_actor_Check_player_sunburn_ChangeDay(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown_interval(actorx);
|
|
Player_actor_Check_player_sunburn_rankdown(actorx);
|
|
Player_actor_Set_player_sunburn_rankdown(actorx);
|
|
}
|
|
|
|
static void Player_actor_Check_player_change_color_for_main(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (player->change_color_request) {
|
|
player->change_color_request = FALSE;
|
|
if (player->change_color_flag) {
|
|
player->change_color_timer += 1.0f;
|
|
if (player->change_color_timer >= 79.68f) {
|
|
player->change_color_timer = 0.0f;
|
|
}
|
|
} else {
|
|
player->change_color_flag = TRUE;
|
|
player->change_color_timer = 0.0f;
|
|
}
|
|
} else {
|
|
if (player->change_color_flag) {
|
|
player->change_color_flag = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
static int Player_actor_Check_InBlockRadioExercise(ACTOR* actorx) {
|
|
if (mEv_check_status(mEv_EVENT_MORNING_AEROBICS, mEv_STATUS_RUN) ||
|
|
mEv_check_status(mEv_EVENT_SPORTS_FAIR_AEROBICS, mEv_STATUS_RUN)) {
|
|
int bx;
|
|
int bz;
|
|
|
|
if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_SHRINE)) {
|
|
int player_bx;
|
|
int player_bz;
|
|
|
|
if (mFI_Wpos2BlockNum(&player_bx, &player_bz, actorx->world.position)) {
|
|
if (player_bx == bx && player_bz == bz) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
/* Check if the aerobics radio is playing in the house */
|
|
int field_type = Common_Get(field_type);
|
|
|
|
if (field_type != mFI_FIELDTYPE2_FG && aMR_RadioBgmNow()) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static int Player_actor_Check_AbleRadioExercise(ACTOR* actorx) {
|
|
/* Player must be in the same block as aerobics radio, or in a house room with one playing */
|
|
if (Player_actor_Check_InBlockRadioExercise(actorx) == FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
/* Player must not be holding any item */
|
|
if (mPlib_Check_now_handin_item() != FALSE) {
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
static int Player_actor_Get_RadioExerciseCommandRingBufferIndex(int base_idx, int ofs) {
|
|
base_idx += ofs;
|
|
if (base_idx >= mPlayer_RADIO_EXCERCISE_COMMAND_RING_BUFFER_SIZE) {
|
|
return base_idx - mPlayer_RADIO_EXCERCISE_COMMAND_RING_BUFFER_SIZE;
|
|
} else {
|
|
return base_idx;
|
|
}
|
|
}
|
|
|
|
static s8 Player_actor_Get_RadioExerciseCommand(int base_idx, s8* command_ring_buffer_p, int ofs) {
|
|
int idx = Player_actor_Get_RadioExerciseCommandRingBufferIndex(base_idx, ofs);
|
|
|
|
/* @BUG - this should probably be || idx >= mPlayer_RADIO_EXCERCISE_COMMAND_RING_BUFFER_SIZE */
|
|
if (idx < 0 && idx < mPlayer_RADIO_EXCERCISE_COMMAND_RING_BUFFER_SIZE) {
|
|
idx = 0;
|
|
}
|
|
|
|
return command_ring_buffer_p[idx];
|
|
}
|
|
|
|
static void Player_actor_Set_RadioExerciseCommandRingBuffer(ACTOR* actorx, s8 command) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int* buffer_idx_p = &player->radio_exercise_command_ring_buffer_index;
|
|
s8* ring_buffer_p = player->radio_exercise_command_ring_buffer;
|
|
s8* ring_buf_timer_p = &player->radio_exercise_ring_buffer_cmd_timer;
|
|
int now_buffer_idx = *buffer_idx_p;
|
|
|
|
if (command >= 0) {
|
|
int cmd = Player_actor_Get_RadioExerciseCommand(0, ring_buffer_p, now_buffer_idx);
|
|
|
|
if (cmd == command && !(*ring_buf_timer_p >= 50.0f)) {
|
|
(*ring_buf_timer_p)++;
|
|
return;
|
|
}
|
|
}
|
|
{
|
|
int new_buffer_idx = Player_actor_Get_RadioExerciseCommandRingBufferIndex(7, now_buffer_idx);
|
|
|
|
*buffer_idx_p = new_buffer_idx;
|
|
ring_buffer_p[Player_actor_Get_RadioExerciseCommandRingBufferIndex(0, new_buffer_idx)] = command;
|
|
*ring_buf_timer_p = 0;
|
|
}
|
|
}
|
|
|
|
static void Player_actor_Set_RadioExerciseCommand(ACTOR* actorx, GAME* game, int skip_input_flag) {
|
|
int command = -1;
|
|
|
|
if (skip_input_flag == FALSE && Player_actor_Check_AbleRadioExercise(actorx)) {
|
|
command = Player_actor_CheckController_forRadio_exercise(game);
|
|
}
|
|
|
|
Player_actor_Set_RadioExerciseCommandRingBuffer(actorx, command);
|
|
}
|
|
|
|
static int Player_actor_Check_radio_exercise_command(ACTOR* actorx, int continue_idx, f32* timer_p) {
|
|
static s8 Player_actor_radio_exercise_command_key_data_type1[] = { 6, 0, 3 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type2_1[] = { 1, 4, 3, 5, 2 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type2_2[] = { 2, 5, 3, 4, 1 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type3[] = { 3, 0, 3 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type4_1_1[] = { 5, 0, 5 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type4_1_2[] = { 7, 0, 5 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type4_2_1[] = { 4, 0, 4 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type4_2_2[] = { 8, 0, 4 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type5_1_1[] = { 2, 0, 2 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type5_1_2[] = { 1, 0, 2 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type5_2_1[] = { 1, 0, 1 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type5_2_2[] = { 2, 0, 1 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type6_1_1[] = { 8, 0, 8 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type6_1_2[] = { 4, 0, 8 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type6_2_1[] = { 7, 0, 7 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type6_2_2[] = { 5, 0, 7 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type7_1[] = { 6, 8, 2, 5, 3, 4, 1, 7 };
|
|
static s8 Player_actor_radio_exercise_command_key_data_type7_2[] = { 6, 7, 1, 4, 3, 5, 2, 8 };
|
|
|
|
// clang-format off
|
|
static s8* command_key_p_data[] = {
|
|
Player_actor_radio_exercise_command_key_data_type1,
|
|
Player_actor_radio_exercise_command_key_data_type2_1,
|
|
Player_actor_radio_exercise_command_key_data_type2_2,
|
|
Player_actor_radio_exercise_command_key_data_type3,
|
|
Player_actor_radio_exercise_command_key_data_type4_1_1,
|
|
Player_actor_radio_exercise_command_key_data_type4_1_2,
|
|
Player_actor_radio_exercise_command_key_data_type4_2_1,
|
|
Player_actor_radio_exercise_command_key_data_type4_2_2,
|
|
Player_actor_radio_exercise_command_key_data_type5_1_1,
|
|
Player_actor_radio_exercise_command_key_data_type5_1_2,
|
|
Player_actor_radio_exercise_command_key_data_type5_2_1,
|
|
Player_actor_radio_exercise_command_key_data_type5_2_2,
|
|
Player_actor_radio_exercise_command_key_data_type6_1_1,
|
|
Player_actor_radio_exercise_command_key_data_type6_1_2,
|
|
Player_actor_radio_exercise_command_key_data_type6_2_1,
|
|
Player_actor_radio_exercise_command_key_data_type6_2_2,
|
|
Player_actor_radio_exercise_command_key_data_type7_1,
|
|
Player_actor_radio_exercise_command_key_data_type7_2,
|
|
};
|
|
// clang-format on
|
|
|
|
// clang-format off
|
|
static int total_command_key_element_data[] = {
|
|
3,
|
|
5,
|
|
5,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
3,
|
|
8,
|
|
8,
|
|
};
|
|
// clang-format on
|
|
|
|
// clang-format off
|
|
static s8 continue_command_data[] = {
|
|
-1,
|
|
17,
|
|
16,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
-1,
|
|
};
|
|
// clang-format on
|
|
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
int continue_command;
|
|
s8* ring_buffer_p = player->radio_exercise_command_ring_buffer;
|
|
int ring_buffer_idx = player->radio_exercise_command_ring_buffer_index;
|
|
s8** key_data_table = command_key_p_data;
|
|
int* len_table = total_command_key_element_data;
|
|
int i;
|
|
|
|
if (continue_idx >= 0) {
|
|
continue_command = continue_command_data[continue_idx];
|
|
} else {
|
|
continue_command = -1;
|
|
}
|
|
|
|
*timer_p = 0.0f;
|
|
for (i = 0; i < ARRAY_COUNT(command_key_p_data); i++) {
|
|
s8* data_p = &(*key_data_table)[(*len_table) - 1];
|
|
|
|
if (continue_command < 0 || i == continue_command) {
|
|
int j = 0;
|
|
int n = (*len_table) - 1;
|
|
|
|
while (n >= 0) {
|
|
s8 cmd = Player_actor_Get_RadioExerciseCommand(j, ring_buffer_p, ring_buffer_idx);
|
|
|
|
if (cmd != *data_p || cmd < 0) {
|
|
break;
|
|
}
|
|
|
|
data_p--;
|
|
j++;
|
|
n--;
|
|
}
|
|
|
|
if (n < 0) {
|
|
if (continue_command_data[i] >= 0) {
|
|
*timer_p = 6.0f;
|
|
}
|
|
|
|
return i;
|
|
}
|
|
}
|
|
|
|
len_table++;
|
|
key_data_table++;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
static int Player_actor_CheckAndRequest_main_radio_exercise_all(GAME* game, int skip_request_flag) {
|
|
ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (Player_actor_Check_AbleRadioExercise(actorx) == FALSE) {
|
|
return FALSE;
|
|
} else {
|
|
int cmd_idx;
|
|
f32 timer;
|
|
|
|
player->radio_exercise_cmd_timer -= 1.0f;
|
|
if (player->radio_exercise_cmd_timer < 0.0f) {
|
|
player->radio_exercise_cmd_timer = 0.0f;
|
|
}
|
|
|
|
cmd_idx = Player_actor_Check_radio_exercise_command(actorx, player->radio_exercise_continue_cmd_idx, &timer);
|
|
if (cmd_idx >= 0) {
|
|
if (player->radio_exercise_continue_cmd_idx >= 0) {
|
|
if (player->radio_exercise_cmd_timer > 0.0f) {
|
|
player->radio_exercise_continue_cmd_idx = cmd_idx;
|
|
player->radio_exercise_cmd_timer = timer;
|
|
}
|
|
} else {
|
|
player->radio_exercise_continue_cmd_idx = cmd_idx;
|
|
player->radio_exercise_cmd_timer = timer;
|
|
}
|
|
}
|
|
|
|
if (skip_request_flag == FALSE && player->radio_exercise_continue_cmd_idx >= 0) {
|
|
if (player->radio_exercise_cmd_timer <= 0.0f) {
|
|
if (Player_actor_request_main_radio_exercise_all(game, player->radio_exercise_continue_cmd_idx, 0.0f,
|
|
mPlayer_REQUEST_PRIORITY_4)) {
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Set_old_sound_frame_counter(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
player->old_sound_frame_counter = sAdo_GetSoundFrameCounter();
|
|
}
|
|
|
|
static int Player_actor_check_able_change_camera_normal_index(ACTOR* actorx) {
|
|
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
|
|
|
if (Player_actor_Check_AbleRadioExercise(actorx)) {
|
|
return FALSE;
|
|
}
|
|
|
|
if (mEv_CheckTitleDemo() <= 0 && mPlib_Check_scene_able_change_camera_pos()) {
|
|
int main_index = player->now_main_index;
|
|
|
|
if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) {
|
|
// clang-format off
|
|
static const s8 data[] = {
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
FALSE,
|
|
};
|
|
// clang-format on
|
|
|
|
return data[main_index];
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void Player_actor_Set_Indoor_Camera_Index(ACTOR* actorx, GAME* game) {
|
|
GAME_PLAY* play = (GAME_PLAY*)game;
|
|
Camera2* camera = &play->camera;
|
|
|
|
if (Player_actor_check_able_change_camera_normal_index(actorx)) {
|
|
int dist_add_idx = camera->indoor_distance_addition_idx;
|
|
int dir_add_idx = camera->indoor_direction_addition_idx;
|
|
|
|
if (chkTrigger(BUTTON_CUP)) {
|
|
if ((dist_add_idx - 1) >= 0) {
|
|
camera->indoor_distance_addition_idx = dist_add_idx - 1;
|
|
Player_actor_sound_camera_move1();
|
|
}
|
|
} else if (chkTrigger(BUTTON_CDOWN)) {
|
|
if ((dist_add_idx + 1) < 3) {
|
|
camera->indoor_distance_addition_idx = dist_add_idx + 1;
|
|
Player_actor_sound_camera_move2();
|
|
}
|
|
}
|
|
|
|
if (chkTrigger(BUTTON_CLEFT)) {
|
|
if ((dir_add_idx - 1) >= 0) {
|
|
camera->indoor_direction_addition_idx = dir_add_idx - 1;
|
|
Player_actor_sound_camera_move1();
|
|
}
|
|
} else if (chkTrigger(BUTTON_CRIGHT)) {
|
|
if ((dir_add_idx + 1) < 3) {
|
|
camera->indoor_direction_addition_idx = dir_add_idx + 1;
|
|
Player_actor_sound_camera_move1();
|
|
}
|
|
}
|
|
}
|
|
}
|