diff --git a/include/audio_defs.h b/include/audio_defs.h index 761b40bd..e2718fab 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -50,6 +50,7 @@ typedef enum audio_sound_effects { NA_SE_MONEY1, NA_SE_MONEY2, NA_SE_COIN, + NA_SE_TEMOCHI_KAZAGURUMA, NA_SE_52 = 0x52, @@ -133,8 +134,9 @@ typedef enum audio_sound_effects { NA_SE_ROTATE = 0x41A, NA_SE_41C = 0x41C, - - NA_SE_SOFT_CHAIR_SIT = 0x41F, + NA_SE_AXE_HIT, + NA_SE_AXE_CUT, + NA_SE_SOFT_CHAIR_SIT, NA_SE_HARD_CHAIR_SIT, NA_SE_BUBU_CHAIR_SIT, NA_SE_SOFT_CHAIR_STANDUP, diff --git a/include/m_lib.h b/include/m_lib.h index 6c28288e..3277f7c4 100644 --- a/include/m_lib.h +++ b/include/m_lib.h @@ -100,8 +100,7 @@ extern void none_proc2(ACTOR* actor, GAME* game); extern int _Game_play_isPause(GAME_PLAY* play); extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, int shift_by_min); -extern f32 get_percent_forAccelBrake(const f32 now, const f32 start, const f32 end, const f32 accelerateDist, - const f32 brakeDist); +extern f32 get_percent_forAccelBrake(f32 now, f32 start, f32 end, f32 accelerateDist, f32 brakeDist); extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, xyz_t* screen_pos); extern f32 get_percent(const int max, const int min, const int x); diff --git a/include/m_player.h b/include/m_player.h index b6ee9568..11df061c 100644 --- a/include/m_player.h +++ b/include/m_player.h @@ -1560,6 +1560,68 @@ typedef struct player_main_putin_scoop_s { int get_gold_scoop_flag; // TODO: check this } mPlayer_main_putin_scoop_c; +typedef struct player_main_talk_s { + ACTOR* talk_actor_p; + int turn_flag; + int feel_type; +} mPlayer_main_talk_c; + +typedef struct player_main_recieve_wait_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + mActor_name_t item; + int surface_flag; +} mPlayer_main_recieve_wait_c; + +typedef struct player_main_recieve_stretch_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + mActor_name_t item; + int surface_flag; +} mPlayer_main_recieve_stretch_c; + +typedef struct player_main_recieve_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + mActor_name_t item; + int surface_flag; +} mPlayer_main_recieve_c; + +typedef struct player_main_recieve_putaway_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + int surface_flag; +} mPlayer_main_recieve_putaway_c; + +typedef struct player_main_give_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + mActor_name_t item; + int surface_flag; +} mPlayer_main_give_c; + +typedef struct player_main_give_wait_s { + ACTOR* talk_actor_p; + int turn_flag; + int ret_main_index; + int surface_flag; +} mPlayer_main_give_wait_c; + +typedef struct player_main_takeout_item_s { + mPlayer_request_takeout_item_c back_request_data; + f32 timer; +} mPlayer_main_takeout_item_c; + +typedef struct player_main_putin_item_s { + mPlayer_request_putin_item_c back_request_data; + f32 timer; +} mPlayer_main_putin_item_c; + typedef struct player_main_wash_car_s { int anime_idx; int change_anime_idx; @@ -1655,6 +1717,15 @@ typedef union { mPlayer_main_putaway_scoop_c putaway_scoop; mPlayer_main_putin_scoop_c putin_scoop; mPlayer_main_demo_wade_c demo_wade; + mPlayer_main_talk_c talk; + mPlayer_main_recieve_wait_c recieve_wait; + mPlayer_main_recieve_stretch_c recieve_stretch; + mPlayer_main_recieve_c recieve; + mPlayer_main_recieve_putaway_c recieve_putaway; + mPlayer_main_give_c give; + mPlayer_main_give_wait_c give_wait; + mPlayer_main_takeout_item_c takeout_item; + mPlayer_main_putin_item_c putin_item; mPlayer_main_wash_car_c wash_car; mPlayer_main_shake_tree_c shake_tree; mPlayer_main_stung_bee_c stung_bee; diff --git a/src/m_choice_main_appear.c_inc b/src/m_choice_main_appear.c_inc index 7d18642f..47355226 100644 --- a/src/m_choice_main_appear.c_inc +++ b/src/m_choice_main_appear.c_inc @@ -1,48 +1,46 @@ static int mChoice_Main_Appear_SetScale(mChoice_c* choice, GAME* game) { - int res; - const f32 max = 10.2f; + int res; - if (choice->timer < max) { - f32 scale; - - choice->timer += 1.0f; - scale = get_percent_forAccelBrake(choice->timer, 0.0f, max, 0.0f, 0.0f); - choice->scale = scale; - choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin); - choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin); - res = FALSE; - } - else { - choice->timer = 0.0f; - choice->scale = 1.0f; - choice->center_x = choice->center_x_target; - choice->center_y = choice->center_y_target; - res = TRUE; - } + if (choice->timer < 10.2f) { + f32 scale; - return res; + choice->timer += 1.0f; + scale = get_percent_forAccelBrake(choice->timer, 0.0f, 10.2f, 0.0f, 0.0f); + choice->scale = scale; + choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin); + choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin); + res = FALSE; + } else { + choice->timer = 0.0f; + choice->scale = 1.0f; + choice->center_x = choice->center_x_target; + choice->center_y = choice->center_y_target; + res = TRUE; + } + + return res; } static void mChoice_request_main_index_fromAppear(mChoice_c* choice, GAME* game, int open_flag) { - if (open_flag) { - mChoice_Change_request_main_index(choice, mChoice_MAIN_NORMAL); - } + if (open_flag) { + mChoice_Change_request_main_index(choice, mChoice_MAIN_NORMAL); + } } static void mChoice_Main_Appear(mChoice_c* choice, GAME* game) { - int open_flag = mChoice_Main_Appear_SetScale(choice, game); + int open_flag = mChoice_Main_Appear_SetScale(choice, game); - mChoice_request_main_index_fromAppear(choice, game, open_flag); - mChoice_MainSetup(choice, game); + mChoice_request_main_index_fromAppear(choice, game, open_flag); + mChoice_MainSetup(choice, game); } static void mChoice_MainSetup_Appear(mChoice_c* choice, GAME* game) { - choice->scale = 0.0f; - choice->main_index = mChoice_MAIN_APPEAR; - choice->requested_main_index = -1; - choice->window_visible_flag = TRUE; - choice->timer = 0.0f; - mChoice_Clear_ChoseNum(choice); - mChoice_sound_SENTAKU_OPEN(); - mChoice_Set_DisplayScaleAndDisplayPos(choice); + choice->scale = 0.0f; + choice->main_index = mChoice_MAIN_APPEAR; + choice->requested_main_index = -1; + choice->window_visible_flag = TRUE; + choice->timer = 0.0f; + mChoice_Clear_ChoseNum(choice); + mChoice_sound_SENTAKU_OPEN(); + mChoice_Set_DisplayScaleAndDisplayPos(choice); } diff --git a/src/m_choice_main_disappear.c_inc b/src/m_choice_main_disappear.c_inc index cab66910..48c653b9 100644 --- a/src/m_choice_main_disappear.c_inc +++ b/src/m_choice_main_disappear.c_inc @@ -1,56 +1,51 @@ static int mChoice_Main_Disappear_SetScale(mChoice_c* choice, GAME* game) { - const f32 max = 10.2f; - - if (choice->timer < max) { - f32 scale; - - choice->timer += 1.0f; - scale = 1.0f - get_percent_forAccelBrake(choice->timer, 0.0f, max, 0.0f, 0.0f); - choice->scale = scale; - choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin); - choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin); - return FALSE; - } - else { - choice->timer = 0.0f; - choice->scale = 0.0f; - choice->center_x = choice->center_x_begin; - choice->center_y = choice->center_y_begin; - return TRUE; - } + if (choice->timer < 10.2f) { + f32 scale; + + choice->timer += 1.0f; + scale = 1.0f - get_percent_forAccelBrake(choice->timer, 0.0f, 10.2f, 0.0f, 0.0f); + choice->scale = scale; + choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin); + choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin); + return FALSE; + } else { + choice->timer = 0.0f; + choice->scale = 0.0f; + choice->center_x = choice->center_x_begin; + choice->center_y = choice->center_y_begin; + return TRUE; + } } static void mChoice_request_main_index_fromDisappear(mChoice_c* choice, GAME* game, int closed_flag) { - if (closed_flag) { - mChoice_Change_request_main_index(choice, mChoice_MAIN_HIDE); - } + if (closed_flag) { + mChoice_Change_request_main_index(choice, mChoice_MAIN_HIDE); + } } static void mChoice_Main_Disappear(mChoice_c* choice, GAME* game) { - int closed_flag = mChoice_Main_Disappear_SetScale(choice, game); + int closed_flag = mChoice_Main_Disappear_SetScale(choice, game); - mChoice_request_main_index_fromDisappear(choice, game, closed_flag); - mChoice_MainSetup(choice, game); + mChoice_request_main_index_fromDisappear(choice, game, closed_flag); + mChoice_MainSetup(choice, game); } static void mChoice_MainSetup_Disappear(mChoice_c* choice, GAME* game) { - if (choice->no_b_flag && choice->selected_choice_idx == (choice->data.choice_num - 1)) { - if (choice->no_close_flag) { - mChoice_sound_ZOOMDOWN_LONG(); - mMsg_Get_base_window_p()->status_flags |= mMsg_STATUS_FLAG_NO_ZOOMDOWN; + if (choice->no_b_flag && choice->selected_choice_idx == (choice->data.choice_num - 1)) { + if (choice->no_close_flag) { + mChoice_sound_ZOOMDOWN_LONG(); + mMsg_Get_base_window_p()->status_flags |= mMsg_STATUS_FLAG_NO_ZOOMDOWN; + } else { + mChoice_sound_ZOOMDOWN_SHORT(); + } + } else { + mChoice_sound_SENTAKU_KETTEI(); } - else { - mChoice_sound_ZOOMDOWN_SHORT(); - } - } - else { - mChoice_sound_SENTAKU_KETTEI(); - } - choice->scale = 1.0f; - choice->main_index = mChoice_MAIN_DISAPPEAR; - choice->requested_main_index = -1; - choice->window_visible_flag = TRUE; - choice->timer = 0.0f; - choice->font_visible_flag = FALSE; + choice->scale = 1.0f; + choice->main_index = mChoice_MAIN_DISAPPEAR; + choice->requested_main_index = -1; + choice->window_visible_flag = TRUE; + choice->timer = 0.0f; + choice->font_visible_flag = FALSE; } diff --git a/src/m_lib.c b/src/m_lib.c index 13b9cf95..f0eaeb31 100644 --- a/src/m_lib.c +++ b/src/m_lib.c @@ -62,11 +62,11 @@ * @param size Number of bytes to copy. */ extern void mem_copy(u8* dst, u8* src, size_t size) { - for (size; size != 0; size--) { - *dst = *src; - src++; - dst++; - } + for (size; size != 0; size--) { + *dst = *src; + src++; + dst++; + } } /** @@ -77,11 +77,11 @@ extern void mem_copy(u8* dst, u8* src, size_t size) { * @param val Value to set each byte in the destination buffer. */ extern void mem_clear(u8* dst, size_t size, u8 val) { - u32 i; + u32 i; - for (i = 0; i < size; i++) { - *dst++ = val; - } + for (i = 0; i < size; i++) { + *dst++ = val; + } } /** @@ -93,14 +93,14 @@ extern void mem_clear(u8* dst, size_t size, u8 val) { * @return TRUE if the memory buffers are equal, FALSE otherwise. */ extern int mem_cmp(u8* p1, u8* p2, size_t size) { - for (size; size != 0; size--) { - if (*p1 != *p2) { - return FALSE; + for (size; size != 0; size--) { + if (*p1 != *p2) { + return FALSE; + } + p1++; + p2++; } - p1++; - p2++; - } - return TRUE; + return TRUE; } /** @@ -109,7 +109,9 @@ extern int mem_cmp(u8* p1, u8* p2, size_t size) { * @param angle Angle in s16 format. * @return Cosine of the angle as a floating-point value. */ -extern f32 cos_s(s16 angle) { return coss(angle) * SHT_MINV; } +extern f32 cos_s(s16 angle) { + return coss(angle) * SHT_MINV; +} /** * @brief Calculate the sine of the given s16 angle. @@ -117,7 +119,9 @@ extern f32 cos_s(s16 angle) { return coss(angle) * SHT_MINV; } * @param angle Angle in s16 format. * @return Sine of the angle as a floating-point value. */ -extern f32 sin_s(s16 angle) { return sins(angle) * SHT_MINV; } +extern f32 sin_s(s16 angle) { + return sins(angle) * SHT_MINV; +} /** * @brief Chase an angle value towards a target angle, with a specified step. @@ -132,24 +136,24 @@ extern f32 sin_s(s16 angle) { return sins(angle) * SHT_MINV; } * @return TRUE if the angle reaches the target, FALSE otherwise. */ extern int chase_angle(s16* const pValue, const s16 target, s16 step) { - if (step) { - f32 updateScale = game_GameFrame_2F; + if (step) { + f32 updateScale = game_GameFrame_2F; - if ((s16)(*pValue - target) > 0) { - step = -step; + if ((s16)(*pValue - target) > 0) { + step = -step; + } + + *pValue += (s16)(step * updateScale); + + if (((s16)(*pValue - target) * step) >= 0) { + *pValue = target; + return TRUE; + } + } else if (*pValue == target) { + return TRUE; } - *pValue += (s16)(step * updateScale); - - if (((s16)(*pValue - target) * step) >= 0) { - *pValue = target; - return TRUE; - } - } else if (*pValue == target) { - return TRUE; - } - - return FALSE; + return FALSE; } /** @@ -165,23 +169,23 @@ extern int chase_angle(s16* const pValue, const s16 target, s16 step) { * @return TRUE if the value reaches the target, FALSE otherwise. */ extern int chase_s(s16* const pValue, const s16 target, s16 step) { - if (step) { - if (*pValue > target) { - step = -step; - } + if (step) { + if (*pValue > target) { + step = -step; + } - *pValue += step; + *pValue += step; - if ((step * (*pValue - target)) >= 0) { - *pValue = target; - return TRUE; + if ((step * (*pValue - target)) >= 0) { + *pValue = target; + return TRUE; + } + } else { + if (*pValue == target) { + return TRUE; + } } - } else { - if (*pValue == target) { - return TRUE; - } - } - return FALSE; + return FALSE; } /** @@ -197,23 +201,23 @@ extern int chase_s(s16* const pValue, const s16 target, s16 step) { * @return TRUE if the value reaches the target, FALSE otherwise. */ extern int chase_f(f32* const pValue, const f32 target, f32 step) { - if (step) { - if (*pValue > target) { - step = -step; - } + if (step) { + if (*pValue > target) { + step = -step; + } - *pValue += step; + *pValue += step; - if ((step * (*pValue - target)) >= 0.0f) { - *pValue = target; - return TRUE; + if ((step * (*pValue - target)) >= 0.0f) { + *pValue = target; + return TRUE; + } + } else { + if (*pValue == target) { + return TRUE; + } } - } else { - if (*pValue == target) { - return TRUE; - } - } - return FALSE; + return FALSE; } /** @@ -228,27 +232,26 @@ extern int chase_f(f32* const pValue, const f32 target, f32 step) { * @param fraction Fraction of the distance to move towards the target. * @return Remaining distance after the chase. */ -extern f32 chase_xyz_t(xyz_t* const pValue, const xyz_t* const target, - const f32 fraction) { - xyz_t diff; - f32 dist; - f32 stepSize; +extern f32 chase_xyz_t(xyz_t* const pValue, const xyz_t* const target, const f32 fraction) { + xyz_t diff; + f32 dist; + f32 stepSize; - xyz_t_sub(target, pValue, &diff); + xyz_t_sub(target, pValue, &diff); - dist = Math3DVecLength(&diff); - if (dist > fraction) { - stepSize = fraction / dist; - pValue->x += stepSize * diff.x; - pValue->y += stepSize * diff.y; - pValue->z += stepSize * diff.z; + dist = Math3DVecLength(&diff); + if (dist > fraction) { + stepSize = fraction / dist; + pValue->x += stepSize * diff.x; + pValue->y += stepSize * diff.y; + pValue->z += stepSize * diff.z; - return dist - fraction; - } else { - xyz_t_move(pValue, target); + return dist - fraction; + } else { + xyz_t_move(pValue, target); - return 0.0f; - } + return 0.0f; + } } /** @@ -264,19 +267,19 @@ extern f32 chase_xyz_t(xyz_t* const pValue, const xyz_t* const target, * @return TRUE if the angle reaches the limit, FALSE otherwise. */ extern int chase_angle2(s16* const pValue, const s16 limit, const s16 step) { - s16 prev = *pValue; + s16 prev = *pValue; - *pValue += step; - if (((s16)(*pValue - limit) * (s16)(prev - limit)) <= 0) { - s32 absDiff = ABS((s16)(*pValue - limit)); + *pValue += step; + if (((s16)(*pValue - limit) * (s16)(prev - limit)) <= 0) { + s32 absDiff = ABS((s16)(*pValue - limit)); - if (absDiff < 16384) { - *pValue = limit; - return TRUE; + if (absDiff < 16384) { + *pValue = limit; + return TRUE; + } } - } - return FALSE; + return FALSE; } /** @@ -287,13 +290,13 @@ extern int chase_angle2(s16* const pValue, const s16 limit, const s16 step) { * @param step Step value for interpolation speed. */ extern void inter_float(f32* const pValue, const f32 arg1, const int step) { - if (step <= 0) { - *pValue = arg1; - } else { - f32 diff = arg1 - *pValue; + if (step <= 0) { + *pValue = arg1; + } else { + f32 diff = arg1 - *pValue; - *pValue += diff / step; - } + *pValue += diff / step; + } } /** @@ -308,7 +311,7 @@ extern void inter_float(f32* const pValue, const f32 arg1, const int step) { * @return Random timer value. */ extern s16 get_random_timer(const s16 base, const s16 range) { - return base + (s16)(range * fqrand()); + return base + (s16)(range * fqrand()); } /** @@ -318,9 +321,9 @@ extern s16 get_random_timer(const s16 base, const s16 range) { * @param src Source xyz_t structure. */ extern void xyz_t_move(xyz_t* const dest, const xyz_t* const src) { - dest->x = src->x; - dest->y = src->y; - dest->z = src->z; + dest->x = src->x; + dest->y = src->y; + dest->z = src->z; } /** @@ -330,9 +333,9 @@ extern void xyz_t_move(xyz_t* const dest, const xyz_t* const src) { * @param src Pointer to the source s_xyz structure. */ extern void xyz_t_move_s_xyz(xyz_t* const dest, const s_xyz* const src) { - dest->x = src->x; - dest->y = src->y; - dest->z = src->z; + dest->x = src->x; + dest->y = src->y; + dest->z = src->z; } /** @@ -343,11 +346,10 @@ extern void xyz_t_move_s_xyz(xyz_t* const dest, const s_xyz* const src) { * @param total Output xyz_t structure for the result. */ -extern void xyz_t_add(const xyz_t* const augend, const xyz_t* const addend, - xyz_t* const total) { - total->x = augend->x + addend->x; - total->y = augend->y + addend->y; - total->z = augend->z + addend->z; +extern void xyz_t_add(const xyz_t* const augend, const xyz_t* const addend, xyz_t* const total) { + total->x = augend->x + addend->x; + total->y = augend->y + addend->y; + total->z = augend->z + addend->z; } /** @@ -357,11 +359,10 @@ extern void xyz_t_add(const xyz_t* const augend, const xyz_t* const addend, * @param subtrahend Second input xyz_t structure. * @param diff Output xyz_t structure for the result. */ -extern void xyz_t_sub(const xyz_t* const minuend, const xyz_t* const subtrahend, - xyz_t* const diff) { - diff->x = minuend->x - subtrahend->x; - diff->y = minuend->y - subtrahend->y; - diff->z = minuend->z - subtrahend->z; +extern void xyz_t_sub(const xyz_t* const minuend, const xyz_t* const subtrahend, xyz_t* const diff) { + diff->x = minuend->x - subtrahend->x; + diff->y = minuend->y - subtrahend->y; + diff->z = minuend->z - subtrahend->z; } /** @@ -371,9 +372,9 @@ extern void xyz_t_sub(const xyz_t* const minuend, const xyz_t* const subtrahend, * @param multiplier Scalar value. */ extern void xyz_t_mult_v(xyz_t* const multiplicand, const f32 multiplier) { - multiplicand->x *= multiplier; - multiplicand->y *= multiplier; - multiplicand->z *= multiplier; + multiplicand->x *= multiplier; + multiplicand->y *= multiplier; + multiplicand->z *= multiplier; } /** @@ -383,13 +384,12 @@ extern void xyz_t_mult_v(xyz_t* const multiplicand, const f32 multiplier) { * @param target Pointer to the second xyz_t structure representing the target position. * @return The Euclidean distance between the two xyz_t structures. */ -extern f32 search_position_distance(const xyz_t* const pos, - const xyz_t* const target) { - f32 diffX = target->x - pos->x; - f32 diffY = target->y - pos->y; - f32 diffZ = target->z - pos->z; +extern f32 search_position_distance(const xyz_t* const pos, const xyz_t* const target) { + f32 diffX = target->x - pos->x; + f32 diffY = target->y - pos->y; + f32 diffZ = target->z - pos->z; - return sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)); + return sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)); } /** @@ -399,12 +399,11 @@ extern f32 search_position_distance(const xyz_t* const pos, * @param target Pointer to the second xyz_t structure representing the target position. * @return The Euclidean distance between the two xyz_t structures in the XZ plane. */ -extern f32 search_position_distanceXZ(const xyz_t* const pos, - const xyz_t* const target) { - f32 diffX = target->x - pos->x; - f32 diffZ = target->z - pos->z; +extern f32 search_position_distanceXZ(const xyz_t* const pos, const xyz_t* const target) { + f32 diffX = target->x - pos->x; + f32 diffZ = target->z - pos->z; - return sqrtf((diffX * diffX) + (diffZ * diffZ)); + return sqrtf((diffX * diffX) + (diffZ * diffZ)); } /** @@ -414,12 +413,11 @@ extern f32 search_position_distanceXZ(const xyz_t* const pos, * @param target Pointer to the second xyz_t structure representing the target position. * @return The angle in the Y axis (yaw) between the two xyz_t positions. */ -extern s16 search_position_angleY(const xyz_t* const pos, - const xyz_t* const target) { - f32 diffX = target->x - pos->x; - f32 diffZ = target->z - pos->z; +extern s16 search_position_angleY(const xyz_t* const pos, const xyz_t* const target) { + f32 diffX = target->x - pos->x; + f32 diffZ = target->z - pos->z; - return atans_table(diffZ, diffX); + return atans_table(diffZ, diffX); } /** @@ -429,12 +427,11 @@ extern s16 search_position_angleY(const xyz_t* const pos, * @param target Pointer to the second xyz_t structure representing the target position. * @return The angle in the X axis (pitch) between the two xyz_t structures. */ -extern s16 search_position_angleX(const xyz_t* const pos, - const xyz_t* const target) { - f32 diffXZ = search_position_distanceXZ(pos, target); - f32 diffY = pos->y - target->y; +extern s16 search_position_angleX(const xyz_t* const pos, const xyz_t* const target) { + f32 diffXZ = search_position_distanceXZ(pos, target); + f32 diffY = pos->y - target->y; - return atans_table(diffXZ, diffY); + return atans_table(diffXZ, diffY); } /** @@ -450,49 +447,48 @@ extern s16 search_position_angleX(const xyz_t* const pos, * @param minStep Minimum allowed step size. * @return The difference between the updated input variable value and the target value. */ -extern f32 add_calc(f32* pValue, f32 target, f32 fraction, f32 maxStep, - f32 minStep) { - f32 negMinStep; - f32 stepSize; +extern f32 add_calc(f32* pValue, f32 target, f32 fraction, f32 maxStep, f32 minStep) { + f32 negMinStep; + f32 stepSize; - if (*pValue != target) { - stepSize = fraction * (target - *pValue); - negMinStep = -minStep; + if (*pValue != target) { + stepSize = fraction * (target - *pValue); + negMinStep = -minStep; - if ((stepSize <= negMinStep) || (minStep <= stepSize)) { - if (stepSize > maxStep) { - stepSize = maxStep; - } else if (stepSize < -maxStep) { - stepSize = -maxStep; - } + if ((stepSize <= negMinStep) || (minStep <= stepSize)) { + if (stepSize > maxStep) { + stepSize = maxStep; + } else if (stepSize < -maxStep) { + stepSize = -maxStep; + } - *pValue += stepSize; + *pValue += stepSize; - if (stepSize > 0.0f) { - if (*pValue > target) { - *pValue = target; + if (stepSize > 0.0f) { + if (*pValue > target) { + *pValue = target; + } + } else { + if (*pValue < target) { + *pValue = target; + } + } + } else { + if (stepSize > 0.0f) { + *pValue += minStep; + if (*pValue > target) { + *pValue = target; + } + } else { + *pValue += negMinStep; + if (*pValue < target) { + *pValue = target; + } + } } - } else { - if (*pValue < target) { - *pValue = target; - } - } - } else { - if (stepSize > 0.0f) { - *pValue += minStep; - if (*pValue > target) { - *pValue = target; - } - } else { - *pValue += negMinStep; - if (*pValue < target) { - *pValue = target; - } - } } - } - return target - *pValue; + return target - *pValue; } /** @@ -507,19 +503,19 @@ extern f32 add_calc(f32* pValue, f32 target, f32 fraction, f32 maxStep, * @param maxStep Maximum allowed step size. */ extern void add_calc2(f32* pValue, f32 target, f32 fraction, f32 maxStep) { - f32 stepSize; + f32 stepSize; - if (*pValue != target) { - stepSize = fraction * (target - *pValue); + if (*pValue != target) { + stepSize = fraction * (target - *pValue); - if (stepSize > maxStep) { - stepSize = maxStep; - } else if (stepSize < -maxStep) { - stepSize = -maxStep; + if (stepSize > maxStep) { + stepSize = maxStep; + } else if (stepSize < -maxStep) { + stepSize = -maxStep; + } + + *pValue += stepSize; } - - *pValue += stepSize; - } } /** @@ -530,19 +526,20 @@ extern void add_calc2(f32* pValue, f32 target, f32 fraction, f32 maxStep) { * @param maxStep Maximum allowed step size. */ extern void add_calc0(f32* pValue, f32 fraction, f32 maxStep) { - f32 stepSize = *pValue * fraction; + f32 stepSize = *pValue * fraction; - if (stepSize > maxStep) { - stepSize = maxStep; - } else if (stepSize < -maxStep) { - stepSize = -maxStep; - } + if (stepSize > maxStep) { + stepSize = maxStep; + } else if (stepSize < -maxStep) { + stepSize = -maxStep; + } - *pValue -= stepSize; + *pValue -= stepSize; } /** - * @brief Add a calculated value to a short integer variable to approach a target angle with minimum and maximum step limits. + * @brief Add a calculated value to a short integer variable to approach a target angle with minimum and maximum step + * limits. * * This function adds a calculated step size to the input short integer variable to approach the target angle. * The step size is calculated based on the fraction and is limited by the minimum and maximum step values. @@ -554,51 +551,51 @@ extern void add_calc0(f32* pValue, f32 fraction, f32 maxStep) { * @param minStep Minimum allowed step size. * @return The difference between the updated input variable angle and the target angle. */ -extern s16 add_calc_short_angle2(s16* pValue, s16 target, f32 fraction, - s16 maxStep, s16 minStep) { - s16 stepSize = 0; - s16 diff = target - *pValue; +extern s16 add_calc_short_angle2(s16* pValue, s16 target, f32 fraction, s16 maxStep, s16 minStep) { + s16 stepSize = 0; + s16 diff = target - *pValue; - if (*pValue != target) { - stepSize = (s16)(diff * fraction); + if (*pValue != target) { + stepSize = (s16)(diff * fraction); - if ((stepSize > minStep) || (stepSize < -minStep)) { - if (stepSize > maxStep) { - stepSize = maxStep; - } else if (stepSize < -maxStep) { - stepSize = -maxStep; - } + if ((stepSize > minStep) || (stepSize < -minStep)) { + if (stepSize > maxStep) { + stepSize = maxStep; + } else if (stepSize < -maxStep) { + stepSize = -maxStep; + } - *pValue += stepSize; + *pValue += stepSize; - if (stepSize > 0) { - if ((s16)(target - *pValue) < 0) { - *pValue = target; + if (stepSize > 0) { + if ((s16)(target - *pValue) < 0) { + *pValue = target; + } + } else { + if ((s16)(target - *pValue) > 0) { + *pValue = target; + } + } + } else { + if (diff >= 0) { + *pValue += minStep; + if ((s16)(target - *pValue) < 0) { + *pValue = target; + } + } else { + *pValue -= minStep; + if ((s16)(target - *pValue) > 0) { + *pValue = target; + } + } } - } else { - if ((s16)(target - *pValue) > 0) { - *pValue = target; - } - } - } else { - if (diff >= 0) { - *pValue += minStep; - if ((s16)(target - *pValue) < 0) { - *pValue = target; - } - } else { - *pValue -= minStep; - if ((s16)(target - *pValue) > 0) { - *pValue = target; - } - } } - } - return target - *pValue; + return target - *pValue; } /** - * @brief Add a calculated value to a short integer angle variable to approach a target angle with minimum and maximum step limits. + * @brief Add a calculated value to a short integer angle variable to approach a target angle with minimum and maximum + * step limits. * * This function adds a calculated step size to the input short integer angle variable to approach the target angle. * The step size is calculated based on the fraction and is limited by the minimum and maximum step values. @@ -611,37 +608,36 @@ extern s16 add_calc_short_angle2(s16* pValue, s16 target, f32 fraction, * @param minStep Minimum allowed step size. * @return The difference between the updated input variable angle and the target angle. */ -extern s16 add_calc_short_angle3(s16* pValue, s16 target, f32 fraction, - s16 maxStep, s16 minStep) { - f32 stepSize; - s32 uTarget; - s32 newValue; - s32 uValue; +extern s16 add_calc_short_angle3(s16* pValue, s16 target, f32 fraction, s16 maxStep, s16 minStep) { + f32 stepSize; + s32 uTarget; + s32 newValue; + s32 uValue; - if (target != *pValue) { - uValue = (u16)*pValue; - uTarget = (u16)target; + if (target != *pValue) { + uValue = (u16)*pValue; + uTarget = (u16)target; - if (uValue > uTarget) { - uTarget += 65536; /* Add 360 short degrees */ + if (uValue > uTarget) { + uTarget += 65536; /* Add 360 short degrees */ + } + + stepSize = (uTarget - uValue) * fraction; + + if (stepSize > maxStep) { + stepSize = maxStep; + } else if (stepSize < minStep) { + stepSize = minStep; + } + + newValue = uValue + (s32)stepSize; + if (newValue > uTarget) { + newValue = uTarget; + } + *pValue = newValue; } - stepSize = (uTarget - uValue) * fraction; - - if (stepSize > maxStep) { - stepSize = maxStep; - } else if (stepSize < minStep) { - stepSize = minStep; - } - - newValue = uValue + (s32)stepSize; - if (newValue > uTarget) { - newValue = uTarget; - } - *pValue = newValue; - } - - return target - *pValue; + return target - *pValue; } /** @@ -651,10 +647,10 @@ extern s16 add_calc_short_angle3(s16* pValue, s16 target, f32 fraction, * @param src Pointer to the source rgba_t variable. */ extern void rgba_t_move(rgba_t* dest, const rgba_t* const src) { - dest->r = src->r; - dest->g = src->g; - dest->b = src->b; - dest->a = src->a; + dest->r = src->r; + dest->g = src->g; + dest->b = src->b; + dest->a = src->a; } /** @@ -662,7 +658,9 @@ extern void rgba_t_move(rgba_t* dest, const rgba_t* const src) { * * @return 0 */ -extern int none_proc1() { return 0; } +extern int none_proc1() { + return 0; +} /** * @brief No-op function meant for use in actor profiles. @@ -670,7 +668,8 @@ extern int none_proc1() { return 0; } * @param actor Pointer to an ACTOR structure. * @param game Pointer to a GAME structure. */ -extern void none_proc2(ACTOR* actor, GAME* game) {} +extern void none_proc2(ACTOR* actor, GAME* game) { +} /** * @brief Check if the game is in pause state. @@ -678,11 +677,13 @@ extern void none_proc2(ACTOR* actor, GAME* game) {} * @param play Pointer to a GAME_PLAY structure. * @return TRUE if the game is in pause state, FALSE otherwise. */ -extern int _Game_play_isPause(GAME_PLAY* play) { return (play->pause.enabled != 0); } +extern int _Game_play_isPause(GAME_PLAY* play) { + return (play->pause.enabled != 0); +} /** * @brief Calculate a percentage with respect to minimum and maximum values, and apply scaling. - * + * * - If `x` is closer to 0 than `min`, return 0 * - If `x` is further from 0 than `max`, return the sign of `x` * - Otherwise, scale `x` by `scale` and return it. @@ -695,26 +696,25 @@ extern int _Game_play_isPause(GAME_PLAY* play) { return (play->pause.enabled != * @param shift_by_min Flag to shift the percentage by the minimum value (1 to shift, 0 not to shift). * @return Scaled percentage of the input value within the specified range. */ -extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, - int shift_by_min) { - if ((-min <= x) && (x <= min)) { - return 0.0f; - } - if (x >= max) { - return 1.0f; - } - if (x <= -max) { - return -1.0f; - } - if (shift_by_min) { - if (x > 0.0f) { - return (x - min) * scale; - } else { - return (x + min) * scale; +extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, int shift_by_min) { + if ((-min <= x) && (x <= min)) { + return 0.0f; + } + if (x >= max) { + return 1.0f; + } + if (x <= -max) { + return -1.0f; + } + if (shift_by_min) { + if (x > 0.0f) { + return (x - min) * scale; + } else { + return (x + min) * scale; + } + } else { + return x * scale; } - } else { - return x * scale; - } } /** @@ -730,49 +730,48 @@ extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, * @param brakeDist Braking distance. * @return Percentage of completion. */ -extern f32 get_percent_forAccelBrake(const f32 now, const f32 start, const f32 end, - const f32 accelerateDist, const f32 brakeDist) { - f32 percent; - f32 total_delta; - f32 now_delta; - f32 step; +extern f32 get_percent_forAccelBrake(f32 now, f32 start, f32 end, f32 accelerateDist, f32 brakeDist) { + f32 percent; + f32 total_delta; + f32 now_delta; + f32 step; - if (now >= end) { - return 1.0f; - } - if (now <= start) { - return 0.0f; - } - total_delta = end - start; - now_delta = now - start; - if (total_delta < (accelerateDist + brakeDist)) { - return 0.0f; - } - - step = 1.0f / (((2.0f * total_delta) - accelerateDist) - brakeDist); - if (accelerateDist != 0.0f) { - if (now_delta <= accelerateDist) { - percent = (now_delta * (step * now_delta)); - percent /= accelerateDist; - return percent; + if (now >= end) { + return 1.0f; + } + if (now <= start) { + return 0.0f; + } + total_delta = end - start; + now_delta = now - start; + if (total_delta < (accelerateDist + brakeDist)) { + return 0.0f; + } + + step = 1.0f / (((2.0f * total_delta) - accelerateDist) - brakeDist); + if (accelerateDist != 0.0f) { + if (now_delta <= accelerateDist) { + percent = (now_delta * (step * now_delta)); + percent /= accelerateDist; + return percent; + } + percent = step * accelerateDist; + } else { + percent = 0.0f; + } + if (now_delta <= (total_delta - brakeDist)) { + percent += (step * 2.0f) * (now_delta - accelerateDist); + return percent; + } + percent += (2.0f * step * ((total_delta - accelerateDist) - brakeDist)); + if (brakeDist != 0.0f) { + percent += step * brakeDist; + if (now_delta < total_delta) { + f32 diff = total_delta - now_delta; + percent -= step * diff * diff / brakeDist; + } } - percent = step * accelerateDist; - } else { - percent = 0.0f; - } - if (now_delta <= (total_delta - brakeDist)) { - percent += (step * 2.0f) * (now_delta - accelerateDist); return percent; - } - percent += (2.0f * step * ((total_delta - accelerateDist) - brakeDist)); - if (brakeDist != 0.0f) { - percent += step * brakeDist; - if (now_delta < total_delta) { - f32 diff = total_delta - now_delta; - percent -= step * diff * diff / brakeDist; - } - } - return percent; } /** @@ -782,18 +781,16 @@ extern f32 get_percent_forAccelBrake(const f32 now, const f32 start, const f32 e * @param wpos Pointer to the 3D world position (xyz_t). * @param screen_pos Pointer to the resulting 2D screen position (xyz_t). */ -extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, - xyz_t* screen_pos) { - f32 w; +extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, xyz_t* screen_pos) { + f32 w; - Matrix_mult(&play->projection_matrix, 0); - Matrix_Position(world_pos, screen_pos); - w = play->projection_matrix.ww + - ((play->projection_matrix.wx * world_pos->x) + - (play->projection_matrix.wy * world_pos->y) + - (play->projection_matrix.wz * world_pos->z)); - screen_pos->x = (SCREEN_WIDTH_F / 2.0f) + ((screen_pos->x / w) * (SCREEN_WIDTH_F / 2.0f)); - screen_pos->y = (SCREEN_HEIGHT_F / 2.0f) - ((screen_pos->y / w) * (SCREEN_HEIGHT_F / 2.0f)); + Matrix_mult(&play->projection_matrix, 0); + Matrix_Position(world_pos, screen_pos); + w = play->projection_matrix.ww + + ((play->projection_matrix.wx * world_pos->x) + (play->projection_matrix.wy * world_pos->y) + + (play->projection_matrix.wz * world_pos->z)); + screen_pos->x = (SCREEN_WIDTH_F / 2.0f) + ((screen_pos->x / w) * (SCREEN_WIDTH_F / 2.0f)); + screen_pos->y = (SCREEN_HEIGHT_F / 2.0f) - ((screen_pos->y / w) * (SCREEN_HEIGHT_F / 2.0f)); } /** @@ -805,20 +802,20 @@ extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, * @return Percentage of the input value within the specified range. */ extern f32 get_percent(const int max, const int min, const int x) { - f32 total_delta; - f32 percent; + f32 total_delta; + f32 percent; - percent = 1.0f; - if (x < min) { - percent = 0.0f; - } else if (x < max) { - total_delta = max - min; - if (total_delta != 0.0f) { - percent = (f32)(x - min) / total_delta; - if (percent > 1.0f) { - percent = 1.0f; - } + percent = 1.0f; + if (x < min) { + percent = 0.0f; + } else if (x < max) { + total_delta = max - min; + if (total_delta != 0.0f) { + percent = (f32)(x - min) / total_delta; + if (percent > 1.0f) { + percent = 1.0f; + } + } } - } - return percent; + return percent; } diff --git a/src/m_msg_appear.c_inc b/src/m_msg_appear.c_inc index ad6a84e2..c85646ee 100644 --- a/src/m_msg_appear.c_inc +++ b/src/m_msg_appear.c_inc @@ -1,93 +1,89 @@ static int mMsg_Main_Appear_SetScale(mMsg_Window_c* msg_p, GAME* game) { - const f32 max = 18.0f; + if (msg_p->timer < 18.0f) { + f32 scale; - if (msg_p->timer < max) { - f32 scale; - - msg_p->timer += 1.0f; - scale = get_percent_forAccelBrake(msg_p->timer, 0.0f, max, 0.0f, 0.0f); - msg_p->window_scale = scale; - msg_p->text_scale = scale; - return FALSE; - } - else { - msg_p->window_scale = 1.0f; - msg_p->text_scale = 1.0f; - msg_p->timer = 0.0f; - return TRUE; - } + msg_p->timer += 1.0f; + scale = get_percent_forAccelBrake(msg_p->timer, 0.0f, 18.0f, 0.0f, 0.0f); + msg_p->window_scale = scale; + msg_p->text_scale = scale; + return FALSE; + } else { + msg_p->window_scale = 1.0f; + msg_p->text_scale = 1.0f; + msg_p->timer = 0.0f; + return TRUE; + } } static void mMsg_request_main_index_fromAppear(mMsg_Window_c* msg_p, GAME* game, int scale_done_flag) { - if (scale_done_flag && mMsg_request_main_cursol(msg_p, FALSE, 5)) { - mMsg_SetTimer(msg_p, 20.0f); - } + if (scale_done_flag && mMsg_request_main_cursol(msg_p, FALSE, 5)) { + mMsg_SetTimer(msg_p, 20.0f); + } } static void mMsg_Main_Appear(mMsg_Window_c* msg_p, GAME* game) { - int scaling_done_flag = mMsg_Main_Appear_SetScale(msg_p, game); - mMsg_request_main_index_fromAppear(msg_p, game, scaling_done_flag); - mMsg_MainSetup_Window(msg_p, game); + int scaling_done_flag = mMsg_Main_Appear_SetScale(msg_p, game); + mMsg_request_main_index_fromAppear(msg_p, game, scaling_done_flag); + mMsg_MainSetup_Window(msg_p, game); } static void mMsg_MainSetup_Appear(mMsg_Window_c* msg_p, GAME* game) { - mMsg_Request_MainAppear_Data_c* appear_data = &msg_p->request_data.request_main_appear; - int msg_no = appear_data->msg_no; + mMsg_Request_MainAppear_Data_c* appear_data = &msg_p->request_data.request_main_appear; + int msg_no = appear_data->msg_no; - if (mMsg_LoadMsgData(msg_p->msg_data, msg_no, FALSE)) { - ACTOR* actor = appear_data->speaker_actor; - int show_name = appear_data->name_shown_flag; + if (mMsg_LoadMsgData(msg_p->msg_data, msg_no, FALSE)) { + ACTOR* actor = appear_data->speaker_actor; + int show_name = appear_data->name_shown_flag; - mMsg_Set_client_actor_p(msg_p, actor, show_name); - msg_p->window_background_color = appear_data->window_color; - mMsg_sound_spec_change_voice(msg_p); - mMsg_sound_voice_mode(msg_p); - msg_p->main_index = mMsg_INDEX_APPEAR; - msg_p->draw_flag = TRUE; - msg_p->window_scale = 0.0f; - msg_p->text_scale = 0.0f; - msg_p->timer = 0.0f; - msg_p->show_continue_button = FALSE; - msg_p->requested_main_index = -1; - msg_p->requested_priority = 4; - msg_p->start_text_cursor_idx = 0; - msg_p->end_text_cursor_idx = 0; + mMsg_Set_client_actor_p(msg_p, actor, show_name); + msg_p->window_background_color = appear_data->window_color; + mMsg_sound_spec_change_voice(msg_p); + mMsg_sound_voice_mode(msg_p); + msg_p->main_index = mMsg_INDEX_APPEAR; + msg_p->draw_flag = TRUE; + msg_p->window_scale = 0.0f; + msg_p->text_scale = 0.0f; + msg_p->timer = 0.0f; + msg_p->show_continue_button = FALSE; + msg_p->requested_main_index = -1; + msg_p->requested_priority = 4; + msg_p->start_text_cursor_idx = 0; + msg_p->end_text_cursor_idx = 0; - if (msg_p->client_actor_p != NULL) { - switch (mNpc_GetNpcSex(msg_p->client_actor_p)) { - case mPr_SEX_MALE: - msg_p->name_background_color.r = 70; - msg_p->name_background_color.g = 245; - msg_p->name_background_color.b = 255; - msg_p->name_text_color.r = 0; - msg_p->name_text_color.g = 0; - msg_p->name_text_color.b = 15; - break; - - case mPr_SEX_FEMALE: - msg_p->name_background_color.r = 235; - msg_p->name_background_color.g = 140; - msg_p->name_background_color.b = 210; - msg_p->name_text_color.r = 45; - msg_p->name_text_color.g = 0; - msg_p->name_text_color.b = 30; - break; + if (msg_p->client_actor_p != NULL) { + switch (mNpc_GetNpcSex(msg_p->client_actor_p)) { + case mPr_SEX_MALE: + msg_p->name_background_color.r = 70; + msg_p->name_background_color.g = 245; + msg_p->name_background_color.b = 255; + msg_p->name_text_color.r = 0; + msg_p->name_text_color.g = 0; + msg_p->name_text_color.b = 15; + break; - default: - msg_p->name_background_color.r = 185; - msg_p->name_background_color.g = 255; - msg_p->name_background_color.b = 0; - msg_p->name_text_color.r = 0; - msg_p->name_text_color.g = 30; - msg_p->name_text_color.b = 0; - break; - } + case mPr_SEX_FEMALE: + msg_p->name_background_color.r = 235; + msg_p->name_background_color.g = 140; + msg_p->name_background_color.b = 210; + msg_p->name_text_color.r = 45; + msg_p->name_text_color.g = 0; + msg_p->name_text_color.b = 30; + break; + + default: + msg_p->name_background_color.r = 185; + msg_p->name_background_color.g = 255; + msg_p->name_background_color.b = 0; + msg_p->name_text_color.r = 0; + msg_p->name_text_color.g = 30; + msg_p->name_text_color.b = 0; + break; + } + } + + msg_p->data_loaded = TRUE; + emu64_refresh(); + } else { + msg_p->data_loaded = FALSE; } - - msg_p->data_loaded = TRUE; - emu64_refresh(); - } - else { - msg_p->data_loaded = FALSE; - } } diff --git a/src/m_msg_disappear.c_inc b/src/m_msg_disappear.c_inc index 39ba7838..959ef060 100644 --- a/src/m_msg_disappear.c_inc +++ b/src/m_msg_disappear.c_inc @@ -1,53 +1,49 @@ static int mMsg_Main_Disappear_SetScale(mMsg_Window_c* msg_p, GAME* game) { - const f32 max = 18.0f; + if (msg_p->timer < 18.0f) { + f32 scale; - if (msg_p->timer < max) { - f32 scale; - - msg_p->timer += 1.0f; - scale = 1.0f - get_percent_forAccelBrake(msg_p->timer, 0.0f, max, 0.0f, 0.0f); - msg_p->window_scale = scale; - msg_p->text_scale = scale; - return FALSE; - } - else { - msg_p->window_scale = 0.0f; - msg_p->text_scale = 0.0f; - msg_p->timer = 0.0f; - return TRUE; - } + msg_p->timer += 1.0f; + scale = 1.0f - get_percent_forAccelBrake(msg_p->timer, 0.0f, 18.0f, 0.0f, 0.0f); + msg_p->window_scale = scale; + msg_p->text_scale = scale; + return FALSE; + } else { + msg_p->window_scale = 0.0f; + msg_p->text_scale = 0.0f; + msg_p->timer = 0.0f; + return TRUE; + } } static void mMsg_request_main_index_fromDisappear(mMsg_Window_c* msg_p, int scale_done_flag) { - if (scale_done_flag) { - mMsg_Change_request_main_index(msg_p, mMsg_INDEX_HIDE, 5); - } + if (scale_done_flag) { + mMsg_Change_request_main_index(msg_p, mMsg_INDEX_HIDE, 5); + } } static void mMsg_Main_Disappear(mMsg_Window_c* msg_p, GAME* game) { - int scaling_done_flag = mMsg_Main_Disappear_SetScale(msg_p, game); - mMsg_request_main_index_fromDisappear(msg_p, scaling_done_flag); - mMsg_MainSetup_Window(msg_p, game); + int scaling_done_flag = mMsg_Main_Disappear_SetScale(msg_p, game); + mMsg_request_main_index_fromDisappear(msg_p, scaling_done_flag); + mMsg_MainSetup_Window(msg_p, game); } static void mMsg_MainSetup_Disappear(mMsg_Window_c* msg_p, GAME* game) { - mMsg_sound_spec_change_scene(msg_p); - msg_p->main_index = mMsg_INDEX_DISAPPEAR; - msg_p->draw_flag = TRUE; - msg_p->window_scale = 1.0f; - msg_p->text_scale = 1.0f; - msg_p->timer = 0.0f; - msg_p->show_continue_button = FALSE; + mMsg_sound_spec_change_scene(msg_p); + msg_p->main_index = mMsg_INDEX_DISAPPEAR; + msg_p->draw_flag = TRUE; + msg_p->window_scale = 1.0f; + msg_p->text_scale = 1.0f; + msg_p->timer = 0.0f; + msg_p->show_continue_button = FALSE; - if (mDemo_Get_use_zoom_sound()) { - if (mDemo_Get_camera() == FALSE) { - mMsg_sound_ZOOMDOWN_SHORT(msg_p); + if (mDemo_Get_use_zoom_sound()) { + if (mDemo_Get_camera() == FALSE) { + mMsg_sound_ZOOMDOWN_SHORT(msg_p); + } else { + mMsg_sound_ZOOMDOWN_LONG(msg_p); + } } - else { - mMsg_sound_ZOOMDOWN_LONG(msg_p); - } - } - msg_p->requested_main_index = -1; - msg_p->requested_priority = 4; + msg_p->requested_main_index = -1; + msg_p->requested_priority = 4; } diff --git a/src/m_player.c b/src/m_player.c index 866e41e2..59bc17da 100644 --- a/src/m_player.c +++ b/src/m_player.c @@ -1,5 +1,6 @@ #include "m_player_lib.h" +#include "libultra/libultra.h" #include "m_play.h" #include "m_common_data.h" #include "m_actor_shadow.h" @@ -12,6 +13,58 @@ #include "ac_set_ovl_insect.h" #include "m_house.h" +/* Static function declarations, add as needed for intellisense */ +static int Player_actor_check_request_main_able(GAME* game, int request_main_index, int priority); +static void Player_actor_request_main_index(GAME* game, int request_index, int priority); +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); +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); +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); +static void Player_actor_SetupItem_Base1(ACTOR* actorx, int anim1_idx, f32 item_morph_speed, int* anim1_idx_p, + int* part_table_idx_p); +static void Player_actor_setup_main_Base(ACTOR* actorx, GAME* game); +static int Player_actor_Movement_Base_Braking_common(ACTOR* actorx, f32 brake_amount); +static int Player_actor_Movement_Base_Braking(ACTOR* actorx); +static void Player_actor_Movement_Base_Stop(ACTOR* actorx, int use_position_speed_y); +static int Player_actor_CulcAnimation_Base2(ACTOR* actorx, f32* last_anim0_current_frame_p); +static int Player_actor_Check_AnimationFrame_PerfectEquel(ACTOR* actorx, f32 frame); +static int Player_actor_Check_AnimationFrame(cKF_FrameControl_c* fc_p, f32 target_frame); +static void Player_actor_set_eye_pattern(ACTOR* actorx, int idx); +static void Player_actor_set_eye_pattern_normal(ACTOR* actorx); +static void Player_actor_set_mouth_pattern(ACTOR* actorx, int idx); +static void Player_actor_set_tex_anime_pattern(ACTOR* actorx); +static void Player_actor_Excute_Corect_forBrake(ACTOR* actorx, GAME* game); +static void Player_actor_Excute_Corect_forStand(ACTOR* actorx, GAME* game); +static void Player_actor_BGcheck_common_type1(ACTOR* actorx); +static void Player_actor_BGcheck_common_type2(ACTOR* actorx); +static void Player_actor_BGcheck_common_type3(ACTOR* actorx); +static int Player_actor_RecieveDemoOrder_EffectOrder(void); +static void Player_actor_Reinput_force_position_angle(ACTOR* actorx, GAME* game); +static void Player_actor_recover_lean_angle(ACTOR* actorx); +static int Player_actor_Check_TradingItemMode(u8 mode); +static void Player_actor_SettleRequestMainIndexPriority(ACTOR* actorx); +static int Player_actor_check_item_is_fish(mActor_name_t item); +static void Player_actor_Change_ItemParent(ACTOR* actor); +static void Player_actor_Set_item_matrix_set(ACTOR* actorx); +static void Player_actor_Unset_item_matrix_set(ACTOR* actorx); +static void Player_actor_Birth_TradingItem(ACTOR* actor, mActor_name_t item, int mode, int present_flag); +static void Player_actor_CHange_TradingItemMode(ACTOR* actorx, u8 mode); +static int Player_actor_Check_ItemParent(ACTOR* actor); +static ACTOR* Player_actor_Get_umbrella_p(ACTOR* actor, GAME* game); +static s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind); +static void Player_actor_Set_now_item_main_index(ACTOR* actorx, int item_main_index); +static void Player_actor_SetEffect_forTakeout_item(ACTOR* actorx, GAME* game); +static void Player_actor_Set_FootMark_Base1(ACTOR* actorx, GAME* game, int disable_effect, int disable_sound); +static s8 Player_actor_Get_ItemKind_from_submenu(void); + +static int Player_actor_Item_main(ACTOR* actorx, GAME* game); +static void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame); +static int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind); + /* Common */ #include "../src/m_player_controller.c_inc" #include "../src/m_player_vibration.c_inc" diff --git a/src/m_player_common.c_inc b/src/m_player_common.c_inc index 4bedc8b9..24e4b710 100644 --- a/src/m_player_common.c_inc +++ b/src/m_player_common.c_inc @@ -2299,7 +2299,7 @@ static void Player_actor_putin_furniture(GAME* game, int slot, mActor_name_t ite } } -static int Player_actor_Check_AnimationFrame_PerfectEqual(ACTOR* actorx, f32 frame) { +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; @@ -4771,13 +4771,13 @@ static int Player_actor_check_request_change_item(GAME* game) { } static int Player_actor_check_item_is_fish(mActor_name_t item) { -/* @BUG - these macros should be swapped */ -#ifndef BUGFIXES - if (ITEM_NAME_GET_CAT(item) == NAME_TYPE_ITEM1 && ITEM_NAME_GET_TYPE(item) == ITEM1_CAT_FISH) { +#if defined(BUGFIXES) + if (ITEM_NAME_GET_TYPE(item) == NAME_TYPE_ITEM1 && ITEM_NAME_GET_CAT(item) == ITEM1_CAT_FISH) { return TRUE; } #else - if (ITEM_NAME_GET_TYPE(item) == NAME_TYPE_ITEM1 && ITEM_NAME_GET_CAT(item) == ITEM1_CAT_FISH) { + // @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 @@ -6242,18 +6242,24 @@ static int Player_actor_Set_shake_tree_table(ACTOR* actorx, GAME* game, mActor_n if (little_flag == FALSE) { for (i = 0; i < 3; i++) { -/* @BUG - *shake_ut_z_p is missing an = sign */ -#ifndef BUGFIXES - if ((*shake_ut_x_p == tree_ut_x) && (*shake_ut_z_p = tree_ut_z)) { -#else +#if defined(BUGFIXES) if ((*shake_ut_x_p == tree_ut_x) && (*shake_ut_z_p == tree_ut_z)) { -#endif 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++; diff --git a/src/m_player_item_common.c_inc b/src/m_player_item_common.c_inc index 75b16f6b..babdb80e 100644 --- a/src/m_player_item_common.c_inc +++ b/src/m_player_item_common.c_inc @@ -1,10 +1,10 @@ -void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) { +static void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) { if (mEv_CheckTitleDemo() <= 0) { Common_Get(now_private)->equipment = item; } } -mActor_name_t Player_actor_Get_ItemNoSubmenu() { +mActor_name_t Player_actor_Get_ItemNoSubmenu(void) { if (mEv_CheckTitleDemo() > 0) { return mPlib_Get_controller_data_for_title_demo_p()->equiped_item; } else { @@ -12,19 +12,18 @@ mActor_name_t Player_actor_Get_ItemNoSubmenu() { } } -s8 Player_actor_Get_ItemKind_from_submenu() { +static s8 Player_actor_Get_ItemKind_from_submenu(void) { return mPlib_Get_ItemNoToItemKind(Player_actor_Get_ItemNoSubmenu()); } -s8 Player_actor_Get_ItemKind_fromScene() { +static s8 Player_actor_Get_ItemKind_fromScene(void) { if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no)) != 0) { return Player_actor_Get_ItemKind_from_submenu(); } return -1; } - -s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) { +static s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; int able = Player_actor_CheckPlayer_AbleLoadItem(kind); s8 scene_kind = Player_actor_Get_ItemKind_fromScene(); @@ -51,7 +50,7 @@ s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) { return -1; } -int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) { +static int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) { static s8 data[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 20, @@ -65,8 +64,7 @@ int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) { } } - -void Player_actor_birth_umbrella(ACTOR* actor, GAME* game) { +static void Player_actor_birth_umbrella(ACTOR* actor, GAME* game) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; int is_umbrella; aTOL_Clip_c* tools; @@ -109,17 +107,17 @@ ACTOR* Player_actor_Get_umbrella_p(ACTOR* actor, GAME* game) { return NULL; } -int Player_actor_Item_CulcAnimation_Base(ACTOR* actor) { +static int Player_actor_Item_CulcAnimation_Base(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; return cKF_SkeletonInfo_R_play(&player->item_keyframe); } -int Player_actor_Item_CulcAnimation_Base2(ACTOR* actor) { +static int Player_actor_Item_CulcAnimation_Base2(ACTOR* actor) { return Player_actor_Item_CulcAnimation_Base(actor) == 1; } -void Player_actor_Item_SetAnimation_Base(ACTOR* actor, f32 frame) { +static void Player_actor_Item_SetAnimation_Base(ACTOR* actor, f32 frame) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; cKF_SkeletonInfo_R_c* keyf = &player->item_keyframe; @@ -128,8 +126,8 @@ void Player_actor_Item_SetAnimation_Base(ACTOR* actor, f32 frame) { keyf->frame_control.current_frame = frame; } -void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx, int mode, f32 speed, f32 morph_speed, - f32 frame) { +static void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; int change_bank = Player_actor_Change_ItemBank(); @@ -161,8 +159,7 @@ void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx, int mod } } - -void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) { +static void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -171,8 +168,7 @@ void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) { } } - -void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) { +static void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -204,8 +200,7 @@ void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) { } } - -void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) { +static void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -237,8 +232,7 @@ void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) { } } - -void Player_actor_Item_Set_PosSpeed_forUki(ACTOR* actor) { +static void Player_actor_Item_Set_PosSpeed_forUki(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -247,7 +241,7 @@ void Player_actor_Item_Set_PosSpeed_forUki(ACTOR* actor) { } } -void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) { +static void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -266,7 +260,7 @@ void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) { } } -void Player_actor_Item_Set_RodTopPos_forUki(ACTOR* actor) { +static void Player_actor_Item_Set_RodTopPos_forUki(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p; @@ -275,9 +269,8 @@ void Player_actor_Item_Set_RodTopPos_forUki(ACTOR* actor) { } } - -void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int mode, f32 speed, f32 morph_speed, - f32 frame) { +static void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int mode, f32 speed, f32 morph_speed, + f32 frame) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; int umbrella; int rod; @@ -320,8 +313,7 @@ void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_idx, int } } - -void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) { +static void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label; @@ -334,7 +326,7 @@ void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) { } } -int Player_actor_Check_ItemAnimationToItemKind(int kind, int anim) { +static int Player_actor_Check_ItemAnimationToItemKind(int kind, int anim) { int res; if (mPlayer_ITEM_IS_AXE(kind) != FALSE) { diff --git a/src/m_player_main_give.c_inc b/src/m_player_main_give.c_inc index e69de29b..66283d5f 100644 --- a/src/m_player_main_give.c_inc +++ b/src/m_player_main_give.c_inc @@ -0,0 +1,124 @@ +static int Player_actor_request_main_give_all(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int mode, int present_flag, int surface_flag, + int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_GIVE, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_give_c* req_give_p = &player->requested_main_index_data.give; + + Player_actor_request_main_index(game, mPlayer_INDEX_GIVE, priority); + req_give_p->talk_actor = talk_actor_p; + req_give_p->turn_flag = turn_flag; + req_give_p->prev_main_index = ret_main_index; + req_give_p->item = item; + req_give_p->mode = mode; + req_give_p->present_flag = present_flag; + req_give_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_request_main_give_from_submenu(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + int main_index = player->now_main_index; + ACTOR* talk_actor_p; + int turn_flag; + mPlayer_request_give_from_submenu_c* req_give_from_submenu_p; + + req_give_from_submenu_p = &mPlib_Get_change_data_from_submenu_p()->request_main_data.give_from_submenu; + if (main_index == mPlayer_INDEX_TALK) { + talk_actor_p = player->main_data.talk.talk_actor_p; + turn_flag = player->main_data.talk.turn_flag; + } else { + talk_actor_p = NULL; + turn_flag = FALSE; + } + + Player_actor_request_main_give_all(game, talk_actor_p, turn_flag, main_index, req_give_from_submenu_p->item, + req_give_from_submenu_p->mode_after, req_give_from_submenu_p->present_flag, + req_give_from_submenu_p->counter_flag, mPlayer_REQUEST_PRIORITY_31); +} + +static void Player_actor_setup_main_Give(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_give_c* req_give_p = &player->requested_main_index_data.give; + mPlayer_main_give_c* main_give_p = &player->main_data.give; + mActor_name_t item; + int mode; + int present_flag; + int anim0_idx; + int anim1_idx; + int part_table_idx; + + item = req_give_p->item; + mode = req_give_p->mode; + present_flag = req_give_p->present_flag; + + main_give_p->talk_actor_p = req_give_p->talk_actor; + main_give_p->turn_flag = req_give_p->turn_flag; + main_give_p->ret_main_index = req_give_p->prev_main_index; + main_give_p->item = req_give_p->item; + main_give_p->surface_flag = req_give_p->on_surface_flag; + + if (Player_actor_check_item_is_fish(item)) { + anim0_idx = mPlayer_ANIM_TRANSFER_F1; + } else if (main_give_p->surface_flag) { + anim0_idx = mPlayer_ANIM_SEND_MAIL1; + } else { + anim0_idx = mPlayer_ANIM_TRANSFER1; + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base2(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, cKF_FRAMECONTROL_STOP, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); + Player_actor_Birth_TradingItem(actorx, item, mode, present_flag); + Player_actor_Set_item_matrix_set(actorx); + Player_actor_sound_GASAGOSO(actorx); +} + +static void Player_actor_Movement_Give(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static int Player_actor_CulcAnimation_Give(ACTOR* actorx) { + f32 dummy; + + return Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Give(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_request_proc_index_fromGive(ACTOR* actorx, GAME* game, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (end_flag) { + int after_mode = Common_Get(clip).handOverItem_clip->player_after_mode; + mPlayer_main_give_c* main_give_p = &player->main_data.give; + ACTOR* talk_actor_p = main_give_p->talk_actor_p; + int turn_flag = main_give_p->turn_flag; + int ret_main_index = main_give_p->ret_main_index; + + Player_actor_SettleRequestMainIndexPriority(actorx); + Player_actor_request_main_give_wait_all(game, talk_actor_p, turn_flag, ret_main_index, main_give_p->item, + main_give_p->surface_flag, mPlayer_REQUEST_PRIORITY_19); + } +} + +static void Player_actor_main_Give(ACTOR* actorx, GAME* game) { + int end_flag; + + Player_actor_Movement_Give(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + end_flag = Player_actor_CulcAnimation_Give(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Give(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Set_item_matrix_set(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromGive(actorx, game, end_flag); +} diff --git a/src/m_player_main_give_wait.c_inc b/src/m_player_main_give_wait.c_inc index e69de29b..dd79675c 100644 --- a/src/m_player_main_give_wait.c_inc +++ b/src/m_player_main_give_wait.c_inc @@ -0,0 +1,119 @@ +static int Player_actor_request_main_give_wait_all(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int surface_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_GIVE_WAIT, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_give_wait_c* req_give_wait_p = &player->requested_main_index_data.give_wait; + + Player_actor_request_main_index(game, mPlayer_INDEX_GIVE_WAIT, priority); + req_give_wait_p->talk_actor = talk_actor_p; + req_give_wait_p->turn_flag = turn_flag; + req_give_wait_p->prev_main_index = ret_main_index; + req_give_wait_p->item = item; + req_give_wait_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Give_wait(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_give_wait_c* req_give_wait_p = &player->requested_main_index_data.give_wait; + mPlayer_main_give_wait_c* main_give_wait_p = &player->main_data.give_wait; + mActor_name_t item; + int anim0_idx; + int anim1_idx; + int part_table_idx; + + item = req_give_wait_p->item; + + main_give_wait_p->talk_actor_p = req_give_wait_p->talk_actor; + main_give_wait_p->turn_flag = req_give_wait_p->turn_flag; + main_give_wait_p->ret_main_index = req_give_wait_p->prev_main_index; + main_give_wait_p->surface_flag = req_give_wait_p->on_surface_flag; + + if (Player_actor_check_item_is_fish(item)) { + anim0_idx = mPlayer_ANIM_TRANS_WAIT_F1; + } else if (main_give_wait_p->surface_flag) { + anim0_idx = mPlayer_ANIM_WAIT1; + } else { + anim0_idx = mPlayer_ANIM_TRANS_WAIT1; + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base1(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, part_table_idx); + Player_actor_setup_main_Base(actorx, game); + Player_actor_CHange_TradingItemMode(actorx, aHOI_REQUEST_TRANS_WAIT); + + /* Handing items over a surface (like the mail counter), item does not need to be attached to player's hand */ + if (main_give_wait_p->surface_flag == FALSE) { + Player_actor_Set_item_matrix_set(actorx); + } +} + +static void Player_actor_settle_main_Give_wait(ACTOR* actorx) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_give_wait_c* main_give_wait_p = &player->main_data.give_wait; + + /* Handing items over a surface (like the mail counter), item does not need to be attached to player's hand */ + if (main_give_wait_p->surface_flag == FALSE) { + Player_actor_Unset_item_matrix_set(actorx); + } +} + +static void Player_actor_Movement_Give_wait(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static int Player_actor_CulcAnimation_Give_wait(ACTOR* actorx) { + f32 dummy; + + return Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Give_wait(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_Set_item_matrix_set_Give_wait(ACTOR* actorx) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_give_wait_c* main_give_wait_p = &player->main_data.give_wait; + + /* Handing items over a surface (like the mail counter), item does not need to be attached to player's hand */ + if (main_give_wait_p->surface_flag == FALSE) { + Player_actor_Set_item_matrix_set(actorx); + } +} + +static void Player_actor_request_proc_index_fromGive_wait(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (Player_actor_Check_ItemParent(actorx) == FALSE) { + mPlayer_main_give_wait_c* main_give_wait_p = &player->main_data.give_wait; + int ret_main_index = main_give_wait_p->ret_main_index; + + Player_actor_SettleRequestMainIndexPriority(actorx); + + if (ret_main_index != mPlayer_INDEX_TALK) { + Player_actor_request_main_demo_wait_all(game, FALSE, 0, mPlayer_REQUEST_PRIORITY_19); + } else { + ACTOR* talk_actor_p = main_give_wait_p->talk_actor_p; + int turn_flag = main_give_wait_p->turn_flag; + Player_actor_request_main_talk_all(game, talk_actor_p, turn_flag, -12.0f, FALSE, + mPlayer_REQUEST_PRIORITY_19); + } + } +} + +static void Player_actor_main_Give_wait(ACTOR* actorx, GAME* game) { + Player_actor_Movement_Give_wait(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + Player_actor_CulcAnimation_Give_wait(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Give_wait(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Set_item_matrix_set_Give_wait(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromGive_wait(actorx, game); +} diff --git a/src/m_player_main_putin_item.c_inc b/src/m_player_main_putin_item.c_inc index e69de29b..e2f6fba7 100644 --- a/src/m_player_main_putin_item.c_inc +++ b/src/m_player_main_putin_item.c_inc @@ -0,0 +1,125 @@ +static int Player_actor_request_main_putin_item(GAME* game, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_PUTIN_ITEM, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_putin_item_c* req_putin_item_p = &player->requested_main_index_data.putin_item; + + req_putin_item_p->request_main_index = player->requested_main_index; + Player_actor_request_main_index(game, mPlayer_INDEX_PUTIN_ITEM, priority); + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Putin_item(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_putin_item_c* req_putin_item_p = &player->requested_main_index_data.putin_item; + mPlayer_main_putin_item_c* main_putin_item_p = &player->main_data.putin_item; + int item_kind; + int anim_idx; + f32 morph_counter; + + item_kind = Player_actor_Get_ItemKind_from_submenu(); + + main_putin_item_p->back_request_data = *req_putin_item_p; + main_putin_item_p->timer = 0.0f; + + Player_actor_LoadOrDestruct_Item(actorx, item_kind, mPlib_Get_BasicItemAnimeIndex_fromItemKind(item_kind), + cKF_FRAMECONTROL_REPEAT, 0.5f, 5.0f, -1.0f); + Player_actor_Set_now_item_main_index(actorx, Player_actor_Get_BasicItemMainIndex_fromItemKind(item_kind)); + player->item_kind = item_kind; + + if (mPlayer_ITEM_IS_UMBRELLA(item_kind) != FALSE) { + anim_idx = mPlayer_ANIM_UMB_CLOSE1; + morph_counter = -5.0f; + + if (player->umbrella_actor != NULL) { + if (Common_Get(clip).tools_clip != NULL) { + Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actorx, player->umbrella_actor, + aTOL_ACTION_PUTAWAY); + } + } else { + ACTOR* umbrella_p; + + player->umbrella_state = aTOL_ACTION_PUTAWAY; + umbrella_p = Player_actor_Get_umbrella_p(actorx, game); + player->umbrella_actor = umbrella_p; + } + } else { + anim_idx = mPlayer_ANIM_PUTAWAY1; + morph_counter = 9.0f; + } + + Player_actor_InitAnimation_Base2(actorx, game, anim_idx, anim_idx, 1.0f, 1.0f, 0.5f, morph_counter, + cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL); + Player_actor_setup_main_Base(actorx, game); + Player_actor_sound_GASAGOSO(actorx); +} + +static void Player_actor_Movement_Putin_item(ACTOR* actorx) { + Player_actor_Movement_Base_Braking_common(actorx, 0.32625f); +} + +static int Player_actor_CulcAnimation_Putin_item(ACTOR* actorx, f32* last_anim0_cur_frame_p) { + return Player_actor_CulcAnimation_Base2(actorx, last_anim0_cur_frame_p); +} + +static void Player_actor_ObjCheck_Putin_item(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_BGcheck_Putin_item(ACTOR* actorx) { + Player_actor_BGcheck_common_type1(actorx); +} + +static void Player_actor_SetItemScale_Putin_item(ACTOR* actorx) { + int item_kind = Player_actor_Get_ItemKind_from_submenu(); + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_putin_item_c* main_putin_item_p = &player->main_data.putin_item; + f32* timer_p = &main_putin_item_p->timer; + + if (mPlayer_ITEM_IS_UMBRELLA(item_kind) == FALSE) { + f32 timer = *timer_p; + + if (*timer_p < 18.0f) { + (*timer_p) += 1.0f; + player->item_scale = 1.0f - get_percent_forAccelBrake(*timer_p, 0.0f, 18.0f, 0.0f, 0.0f); + } + } +} + +static void Player_actor_SearchAnimation_Putin_item(ACTOR* actorx, GAME* game, f32 frame) { + if (Player_actor_Check_AnimationFrame_PerfectEquel(actorx, frame) == FALSE) { + Player_actor_Set_FootMark_Base1(actorx, game, FALSE, FALSE); + } +} + +static void Player_actor_request_proc_index_fromPutin_item(ACTOR* actorx, GAME* game, int end_flag) { + if (end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_putin_item_c* main_putin_item_p = &player->main_data.putin_item; + + Player_actor_SettleRequestMainIndexPriority(actorx); + bcopy(&main_putin_item_p->back_request_data.request_data, &player->requested_main_index_data, + sizeof(mPlayer_request_backup_u)); + Player_actor_request_main_index(game, main_putin_item_p->back_request_data.request_main_index, + mPlayer_REQUEST_PRIORITY_37); + } +} + +static void Player_actor_main_Putin_item(ACTOR* actorx, GAME* game) { + f32 last_anim0_cur_frame; + int end_flag; + + Player_actor_Movement_Putin_item(actorx); + end_flag = Player_actor_CulcAnimation_Putin_item(actorx, &last_anim0_cur_frame); + Player_actor_Reinput_force_position_angle(actorx, game); + Player_actor_SetItemScale_Putin_item(actorx); + Player_actor_SearchAnimation_Putin_item(actorx, game, last_anim0_cur_frame); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Putin_item(actorx, game); + Player_actor_BGcheck_Putin_item(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromPutin_item(actorx, game, end_flag); +} diff --git a/src/m_player_main_recieve.c_inc b/src/m_player_main_recieve.c_inc index e69de29b..c340e063 100644 --- a/src/m_player_main_recieve.c_inc +++ b/src/m_player_main_recieve.c_inc @@ -0,0 +1,99 @@ +static int Player_actor_request_main_recieve(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int surface_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_RECIEVE, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_recieve_c* req_recieve_p = &player->requested_main_index_data.recieve; + + Player_actor_request_main_index(game, mPlayer_INDEX_RECIEVE, priority); + req_recieve_p->talk_actor = talk_actor_p; + req_recieve_p->turn_flag = turn_flag; + req_recieve_p->prev_main_index = ret_main_index; + req_recieve_p->item = item; + req_recieve_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Recieve(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_recieve_c* req_recieve_p = &player->requested_main_index_data.recieve; + mPlayer_main_recieve_c* main_recieve_p = &player->main_data.recieve; + mActor_name_t item; + int anim0_idx; + int anim1_idx; + int part_table_idx; + + item = req_recieve_p->item; + main_recieve_p->talk_actor_p = req_recieve_p->talk_actor; + main_recieve_p->turn_flag = req_recieve_p->turn_flag; + main_recieve_p->ret_main_index = req_recieve_p->prev_main_index; + main_recieve_p->item = item; + main_recieve_p->surface_flag = req_recieve_p->on_surface_flag; + + if (Player_actor_check_item_is_fish(item)) { + anim0_idx = mPlayer_ANIM_GET_PULL_F1; + } else if (main_recieve_p->surface_flag) { + anim0_idx = mPlayer_ANIM_RETURN_MAIL2; + } else { + anim0_idx = mPlayer_ANIM_GET_PULL1; + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base2(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, cKF_FRAMECONTROL_STOP, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); + Player_actor_Change_ItemParent(actorx); + Player_actor_Set_item_matrix_set(actorx); +} + +static void Player_actor_Movement_Recieve(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static int Player_actor_CulcAnimation_Recieve(ACTOR* actorx) { + f32 dummy; + + return Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Recieve(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_request_proc_index_fromRecieve(ACTOR* actorx, GAME* game, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (end_flag) { + int after_mode = Common_Get(clip).handOverItem_clip->player_after_mode; + mPlayer_main_recieve_c* main_recieve_p = &player->main_data.recieve; + ACTOR* talk_actor_p = main_recieve_p->talk_actor_p; + int turn_flag = main_recieve_p->turn_flag; + int ret_main_index = main_recieve_p->ret_main_index; + mActor_name_t item = main_recieve_p->item; + + Player_actor_SettleRequestMainIndexPriority(actorx); + switch (after_mode) { + case aHOI_REQUEST_PUTAWAY: + Player_actor_request_main_recieve_putaway(game, talk_actor_p, turn_flag, ret_main_index, item, + main_recieve_p->surface_flag, mPlayer_REQUEST_PRIORITY_19); + break; + } + } +} + +static void Player_actor_main_Recieve(ACTOR* actorx, GAME* game) { + int end_flag; + + Player_actor_Movement_Recieve(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + end_flag = Player_actor_CulcAnimation_Recieve(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Recieve(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Set_item_matrix_set(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromRecieve(actorx, game, end_flag); +} diff --git a/src/m_player_main_recieve_putaway.c_inc b/src/m_player_main_recieve_putaway.c_inc index e69de29b..4af42da0 100644 --- a/src/m_player_main_recieve_putaway.c_inc +++ b/src/m_player_main_recieve_putaway.c_inc @@ -0,0 +1,101 @@ +static int Player_actor_request_main_recieve_putaway(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int surface_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_RECIEVE_PUTAWAY, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_recieve_putaway_c* req_recieve_putaway_p = &player->requested_main_index_data.recieve_putaway; + + Player_actor_request_main_index(game, mPlayer_INDEX_RECIEVE_PUTAWAY, priority); + req_recieve_putaway_p->talk_actor = talk_actor_p; + req_recieve_putaway_p->turn_flag = turn_flag; + req_recieve_putaway_p->prev_main_index = ret_main_index; + req_recieve_putaway_p->item = item; + req_recieve_putaway_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Recieve_putaway(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_recieve_putaway_c* req_recieve_putaway_p = &player->requested_main_index_data.recieve_putaway; + mPlayer_main_recieve_putaway_c* main_recieve_putaway_p = &player->main_data.recieve_putaway; + mActor_name_t item; + int anim0_idx; + int anim1_idx; + int part_table_idx; + + item = req_recieve_putaway_p->item; + main_recieve_putaway_p->talk_actor_p = req_recieve_putaway_p->talk_actor; + main_recieve_putaway_p->turn_flag = req_recieve_putaway_p->turn_flag; + main_recieve_putaway_p->ret_main_index = req_recieve_putaway_p->prev_main_index; + main_recieve_putaway_p->surface_flag = req_recieve_putaway_p->on_surface_flag; + + if (Player_actor_check_item_is_fish(item)) { + anim0_idx = mPlayer_ANIM_GET_PUTAWAY_F1; + } else if (main_recieve_putaway_p->surface_flag) { + anim0_idx = mPlayer_ANIM_RETURN_MAIL3; + } else { + anim0_idx = mPlayer_ANIM_GET_PUTAWAY1; + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base2(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, cKF_FRAMECONTROL_STOP, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); + Player_actor_CHange_TradingItemMode(actorx, aHOI_REQUEST_PUTAWAY); + Player_actor_Set_item_matrix_set(actorx); + Player_actor_sound_GASAGOSO(actorx); +} + +static void Player_actor_settle_main_Recieve_putaway(ACTOR* actorx) { + Player_actor_Unset_item_matrix_set(actorx); +} + +static void Player_actor_Movement_Recieve_putaway(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static int Player_actor_CulcAnimation_Recieve_putaway(ACTOR* actorx) { + f32 dummy; + + return Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Recieve_putaway(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_request_proc_index_fromRecieve_putaway(ACTOR* actorx, GAME* game, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (end_flag) { + int after_mode = Common_Get(clip).handOverItem_clip->player_after_mode; + mPlayer_main_recieve_putaway_c* main_recieve_putaway_p = &player->main_data.recieve_putaway; + int ret_main_index = main_recieve_putaway_p->ret_main_index; + + Player_actor_SettleRequestMainIndexPriority(actorx); + if (ret_main_index != mPlayer_INDEX_TALK) { + Player_actor_request_main_demo_wait_all(game, FALSE, 0, mPlayer_REQUEST_PRIORITY_19); + } else { + Player_actor_request_main_talk_all(game, main_recieve_putaway_p->talk_actor_p, + main_recieve_putaway_p->turn_flag, -12.0f, FALSE, + mPlayer_REQUEST_PRIORITY_19); + } + } +} + +static void Player_actor_main_Recieve_putaway(ACTOR* actorx, GAME* game) { + int end_flag; + + Player_actor_Movement_Recieve_putaway(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + end_flag = Player_actor_CulcAnimation_Recieve_putaway(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Recieve_putaway(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Set_item_matrix_set(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromRecieve_putaway(actorx, game, end_flag); +} diff --git a/src/m_player_main_recieve_stretch.c_inc b/src/m_player_main_recieve_stretch.c_inc index e69de29b..f4ae3282 100644 --- a/src/m_player_main_recieve_stretch.c_inc +++ b/src/m_player_main_recieve_stretch.c_inc @@ -0,0 +1,91 @@ +static int Player_actor_request_main_recieve_stretch(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int surface_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_RECIEVE_STRETCH, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_recieve_stretch_c* req_recieve_stretch_p = &player->requested_main_index_data.recieve_stretch; + + Player_actor_request_main_index(game, mPlayer_INDEX_RECIEVE_STRETCH, priority); + req_recieve_stretch_p->talk_actor = talk_actor_p; + req_recieve_stretch_p->turn_flag = turn_flag; + req_recieve_stretch_p->prev_main_index = ret_main_index; + req_recieve_stretch_p->item = item; + req_recieve_stretch_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Recieve_stretch(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_recieve_stretch_c* req_recieve_stretch_p = &player->requested_main_index_data.recieve_stretch; + mPlayer_main_recieve_stretch_c* main_recieve_stretch_p = &player->main_data.recieve_stretch; + mActor_name_t item; + int anim0_idx; + int anim1_idx; + int part_table_idx; + + item = req_recieve_stretch_p->item; + main_recieve_stretch_p->talk_actor_p = req_recieve_stretch_p->talk_actor; + main_recieve_stretch_p->turn_flag = req_recieve_stretch_p->turn_flag; + main_recieve_stretch_p->ret_main_index = req_recieve_stretch_p->prev_main_index; + main_recieve_stretch_p->item = item; + main_recieve_stretch_p->surface_flag = req_recieve_stretch_p->on_surface_flag; + + if (Player_actor_check_item_is_fish(item)) { + anim0_idx = mPlayer_ANIM_GET_F1; + } else if (main_recieve_stretch_p->surface_flag) { + anim0_idx = mPlayer_ANIM_RETURN_MAIL1; + } else { + anim0_idx = mPlayer_ANIM_GET1; + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base2(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, cKF_FRAMECONTROL_STOP, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); +} + +static void Player_actor_Movement_Recieve_stretch(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static int Player_actor_CulcAnimation_Recieve_stretch(ACTOR* actorx) { + f32 dummy; + + return Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Recieve_stretch(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_request_proc_index_fromRecieve_stretch(ACTOR* actorx, GAME* game, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (end_flag) { + mPlayer_main_recieve_stretch_c* main_recieve_stretch_p = &player->main_data.recieve_stretch; + ACTOR* talk_actor_p = main_recieve_stretch_p->talk_actor_p; + int turn_flag = main_recieve_stretch_p->turn_flag; + int ret_main_index = main_recieve_stretch_p->ret_main_index; + mActor_name_t item = main_recieve_stretch_p->item; + + Player_actor_SettleRequestMainIndexPriority(actorx); + Player_actor_request_main_recieve(game, talk_actor_p, turn_flag, ret_main_index, item, + main_recieve_stretch_p->surface_flag, mPlayer_REQUEST_PRIORITY_19); + } +} + +static void Player_actor_main_Recieve_stretch(ACTOR* actorx, GAME* game) { + int end_flag; + + Player_actor_Movement_Recieve_stretch(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + end_flag = Player_actor_CulcAnimation_Recieve_stretch(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Recieve_stretch(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromRecieve_stretch(actorx, game, end_flag); +} diff --git a/src/m_player_main_recieve_wait.c_inc b/src/m_player_main_recieve_wait.c_inc index e69de29b..1b82f765 100644 --- a/src/m_player_main_recieve_wait.c_inc +++ b/src/m_player_main_recieve_wait.c_inc @@ -0,0 +1,78 @@ +static int Player_actor_request_main_recieve_wait(GAME* game, ACTOR* talk_actor_p, int turn_flag, int ret_main_index, + mActor_name_t item, int surface_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_RECIEVE_WAIT, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_recieve_wait_c* req_recieve_wait_p = &player->requested_main_index_data.recieve_wait; + + Player_actor_request_main_index(game, mPlayer_INDEX_RECIEVE_WAIT, priority); + req_recieve_wait_p->talk_actor = talk_actor_p; + req_recieve_wait_p->turn_flag = turn_flag; + req_recieve_wait_p->prev_main_index = ret_main_index; + req_recieve_wait_p->item = item; + req_recieve_wait_p->on_surface_flag = surface_flag; + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Recieve_wait(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_recieve_wait_c* req_recieve_wait_p = &player->requested_main_index_data.recieve_wait; + mPlayer_main_recieve_wait_c* main_recieve_wait_p = &player->main_data.recieve_wait; + int anim1_idx; + int part_table_idx; + + Player_actor_SetupItem_Base1(actorx, mPlayer_ANIM_WAIT1, -5.0f, &anim1_idx, &part_table_idx); + main_recieve_wait_p->talk_actor_p = req_recieve_wait_p->talk_actor; + main_recieve_wait_p->turn_flag = req_recieve_wait_p->turn_flag; + main_recieve_wait_p->ret_main_index = req_recieve_wait_p->prev_main_index; + main_recieve_wait_p->item = req_recieve_wait_p->item; + main_recieve_wait_p->surface_flag = req_recieve_wait_p->on_surface_flag; + Player_actor_InitAnimation_Base1(actorx, game, mPlayer_ANIM_WAIT1, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); +} + +static void Player_actor_Movement_Recieve_wait(ACTOR* actorx) { + Player_actor_Movement_Base_Stop(actorx, FALSE); +} + +static void Player_actor_CulcAnimation_Recieve_wait(ACTOR* actorx) { + f32 dummy; + + Player_actor_CulcAnimation_Base2(actorx, &dummy); +} + +static void Player_actor_ObjCheck_Recieve_wait(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_request_proc_index_fromRecieve_wait(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (Player_actor_Check_TradingItemMode(aHOI_REQUEST_TRANS_WAIT) || + Player_actor_Check_TradingItemMode(aHOI_REQUEST_RETURN_WAIT)) { + mPlayer_main_recieve_wait_c* main_recieve_wait_p = &player->main_data.recieve_wait; + ACTOR* talk_actor_p = main_recieve_wait_p->talk_actor_p; + int turn_flag = main_recieve_wait_p->turn_flag; + int ret_main_index = main_recieve_wait_p->ret_main_index; + mActor_name_t item = main_recieve_wait_p->item; + + Player_actor_SettleRequestMainIndexPriority(actorx); + Player_actor_request_main_recieve_stretch(game, talk_actor_p, turn_flag, ret_main_index, item, + main_recieve_wait_p->surface_flag, mPlayer_REQUEST_PRIORITY_19); + } +} + +static void Player_actor_main_Recieve_wait(ACTOR* actorx, GAME* game) { + Player_actor_Movement_Recieve_wait(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + Player_actor_CulcAnimation_Recieve_wait(actorx); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Recieve_wait(actorx, game); + Player_actor_BGcheck_Wait(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromRecieve_wait(actorx, game); +} diff --git a/src/m_player_main_takeout_item.c_inc b/src/m_player_main_takeout_item.c_inc index e69de29b..e0cad276 100644 --- a/src/m_player_main_takeout_item.c_inc +++ b/src/m_player_main_takeout_item.c_inc @@ -0,0 +1,143 @@ +static int Player_actor_request_main_takeout_item(GAME* game, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_TAKEOUT_ITEM, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + mPlayer_request_takeout_item_c* req_takeout_item_p = &player->requested_main_index_data.takeout_item; + + req_takeout_item_p->request_main_index = player->requested_main_index; + Player_actor_request_main_index(game, mPlayer_INDEX_TAKEOUT_ITEM, priority); + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Takeout_item(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_takeout_item_c* req_takeout_item_p = &player->requested_main_index_data.takeout_item; + mPlayer_main_takeout_item_c* main_takeout_item_p = &player->main_data.takeout_item; + int item_kind; + int anim1_idx; + + item_kind = Player_actor_Get_ItemKind(actorx, player->requested_main_index); + + main_takeout_item_p->back_request_data = *req_takeout_item_p; + main_takeout_item_p->timer = 0.0f; + + Player_actor_LoadOrDestruct_Item(actorx, item_kind, mPlib_Get_BasicItemAnimeIndex_fromItemKind(item_kind), + cKF_FRAMECONTROL_REPEAT, 0.5f, 5.0f, -1.0f); + Player_actor_Set_now_item_main_index(actorx, Player_actor_Get_BasicItemMainIndex_fromItemKind(item_kind)); + player->item_kind = item_kind; + + if (mPlayer_ITEM_IS_UMBRELLA(item_kind) != FALSE) { + ACTOR* umbrella_p; + + player->umbrella_state = 1; + umbrella_p = Player_actor_Get_umbrella_p(actorx, game); + Player_actor_InitAnimation_Base2(actorx, game, mPlayer_ANIM_UMB_OPEN1, mPlayer_ANIM_UMB_OPEN1, 1.0f, 1.0f, 0.5f, + -5.0f, cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL); + player->item_scale = 1.0f; + } else { + Player_actor_InitAnimation_Base3(actorx, game, mPlayer_ANIM_PUTAWAY1, mPlayer_ANIM_PUTAWAY1, 0.5f, 9.0f, + cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL); + player->item_scale = 0.0f; + } + + Player_actor_setup_main_Base(actorx, game); + Player_actor_sound_GASAGOSO(actorx); +} + +static void Player_actor_settle_main_Takeout_item(ACTOR* actorx, GAME* game) { + Player_actor_SetEffect_forTakeout_item(actorx, game); +} + +static void Player_actor_Movement_Takeout_item(ACTOR* actorx) { + Player_actor_Movement_Base_Braking_common(actorx, 0.32625f); +} + +static int Player_actor_CulcAnimation_Takeout_item(ACTOR* actorx, f32* last_anim0_cur_frame_p) { + return Player_actor_CulcAnimation_Base2(actorx, last_anim0_cur_frame_p); +} + +static void Player_actor_ObjCheck_Takeout_item(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forStand(actorx, game); +} + +static void Player_actor_SearchAnimation_Takeout_item(ACTOR* actorx, GAME* game, f32 frame) { + if (Player_actor_Check_AnimationFrame_PerfectEquel(actorx, frame) == FALSE) { + Player_actor_Set_FootMark_Base1(actorx, game, FALSE, FALSE); + } +} + +static void Player_actor_BGcheck_Takeout_item(ACTOR* actorx) { + Player_actor_BGcheck_common_type1(actorx); +} + +static void Player_actor_SearchTimer_Takeout_item(ACTOR* actorx, GAME* game) { + int item_kind = Player_actor_Get_ItemKind_from_submenu(); + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_takeout_item_c* main_takeout_item_p = &player->main_data.takeout_item; + f32* timer_p = &main_takeout_item_p->timer; + + if (mPlayer_ITEM_IS_UMBRELLA(item_kind) == FALSE) { + f32 timer = *timer_p; + + if (*timer_p < 54.0f) { + (*timer_p) += 1.0f; + + if (*timer_p >= 36.0f) { + int next_anim0_idx; + int now_anim0_idx; + + player->item_scale = get_percent_forAccelBrake(*timer_p, 36.0f, 54.0f, 0.0f, 0.0f); + next_anim0_idx = mPlib_Get_BasicPlayerAnimeIndex_fromItemKind(item_kind); + now_anim0_idx = player->animation0_idx; + + if (now_anim0_idx != next_anim0_idx) { + Player_actor_InitAnimation_Base1(actorx, game, next_anim0_idx, next_anim0_idx, 1.0f, 1.0f, 0.5f, + 9.0f, mPlayer_PART_TABLE_NORMAL); + } + } + } + } +} + +static void Player_actor_request_proc_index_fromTakeout_item(ACTOR* actorx, GAME* game, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_takeout_item_c* main_takeout_item_p = &player->main_data.takeout_item; + int item_kind = Player_actor_Get_ItemKind_from_submenu(); + + if (mPlayer_ITEM_IS_UMBRELLA(item_kind) != FALSE) { + if (end_flag == FALSE) { + return; + } + } else { + f32 timer = main_takeout_item_p->timer; + + if (timer < 54.0f) { + return; + } + } + + Player_actor_SettleRequestMainIndexPriority(actorx); + bcopy(&main_takeout_item_p->back_request_data.request_data, &player->requested_main_index_data, + sizeof(mPlayer_request_backup_u)); + Player_actor_request_main_index(game, main_takeout_item_p->back_request_data.request_main_index, + mPlayer_REQUEST_PRIORITY_37); +} + +static void Player_actor_main_Takeout_item(ACTOR* actorx, GAME* game) { + f32 last_anim0_cur_frame; + int end_flag; + + Player_actor_Movement_Takeout_item(actorx); + end_flag = Player_actor_CulcAnimation_Takeout_item(actorx, &last_anim0_cur_frame); + Player_actor_Reinput_force_position_angle(actorx, game); + Player_actor_SearchTimer_Takeout_item(actorx, game); + Player_actor_SearchAnimation_Takeout_item(actorx, game, last_anim0_cur_frame); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_ObjCheck_Takeout_item(actorx, game); + Player_actor_BGcheck_Takeout_item(actorx); + Player_actor_Item_main(actorx, game); + Player_actor_request_proc_index_fromTakeout_item(actorx, game, end_flag); +} diff --git a/src/m_player_main_talk.c_inc b/src/m_player_main_talk.c_inc index e69de29b..1b8878b2 100644 --- a/src/m_player_main_talk.c_inc +++ b/src/m_player_main_talk.c_inc @@ -0,0 +1,210 @@ +static int Player_actor_request_main_talk_all(GAME* game, ACTOR* talk_actor_p, int turn_flag, f32 morph_speed, + int umbrella_flag, int priority) { + if (Player_actor_check_request_main_able(game, mPlayer_INDEX_TALK, priority)) { + PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); + + player->requested_main_index_data.talk.talk_actor = talk_actor_p; + player->requested_main_index_data.talk.turn_flag = turn_flag; + player->requested_main_index_data.talk.morph_speed = morph_speed; + player->requested_main_index_data.talk.umbrella_flag = umbrella_flag; + + Player_actor_request_main_index(game, mPlayer_INDEX_TALK, priority); + return TRUE; + } + + return FALSE; +} + +static void Player_actor_setup_main_Talk(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_request_talk_c* req_talk_p = &player->requested_main_index_data.talk; + mPlayer_main_talk_c* main_talk_p = &player->main_data.talk; + f32 morph_speed = req_talk_p->morph_speed; + int anim1_idx; + int part_table_idx; + + if (req_talk_p->umbrella_flag) { + player->unable_hand_item_in_demo = TRUE; + } + + main_talk_p->talk_actor_p = req_talk_p->talk_actor; + main_talk_p->turn_flag = req_talk_p->turn_flag; + main_talk_p->feel_type = 0; + + Player_actor_SetupItem_Base1(actorx, mPlayer_ANIM_WAIT1, -ABS(morph_speed), &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base1(actorx, game, mPlayer_ANIM_WAIT1, anim1_idx, 1.0f, 1.0f, 0.5f, morph_speed, + part_table_idx); + Player_actor_setup_main_Base(actorx, game); +} + +static void Player_actor_settle_main_Talk(ACTOR* actorx, GAME* game) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + int ef = player->main_data.talk.feel_type; + + if (ef > 0) { + eEC_CLIP->effect_kill_proc(ef - 1, RSV_NO); + } +} + +static void Player_actor_Movement_Talk(ACTOR* actorx) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + mPlayer_main_talk_c* main_talk_p = &player->main_data.talk; + ACTOR* talk_actor_p = main_talk_p->talk_actor_p; + int turn_flag = main_talk_p->turn_flag; + + Player_actor_Movement_Base_Braking(actorx); + if (turn_flag) { + if (talk_actor_p != NULL) { + s16 target_angle = DEG2SHORT_ANGLE2(-180.0f) + talk_actor_p->player_angle_y; + s16 cur_angle = add_calc_short_angle2(&actorx->shape_info.rotation.y, target_angle, 1.0f - sqrtf(0.5f), + DEG2SHORT_ANGLE2(13.73291015625f), DEG2SHORT_ANGLE2(0.274658203125f)); + + actorx->world.angle.y = actorx->shape_info.rotation.y; + if (mDemo_Check_SpeakerAble() == FALSE && mDemo_Check_DiffAngle_forTalk(cur_angle)) { + mDemo_Set_SpeakerAble(); + } + } + } else { + mDemo_Set_SpeakerAble(); + } +} + +static int Player_actor_CulcAnimation_Talk(ACTOR* actorx, f32* last_cur_anim0_frame_p) { + return Player_actor_CulcAnimation_Base2(actorx, last_cur_anim0_frame_p); +} + +static void Player_actor_Set_FeelEffect_common(ACTOR* actorx, int* feel_type_p) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (player->animation0_idx == mPlayer_ANIM_GAAAN1 && + Player_actor_Check_AnimationFrame(&player->keyframe0.frame_control, 5.0f)) { + player->draw_effect_idx = eEC_EFFECT_SHOCK + 1; + } +} + +static void Player_actor_SearchAnimation_Talk(ACTOR* actorx, f32 last_cur_anim0_frame) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (Player_actor_Check_AnimationFrame_PerfectEquel(actorx, last_cur_anim0_frame) == FALSE) { + Player_actor_Set_FeelEffect_common(actorx, &player->main_data.talk.feel_type); + } +} + +static void Player_actor_ChangeAnimation_FromDemoOrder_common(ACTOR* actorx, GAME* game, int order, int end_flag, + int* feel_type_p) { + int anim0_idx; + int anim1_idx; + int part_table_idx; + int mode; + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (order > 0) { + switch (order) { + case 0xFF: + anim0_idx = mPlayer_ANIM_WAIT1; + mode = cKF_FRAMECONTROL_REPEAT; + + if (*feel_type_p > 0) { + /* @BUG? - shouldn't this be subtracting 1 to get the real type of the effect? */ + eEC_CLIP->effect_kill_proc(*feel_type_p, RSV_NO); + *feel_type_p = 0; + } + break; + case 2: + anim0_idx = mPlayer_ANIM_GAAAN1; + mode = cKF_FRAMECONTROL_STOP; + break; + case 0xFE: + anim0_idx = mPlayer_ANIM_BIKU1; + mode = cKF_FRAMECONTROL_STOP; + break; + default: + return; + } + } else { + + if (end_flag != FALSE) { + int now_anim0_idx = player->animation0_idx; + + if (now_anim0_idx == mPlayer_ANIM_GAAAN1) { + anim0_idx = mPlayer_ANIM_GAAAN2; + mode = cKF_FRAMECONTROL_REPEAT; + } else if (now_anim0_idx == mPlayer_ANIM_BIKU1) { + anim0_idx = mPlayer_ANIM_WAIT1; + mode = cKF_FRAMECONTROL_REPEAT; + } else { + return; + } + } else { + return; + } + } + + Player_actor_SetupItem_Base1(actorx, anim0_idx, -5.0f, &anim1_idx, &part_table_idx); + Player_actor_InitAnimation_Base2(actorx, game, anim0_idx, anim1_idx, 1.0f, 1.0f, 0.5f, -5.0f, mode, part_table_idx); +} + +static void Player_actor_ChangeAnimation_FromDemoOrder_Talk(ACTOR* actorx, GAME* game, int order, int end_flag) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + Player_actor_ChangeAnimation_FromDemoOrder_common(actorx, game, order, end_flag, &player->main_data.talk.feel_type); +} + +static void Player_actor_SetEffect_FromDemoOrder_common(ACTOR* actorx, GAME* game, int order) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + + if (order > 0) { + switch (order) { + case 0xFD: + eEC_CLIP->effect_make_proc(eEC_EFFECT_HALLOWEEN, player->feel_pos, 2, actorx->shape_info.rotation.y, + game, RSV_NO, 0, 0); + break; + } + } +} + +static void Player_actor_SetEffect_FromDemoOrder_Talk(ACTOR* actorx, GAME* game, int order) { + Player_actor_SetEffect_FromDemoOrder_common(actorx, game, order); +} + +static void Player_actor_set_eye_pattern_Talk(ACTOR* actorx) { + PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; + int anim0_idx = player->animation0_idx; + + if (anim0_idx == mPlayer_ANIM_GAAAN1 || anim0_idx == mPlayer_ANIM_BIKU1) { + Player_actor_set_tex_anime_pattern(actorx); + } else if (anim0_idx == mPlayer_ANIM_GAAAN2) { + Player_actor_set_eye_pattern(actorx, 6); + Player_actor_set_mouth_pattern(actorx, 5); + } else { + Player_actor_set_eye_pattern_normal(actorx); + Player_actor_set_mouth_pattern(actorx, 0); + } +} + +static void Player_actor_ObjCheck_Talk(ACTOR* actorx, GAME* game) { + Player_actor_Excute_Corect_forBrake(actorx, game); +} + +static void Player_actor_BGcheck_Talk(ACTOR* actorx) { + Player_actor_BGcheck_common_type1(actorx); +} + +static void Player_actor_main_Talk(ACTOR* actorx, GAME* game) { + int order; + f32 last_cur_anim0_frame; + int end_flag; + + order = Player_actor_RecieveDemoOrder_EffectOrder(); + Player_actor_Movement_Talk(actorx); + Player_actor_Reinput_force_position_angle(actorx, game); + end_flag = Player_actor_CulcAnimation_Talk(actorx, &last_cur_anim0_frame); + Player_actor_SearchAnimation_Talk(actorx, last_cur_anim0_frame); + Player_actor_ChangeAnimation_FromDemoOrder_Talk(actorx, game, order, end_flag); + Player_actor_SetEffect_FromDemoOrder_Talk(actorx, game, order); + Player_actor_recover_lean_angle(actorx); + Player_actor_set_eye_pattern_Talk(actorx); + Player_actor_ObjCheck_Talk(actorx, game); + Player_actor_BGcheck_Talk(actorx); + Player_actor_Item_main(actorx, game); +} diff --git a/src/m_player_sound.c_inc b/src/m_player_sound.c_inc index a3fcb25f..ae8459eb 100644 --- a/src/m_player_sound.c_inc +++ b/src/m_player_sound.c_inc @@ -3,32 +3,32 @@ typedef enum player_status_level_s { mPlayer_WALK, mPlayer_RUN, mPlayer_DASH, -}mPlayer_STATUS_LEVEL; +} mPlayer_STATUS_LEVEL; -void Player_actor_sound_SetStatus(ACTOR* actor) { +static void Player_actor_sound_SetStatus(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; int status; f32 speed; - + status = player->now_main_index; - speed = player->keyframe0.frame_control.speed / 0.6f; - + speed = player->keyframe0.frame_control.speed / 0.6f; + switch (status) { - case mPlayer_INDEX_READY_WALK_NET: - case mPlayer_INDEX_DEMO_WALK: - case mPlayer_INDEX_WALK: - status = mPlayer_WALK; - break; - case mPlayer_INDEX_RUN: - status = mPlayer_RUN; - break; - case mPlayer_INDEX_DASH: - status = mPlayer_DASH; - break; - default: - status = 0; - break; - } + case mPlayer_INDEX_READY_WALK_NET: + case mPlayer_INDEX_DEMO_WALK: + case mPlayer_INDEX_WALK: + status = mPlayer_WALK; + break; + case mPlayer_INDEX_RUN: + status = mPlayer_RUN; + break; + case mPlayer_INDEX_DASH: + status = mPlayer_DASH; + break; + default: + status = 0; + break; + } if (speed > 1.0f) { speed = 1.0f; } else if (speed < 0.0f) { @@ -37,15 +37,15 @@ void Player_actor_sound_SetStatus(ACTOR* actor) { sAdo_PlayerStatusLevel(speed, status); } -void Player_actor_set_sound_common1(xyz_t* pos, u16 id) { +static void Player_actor_set_sound_common1(xyz_t* pos, u16 id) { sAdo_OngenTrgStart(id, pos); } -void Player_actor_set_sound_common2(ACTOR* actor, u16 id) { - Player_actor_set_sound_common1(&actor->world.position,id); +static void Player_actor_set_sound_common2(ACTOR* actor, u16 id) { + Player_actor_set_sound_common1(&actor->world.position, id); } -void Player_actor_sound_FootStep1(ACTOR* actor, u16 id){ +static void Player_actor_sound_FootStep1(ACTOR* actor, u16 id) { xyz_t* pos = &actor->world.position; xyz_t apos; int check; @@ -53,23 +53,22 @@ void Player_actor_sound_FootStep1(ACTOR* actor, u16 id){ apos = *pos; - attr = mCoBG_Wpos2Attribute(apos,0); - if(sAdo_CheckOnPlussBridge(pos,attr)){ + attr = mCoBG_Wpos2Attribute(apos, 0); + if (sAdo_CheckOnPlussBridge(pos, attr)) { id = 0x420A; } sAdo_PlyWalkSe(id, pos); } -void Player_actor_sound_FootStep2(ACTOR* actor) { +static void Player_actor_sound_FootStep2(ACTOR* actor) { int floorId; - + floorId = Common_Get(floor_idx); if (floorId >= 0) { if (mRmTp_SoundStepWalkSE(&actor->world.position) != 0) { sAdo_PlyWalkSeRoom(0xFF, &actor->world.position); - } - else if (floorId < 0x56) { + } else if (floorId < 0x56) { sAdo_PlyWalkSeRoom(floorId, &actor->world.position); } } else { @@ -78,257 +77,254 @@ void Player_actor_sound_FootStep2(ACTOR* actor) { } } -void Player_actor_sound_Tumble(ACTOR* actor) { +static void Player_actor_sound_Tumble(ACTOR* actor) { u16 label = sAdo_Get_KokeruLabel(actor->bg_collision_check.result.unit_attribute); Player_actor_set_sound_common2(actor, label); } - -void Player_actor_sound_AMI_FURI(ACTOR* actor) { + +static void Player_actor_sound_AMI_FURI(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; Player_actor_set_sound_common1(&player->net_pos, NA_SE_TOOL_FURI); } -void Player_actor_sound_AMI_HIT(ACTOR* actor) { +static void Player_actor_sound_AMI_HIT(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; Player_actor_set_sound_common1(&player->net_pos, NA_SE_AMI_HIT); } -void Player_actor_sound_AMI_GET(ACTOR* actor) { +static void Player_actor_sound_AMI_GET(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; Player_actor_set_sound_common1(&player->net_pos, NA_SE_TOOL_GET); } -void Player_actor_sound_GASAGOSO(ACTOR* actor) { - Player_actor_set_sound_common2(actor,0x69); +static void Player_actor_sound_GASAGOSO(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_GASAGOSO); } -void Player_actor_sound_AXE_FURI(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_TOOL_FURI); +static void Player_actor_sound_AXE_FURI(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_TOOL_FURI); } -void Player_actor_sound_AXE_HIT(ACTOR* actor,xyz_t* pos) { +static void Player_actor_sound_AXE_HIT(ACTOR* actor, xyz_t* pos) { xyz_t posA; posA.x = pos->x; posA.z = pos->z; - posA.y = actor->world.position.y + 20.0f; - - Player_actor_set_sound_common1(&posA, 0x41D); + posA.y = actor->world.position.y + 20.0f; + + Player_actor_set_sound_common1(&posA, NA_SE_AXE_HIT); } -void Player_actor_sound_AXE_CUT(ACTOR* actor,xyz_t* pos) { +static void Player_actor_sound_AXE_CUT(ACTOR* actor, xyz_t* pos) { xyz_t posA; posA.x = pos->x; posA.z = pos->z; - posA.y = actor->world.position.y + 20.0f; - - Player_actor_set_sound_common1(&posA, 0x41E); + posA.y = actor->world.position.y + 20.0f; + + Player_actor_set_sound_common1(&posA, NA_SE_AXE_CUT); } -void Player_actor_sound_SIT(ACTOR* actor, int ftr_idx){ +static void Player_actor_sound_SIT(ACTOR* actor, int ftr_idx) { int id = mRmTp_GetFtrActionSE(ftr_idx, mRmTp_CHAIR_ACTION_SIT); - - if(id >= 0){ - Player_actor_set_sound_common2(actor,id); - } - else{ - Player_actor_set_sound_common2(actor,NA_SE_HARD_CHAIR_SIT); + + if (id >= 0) { + Player_actor_set_sound_common2(actor, id); + } else { + Player_actor_set_sound_common2(actor, NA_SE_HARD_CHAIR_SIT); } } -void Player_actor_sound_STANDUP(ACTOR* actor, int ftr_idx){ - int id = mRmTp_GetFtrActionSE(ftr_idx,1); - - if(id >= 0){ - Player_actor_set_sound_common2(actor,id); - } - else{ - Player_actor_set_sound_common2(actor,NA_SE_HARD_CHAIR_STANDUP); +static void Player_actor_sound_STANDUP(ACTOR* actor, int ftr_idx) { + int id = mRmTp_GetFtrActionSE(ftr_idx, 1); + + if (id >= 0) { + Player_actor_set_sound_common2(actor, id); + } else { + Player_actor_set_sound_common2(actor, NA_SE_HARD_CHAIR_STANDUP); } } -void Player_actor_sound_JUMP(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_JUMP); +static void Player_actor_sound_JUMP(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_JUMP); } -void Player_actor_sound_LANDING(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_LANDING); +static void Player_actor_sound_LANDING(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_LANDING); } -void Player_actor_sound_ITEM_GET(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_ITEM_GET); +static void Player_actor_sound_ITEM_GET(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_ITEM_GET); } -void Player_actor_sound_BED_IN(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_BED_IN); +static void Player_actor_sound_BED_IN(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_BED_IN); } -void Player_actor_sound_BED_NEGAERI(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_BED_NEGAERI); +static void Player_actor_sound_BED_NEGAERI(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_BED_NEGAERI); } -void Player_actor_sound_BED_OUT(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_BED_OUT); +static void Player_actor_sound_BED_OUT(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_BED_OUT); } -void Player_actor_sound_ROD_STROKE(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_ROD_STROKE); +static void Player_actor_sound_ROD_STROKE(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_ROD_STROKE); } -void Player_actor_sound_ROD_STROKE_small(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_ROD_STROKE_SMALL); +static void Player_actor_sound_ROD_STROKE_small(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_ROD_STROKE_SMALL); } -void Player_actor_sound_ROD_BACK(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_ROD_BACK); +static void Player_actor_sound_ROD_BACK(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_ROD_BACK); } -void Player_actor_sound_scoop1(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP1); +static void Player_actor_sound_scoop1(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP1); } -void Player_actor_sound_scoop_umeru(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_UMERU); +static void Player_actor_sound_scoop_umeru(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_UMERU); } -void Player_actor_sound_scoop_hit(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_HIT); +static void Player_actor_sound_scoop_hit(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_HIT); } -void Player_actor_sound_scoop_shigemi(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_SHIGEMI); +static void Player_actor_sound_scoop_shigemi(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_SHIGEMI); } -void Player_actor_sound_ITEM_HORIDASHI(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_ITEM_HORIDASHI); +static void Player_actor_sound_ITEM_HORIDASHI(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_ITEM_HORIDASHI); } -void Player_actor_sound_slip(ACTOR* actor){ - Player_actor_set_sound_common2(actor,0x4129); +static void Player_actor_sound_slip(ACTOR* actor) { + Player_actor_set_sound_common2(actor, 0x4129); } -void Player_actor_sound_tree_touch(xyz_t* pos){ - sAdo_OngenTrgStart(NA_SE_TREE_TOUCH,pos); -} - -void Player_actor_sound_tree_yurasu(xyz_t* pos){ - sAdo_OngenTrgStart(NA_SE_TREE_YURASU,pos); +static void Player_actor_sound_tree_touch(xyz_t* pos) { + sAdo_OngenTrgStart(NA_SE_TREE_TOUCH, pos); } -void Player_actor_sound_kirikabu_scoop(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_KIRIBASU_SCOOP); +static void Player_actor_sound_tree_yurasu(xyz_t* pos) { + sAdo_OngenTrgStart(NA_SE_TREE_YURASU, pos); } -void Player_actor_sound_kirikabu_out(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_KIRIBASU_OUT); +static void Player_actor_sound_kirikabu_scoop(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_KIRIBASU_SCOOP); } -void Player_actor_sound_knock(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_SOUND_KNOCK); +static void Player_actor_sound_kirikabu_out(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_KIRIBASU_OUT); } -void Player_actor_sound_coin_gasagoso(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_COIN_GASAGOSO); +static void Player_actor_sound_knock(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SOUND_KNOCK); } -void Player_actor_sound_araiiki(ACTOR* actor){ +static void Player_actor_sound_coin_gasagoso(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_COIN_GASAGOSO); +} + +static void Player_actor_sound_araiiki(ACTOR* actor) { s8 gender = Common_Get(now_private)->gender; - Player_actor_set_sound_common2(actor,(gender == 0) ? (u16)NA_SE_ARAIIKI_BOY : (u16)NA_SE_ARAIIKI_GIRL); + Player_actor_set_sound_common2(actor, (gender == 0) ? (u16)NA_SE_ARAIIKI_BOY : (u16)NA_SE_ARAIIKI_GIRL); } -void Player_actor_sound_zassou_nuku(xyz_t* pos) { - sAdo_OngenTrgStart(NA_SE_ZASSOU_NUKU,pos); +static void Player_actor_sound_zassou_nuku(xyz_t* pos) { + sAdo_OngenTrgStart(NA_SE_ZASSOU_NUKU, pos); } -void Player_actor_sound_hachi_sasareru(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_HACHI_SASARERU); -} - -void Player_actor_sound_wear(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_WEAR); +static void Player_actor_sound_hachi_sasareru(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_HACHI_SASARERU); } -void Player_actor_sound_dai_ue_kakunou(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_DAI_UE_KAKUNOU); +static void Player_actor_sound_wear(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_WEAR); } -void Player_actor_sound_umbrella_rotate(ACTOR* actor){ - Player_actor_set_sound_common2(actor,NA_SE_UMBRELLA_ROTATE); +static void Player_actor_sound_dai_ue_kakunou(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_DAI_UE_KAKUNOU); } -u16 Player_actor_sound_Get_bgm_num_forCompletePayment() { - switch(Common_Get(complete_payment_type)){ +static void Player_actor_sound_umbrella_rotate(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_UMBRELLA_ROTATE); +} + +static u16 Player_actor_sound_Get_bgm_num_forCompletePayment() { + switch (Common_Get(complete_payment_type)) { case 1: - return NA_SE_MONEY0; + return NA_SE_MONEY0; default: - return NA_SE_MONEY1; + return NA_SE_MONEY1; } } -u16 Player_actor_sound_Get_bgm_num_forDemoGetGoldenItem(int type) { - switch (type) { - case 0: - return NA_SE_MONEY0; - case 1: - return NA_SE_MONEY2; - case 2: - return NA_SE_COIN; - default: - return NA_SE_MONEY1; +static u16 Player_actor_sound_Get_bgm_num_forDemoGetGoldenItem(int type) { + switch (type) { + case 0: + return NA_SE_MONEY0; + case 1: + return NA_SE_MONEY2; + case 2: + return NA_SE_COIN; + default: + return NA_SE_MONEY1; } } - -void Player_actor_sound_camera_move1(void) { +static void Player_actor_sound_camera_move1(void) { sAdo_SysTrgStart(NA_SE_CAMERA_MOVE1); } -void Player_actor_sound_camera_move2() { +static void Player_actor_sound_camera_move2() { sAdo_SysTrgStart(NA_SE_CAMERA_MOVE2); } -void Player_actor_sound_karaburi(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_KARABURI); +static void Player_actor_sound_karaburi(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_KARABURI); } -void Player_actor_sound_scoop_tree_hit(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_TREE_HIT); +static void Player_actor_sound_scoop_tree_hit(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_TREE_HIT); } -void Player_actor_sound_scoop_item_hit(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_ITEM_HIT); +static void Player_actor_sound_scoop_item_hit(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_ITEM_HIT); } -void Player_actor_sound_axe_ball_hit(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_SCOOP_ITEM_HIT); +static void Player_actor_sound_axe_ball_hit(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_SCOOP_ITEM_HIT); } -void Player_actor_sound_axe_broken1(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_TOOL_BROKEN1); +static void Player_actor_sound_axe_broken1(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_TOOL_BROKEN1); } -void Player_actor_sound_axe_broken2(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_TOOL_BROKEN2); -} - -void Player_actor_sound_axe_broken3(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_TOOL_BROKEN3); +static void Player_actor_sound_axe_broken2(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_TOOL_BROKEN2); } -void Player_actor_sound_uchiwa(ACTOR* actor) { - Player_actor_set_sound_common2(actor,NA_SE_UCHIWA); +static void Player_actor_sound_axe_broken3(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_TOOL_BROKEN3); } -void Player_actor_sound_move_temochi_kazaguruma(ACTOR* actor) { +static void Player_actor_sound_uchiwa(ACTOR* actor) { + Player_actor_set_sound_common2(actor, NA_SE_UCHIWA); +} + +static void Player_actor_sound_move_temochi_kazaguruma(ACTOR* actor) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; f32 speed; - speed = ABS(player->item_keyframe.frame_control.speed / 44.0f); + speed = ABS(player->item_keyframe.frame_control.speed / 44.0f); if (speed > 1.0f) { speed = 1.0f; @@ -337,6 +333,6 @@ void Player_actor_sound_move_temochi_kazaguruma(ACTOR* actor) { } if (speed != 0.0f) { sAdo_kazagurumaLevel(speed); - sAdo_OngenPos((u32) player, NA_SE_TEMOCHI_KAZAGURUMA, &actor->world.position); + sAdo_OngenPos((u32)player, NA_SE_TEMOCHI_KAZAGURUMA, &actor->world.position); } }