From d8ae38b5f06242a136b686142f30f99f408b085a Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Mon, 4 Mar 2024 19:30:45 -0500 Subject: [PATCH] Implement & link ac_tak_stew, add all effects to enum --- include/ac_furniture.h | 28 ++ include/ef_effect_control.h | 175 +++++++++-- src/ac_douzou_move.c_inc | 2 +- src/ac_s_car_move.c_inc | 18 +- src/ac_shrine_move.c_inc | 586 +++++++++++++++++------------------- src/f_furniture.c | 3 +- src/ftr/ac_tak_stew.c | 68 ++++- 7 files changed, 521 insertions(+), 359 deletions(-) diff --git a/include/ac_furniture.h b/include/ac_furniture.h index aa1f1b56..c44cfa01 100644 --- a/include/ac_furniture.h +++ b/include/ac_furniture.h @@ -12,6 +12,34 @@ extern "C" { typedef struct furniture_actor_s FTR_ACTOR; +enum { + aFTR_STATE_STOP, + aFTR_STATE_WAIT_PUSH, + aFTR_STATE_WAIT_PUSH2, + aFTR_STATE_WAIT_PUSH3, + aFTR_STATE_PUSH, + aFTR_STATE_WAIT_PULL, + aFTR_STATE_WAIT_PULL2, + aFTR_STATE_PULL, + aFTR_STATE_WAIT_LROTATE, + aFTR_STATE_LROTATE, + aFTR_STATE_WAIT_RROTATE, + aFTR_STATE_RROTATE, + aFTR_STATE_BIRTH_WAIT, + aFTR_STATE_BIRTH, + aFTR_STATE_BYE, + aFTR_STATE_DEATH, + + aFTR_STATE_NUM +}; + +enum { + aFTR_CTR_TYPE_GAME, + aFTR_CTR_TYPE_GAME_PLAY, + + aFTR_CTR_TYPE_NUM +}; + enum { aFTR_SHAPE_TYPEB_90, /* 2x1 (facing up)*/ aFTR_SHAPE_TYPEB_180, /* 2x1 [- *] */ diff --git a/include/ef_effect_control.h b/include/ef_effect_control.h index 317fc64d..9970f7af 100644 --- a/include/ef_effect_control.h +++ b/include/ef_effect_control.h @@ -10,54 +10,171 @@ extern "C" { #endif enum effect_type { - eEC_EFFECT_SHOCK, - eEC_EFFECT_DUST, - eEC_EFFECT_MUKA, - eEC_EFFECT_WARAU, - /* TODO: finish */ - eEC_EFFECT_CAR_SPARKLE = 90, - eEC_DOUZOU_LIGHT = 101, - eEC_HEM_LIGHT = 123, - - eEC_EFFECT_NUM = 126 + eEC_EFFECT_SHOCK, + eEC_EFFECT_DUST, + eEC_EFFECT_MUKA, + eEC_EFFECT_WARAU, + eEC_EFFECT_HA, + eEC_EFFECT_SIBUKI, + eEC_EFFECT_GIMONHU, + eEC_EFFECT_KANTANHU, + eEC_EFFECT_ASE, + eEC_EFFECT_ASE_CH, + eEC_EFFECT_KANGAERU, + eEC_EFFECT_OTIKOMI, + eEC_EFFECT_BURUBURU, + eEC_EFFECT_SIAWASE_HIKARI, + eEC_EFFECT_SIAWASE_HANA, + eEC_EFFECT_SIAWASE_HANA_CH, + eEC_EFFECT_TAKURAMI, + eEC_EFFECT_TAKURAMI_KIRA, + eEC_EFFECT_KAZE, + eEC_EFFECT_KAZE_HAPPA, + eEC_EFFECT_LOVELOVE, + eEC_EFFECT_LOVELOVE_HEART, + eEC_EFFECT_PUN, + eEC_EFFECT_PUN_YUGE, + eEC_EFFECT_PUN_SEKIMEN, + eEC_EFFECT_NAKU, + eEC_EFFECT_NAMIDA, + eEC_EFFECT_HIRAMEKI_DEN, + eEC_EFFECT_HIRAMEKI_HIKARI, + eEC_EFFECT_SITUREN, + eEC_EFFECT_ASE2, + eEC_EFFECT_DASH_ASIMOTO, + eEC_EFFECT_KONPU, + eEC_EFFECT_LOVELOVE2, + eEC_EFFECT_KPUN, + eEC_EFFECT_KISHA_KEMURI, + eEC_EFFECT_NEBOKE, + eEC_EFFECT_NEBOKE_AWA, + eEC_EFFECT_HANABI_YANAGI, + eEC_EFFECT_HANABI_BOTAN1, + eEC_EFFECT_HANABI_BOTAN2, + eEC_EFFECT_HANABI_HOSHI, + eEC_EFFECT_HANABI_SET, + eEC_EFFECT_HANABI_SWITCH, + eEC_EFFECT_FOOTPRINT, + eEC_EFFECT_TURN_FOOTPRINT, + eEC_EFFECT_BUBU, + eEC_EFFECT_TURN_ASIMOTO, + eEC_EFFECT_STRING, + eEC_EFFECT_YUKIHANE, + eEC_EFFECT_ANAHIKARI, + eEC_EFFECT_BUSH_HAPPA, + eEC_EFFECT_BUSH_YUKI, + eEC_EFFECT_TUMBLE, + eEC_EFFECT_TUMBLE_BODYPRINT, + eEC_EFFECT_SLIP, + eEC_EFFECT_TUMBLE_DUST, + eEC_EFFECT_SWING_NET, + eEC_EFFECT_AMI_MIZU, + eEC_EFFECT_MIZUTAMA, + eEC_EFFECT_YUKIDAMA, + eEC_EFFECT_KIKUZU, + eEC_EFFECT_SWING_AXE, + eEC_EFFECT_STEAM, + eEC_EFFECT_NIGHT15_MOON, + eEC_EFFECT_NIGHT13_MOON, + eEC_EFFECT_NEBOKE_AKUBI, + eEC_EFFECT_SLIP_FOOTPRINT, + eEC_EFFECT_WALK_ASIMOTO, + eEC_EFFECT_TURI_HAMON, + eEC_EFFECT_TURI_MIZU, + eEC_EFFECT_TURI_HANE0, + eEC_EFFECT_TURI_HANE1, + eEC_EFFECT_TURI_SUITEKI, + eEC_EFFECT_ONGEN, + eEC_EFFECT_IMPACT_STAR, + eEC_EFFECT_SANDSPLASH, + eEC_EFFECT_YOUNG_TREE, + eEC_EFFECT_SWING_ROD, + eEC_EFFECT_DOYON, + eEC_EFFECT_KAGU_HAPPA, + eEC_EFFECT_HANABI_DUMMY, + eEC_EFFECT_DIG_HOLE, + eEC_EFFECT_DIG_SCOOP, + eEC_EFFECT_DIG_MUD, + eEC_EFFECT_KIGAE, + eEC_EFFECT_KIGAE_LIGHT, + eEC_EFFECT_TAPE, + eEC_EFFECT_CLACKER, + eEC_EFFECT_KAMIFUBUKI, + eEC_EFFECT_CAR_BLIGHT, + eEC_EFFECT_TAMAIRE, + eEC_EFFECT_CAR_LIGHT, + eEC_EFFECT_RESET_HOLE, + eEC_EFFECT_GOKI, + eEC_EFFECT_HANABIRA, + eEC_EFFECT_WAIT_ASIMOTO, + eEC_EFFECT_OTOSIANA, + eEC_EFFECT_IKIGIRE, + eEC_EFFECT_YUKIDARUMA, + eEC_EFFECT_KYOUSOU_ONPU, + eEC_EFFECT_DOUZOU_LIGHT, + eEC_EFFECT_HALLOWEEN_SMOKE, + eEC_EFFECT_HALLOWEEN, + eEC_EFFECT_MOTIYUGE, + eEC_EFFECT_TABERU, + eEC_EFFECT_KASAMIZU, + eEC_EFFECT_KASAMIZUTAMA, + eEC_EFFECT_HANATIRI, + eEC_EFFECT_URANAI, + eEC_EFFECT_SUISOU_AWA, + eEC_EFFECT_BREAK_AXE, + eEC_EFFECT_YAJIRUSHI, + eEC_EFFECT_SOBA_YUGE, + eEC_EFFECT_FURO_YUGE, + eEC_EFFECT_SHOOTING, + eEC_EFFECT_SHOOTING_SET, + eEC_EFFECT_SHOOTING_KIRA, + eEC_EFFECT_COIN, + eEC_EFFECT_TENT_LAMP, + eEC_EFFECT_FLASH, + eEC_EFFECT_FLASHC, + eEC_EFFECT_KILLER, + eEC_EFFECT_MAKE_HEM, + eEC_EFFECT_MAKE_HEM_KIRA, + eEC_EFFECT_MAKE_HEM_LIGHT, + + eEC_EFFECT_NUM }; enum { - eEC_LIGHT_COLOR_DISABLED, - eEC_LIGHT_COLOR_INCREASING, - eEC_LIGHT_COLOR_MAXIMUM, - eEC_LIGHT_COLOR_DECREASING, + eEC_LIGHT_COLOR_DISABLED, + eEC_LIGHT_COLOR_INCREASING, + eEC_LIGHT_COLOR_MAXIMUM, + eEC_LIGHT_COLOR_DECREASING, - eEC_LIGHT_COLOR_NUM + eEC_LIGHT_COLOR_NUM }; typedef void (*eEC_NAME2EFFECTMAKE_PROC)(int, xyz_t, int, short, GAME*, u16, s16, s16); -typedef void (*eEC_NAME2EFFECTKILL_PROC)(int,u16); +typedef void (*eEC_NAME2EFFECTKILL_PROC)(int, u16); -typedef void (*eEC_REGISTEFFECTLIGHT_PROC)(f32*, s16,s16,s16); +typedef void (*eEC_REGISTEFFECTLIGHT_PROC)(f32*, s16, s16, s16); typedef int (*eEC_EFFECTLIGHTSTATUS_PROC)(rgba_t*, int*); // returns eEC_LIGHT_COLOR_* typedef struct effect_control_clip_s { - /* 0x00 */ eEC_NAME2EFFECTMAKE_PROC effect_make_proc; - /* 0x04 */ eEC_NAME2EFFECTKILL_PROC effect_kill_proc; - /* 0x08 */ u8 _08[0x30 - 0x08]; - /* 0x30 */ eEC_REGISTEFFECTLIGHT_PROC regist_effect_light; - /* 0x34 */ void* _34; - /* 0x38 */ void* _38; - /* 0x3C */ eEC_EFFECTLIGHTSTATUS_PROC effect_light_status; - /* 0x40 */ void* _40; - /* 0x44 */ void* _44; + /* 0x00 */ eEC_NAME2EFFECTMAKE_PROC effect_make_proc; + /* 0x04 */ eEC_NAME2EFFECTKILL_PROC effect_kill_proc; + /* 0x08 */ u8 _08[0x30 - 0x08]; + /* 0x30 */ eEC_REGISTEFFECTLIGHT_PROC regist_effect_light; + /* 0x34 */ void* _34; + /* 0x38 */ void* _38; + /* 0x3C */ eEC_EFFECTLIGHTSTATUS_PROC effect_light_status; + /* 0x40 */ void* _40; + /* 0x44 */ void* _44; } eEC_EffectControl_Clip_c; typedef struct effect_control_s EFFECT_CONTROL_ACTOR; struct effect_control_s { - ACTOR actor_class; - eEC_EffectControl_Clip_c clip; + ACTOR actor_class; + eEC_EffectControl_Clip_c clip; }; - extern ACTOR_PROFILE Effect_Control_Profile; #ifdef __cplusplus diff --git a/src/ac_douzou_move.c_inc b/src/ac_douzou_move.c_inc index 96afb244..fdeb2659 100644 --- a/src/ac_douzou_move.c_inc +++ b/src/ac_douzou_move.c_inc @@ -105,7 +105,7 @@ static int aDOU_setEffect_sub(ACTOR* actor, GAME* game, int house_no, int color) Matrix_Position(&ofs, &eff_pos); /* Spawn effect */ - (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_DOUZOU_LIGHT, eff_pos, 1, 0, game, DOUZOU, color, 0); + (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_DOUZOU_LIGHT, eff_pos, 1, 0, game, DOUZOU, color, 0); Matrix_pull(); diff --git a/src/ac_s_car_move.c_inc b/src/ac_s_car_move.c_inc index 3379b5e4..2f836deb 100644 --- a/src/ac_s_car_move.c_inc +++ b/src/ac_s_car_move.c_inc @@ -1,15 +1,9 @@ static void aSCR_set_bgOffset(STRUCTURE_ACTOR* car, int offs) { - static mCoBG_OffsetTable_c height_table_ct[] = { - { 0x64, 3, 3, 0, 3, 3, 1 }, - { 0x64, 3, 3, 3, 0, 3, 1 }, - { 0x64, 0, 0, 0, 0, 0, 0 }, - { 0x64, 3, 0, 3, 3, 3, 1 }, - { 0x64, 6, 3, 3, 3, 3, 0 }, - { 0x64, 3, 3, 3, 0, 3, 1 }, - { 0x64, 0, 0, 0, 0, 0, 0 }, - { 0x64, 3, 0, 3, 3, 3, 1 }, - { 0x64, 3, 3, 3, 3, 0, 1 } - }; + static mCoBG_OffsetTable_c height_table_ct[] = { { 0x64, 3, 3, 0, 3, 3, 1 }, { 0x64, 3, 3, 3, 0, 3, 1 }, + { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 3, 0, 3, 3, 3, 1 }, + { 0x64, 6, 3, 3, 3, 3, 0 }, { 0x64, 3, 3, 3, 0, 3, 1 }, + { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 3, 0, 3, 3, 3, 1 }, + { 0x64, 3, 3, 3, 3, 0, 1 } }; static mCoBG_OffsetTable_c* height_table[] = { height_table_ct, height_table_ct }; @@ -63,7 +57,7 @@ static void aSCR_actor_move(ACTOR* actor, GAME* game) { designer_common = (mEv_dsg_common_c*)mEv_get_common_area(mEv_EVENT_DESIGNER, FALSE); if (designer_common != NULL && designer_common->button_presses >= 100) { if (car->action <= 0) { - (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_CAR_SPARKLE, actor->world.position, 1, 0, game, + (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_CAR_BLIGHT, actor->world.position, 1, 0, game, actor->npc_id, designer_common->_04 != 0, 0); car->action = (int)(fqrand() * 3.0f) * 16 + 48; } else { diff --git a/src/ac_shrine_move.c_inc b/src/ac_shrine_move.c_inc index a257e151..e25a3ad1 100644 --- a/src/ac_shrine_move.c_inc +++ b/src/ac_shrine_move.c_inc @@ -1,93 +1,88 @@ /* @unused static void aSHR_OngenTrgStart(SHRINE_ACTOR*, int?) */ static void aSHR_set_bgOffset(ACTOR* actorx, int table_idx) { - static mCoBG_OffsetTable_c height_table_ct[4][2] = { - { - { 100, 1, 1, 1, 1, 1, 0 }, // X - { 100, 1, 1, 1, 1, 1, 0 }, // Z - }, - { - { 100, 2, 2, 1, 1, 4, 0 }, - { 100, 2, 4, 1, 1, 2, 0 }, - }, - { - { 100, 11, 11, 11, 11, 11, 0 }, - { 100, 11, 11, 11, 11, 11, 0 }, - }, - { - { 100, 11, 11, 11, 11, 11, 0 }, - { 100, 11, 11, 11, 11, 11, 0 } + static mCoBG_OffsetTable_c height_table_ct[4][2] = { { + { 100, 1, 1, 1, 1, 1, 0 }, // X + { 100, 1, 1, 1, 1, 1, 0 }, // Z + }, + { + { 100, 2, 2, 1, 1, 4, 0 }, + { 100, 2, 4, 1, 1, 2, 0 }, + }, + { + { 100, 11, 11, 11, 11, 11, 0 }, + { 100, 11, 11, 11, 11, 11, 0 }, + }, + { { 100, 11, 11, 11, 11, 11, 0 }, + { 100, 11, 11, 11, 11, 11, 0 } } }; + + static mCoBG_OffsetTable_c* height_table[] = { (mCoBG_OffsetTable_c*)height_table_ct, + (mCoBG_OffsetTable_c*)height_table_ct }; + + static f32 addX[2] = { -20.0f, 20.0f }; + static f32 addZ[4] = { 20.0f, -20.0f, -60.0f, -100.0f }; + + mCoBG_OffsetTable_c* height_table_p = (mCoBG_OffsetTable_c*)height_table[table_idx]; + int i; + + for (i = 0; i < 4; i++) { + xyz_t pos; + + pos.z = actorx->home.position.z + addZ[i]; + pos.x = actorx->home.position.x + addX[0]; + mCoBG_SetPluss5PointOffset_file(pos, height_table_p[0], __FILE__, 238); + + pos.x = actorx->home.position.x + addX[1]; + mCoBG_SetPluss5PointOffset_file(pos, height_table_p[1], __FILE__, 242); + + height_table_p += 2; } - }; - - static mCoBG_OffsetTable_c* height_table[] = { - (mCoBG_OffsetTable_c*)height_table_ct, - (mCoBG_OffsetTable_c*)height_table_ct - }; - - static f32 addX[2] = { -20.0f, 20.0f }; - static f32 addZ[4] = { 20.0f, -20.0f, -60.0f, -100.0f }; - - mCoBG_OffsetTable_c* height_table_p = (mCoBG_OffsetTable_c*)height_table[table_idx]; - int i; - - for (i = 0; i < 4; i++) { - xyz_t pos; - - pos.z = actorx->home.position.z + addZ[i]; - pos.x = actorx->home.position.x + addX[0]; - mCoBG_SetPluss5PointOffset_file(pos, height_table_p[0], __FILE__, 238); - - pos.x = actorx->home.position.x + addX[1]; - mCoBG_SetPluss5PointOffset_file(pos, height_table_p[1], __FILE__, 242); - - height_table_p += 2; - } } static int aSHR_talk_check(ACTOR* actorx, GAME_PLAY* play) { - PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); - SHRINE_ACTOR* shrine = (SHRINE_ACTOR*)actorx; - int res = FALSE; - - if (aSHR_GET_CLIP()->hem_flag == TRUE) { - return FALSE; - } + PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play); + SHRINE_ACTOR* shrine = (SHRINE_ACTOR*)actorx; + int res = FALSE; - if (shrine->structure_class.arg2 == 0 && mDemo_Get_talk_actor() == NULL && player != NULL) { - s16 player_angle_y = search_position_angleY(&actorx->world.position, &player->actor_class.world.position); - - if (ABS(player_angle_y - actorx->shape_info.rotation.y) < DEG2SHORT_ANGLE(22.5f)) { - res = TRUE; + if (aSHR_GET_CLIP()->hem_flag == TRUE) { + return FALSE; } - } - return res; + if (shrine->structure_class.arg2 == 0 && mDemo_Get_talk_actor() == NULL && player != NULL) { + s16 player_angle_y = search_position_angleY(&actorx->world.position, &player->actor_class.world.position); + + if (ABS(player_angle_y - actorx->shape_info.rotation.y) < DEG2SHORT_ANGLE(22.5f)) { + res = TRUE; + } + } + + return res; } static void aSHR_set_talk_info(ACTOR* actorx) { - rgba_t window_color; + rgba_t window_color; - mDemo_Set_msg_num(0x1124); - mDemo_Set_camera(CAMERA2_PROCESS_NORMAL); - mDemo_Set_talk_display_name(FALSE); - mDemo_Set_ListenAble(); + mDemo_Set_msg_num(0x1124); + mDemo_Set_camera(CAMERA2_PROCESS_NORMAL); + mDemo_Set_talk_display_name(FALSE); + mDemo_Set_ListenAble(); - window_color.r = 205; - window_color.g = 80; - window_color.b = 40; - window_color.a = 255; - mDemo_Set_talk_window_color(&window_color); + window_color.r = 205; + window_color.g = 80; + window_color.b = 40; + window_color.a = 255; + mDemo_Set_talk_window_color(&window_color); } static int aSHR_ctrl_light() { - int res = FALSE; + int res = FALSE; - if (Common_Get(time.now_sec) < (6 * mTM_SECONDS_IN_HOUR) || Common_Get(time.now_sec) >= (18 * mTM_SECONDS_IN_HOUR)) { - res = TRUE; - } + if (Common_Get(time.now_sec) < (6 * mTM_SECONDS_IN_HOUR) || + Common_Get(time.now_sec) >= (18 * mTM_SECONDS_IN_HOUR)) { + res = TRUE; + } - return res; + return res; } static void aSHR_Present_move_wait_init(aSHR_Present_c*); @@ -95,307 +90,284 @@ static void aSHR_Present_move_wait(aSHR_Present_c*); static void aSHR_Present_move_walk(aSHR_Present_c*); static void aSHR_Present_ct(aSHR_Present_c* present) { - bzero(present, sizeof(aSHR_Present_c)); - aSHR_Present_move_wait_init(present); + bzero(present, sizeof(aSHR_Present_c)); + aSHR_Present_move_wait_init(present); } static void aSHR_Present_move(aSHR_Present_c* present, SHRINE_ACTOR* shrine, GAME_PLAY* play) { - (*present->move_proc)(present); + (*present->move_proc)(present); - if (present->move_proc == aSHR_Present_move_walk && present->finish_flag == FALSE) { - HANDOVERITEM_ACTOR* handOverItem = (HANDOVERITEM_ACTOR*)Actor_info_name_search(&play->actor_info, mAc_PROFILE_HANDOVERITEM, ACTOR_PART_BG); + if (present->move_proc == aSHR_Present_move_walk && present->finish_flag == FALSE) { + HANDOVERITEM_ACTOR* handOverItem = + (HANDOVERITEM_ACTOR*)Actor_info_name_search(&play->actor_info, mAc_PROFILE_HANDOVERITEM, ACTOR_PART_BG); - if (handOverItem != NULL) { - /* Move the 'handOverItem' actor's position to the location of our 'present' */ - Matrix_push(); - Matrix_translate( - shrine->structure_class.actor_class.world.position.x + present->trans.x, - shrine->structure_class.actor_class.world.position.y + present->trans.y, - shrine->structure_class.actor_class.world.position.z + present->trans.z, - 0 - ); - Matrix_scale(0.01f, 0.01f, 0.01f, 1); - Matrix_get(&handOverItem->tools_class.matrix_work); - Matrix_pull(); - handOverItem->tools_class.init_matrix = TRUE; + if (handOverItem != NULL) { + /* Move the 'handOverItem' actor's position to the location of our 'present' */ + Matrix_push(); + Matrix_translate(shrine->structure_class.actor_class.world.position.x + present->trans.x, + shrine->structure_class.actor_class.world.position.y + present->trans.y, + shrine->structure_class.actor_class.world.position.z + present->trans.z, 0); + Matrix_scale(0.01f, 0.01f, 0.01f, 1); + Matrix_get(&handOverItem->tools_class.matrix_work); + Matrix_pull(); + handOverItem->tools_class.init_matrix = TRUE; + } } - } } static void aSHR_Present_move_wait_init(aSHR_Present_c* present) { - present->move_proc = &aSHR_Present_move_wait; + present->move_proc = &aSHR_Present_move_wait; } static void aSHR_Present_move_wait(aSHR_Present_c* present) { - /* Do nothing */ + /* Do nothing */ } static const xyz_t aSHR_present_init_pos = { 2.0f, 40.0f, 10.0f }; // start -static const xyz_t aSHR_present_aim_pos = { 2.0f, 40.0f, 33.0f }; // goal +static const xyz_t aSHR_present_aim_pos = { 2.0f, 40.0f, 33.0f }; // goal static void aSHR_Present_move_walk(aSHR_Present_c* present) { - f32 move = get_percent_forAccelBrake(present->percent, 0.0f, 1.0f, 0.15f, 0.15f); - - present->percent += 0.012f; - Math3DInDivPos2(&aSHR_present_init_pos, &aSHR_present_aim_pos, &present->trans, move); + f32 move = get_percent_forAccelBrake(present->percent, 0.0f, 1.0f, 0.15f, 0.15f); - if (move >= 1.0f) { - present->finish_flag = TRUE; - } + present->percent += 0.012f; + Math3DInDivPos2(&aSHR_present_init_pos, &aSHR_present_aim_pos, &present->trans, move); + + if (move >= 1.0f) { + present->finish_flag = TRUE; + } } static void aSHR_wait(SHRINE_ACTOR* shrine, GAME_PLAY* play) { - if (mDemo_Check(mDemo_TYPE_TALK, (ACTOR*)shrine) == TRUE) { - mDemo_Set_ListenAble(); - aSHR_setup_action(shrine, play, aSHR_ACTION_TALK); - } - else if (aSHR_talk_check((ACTOR*)shrine, play)) { - mDemo_Request(mDemo_TYPE_TALK, (ACTOR*)shrine, &aSHR_set_talk_info); - } + if (mDemo_Check(mDemo_TYPE_TALK, (ACTOR*)shrine) == TRUE) { + mDemo_Set_ListenAble(); + aSHR_setup_action(shrine, play, aSHR_ACTION_TALK); + } else if (aSHR_talk_check((ACTOR*)shrine, play)) { + mDemo_Request(mDemo_TYPE_TALK, (ACTOR*)shrine, &aSHR_set_talk_info); + } } static void aSHR_talk(SHRINE_ACTOR* shrine, GAME_PLAY* play) { - static u8 choume_str[FG_BLOCK_Z_NUM + 1] = { 'Q', 'A', 'B', 'C', 'D', 'E', 'F' }; - mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); - int msg_no = 0x1128; - int action; - int condition; - int field_rank; - int bx; - int bz; - int good_field; - u8 acre_str[mIN_ITEM_NAME_LEN]; + static u8 choume_str[FG_BLOCK_Z_NUM + 1] = { 'Q', 'A', 'B', 'C', 'D', 'E', 'F' }; + mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); + int msg_no = 0x1128; + int action; + int condition; + int field_rank; + int bx; + int bz; + int good_field; + u8 acre_str[mIN_ITEM_NAME_LEN]; - if (mMsg_Check_MainNormalContinue(msg_p)) { - switch (mChoice_Get_ChoseNum(mChoice_Get_base_window_p())) { - case mChoice_CHOICE0: /* How are things? */ - { - condition = mFAs_GetFieldRank_Condition(&field_rank, &bx, &bz); - good_field = mFAs_CheckGoodField(); + if (mMsg_Check_MainNormalContinue(msg_p)) { + switch (mChoice_Get_ChoseNum(mChoice_Get_base_window_p())) { + case mChoice_CHOICE0: /* How are things? */ + { + condition = mFAs_GetFieldRank_Condition(&field_rank, &bx, &bz); + good_field = mFAs_CheckGoodField(); - if ( - field_rank == mFAs_FIELDRANK_SIX && /* Current field rank is 'perfect' */ - good_field && /* Perfect town status achieved for long enough */ - mSC_trophy_get(mSC_TROPHY_GOLDEN_AXE) == FALSE && /* Haven't already obtained the golden axe */ - mLd_PlayerManKindCheck() == FALSE && /* Must be from this town */ - mPr_GetPossessionItemIdx(Common_Get(now_private), EMPTY_NO) >= 0 && /* Must have a free inventory slot */ - mEv_CheckFirstJob() == FALSE && /* Can't be doing the part-time job */ - condition != mFAs_CONDITION_DUST_OVER /* No trash */ - ) { - msg_no = 0x2C50; - action = aSHR_ACTION_MAKE_HEM; - } - else if (condition != mFAs_CONDITION_NO_CASE) { - switch (condition) { - case mFAs_CONDITION_DUST_OVER: - msg_no = 0x2C4F; - break; - case mFAs_CONDITION_TREE_LESS: - msg_no = 0x2C45; - break; - case mFAs_CONDITION_TREE_OVER: - msg_no = 0x2C46; - break; - //case mFAs_CONDITION_GRASS_OVER: - default: - msg_no = 0x2C47; - break; - } + if (field_rank == mFAs_FIELDRANK_SIX && /* Current field rank is 'perfect' */ + good_field && /* Perfect town status achieved for long enough */ + mSC_trophy_get(mSC_TROPHY_GOLDEN_AXE) == FALSE && /* Haven't already obtained the golden axe */ + mLd_PlayerManKindCheck() == FALSE && /* Must be from this town */ + mPr_GetPossessionItemIdx(Common_Get(now_private), EMPTY_NO) >= + 0 && /* Must have a free inventory slot */ + mEv_CheckFirstJob() == FALSE && /* Can't be doing the part-time job */ + condition != mFAs_CONDITION_DUST_OVER /* No trash */ + ) { + msg_no = 0x2C50; + action = aSHR_ACTION_MAKE_HEM; + } else if (condition != mFAs_CONDITION_NO_CASE) { + switch (condition) { + case mFAs_CONDITION_DUST_OVER: + msg_no = 0x2C4F; + break; + case mFAs_CONDITION_TREE_LESS: + msg_no = 0x2C45; + break; + case mFAs_CONDITION_TREE_OVER: + msg_no = 0x2C46; + break; + // case mFAs_CONDITION_GRASS_OVER: + default: + msg_no = 0x2C47; + break; + } - mFont_UnintToString(acre_str, sizeof(acre_str), bx, sizeof(acre_str), TRUE, FALSE, TRUE); - mMsg_Set_free_str(msg_p, mMsg_FREE_STR1, acre_str, sizeof(acre_str)); - mMsg_Set_free_str(msg_p, mMsg_FREE_STR0, &choume_str[bz], 1); - action = aSHR_ACTION_TALK_END; - } - else { - msg_no = 0x2C4E - field_rank; /* Message is based on the field rank */ - action = aSHR_ACTION_TALK_END; + mFont_UnintToString(acre_str, sizeof(acre_str), bx, sizeof(acre_str), TRUE, FALSE, TRUE); + mMsg_Set_free_str(msg_p, mMsg_FREE_STR1, acre_str, sizeof(acre_str)); + mMsg_Set_free_str(msg_p, mMsg_FREE_STR0, &choume_str[bz], 1); + action = aSHR_ACTION_TALK_END; + } else { + msg_no = 0x2C4E - field_rank; /* Message is based on the field rank */ + action = aSHR_ACTION_TALK_END; + } + + mMsg_Set_continue_msg_num(msg_p, msg_no); + break; + } + + case mChoice_CHOICE1: /* Apologize */ + { + if (mSM_check_open_inventory_itemlist(mSM_IV_OPEN_SHRINE, 0)) { + shrine->structure_class.arg0 = 0; + action = aSHR_ACTION_TALK_GOMEN; + } else { + msg_no = 0x1127; + action = aSHR_ACTION_TALK_END; + } + + mMsg_Set_continue_msg_num(msg_p, msg_no); + break; + } + + default: /* 'What's this?', 'Nothing...' */ + { + action = aSHR_ACTION_TALK_END; + break; + } } - mMsg_Set_continue_msg_num(msg_p, msg_no); - break; - } - - case mChoice_CHOICE1: /* Apologize */ - { - if (mSM_check_open_inventory_itemlist(mSM_IV_OPEN_SHRINE, 0)) { - shrine->structure_class.arg0 = 0; - action = aSHR_ACTION_TALK_GOMEN; + if (action != -1) { + aSHR_setup_action(shrine, play, action); } - else { - msg_no = 0x1127; - action = aSHR_ACTION_TALK_END; - } - - mMsg_Set_continue_msg_num(msg_p, msg_no); - break; - } - - default: /* 'What's this?', 'Nothing...' */ - { - action = aSHR_ACTION_TALK_END; - break; - } } - - if (action != -1) { - aSHR_setup_action(shrine, play, action); - } - } } static void aSHR_talk_gomen(SHRINE_ACTOR* shrine, GAME_PLAY* play) { - mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); - Submenu* submenu = &play->submenu; - int msg_no = -1; + mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); + Submenu* submenu = &play->submenu; + int msg_no = -1; - /* TODO: enums for whatever this is */ - switch (shrine->structure_class.arg0) { - //default: - - case 0: - { - if (mMsg_Check_MainNormalContinue(msg_p) == TRUE) { - mMsg_request_main_disappear_wait_type1(msg_p); - shrine->structure_class.arg0 = 1; - } - return; + /* TODO: enums for whatever this is */ + switch (shrine->structure_class.arg0) { + // default: + + case 0: { + if (mMsg_Check_MainNormalContinue(msg_p) == TRUE) { + mMsg_request_main_disappear_wait_type1(msg_p); + shrine->structure_class.arg0 = 1; + } + return; + } + + case 1: { + if (mMsg_Check_main_wait(msg_p) == TRUE) { + mSM_open_submenu(submenu, mSM_OVL_INVENTORY, mSM_IV_OPEN_SHRINE, 0); + shrine->structure_class.arg0 = 2; + } + return; + } + + case 2: { + u8 item_name[mIN_ITEM_NAME_LEN]; + Submenu_Item_c* sm_item; + if (submenu->open_flag) { + return; + } + + sm_item = submenu->item_p; + if (sm_item->item == EMPTY_NO) { + mMsg_request_main_forceoff(); + } else if (mQst_CheckNpcExistbyItemIdx(sm_item->slot_no, mQst_CHECK_NPC_RECEIPIENT)) { + msg_no = 0x1129; + } else if (mQst_CheckNpcExistbyItemIdx(sm_item->slot_no, mQst_CHECK_NPC_SENDER)) { + msg_no = 0x112A; + } else if (mQst_CheckFirstJobQuestbyItemIdx(sm_item->slot_no)) { + msg_no = 0x112A; + } else { + mIN_copy_name_str(item_name, sm_item->item); + mMsg_Set_free_str_art(msg_p, mMsg_FREE_STR0, item_name, mIN_ITEM_NAME_LEN, + mIN_get_item_article(sm_item->item)); + msg_no = 0x112B; + mQst_ClearQuestbyPossessionIdx(sm_item->slot_no); + mPr_SetPossessionItem(Common_Get(now_private), sm_item->slot_no, EMPTY_NO, mPr_ITEM_COND_NORMAL); + } + + if (msg_no != -1) { + mMsg_Set_ForceNext(msg_p); + mMsg_request_main_appear_wait_type1(msg_p); + mMsg_Set_continue_msg_num(msg_p, msg_no); + } + + aSHR_setup_action(shrine, play, aSHR_ACTION_TALK_END); + shrine->structure_class.arg0 = 0; + break; + } } - - case 1: - { - if (mMsg_Check_main_wait(msg_p) == TRUE) { - mSM_open_submenu(submenu, mSM_OVL_INVENTORY, mSM_IV_OPEN_SHRINE, 0); - shrine->structure_class.arg0 = 2; - } - return; - } - - case 2: - { - u8 item_name[mIN_ITEM_NAME_LEN]; - Submenu_Item_c* sm_item; - if (submenu->open_flag) { - return; - } - - sm_item = submenu->item_p; - if (sm_item->item == EMPTY_NO) { - mMsg_request_main_forceoff(); - } - else if (mQst_CheckNpcExistbyItemIdx(sm_item->slot_no, mQst_CHECK_NPC_RECEIPIENT)) { - msg_no = 0x1129; - } - else if (mQst_CheckNpcExistbyItemIdx(sm_item->slot_no, mQst_CHECK_NPC_SENDER)) { - msg_no = 0x112A; - } - else if (mQst_CheckFirstJobQuestbyItemIdx(sm_item->slot_no)) { - msg_no = 0x112A; - } - else { - mIN_copy_name_str(item_name, sm_item->item); - mMsg_Set_free_str_art(msg_p, mMsg_FREE_STR0, item_name, mIN_ITEM_NAME_LEN, mIN_get_item_article(sm_item->item)); - msg_no = 0x112B; - mQst_ClearQuestbyPossessionIdx(sm_item->slot_no); - mPr_SetPossessionItem(Common_Get(now_private), sm_item->slot_no, EMPTY_NO, mPr_ITEM_COND_NORMAL); - } - - if (msg_no != -1) { - mMsg_Set_ForceNext(msg_p); - mMsg_request_main_appear_wait_type1(msg_p); - mMsg_Set_continue_msg_num(msg_p, msg_no); - } - - aSHR_setup_action(shrine, play, aSHR_ACTION_TALK_END); - shrine->structure_class.arg0 = 0; - break; - } - } } static void aSHR_make_hem_init(SHRINE_ACTOR* shrine) { - mDemo_Set_talk_return_demo_wait(TRUE); - mPlib_Set_able_force_speak_label((ACTOR*)shrine); + mDemo_Set_talk_return_demo_wait(TRUE); + mPlib_Set_able_force_speak_label((ACTOR*)shrine); } static void aSHR_make_hem(SHRINE_ACTOR* shrine, GAME_PLAY* play) { - if (shrine->structure_class.actor_class.parent_actor == NULL) { - if ( - mMsg_Check_MainDisappear(mMsg_Get_base_window_p()) && - Common_Get(clip).npc_clip != NULL && - Common_Get(clip).npc_clip->setupActor_proc != NULL - ) { - int made_hem = (*Common_Get(clip).npc_clip->setupActor_proc)(play, SP_NPC_HEM, -1, -1, -1, shrine->structure_class.actor_class.block_x, shrine->structure_class.actor_class.block_z, 7, 8); + if (shrine->structure_class.actor_class.parent_actor == NULL) { + if (mMsg_Check_MainDisappear(mMsg_Get_base_window_p()) && Common_Get(clip).npc_clip != NULL && + Common_Get(clip).npc_clip->setupActor_proc != NULL) { + int made_hem = (*Common_Get(clip).npc_clip->setupActor_proc)( + play, SP_NPC_HEM, -1, -1, -1, shrine->structure_class.actor_class.block_x, + shrine->structure_class.actor_class.block_z, 7, 8); - if (made_hem == TRUE) { - ACTOR* hem_actor = Actor_info_fgName_search(&play->actor_info, SP_NPC_HEM, ACTOR_PART_NPC); + if (made_hem == TRUE) { + ACTOR* hem_actor = Actor_info_fgName_search(&play->actor_info, SP_NPC_HEM, ACTOR_PART_NPC); - if (hem_actor != NULL) { - xyz_t pos = shrine->structure_class.actor_class.world.position; - - hem_actor->parent_actor = (ACTOR*)shrine; - aSHR_GET_CLIP()->hem_flag = TRUE; - Common_Set(hem_visible, FALSE); - pos.z += mFI_UT_WORLDSIZE_Z_F; - (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_HEM_LIGHT, pos, 2, 0, (GAME*)play, 0xFFFF, 1, 0); - mSC_trophy_set(mSC_TROPHY_GOLDEN_AXE); - mFAs_ClearGoodField(); /* Only one player can get it at a time */ - aSHR_setup_action(shrine, play, aSHR_ACTION_TALK_END); + if (hem_actor != NULL) { + xyz_t pos = shrine->structure_class.actor_class.world.position; - if (mPlib_Check_able_force_speak_label((GAME*)play, (ACTOR*)shrine)) { - mPlib_Set_able_force_speak_label(hem_actor); - } + hem_actor->parent_actor = (ACTOR*)shrine; + aSHR_GET_CLIP()->hem_flag = TRUE; + Common_Set(hem_visible, FALSE); + pos.z += mFI_UT_WORLDSIZE_Z_F; + (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_MAKE_HEM, pos, 2, 0, (GAME*)play, + 0xFFFF, 1, 0); + mSC_trophy_set(mSC_TROPHY_GOLDEN_AXE); + mFAs_ClearGoodField(); /* Only one player can get it at a time */ + aSHR_setup_action(shrine, play, aSHR_ACTION_TALK_END); + + if (mPlib_Check_able_force_speak_label((GAME*)play, (ACTOR*)shrine)) { + mPlib_Set_able_force_speak_label(hem_actor); + } + } + } } - } } - } } static void aSHR_talk_end(SHRINE_ACTOR* shrine, GAME_PLAY* play) { - if (mDemo_Check(mDemo_TYPE_TALK, (ACTOR*)shrine) == FALSE) { - aSHR_setup_action(shrine, play, aSHR_ACTION_WAIT); - } + if (mDemo_Check(mDemo_TYPE_TALK, (ACTOR*)shrine) == FALSE) { + aSHR_setup_action(shrine, play, aSHR_ACTION_WAIT); + } } typedef void (*aSHR_PROC)(SHRINE_ACTOR*, GAME_PLAY*); typedef void (*aSHR_INIT_PROC)(SHRINE_ACTOR*); static void aSHR_setup_action(SHRINE_ACTOR* shrine, GAME_PLAY* play, int action) { - static aSHR_INIT_PROC init_proc[aSHR_ACTION_NUM] = { - NULL, - NULL, - NULL, - &aSHR_make_hem_init, - NULL - }; + static aSHR_INIT_PROC init_proc[aSHR_ACTION_NUM] = { NULL, NULL, NULL, &aSHR_make_hem_init, NULL }; - static aSHR_PROC process[aSHR_ACTION_NUM] = { - &aSHR_wait, - &aSHR_talk, - &aSHR_talk_gomen, - &aSHR_make_hem, - &aSHR_talk_end - }; + static aSHR_PROC process[aSHR_ACTION_NUM] = { &aSHR_wait, &aSHR_talk, &aSHR_talk_gomen, &aSHR_make_hem, + &aSHR_talk_end }; - if (init_proc[action] != NULL) { - (*init_proc[action])(shrine); - } + if (init_proc[action] != NULL) { + (*init_proc[action])(shrine); + } - shrine->structure_class.action_proc = (aSTR_MOVE_PROC)process[action]; - shrine->structure_class.action = action; + shrine->structure_class.action_proc = (aSTR_MOVE_PROC)process[action]; + shrine->structure_class.action = action; } static void aSHR_actor_move(ACTOR* actorx, GAME* game) { - GAME_PLAY* play = (GAME_PLAY*)game; - SHRINE_ACTOR* shrine = (SHRINE_ACTOR*)actorx; + GAME_PLAY* play = (GAME_PLAY*)game; + SHRINE_ACTOR* shrine = (SHRINE_ACTOR*)actorx; - (*(aSHR_PROC)shrine->structure_class.action_proc)(shrine, play); - aSHR_Present_move(&aSHR_present, shrine, play); - sAdo_OngenPos((u32)actorx, 0x5A, &actorx->world.position); + (*(aSHR_PROC)shrine->structure_class.action_proc)(shrine, play); + aSHR_Present_move(&aSHR_present, shrine, play); + sAdo_OngenPos((u32)actorx, 0x5A, &actorx->world.position); } static void aSHR_actor_init(ACTOR* actorx, GAME* game) { - mFI_SetFG_common(DUMMY_SHRINE, actorx->home.position, FALSE); - aSHR_actor_move(actorx, game); - actorx->mv_proc = &aSHR_actor_move; + mFI_SetFG_common(DUMMY_SHRINE, actorx->home.position, FALSE); + aSHR_actor_move(actorx, game); + actorx->mv_proc = &aSHR_actor_move; } diff --git a/src/f_furniture.c b/src/f_furniture.c index 89cd5e98..48b179af 100644 --- a/src/f_furniture.c +++ b/src/f_furniture.c @@ -4,6 +4,7 @@ #include "m_rcp.h" #include "m_play.h" #include "m_common_data.h" +#include "audio.h" static u16 fFTR_myhome_off_pal_table[][16] = { // clang-format off @@ -126,6 +127,7 @@ static Gfx* fFTR_GetTwoTileGfx(int width0, int height0, int scroll_x0, int scrol */ #include "../src/ftr/ac_famicom_common.c" +#include "../src/ftr/ac_tak_stew.c" // #include "../src/ftr/ac_sum_hal_chest02.c" // #include "../src/ftr/ac_sum_clchest03.c" @@ -816,4 +818,3 @@ static Gfx* fFTR_GetTwoTileGfx(int width0, int height0, int scroll_x0, int scrol // #include "../src/ftr/ac_nog_cornucopia.c" // #include "../src/ftr/ac_nog_gong.c" // #include "../src/ftr/ac_tak_noise.c" -// #include "../src/ftr/ac_tak_stew.c" diff --git a/src/ftr/ac_tak_stew.c b/src/ftr/ac_tak_stew.c index fb379c27..8ddcf6fa 100644 --- a/src/ftr/ac_tak_stew.c +++ b/src/ftr/ac_tak_stew.c @@ -1,17 +1,66 @@ -static void fTSW_ct(FTR_ACTOR* ftr_actor, u8* data); -static void fTSW_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fTSW_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data); -static void fTSW_dt(FTR_ACTOR* ftr_actor, u8* data); +static void fTSW_ct(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} + +static void fTSW_mv(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + + if (ftr_actor->state != aFTR_STATE_BIRTH && ftr_actor->state != aFTR_STATE_BYE && + ftr_actor->state != aFTR_STATE_DEATH && ftr_actor->state != aFTR_STATE_BIRTH_WAIT) { + u32 frame = play->game_frame; + + sAdo_OngenPos((u32)ftr_actor, 0x54, &ftr_actor->position); + + if ((frame & 7) == 0) { + xyz_t effect_pos = ftr_actor->position; + + effect_pos.y += 15.0f; + (*Common_Get(clip).effect_clip->effect_make_proc)(eEC_EFFECT_SOBA_YUGE, effect_pos, 1, 0, game, RSV_NO, 10, + 0); + } + } +} + +static void fTSW_dt(FTR_ACTOR* ftr_actor, u8* data) { + // nothing +} + +extern u8 int_tak_stew_a1_tex[]; +extern u8 int_tak_stew_a2_tex_rgb_ci4[]; + +static u8* fTSW_texture_table[] = { int_tak_stew_a1_tex, int_tak_stew_a2_tex_rgb_ci4 }; + +extern Gfx int_tak_stew_nabe_on_model[]; +extern Gfx int_tak_stew_nabe_onT_model[]; +extern Gfx int_tak_stew_a1T_model[]; + +static void fTSW_dw(FTR_ACTOR* ftr_actor, ACTOR* my_room_actor, GAME* game, u8* data) { + GAME_PLAY* play = (GAME_PLAY*)game; + u32 ctr_ofs; + + if (ftr_actor->ctr_type == aFTR_CTR_TYPE_GAME_PLAY) { + ctr_ofs = play->game_frame; + } else { + ctr_ofs = game->frame_counter; + } + + OPEN_DISP(game->graph); + + gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, fTSW_texture_table[(ctr_ofs / 6) & 1]); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_tak_stew_nabe_on_model); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_tak_stew_nabe_onT_model); + gSPDisplayList(NEXT_POLY_OPA_DISP, int_tak_stew_a1T_model); + + CLOSE_DISP(game->graph); +} static aFTR_vtable_c fTSW_func = { - &fTSW_ct, - &fTSW_mv, - &fTSW_dw, - &fTSW_dt, - NULL, + &fTSW_ct, &fTSW_mv, &fTSW_dw, &fTSW_dt, NULL, }; aFTR_PROFILE iam_tak_stew = { + // clang-format off NULL, NULL, NULL, @@ -29,4 +78,5 @@ aFTR_PROFILE iam_tak_stew = { 0, 0, &fTSW_func, + // clang-format on };