From 68f332edbf5b82949b45a2a3ea0208f811297650 Mon Sep 17 00:00:00 2001 From: Cuyler36 <24523422+Cuyler36@users.noreply.github.com> Date: Mon, 28 Oct 2024 02:50:45 -0400 Subject: [PATCH] Implement & link m_mscore_ovl --- config/rel_slices.yml | 5 + config/symbols.yml | 6 +- include/audio_defs.h | 20 +- include/m_bgm.h | 2 +- include/m_mscore_ovl.h | 13 + include/m_mscore_ovl_h.h | 2 + include/m_submenu_ovl.h | 3 +- src/m_mscore_ovl.c | 601 +++++++++++++++++++++++++++++++++++++++ src/m_player_sound.c_inc | 18 +- 9 files changed, 653 insertions(+), 17 deletions(-) create mode 100644 src/m_mscore_ovl.c diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 0df80d8d..43854eb3 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -1098,6 +1098,11 @@ m_map_ovl.c: .rodata: [0x8064B628, 0x8064B6B0] .data: [0x806CD9C0, 0x806CE008] .bss: [0x81340468, 0x81340488] +m_mscore_ovl.c: + .text: [0x805E7A54, 0x805E8CF8] + .rodata: [0x8064B6B0, 0x8064B738] + .data: [0x806CE008, 0x806CE338] + .bss: [0x81340488, 0x813404B0] m_needlework_ovl.c: .text: [0x805E9768, 0x805EAAC0] .rodata: [0x8064B778, 0x8064B7A8] diff --git a/config/symbols.yml b/config/symbols.yml index 328d60da..1099f0f5 100644 --- a/config/symbols.yml +++ b/config/symbols.yml @@ -34376,6 +34376,8 @@ global: 0x80AF0D00: onp__x_tex_rgb_ia8 0x80AF0F00: onp__y2_tex_rgb_ia8 0x80AF1100: onp__y_tex_rgb_ia8 + 0x80AF1300: onp_hyouji_v + 0x80AF14C0: onp_win_rmoji_model 0x80AF1520: onp_win_zT_model 0x80AF1570: onp_win_mojiT_model 0x80AF15D8: onp_win_rT_model @@ -57523,8 +57525,8 @@ src/dataobject.obj: 0x80AD4C00: lat_tegami_fusen_tex 0x80AEF740: onp_hyouji_v 0x80AF1300: onp_hyouji_v - 0x80AF14C0: onp_win_rmoji_model - 0x80AF68A8: onp_win_rmoji_model + # 0x80AF14C0: onp_win_rmoji_model + 0x80AF68A8: onp_win_rmoji_model_1 0x80AF6B40: inv_mwin_nwaku_tex 0x80AFBB60: kan_hyouji_v 0x80AFC700: kan_hyouji_v diff --git a/include/audio_defs.h b/include/audio_defs.h index 5a96fd07..73f83c9f 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -52,11 +52,22 @@ typedef enum audio_sound_effects { NA_SE_DRAWER_SHUT = 0x3A, NA_SE_ITEM_GET = 0x40, + NA_SE_NOTE_G_LOW = MONO(0x42), + NA_SE_NOTE_A_LOW = MONO(0x43), + NA_SE_NOTE_B_LOW = MONO(0x44), + NA_SE_NOTE_C_LOW = MONO(0x45), + NA_SE_NOTE_D_LOW = MONO(0x46), + NA_SE_NOTE_E_LOW = MONO(0x47), + NA_SE_NOTE_F_LOW = MONO(0x48), + NA_SE_NOTE_G = MONO(0x49), + NA_SE_NOTE_A = MONO(0x4A), + NA_SE_NOTE_B = MONO(0x4B), + NA_SE_NOTE_C = MONO(0x4C), + NA_SE_NOTE_D = MONO(0x4D), + NA_SE_NOTE_E = MONO(0x4E), + NA_SE_NOTE_RANDOM = MONO(0x4F), NA_SE_47 = 0x47, - NA_SE_MONEY0 = 0x49, - NA_SE_MONEY1, - NA_SE_MONEY2, - NA_SE_COIN, + NA_SE_COIN = 0x4C, NA_SE_TEMOCHI_KAZAGURUMA, NA_SE_REGISTER = 0x50, @@ -101,6 +112,7 @@ typedef enum audio_sound_effects { NA_SE_HANABI2 = HANABI(0x111), NA_SE_HANABI3 = HANABI(0x112), NA_SE_EAT = 0x113, + NA_SE_114 = 0x114, NA_SE_11B = 0x11B, NA_SE_WEAR = 0x11C, diff --git a/include/m_bgm.h b/include/m_bgm.h index bac71a79..f69aefd0 100644 --- a/include/m_bgm.h +++ b/include/m_bgm.h @@ -12,7 +12,7 @@ extern "C" { enum { mBGM_PAUSE_0, mBGM_PAUSE_1, - mBGM_PAUSE_2, + mBGM_PAUSE_MSCORE, mBGM_PAUSE_NOTICE, mBGM_PAUSE_4, mBGM_PAUSE_STOP, diff --git a/include/m_mscore_ovl.h b/include/m_mscore_ovl.h index 7891970d..f89ad5e1 100644 --- a/include/m_mscore_ovl.h +++ b/include/m_mscore_ovl.h @@ -2,11 +2,24 @@ #define M_MSCORE_OVL_H #include "types.h" +#include "m_mscore_ovl_h.h" +#include "m_submenu.h" #ifdef __cplusplus extern "C" { #endif +struct mscore_ovl_s { + u8 melody[16]; + int cursor_idx; + int anim_frame; + int wait_timer; + s16 menu_idx; + s16 scale_dir; + f32 scale; + u8* unused_segment_p; // only used in DnM +}; + extern void mMS_mscore_ovl_construct(Submenu* submenu); extern void mMS_mscore_ovl_destruct(Submenu* submenu); extern void mMS_mscore_ovl_set_proc(Submenu* submenu); diff --git a/include/m_mscore_ovl_h.h b/include/m_mscore_ovl_h.h index f39bc8e8..466ffbd1 100644 --- a/include/m_mscore_ovl_h.h +++ b/include/m_mscore_ovl_h.h @@ -7,6 +7,8 @@ extern "C" { #endif +typedef struct mscore_ovl_s mMS_Ovl_c; + #ifdef __cplusplus } #endif diff --git a/include/m_submenu_ovl.h b/include/m_submenu_ovl.h index 4bf0053b..4571d02b 100644 --- a/include/m_submenu_ovl.h +++ b/include/m_submenu_ovl.h @@ -37,6 +37,7 @@ #include "m_gba_ovl_h.h" #include "m_cpedit_ovl_h.h" #include "m_cpwarning_ovl_h.h" +#include "m_mscore_ovl_h.h" #ifdef __cplusplus extern "C" { @@ -187,7 +188,7 @@ struct submenu_overlay_s { /* 0x9A4 */ mEE_Ovl_c* editEndChk_ovl; /* 0x9A8 */ mWR_Ovl_c* warning_ovl; /* 0x9AC */ mRP_Ovl_c* repay_ovl; - /* 0x9B0 */ void* _9B0; + /* 0x9B0 */ mMS_Ovl_c* mscore_ovl; /* 0x9B4 */ mMP_Overlay_c* map_ovl; /* 0x9B8 */ mNT_Ovl_c* notice_ovl; /* 0x9BC */ mBR_Ovl_c* birthday_ovl; diff --git a/src/m_mscore_ovl.c b/src/m_mscore_ovl.c new file mode 100644 index 00000000..a4b649e8 --- /dev/null +++ b/src/m_mscore_ovl.c @@ -0,0 +1,601 @@ +#include "m_mscore_ovl.h" + +#include "m_submenu_ovl.h" +#include "audio.h" +#include "m_common_data.h" +#include "m_editEndChk_ovl.h" +#include "m_melody.h" +#include "sys_matrix.h" +#include "m_font.h" +#include "m_bgm.h" + +static mMS_Ovl_c mscore_ovl_data; + +enum { + mMS_SCALE_IN, + mMS_SCALE_OUT, + mMS_SCALE_WAIT, + + mMS_SCALE_NUM +}; + +enum { + mMS_FRAME_NORMAL, + mMS_FRAME_REST, + mMS_FRAME_OFF, + mMS_FRAME_RANDOM, + mMS_FRAME_END, + + mMS_FRAME_NUM +}; + +typedef struct { + u8* tex[2]; + Gfx* model; + f32 offset[2]; +} mMS_note_frame_c; + +extern u8 onp_win_q_tex_rgb_i4[]; +extern u8 onp_win_a_tex_rgb_i4[]; +extern u8 onp_win_b_tex_rgb_i4[]; +extern u8 onp_win_c_tex_rgb_i4[]; +extern u8 onp_win_d_tex_rgb_i4[]; +extern u8 onp_win_e_tex_rgb_i4[]; +extern u8 onp_win_f_tex_rgb_i4[]; +extern u8 onp_win_g_tex_rgb_i4[]; + +extern u8 onp_win_bou1_tex[]; +extern u8 onp_win_shimari_tex_rgb_ia8[]; +extern u8 onp_win_onpu8_tex_rgb_i4[]; +extern u8 onp_win_z_tex_rgb_i4[]; + +extern u8 onp_win_test1_tex_rgb_ia8[]; +extern u8 onp_win_test2_tex_rgb_ia8[]; +extern u8 onp_win_test3_tex_rgb_ia8[]; +extern u8 onp_win_test5_tex_rgb_ia8[]; +extern u8 onp_win_test10_tex_rgb_ia8[]; +extern u8 onp_win_test11_tex_rgb_ia8[]; +extern u8 onp_win_shimari_tex_rgb_ia8[]; + +extern Gfx onp_hyouji_waku1T_model[]; +extern Gfx onp_hyouji_waku2T_model[]; +extern Gfx onp_hyouji_waku3T_model[]; +extern Gfx onp_hyouji_waku4T_model[]; +extern Gfx onp_hyouji_bouT_model[]; +extern Gfx onp_hyouji_moji1T_model[]; +extern Gfx onp_hyouji_waku_mode[]; +extern Gfx onp_hyouji_moji_mode[]; + +// clang-format off +static mMS_note_frame_c note_frame[] = { + { + { onp_win_test1_tex_rgb_ia8, onp_win_test2_tex_rgb_ia8 }, + onp_hyouji_waku1T_model, + { 0.0f, 0.0f } + }, + { + { onp_win_test2_tex_rgb_ia8, onp_win_test3_tex_rgb_ia8 }, + onp_hyouji_waku2T_model, + { -1.0f, 20.0f } + }, + { + { onp_win_test5_tex_rgb_ia8, onp_win_shimari_tex_rgb_ia8 }, + onp_hyouji_waku3T_model, + { 1.0f, 1.0f } + }, + { + { onp_win_test10_tex_rgb_ia8, onp_win_test11_tex_rgb_ia8 }, + onp_hyouji_waku4T_model, + { -1.0f, 5.0f } + }, +}; +// clang-format on + +typedef struct { + mMS_note_frame_c* frame; + u8* tex; + f32 ofs_y; + int prim_color[3]; + int env_color[3]; +} mMS_note_moji_c; + +// clang-format onff +static mMS_note_moji_c note_moji[] = { + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_g_tex_rgb_i4, -29.0f, { 0, 10, 0 }, { 70, 155, 255 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_a_tex_rgb_i4, -29.0f, { 0, 10, 0 }, { 0, 200, 205 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_b_tex_rgb_i4, -29.0f, { 0, 20, 0 }, { 0, 225, 150 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_c_tex_rgb_i4, -23.0f, { 0, 40, 0 }, { 20, 235, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_d_tex_rgb_i4, -23.0f, { 0, 40, 0 }, { 90, 245, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_e_tex_rgb_i4, -23.0f, { 0, 40, 0 }, { 130, 255, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_f_tex_rgb_i4, -23.0f, { 0, 50, 0 }, { 155, 255, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_g_tex_rgb_i4, -23.0f, { 0, 50, 0 }, { 175, 255, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_a_tex_rgb_i4, -23.0f, { 0, 60, 0 }, { 195, 255, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_b_tex_rgb_i4, -23.0f, { 0, 60, 0 }, { 225, 255, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_c_tex_rgb_i4, -16.0f, { 0, 60, 0 }, { 255, 235, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_d_tex_rgb_i4, -16.0f, { 0, 60, 0 }, { 255, 215, 0 } }, + { ¬e_frame[mMS_FRAME_NORMAL], onp_win_e_tex_rgb_i4, -16.0f, { 0, 70, 0 }, { 255, 175, 0 } }, + { ¬e_frame[mMS_FRAME_RANDOM], onp_win_q_tex_rgb_i4, -20.0f, { 70, 60, 30 }, { 255, 110, 110 } }, + { ¬e_frame[mMS_FRAME_REST], onp_win_z_tex_rgb_i4, -29.0f, { 10, 10, 0 }, { 165, 100, 255 } }, + { ¬e_frame[mMS_FRAME_OFF], onp_win_onpu8_tex_rgb_i4, -29.0f, { 60, 0, 60 }, { 255, 50, 255 } }, +}; +// clang-format on + +static u8 mMS_str_title[13] = "Are you sure?"; +static u8 mMS_str_ok[3] = "Yes"; +static u8 mMS_str_cancel[2] = "No"; + +static void mMS_move_Move(Submenu* submenu, mSM_MenuInfo_c* menu_info) { + submenu->overlay->move_Move_proc(submenu, menu_info); +} + +static void mMS_move_Play(Submenu* submenu, mSM_MenuInfo_c* menu_info) { + static u16 single_se[] = { + NA_SE_NOTE_G_LOW, + NA_SE_NOTE_A_LOW, + NA_SE_NOTE_B_LOW, + NA_SE_NOTE_C_LOW, + NA_SE_NOTE_D_LOW, + NA_SE_NOTE_E_LOW, + NA_SE_NOTE_F_LOW, + NA_SE_NOTE_G, + NA_SE_NOTE_A, + NA_SE_NOTE_B, + NA_SE_NOTE_C, + NA_SE_NOTE_D, + NA_SE_NOTE_E, + NA_SE_NOTE_RANDOM, + 0, // hold + 0, // off + }; + int note_idx; + mMS_Ovl_c* mscore_ovl = submenu->overlay->mscore_ovl; + u32 trigger; + u8* note_p; + + if (submenu->current_menu_type != mSM_OVL_MSCORE) { + return; + } + + if (mscore_ovl->wait_timer > 0) { + mscore_ovl->wait_timer--; + + if (mscore_ovl->wait_timer == 1) { + sAdo_Inst(0, mscore_ovl->melody); + } + + return; + } + + if (sAdo_InstCountGet() >= 0) { + return; + } + + trigger = submenu->overlay->menu_control.trigger; + if (mscore_ovl->cursor_idx == -1) { + mscore_ovl->cursor_idx = 0; + } + + note_idx = mscore_ovl->cursor_idx; + if (note_idx < 16) { + note_p = &mscore_ovl->melody[note_idx]; + } else { + note_p = NULL; + } + + if ((trigger & BUTTON_X) != 0) { + sAdo_Inst(0, mscore_ovl->melody); + } else if ((trigger & BUTTON_Y) != 0) { + menu_info->proc_status = mSM_OVL_PROC_OBEY; + mscore_ovl->menu_idx = 0; + mscore_ovl->scale = 0.0f; + mscore_ovl->scale_dir = mMS_SCALE_IN; + sAdo_SysTrgStart(NA_SE_33); + } else if ((trigger & BUTTON_R) != 0) { + submenu->overlay->move_chg_base_proc(menu_info, mSM_MOVE_OUT_TOP); + submenu->after_mode = aHOI_REQUEST_NUM; + sAdo_SysTrgStart(NA_SE_MENU_EXIT); + } else if ((trigger & BUTTON_START) != 0 || (note_idx == 16 && (trigger & BUTTON_A) != 0)) { + mSM_open_submenu(submenu, mSM_OVL_EDITENDCHK, mEE_TYPE_MSCORE, 0); + menu_info->proc_status = mSM_OVL_PROC_WAIT; + mscore_ovl->anim_frame = 0; + sAdo_SysTrgStart(NA_SE_MENU_EXIT); + } else if ((trigger & (BUTTON_A | BUTTON_CRIGHT)) != 0) { + if (note_idx != 16) { + mscore_ovl->cursor_idx++; + } + } else if ((trigger & (BUTTON_B | BUTTON_CLEFT)) != 0) { + if (note_idx != 0) { + mscore_ovl->cursor_idx--; + } + } else if (note_idx != 16) { + if ((trigger & BUTTON_CDOWN) != 0) { + if (*note_p != 14) { + if (*note_p == 0) { + *note_p = 15; + } else { + (*note_p)--; + sAdo_SysTrgStart(single_se[*note_p]); + } + } + } else if ((trigger & BUTTON_CUP)) { + if (*note_p != 13) { + if (*note_p == 15) { + *note_p = 0; + } else { + (*note_p)++; + } + + if (*note_p != 14 && *note_p != 15) { + sAdo_SysTrgStart(single_se[*note_p]); + } + } + } + } + + if (note_idx != mscore_ovl->cursor_idx) { + mscore_ovl->anim_frame = 0; + if (mscore_ovl->cursor_idx != 16) { + u8 note = mscore_ovl->melody[mscore_ovl->cursor_idx]; + + if (note != 14 && note != 15) { + sAdo_SysTrgStart(single_se[note]); + } + } else { + sAdo_SysTrgStart(NA_SE_CURSOL); + } + } else { + mscore_ovl->anim_frame = (mscore_ovl->anim_frame + 1) % 18; + } +} + +static void mMS_move_Wait(Submenu* submenu, mSM_MenuInfo_c* menu_info) { + mMS_Ovl_c* mscore_ovl = submenu->overlay->mscore_ovl; + mSM_MenuInfo_c* edit_end_menu = &submenu->overlay->menu_info[mSM_OVL_EDITENDCHK]; + + if (edit_end_menu->proc_status == mSM_OVL_PROC_MOVE && edit_end_menu->next_proc_status == mSM_OVL_PROC_END) { + if (edit_end_menu->data1 == 0) { + mMld_SetSaveMelody(mscore_ovl->melody); + submenu->overlay->move_chg_base_proc(menu_info, mSM_MOVE_OUT_TOP); + } else if (edit_end_menu->data1 == 1) { + mscore_ovl->anim_frame = 0; + mscore_ovl->cursor_idx = 0; + menu_info->proc_status = mSM_OVL_PROC_PLAY; + } else { + mMld_SetSaveMelody((u8*)menu_info->data3); + submenu->overlay->move_chg_base_proc(menu_info, mSM_MOVE_OUT_TOP); + } + } +} + +static void mMS_move_Obey(Submenu* submenu, mSM_MenuInfo_c* menu_info) { + mMS_Ovl_c* mscore_ovl = submenu->overlay->mscore_ovl; + u32 trigger = submenu->overlay->menu_control.trigger; + + if (mscore_ovl->scale_dir == mMS_SCALE_IN) { + mscore_ovl->scale += 0.25f; + if (mscore_ovl->scale >= 1.0f) { + mscore_ovl->scale = 1.0f; + mscore_ovl->scale_dir = mMS_SCALE_WAIT; + } + } else if (mscore_ovl->scale_dir == mMS_SCALE_OUT) { + mscore_ovl->scale -= 0.25f; + if (mscore_ovl->scale < 0.0f) { + mscore_ovl->scale = 0.0f; + menu_info->proc_status = mSM_OVL_PROC_PLAY; + } + } else { + if ((trigger & BUTTON_A) != 0) { + if (mscore_ovl->menu_idx == 0) { + int i; + + for (i = 0; i < 16; i++) { + mscore_ovl->melody[i] = 14; + } + + sAdo_SysTrgStart(NA_SE_114); + } else { + sAdo_SysTrgStart(MONO(NA_SE_3)); + } + + mscore_ovl->scale_dir = mMS_SCALE_OUT; + } else if ((trigger & BUTTON_B) != 0) { + sAdo_SysTrgStart(MONO(NA_SE_3)); + mscore_ovl->scale_dir = mMS_SCALE_OUT; + } else if ((trigger & BUTTON_CDOWN) != 0) { + if (mscore_ovl->menu_idx == 0) { + mscore_ovl->menu_idx = 1; + sAdo_SysTrgStart(NA_SE_CURSOL); + } + } else if ((trigger & BUTTON_CUP) != 0) { + if (mscore_ovl->menu_idx == 1) { + mscore_ovl->menu_idx = 0; + sAdo_SysTrgStart(NA_SE_CURSOL); + } + } + } + + mscore_ovl->anim_frame = (mscore_ovl->anim_frame + 1) % 18; +} + +static void mMS_move_End(Submenu* submenu, mSM_MenuInfo_c* menu_info) { + submenu->overlay->move_End_proc(submenu, menu_info); +} +typedef void (*mMS_OVL_PROC)(Submenu*, mSM_MenuInfo_c*); + +static void mMS_mscore_ovl_move(Submenu* submenu) { + static mMS_OVL_PROC ovl_move_proc[] = { + &mMS_move_Move, &mMS_move_Play, &mMS_move_Wait, &mMS_move_Obey, &mMS_move_End, + }; + + mSM_Control_c* control = &submenu->overlay->menu_control; + mSM_MenuInfo_c* menu_info = &submenu->overlay->menu_info[mSM_OVL_MSCORE]; + + menu_info->pre_move_func(submenu); + (*ovl_move_proc[menu_info->proc_status])(submenu, menu_info); +} + +static void mMS_MScore_draw_init(mSM_MenuInfo_c* menu_info) { + // empty +} + +extern u8 start2_tex_rgb_ia8[]; +extern u8 start_tex_rgb_ia8[]; +extern u8 onp__x2_tex_rgb_ia8[]; +extern u8 onp__x_tex_rgb_ia8[]; +extern u8 onp__y2_tex_rgb_ia8[]; +extern u8 onp__y_tex_rgb_ia8[]; +extern u8 onp_win_rbutton2_tex_rgb_ia8[]; +extern u8 onp_win_rbutton_tex_rgb_ia8[]; + +extern Gfx onp_win_model[]; +extern Gfx onp_win_mojiT_model[]; +extern Gfx onp_win_zT_model[]; +extern Gfx onp_win_rT_model[]; +extern Gfx onp_win_sT_model[]; +extern Gfx onp_win_rmoji_model[]; +extern Gfx onp_win_owariT_model[]; + +extern Gfx sen_item2_DL_mode[]; +extern Gfx sen_win_wakuT_model[]; +extern Gfx sen_win_cursor_model[]; + +static void mMS_set_dl(Submenu* submenu, mSM_MenuInfo_c* menu_info, GAME* game) { + static rgb_t color_data[] = { { 255, 0, 0 }, { 0, 0, 255 } }; + static rgb_t sel_str_color_data[] = { { 140, 160, 205 }, { 70, 70, 225 } }; + static u8* mMS_start_button_tex_tbl[] = { start_tex_rgb_ia8, start2_tex_rgb_ia8 }; + static u8* mMS_y_button_tex_tbl[] = { onp__y_tex_rgb_ia8, onp__y2_tex_rgb_ia8 }; + static u8* mMS_x_button_tex_tbl[] = { onp__x_tex_rgb_ia8, onp__x2_tex_rgb_ia8 }; + static u8* mMS_r_button_tex_tbl[] = { onp_win_rbutton_tex_rgb_ia8, onp_win_rbutton2_tex_rgb_ia8 }; + GRAPH* graph; + mMS_note_moji_c* note_moji_p; + rgb_t* color_p; + f32 base_x; + f32 base_y; + f32 scale; + f32 stick_x; + f32 stick_y; + int i; + int inst_count; + int play_idx; + int cursor_idx; + int button_flag; + mMS_Ovl_c* mscore_ovl; + f32 pos_x; + f32 pos_y; + f32 anm_scale; + f32 text_scale; + int idx; + + graph = game->graph; + mscore_ovl = submenu->overlay->mscore_ovl; + pos_x = menu_info->position[0]; + pos_y = menu_info->position[1]; + anm_scale = mscore_ovl->scale; + inst_count = sAdo_InstCountGet(); + + Matrix_scale(16.0f, 16.0f, 1.0f, 0); + Matrix_translate(pos_x, pos_y, 1.0f, 1); + + OPEN_POLY_OPA_DISP(graph); + + button_flag = (menu_info->proc_status == mSM_OVL_PROC_PLAY || menu_info->proc_status == mSM_OVL_PROC_OBEY || + (menu_info->proc_status == mSM_OVL_PROC_WAIT && + submenu->overlay->menu_info[mSM_OVL_EDITENDCHK].proc_status == mSM_OVL_PROC_MOVE)); + gSPSegment(POLY_OPA_DISP++, ANIME_1_TXT_SEG, mMS_x_button_tex_tbl[button_flag & ((getButton() & BUTTON_X) != 0)]); + gSPSegment(POLY_OPA_DISP++, ANIME_2_TXT_SEG, mMS_y_button_tex_tbl[button_flag & ((getButton() & BUTTON_Y) != 0)]); + gSPSegment(POLY_OPA_DISP++, ANIME_4_TXT_SEG, mMS_r_button_tex_tbl[button_flag & ((getButton() & BUTTON_R) != 0)]); + idx = button_flag & ((getButton() & BUTTON_START) != 0); + gSPSegment(POLY_OPA_DISP++, ANIME_3_TXT_SEG, mMS_start_button_tex_tbl[idx]); + + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, onp_win_model); + gSPDisplayList(POLY_OPA_DISP++, onp_win_mojiT_model); + gSPDisplayList(POLY_OPA_DISP++, onp_win_zT_model); + gSPDisplayList(POLY_OPA_DISP++, onp_win_rT_model); + gSPDisplayList(POLY_OPA_DISP++, onp_win_sT_model); + gSPDisplayList(POLY_OPA_DISP++, onp_win_rmoji_model); + + color_p = (mscore_ovl->cursor_idx == 16) ? &color_data[0] : &color_data[1]; + gDPSetPrimColor(POLY_OPA_DISP++, 0, 255, color_p->r, color_p->g, color_p->b, 255); + gSPDisplayList(POLY_OPA_DISP++, onp_win_owariT_model); + + if (inst_count >= 0) { + cursor_idx = -1; + play_idx = inst_count; + } else { + cursor_idx = mscore_ovl->cursor_idx; + play_idx = cursor_idx < 0 ? 0 : cursor_idx; + } + + if (cursor_idx != 16) { + stick_x = -91.0f + 21.2f * (play_idx % 8) + ((play_idx < 8) ? 0.0f : 19.0f); + stick_y = 20.0f + ((play_idx < 8) ? 0.0f : -50.0f); + + Matrix_translate(stick_x, stick_y, 0.0f, 1); + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, onp_hyouji_moji_mode); + gSPDisplayList(POLY_OPA_DISP++, onp_hyouji_bouT_model); + } + + if (inst_count < 0) { + play_idx = -1; + } + + gSPDisplayList(POLY_OPA_DISP++, onp_hyouji_waku_mode); + + base_x = (-105.0f + pos_x + 2.0f) + 12.0f; + base_y = 64.0f + pos_y; + scale = 1.0f + (1.0f - cosf_table((f32)mscore_ovl->anim_frame * ((f32)M_PI / 9.0f))) * 0.075f; + + for (i = 0; i < 16; i++) { + note_moji_p = ¬e_moji[mscore_ovl->melody[i]]; + Matrix_scale(16.0f, 16.0f, 1.0f, 0); + Matrix_translate(base_x, base_y + note_moji_p->ofs_y, 0.0f, 1); + if (i == cursor_idx) { + Matrix_scale(scale, scale, 1.0f, 1); + } + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 255, note_moji_p->prim_color[0], note_moji_p->prim_color[1], + note_moji_p->prim_color[2], 255); + gDPSetEnvColor(POLY_OPA_DISP++, note_moji_p->env_color[0], note_moji_p->env_color[1], note_moji_p->env_color[2], + 255); + gSPSegment(POLY_OPA_DISP++, ANIME_1_TXT_SEG, note_moji_p->frame->tex[i == play_idx]); + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, note_moji_p->frame->model); + + if (i == 7) { + base_x = 12.0f + (-105.0f + pos_x + 22.0f); + base_y += -50.0f; + } else { + base_x += 21.0f; + } + } + + gSPDisplayList(POLY_OPA_DISP++, onp_hyouji_moji_mode); + + base_x = (-105.0f + pos_x + 2.0f) + 12.0f; + base_y = 64.0f + pos_y; + for (i = 0; i < 16; i++) { + if (i != play_idx) { + note_moji_p = ¬e_moji[mscore_ovl->melody[i]]; + Matrix_scale(16.0f, 16.0f, 1.0f, 0); + Matrix_translate(base_x + note_moji_p->frame->offset[0], + base_y + note_moji_p->frame->offset[1] + note_moji_p->ofs_y, 0.0f, 1); + + if (i == cursor_idx) { + Matrix_scale(scale, scale, 1.0f, 1); + color_p = &color_data[0]; + } else { + color_p = &color_data[1]; + } + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 255, color_p->r, color_p->g, color_p->b, 255); + gSPSegment(POLY_OPA_DISP++, ANIME_2_TXT_SEG, note_moji_p->tex); + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, onp_hyouji_moji1T_model); + } + + if (i == 7) { + base_x = 12.0f + (-105.0f + pos_x + 22.0f); + base_y += -50.0f; + } else { + base_x += 21.0f; + } + } + + CLOSE_POLY_OPA_DISP(graph); + + if (menu_info->proc_status == mSM_OVL_PROC_OBEY && !F32_IS_ZERO(anm_scale)) { + OPEN_POLY_OPA_DISP(graph); + + gSPDisplayList(POLY_OPA_DISP++, sen_item2_DL_mode); + gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_THRESHOLD); + gDPSetBlendColor(POLY_OPA_DISP++, 255, 255, 255, 40); + + Matrix_scale(16.0f, 16.0f, 1.0f, 0); + Matrix_translate(-17.0f + pos_x, -65.0f + pos_y, 140.0f, 1); + Matrix_scale(anm_scale, anm_scale, 1.0f, 1); + Matrix_push(); + + Matrix_translate(16.0f, 35.0f, 0.0f, 1); + Matrix_scale(0.897059f, 0.708333f, 1.0f, 1); + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, 225, 255, 175, 255); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 255, 40, 255); + gSPDisplayList(POLY_OPA_DISP++, sen_win_wakuT_model); + Matrix_pull(); + + Matrix_translate(-26.0f, 51.0f - (mscore_ovl->menu_idx + 1) * 16, 0.0f, 1); + gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 255, 235, 60, 60, 255); + gSPDisplayList(POLY_OPA_DISP++, sen_win_cursor_model); + + gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_NONE); + gDPSetBlendColor(POLY_OPA_DISP++, 255, 255, 255, 8); + + CLOSE_POLY_OPA_DISP(graph); + + base_x = 160.0f + (-17.0f + pos_x + -22.0f * anm_scale); + base_y = 120.0f - (-65.0f + pos_y + 59.0f * anm_scale); + text_scale = anm_scale * 0.875f; + + submenu->overlay->set_char_matrix_proc(graph); + mFont_SetLineStrings(game, mMS_str_title, sizeof(mMS_str_title), base_x, base_y, 255, 60, 60, 255, FALSE, TRUE, + text_scale, text_scale, mFont_MODE_POLY); + color_p = &sel_str_color_data[mscore_ovl->menu_idx == 0]; + base_y += 16.0f * anm_scale; + mFont_SetLineStrings(game, mMS_str_ok, sizeof(mMS_str_ok), base_x, base_y, color_p->r, color_p->g, color_p->b, + 255, FALSE, TRUE, text_scale, text_scale, mFont_MODE_POLY); + color_p = &sel_str_color_data[mscore_ovl->menu_idx == 1]; + base_y += 16.0f * anm_scale; + mFont_SetLineStrings(game, mMS_str_cancel, sizeof(mMS_str_cancel), base_x, base_y, color_p->r, color_p->g, + color_p->b, 255, FALSE, TRUE, text_scale, text_scale, mFont_MODE_POLY); + } +} + +static void mMS_mscore_ovl_draw(Submenu* submenu, GAME* game) { + mSM_MenuInfo_c* menu_info = &submenu->overlay->menu_info[mSM_OVL_MSCORE]; + + menu_info->pre_draw_func(submenu, game); + mMS_set_dl(submenu, menu_info, game); +} + +extern void mMS_mscore_ovl_set_proc(Submenu* submenu) { + mSM_Control_c* control = &submenu->overlay->menu_control; + + control->menu_move_func = &mMS_mscore_ovl_move; + control->menu_draw_func = &mMS_mscore_ovl_draw; +} + +static void mMS_mscore_ovl_init(Submenu* submenu) { + mSM_MenuInfo_c* menu_info = &submenu->overlay->menu_info[mSM_OVL_MSCORE]; + mMS_Ovl_c* mscore_ovl = submenu->overlay->mscore_ovl; + + submenu->overlay->move_chg_base_proc(menu_info, mSM_MOVE_IN_TOP); + submenu->overlay->menu_control.animation_flag = FALSE; + mscore_ovl->anim_frame = 0; + mscore_ovl->wait_timer = 10; + mscore_ovl->cursor_idx = -1; + mMld_GetMelody(mscore_ovl->melody); +} + +extern void mMS_mscore_ovl_construct(Submenu* submenu) { + Submenu_Overlay_c* overlay = submenu->overlay; + + if (overlay->mscore_ovl == NULL) { + mSM_MenuInfo_c* menu_info = &overlay->menu_info[mSM_OVL_MSCORE]; + + mem_clear((u8*)&mscore_ovl_data, sizeof(mscore_ovl_data), 0); + overlay->mscore_ovl = &mscore_ovl_data; + mMS_MScore_draw_init(menu_info); + } + + mMS_mscore_ovl_init(submenu); + mMS_mscore_ovl_set_proc(submenu); + mBGMPsComp_pause(mBGM_PAUSE_MSCORE); +} + +extern void mMS_mscore_ovl_destruct(Submenu* submenu) { + submenu->overlay->mscore_ovl = NULL; + mBGMPsComp_pause(mBGM_PAUSE_STOP); +} diff --git a/src/m_player_sound.c_inc b/src/m_player_sound.c_inc index 05b68629..e63f840e 100644 --- a/src/m_player_sound.c_inc +++ b/src/m_player_sound.c_inc @@ -261,22 +261,22 @@ static void Player_actor_sound_umbrella_rotate(ACTOR* actor) { static u8 Player_actor_sound_Get_bgm_num_forCompletePayment(void) { switch (Common_Get(complete_payment_type)) { case mPlayer_COMPLETE_PAYMENT_TYPE_ARBEIT: - return NA_SE_MONEY0; + return BGM_INTRO_CHORES_COMPLETE; default: - return NA_SE_MONEY1; + return BGM_DEBT_PAID; } } static u8 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; + case mPlayer_GOLDEN_ITEM_TYPE_AXE: + return BGM_INTRO_CHORES_COMPLETE; + case mPlayer_GOLDEN_ITEM_TYPE_NET: + return BGM_ALL_INSECTS; + case mPlayer_GOLDEN_ITEM_TYPE_ROD: + return BGM_ALL_FISH; default: - return NA_SE_MONEY1; + return BGM_DEBT_PAID; } }