diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index df3641ba8..cff8fa9f2 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -91,9 +91,12 @@ public: void getBounds() {} void getGlbBounds() {} - void getRotate() const {} + f32 getRotate() const { return mRotation; } void place(const JGeometry::TBox2&) {} - void rotate(f32) {} + void rotate(f32 angle) { + mRotation = angle; + calcMtx(); + } void rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle) { mBasePosition.x = offsetX; mBasePosition.y = offsetY; diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h index c7e778a2b..06786acba 100644 --- a/include/JSystem/J2DGraph/J2DTextBox.h +++ b/include/JSystem/J2DGraph/J2DTextBox.h @@ -52,7 +52,8 @@ public: void setCharColor(JUtility::TColor c) { mCharColor.set(c); } void setGradColor(JUtility::TColor c) { mGradColor.set(c); } void setBlack(JUtility::TColor c) { mBlack = c; } - void setWhite(JUtility::TColor c) { mBlack = c; } + void setWhite(JUtility::TColor c) { mWhite = c; } + void setLineSpace(f32 x) { mLineSpace = x; } f32 getLineSpace() const { return mLineSpace; } f32 getCharSpace() const { return mCharSpace; } diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index ba12f61c0..bc139d1c5 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1149,6 +1149,10 @@ inline void dComIfGs_offCompleteCollectMap(int i_no) { g_dComIfG_gameInfo.save.getPlayer().getMap().offCompleteMap(i_no - 1); } +inline s32 dComIfGs_getCollectMapNum() { + return g_dComIfG_gameInfo.save.getPlayer().getMap().getCollectMapNum(); +} + inline void dComIfGs_onSaveArriveGridForAgb(int i_no) { g_dComIfG_gameInfo.save.getPlayer().getMap().onSaveArriveGridForAgb(i_no); } diff --git a/include/d/d_lib.h b/include/d/d_lib.h index ea6359c45..89881b724 100644 --- a/include/d/d_lib.h +++ b/include/d/d_lib.h @@ -25,7 +25,7 @@ public: void Yinit(); virtual f32 getValueStick(); virtual s16 getAngleStick(); - s32 checkTrigger(); + u8 checkTrigger(); bool checkLeftTrigger(); bool checkRightTrigger(); bool checkUpTrigger(); diff --git a/include/d/d_menu_collect.h b/include/d/d_menu_collect.h index a556326b7..8b33a2ad9 100644 --- a/include/d/d_menu_collect.h +++ b/include/d/d_menu_collect.h @@ -2,6 +2,10 @@ #define D_MENU_COLLECT_H #include "dolphin/types.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DTextBox.h" +#include "f_op/f_op_msg_mng.h" +#include "d/d_2dnumber.h" struct fopMsgM_pane_class; class JKRArchive; @@ -84,11 +88,102 @@ public: void animeStep4(short, short); void _open2(); void _close2(); + + /* 0x000 */ u8 m000[0x004 - 0x000]; + /* 0x004 */ J2DScreen* m004; + /* 0x008 */ fopMsgM_pane_class m008; + /* 0x040 */ fopMsgM_pane_class m040; + /* 0x078 */ fopMsgM_pane_class m078; + /* 0x0B0 */ fopMsgM_pane_class m0B0[15]; + /* 0x3F8 */ fopMsgM_pane_class m3F8[15]; + /* 0x740 */ fopMsgM_pane_class m740; + /* 0x778 */ fopMsgM_pane_class m778; + /* 0x7B0 */ fopMsgM_pane_class m7B0; + /* 0x7E8 */ fopMsgM_pane_class m7E8; + /* 0x820 */ fopMsgM_pane_class m820; + /* 0x858 */ fopMsgM_pane_class m858; + /* 0x890 */ fopMsgM_pane_class m890; + /* 0x8C8 */ fopMsgM_pane_class m8C8; + /* 0x900 */ fopMsgM_pane_class m900; + /* 0x938 */ fopMsgM_pane_class m938; + /* 0x970 */ fopMsgM_pane_class m970; + /* 0x9A8 */ fopMsgM_pane_class m9A8; + /* 0x9E0 */ fopMsgM_pane_class m9E0; + /* 0xA18 */ fopMsgM_pane_class mA18[4]; + /* 0xAF8 */ fopMsgM_pane_class mAF8; + /* 0xB30 */ fopMsgM_pane_class mB30; + /* 0xB68 */ fopMsgM_pane_class mB68[4]; + /* 0xC48 */ fopMsgM_pane_class mC48; + /* 0xC80 */ fopMsgM_pane_class mC80; + /* 0xCB8 */ fopMsgM_pane_class mCB8; + /* 0xCF0 */ fopMsgM_pane_class mCF0; + /* 0xD28 */ fopMsgM_pane_class mD28; + /* 0xD60 */ fopMsgM_pane_class mD60; + /* 0xD98 */ fopMsgM_pane_class mD98; + /* 0xDD0 */ fopMsgM_pane_class mDD0; + /* 0xE08 */ fopMsgM_pane_class mE08[8]; + /* 0xFC8 */ fopMsgM_pane_class mFC8; + /* 0x1000 */ fopMsgM_pane_class m1000[3]; + /* 0x10A8 */ fopMsgM_pane_class m10A8[3]; + /* 0x1150 */ fopMsgM_pane_class m1150[11]; + /* 0x13B8 */ fopMsgM_pane_class m13B8[3]; + /* 0x1460 */ fopMsgM_pane_class m1460; + /* 0x1498 */ fopMsgM_pane_class m1498[6]; + /* 0x15E8 */ fopMsgM_pane_class m15E8[6]; + /* 0x1738 */ fopMsgM_pane_class m1738; + /* 0x1770 */ fopMsgM_pane_class m1770; + /* 0x17A8 */ fopMsgM_pane_class m17A8[6]; + /* 0x18F8 */ fopMsgM_pane_class m18F8[6]; + /* 0x1A48 */ fopMsgM_pane_class m1A48[6]; + /* 0x1B98 */ fopMsgM_pane_class m1B98[6]; + /* 0x1CE8 */ fopMsgM_pane_class m1CE8[6]; + /* 0x1E38 */ fopMsgM_pane_class m1E38[6]; + /* 0x1460 */ fopMsgM_pane_class m1F88; + /* 0x1460 */ fopMsgM_pane_class m1FC0; + /* 0x1460 */ fopMsgM_pane_class m1FF8; + /* 0x2030 */ fopMsgM_pane_class m2030[5]; + /* 0x2148 */ fopMsgM_pane_class m2148[5]; + /* 0x2260 */ fopMsgM_pane_class m2260[5]; + /* 0x2378 */ fopMsgM_pane_class m2378; + /* 0x23B0 */ fopMsgM_pane_class m23B0; + /* 0x23E8 */ fopMsgM_pane_class m23E8; + /* 0x2420 */ fopMsgM_pane_class m2420; + /* 0x2458 */ u8 m2458[0x2460 - 0x2458]; + /* 0x2460 */ dDlst_2DOutFont_c* m2460; + /* 0x2464 */ u8 m2464[0x2470 - 0x2464]; + /* 0x2470 */ JUTFont* m2470; + /* 0x2474 */ JUTFont* m2474; + /* 0x2478 */ J2DPane* m2478; + /* 0x247C */ u8 m247C[0x2498 - 0x247C]; + /* 0x2498 */ ResTIMG* m2498; + /* 0x249C */ ResTIMG* m249C; + /* 0x24A0 */ ResTIMG* m24A0[6]; + /* 0x24B8 */ u8 m24B8[0x27A8 - 0x24B8]; + /* 0x27A8 */ f32 m27A8; + /* 0x27AC */ f32 m27AC; }; class dMc_HIO_c { public: dMc_HIO_c(); + virtual ~dMc_HIO_c() {} + +public: + /* 0x00 */ // vtable + /* 0x04 */ u8 m04[0x44 - 0x04]; + /* 0x44 */ s16 m44; + /* 0x46 */ s16 m46; + /* 0x48 */ s16 m48; + /* 0x4A */ s16 m4A; + /* 0x4C */ s16 m4C; + /* 0x4E */ s16 m4E; + /* 0x50 */ s16 m50; + /* 0x52 */ u8 m52; + /* 0x53 */ u8 m53; + /* 0x54 */ f32 m54; + /* 0x58 */ JUtility::TColor m58; + /* 0x5C */ u8 m5C; + /* 0x5D */ u8 m5D; }; #endif /* D_MENU_COLLECT_H */ diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index c3529d8bf..38f78e262 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -10,14 +10,25 @@ struct fopMsgM_pane_class; class JKRArchive; class JUTFont; +struct mesg_entry; class dMenu_Option_c : public dDlst_base_c { public: void alphaChange(fopMsgM_pane_class*, f32) {} void getQuitStatus() {} - void setArchive(JKRArchive*) {} - void setFont(JUTFont*, JUTFont*) {} - void setTextArea(char*, char*, char*, char*) {} + void setArchive(JKRArchive* archive) { + mpArchive = archive; + } + void setFont(JUTFont* font_1, JUTFont* font_2) { + mD2C = font_1; + mD30 = font_2; + } + void setTextArea(char* param_1, char* param_2, char* param_3, char* param_4) { + mD38 = param_1; + mD3C = param_2; + mD40 = param_3; + mD44 = param_4; + } void screenSet(); void mainInit(); @@ -36,7 +47,7 @@ public: void outFontInit(); void outFontMove(); void outFontDraw(); - void stringlength(fopMsgM_pane_class*, char*); + f32 stringlength(fopMsgM_pane_class*, char*); void changeScaleCenter(fopMsgM_pane_class*, char*); void setSoundMode(u32); void changeScaleRight(fopMsgM_pane_class*, char*); @@ -45,8 +56,8 @@ public: void _delete(); void _move(); void _draw(); - void _open(); - void _close(); + bool _open(); + bool _close(); private: /* 0x004 */ J2DScreen* scrn; @@ -55,31 +66,26 @@ private: /* 0x078 */ fopMsgM_pane_class m078; /* 0x0B0 */ fopMsgM_pane_class m0B0[15]; /* 0x3F8 */ fopMsgM_pane_class m3F8[15]; - /* 0x740 */ fopMsgM_pane_class m740; - /* 0x778 */ fopMsgM_pane_class m778; + /* 0x740 */ fopMsgM_pane_class m740[2]; /* 0x7B0 */ fopMsgM_pane_class m7B0; /* 0x7E8 */ fopMsgM_pane_class m7E8; /* 0x820 */ fopMsgM_pane_class m820; - /* 0x858 */ fopMsgM_pane_class m858; - /* 0x890 */ fopMsgM_pane_class m890; + /* 0x858 */ fopMsgM_pane_class m858[2]; /* 0x8C8 */ fopMsgM_pane_class m8C8[4]; /* 0x9A8 */ fopMsgM_pane_class m9A8[2]; /* 0xA18 */ fopMsgM_pane_class mA18[3]; /* 0xAC0 */ fopMsgM_pane_class mAC0[2]; - /* 0xB30 */ fopMsgM_pane_class mB30; - /* 0xB68 */ fopMsgM_pane_class mB68; - /* 0xBA0 */ fopMsgM_pane_class mBA0; - /* 0xBD8 */ fopMsgM_pane_class mBD8; - /* 0xC10 */ fopMsgM_pane_class mC10; - /* 0xC48 */ fopMsgM_pane_class mC48; - /* 0xC80 */ fopMsgM_pane_class mC80; - /* 0xCB8 */ fopMsgM_pane_class mCB8; + /* 0xB30 */ fopMsgM_pane_class mB30[6]; + /* 0xC80 */ fopMsgM_pane_class mC80[2]; /* 0xCF0 */ fopMsgM_pane_class mCF0; /* 0xD28 */ JKRArchive* mpArchive; /* 0xD2C */ JUTFont* mD2C; /* 0xD30 */ JUTFont* mD30; /* 0xD34 */ STControl* stick; - /* 0xD38 */ u8 mD38[0xD48 - 0xD38]; + /* 0xD38 */ char* mD38; + /* 0xD3C */ char* mD3C; + /* 0xD40 */ char* mD40; + /* 0xD44 */ char* mD44; /* 0xD48 */ char mD48[20]; /* 0xD5C */ char mD5C[2][20]; /* 0xD84 */ char mD84[2][20]; @@ -89,9 +95,12 @@ private: /* 0xE39 */ u8 mE39; /* 0xE3A */ u8 mE3A; /* 0xE3B */ u8 mE3B; - /* 0xE3C */ u8 mE3C[0xE40 - 0xE3C]; + /* 0xE3C */ u8 mE3C; + /* 0xE3D */ u8 mE3D; + /* 0xE3E */ u8 mE3E; + /* 0xE3F */ u8 mE3F; /* 0xE40 */ u8 mE40; - /* 0xE41 */ u8 mE41[0xE42 - 0xE41]; + /* 0xE41 */ u8 mE41; }; // Size: 0xE42 class dMo_HIO_c : public JORReflexible { diff --git a/include/d/d_meter.h b/include/d/d_meter.h index f67692867..df5f53d69 100644 --- a/include/d/d_meter.h +++ b/include/d/d_meter.h @@ -596,5 +596,6 @@ extern dMeter_msg_HIO_c g_msgHIO; extern dMeter_message_HIO_c g_messageHIO; void dMeter_mtrShow(); +void dMenu_setPushMenuButton(u8); #endif /* D_METER_H */ diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 0892d1356..51b05a298 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -17,7 +17,28 @@ class JUTFont; struct mesg_header; struct mesg_data; struct mesg_info; -struct mesg_entry; + +struct mesg_entry { + // mesg_entry() {} // fixes fopMsgM_selectMessageGet, but messes up getMesgEntry + + /* 0x00 */ u32 mDataOffs; + /* 0x04 */ u16 mMesgID; + /* 0x06 */ s16 mItemPrice; + /* 0x08 */ u16 mNextMessageID; + /* 0x0A */ u16 field_0x0a; + /* 0x0C */ u8 mTextboxType; + /* 0x0D */ u8 mDrawType; + /* 0x0E */ u8 mTextboxPosition; + /* 0x0F */ u8 mItemImage; + /* 0x10 */ u8 field_0x10; + /* 0x11 */ u8 mInitialSound; + /* 0x12 */ u8 mInitialCamera; + /* 0x13 */ u8 mInitialAnimation; + /* 0x14 */ u8 field_0x14; + /* 0x15 */ u8 field_0x15; + /* 0x16 */ u8 field_0x16; + /* 0x17 */ u8 field_0x17; +}; struct msg_process_profile_definition { /* 0x00 */ leaf_process_profile_definition base; @@ -356,6 +377,8 @@ void fopMsgM_setFontsizeCenter(char* param_1, char* param_2, char* param_3, char void fopMsgM_setFontsizeCenter2(char* a, char* b, char* c, char* d, int, int size, int, int); void fopMsgM_outFontSet(J2DPicture*, J2DPicture*, s16*, u32, u8); +void fopMsgM_outFontSet(J2DPicture*, s16*, u32, u8); void fopMsgM_outFontDraw(J2DPicture*, J2DPicture*, int, int, int, s16*, u8, u8); +void fopMsgM_outFontDraw2(J2DPicture*, J2DPicture*, int, int, int, int, s16*, u8, u8); #endif /* F_OP_MSG_MNG_H */ diff --git a/src/d/d_lib.cpp b/src/d/d_lib.cpp index da322377c..c00276d49 100644 --- a/src/d/d_lib.cpp +++ b/src/d/d_lib.cpp @@ -353,7 +353,7 @@ s16 CSTControl::getAngleStick() { } /* 80058340-800585D0 .text checkTrigger__9STControlFv */ -s32 STControl::checkTrigger() { +u8 STControl::checkTrigger() { field_0x0d = field_0x0c; f32 valueStick = getValueStick(); s16 angleStick = getAngleStick(); diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 4e6061774..bf5f31bc7 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -5,15 +5,323 @@ #include "d/d_menu_collect.h" #include "dolphin/types.h" +#include "stdio.h" +#include "d/d_com_inf_game.h" + +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep +#include "weak_data_1811.h" // IWYU pragma: keep + +static dMc_HIO_c g_mcHIO; /* 8019BE8C-8019BF14 .text __ct__9dMc_HIO_cFv */ dMc_HIO_c::dMc_HIO_c() { - /* Nonmatching */ + m46 = 40; + m48 = 10; + m4A = 120; + m4C = 100; + m54 = 4.0f; + m5C = 0xff; + m5D = 70; + m52 = 130; + m4E = 250; + m50 = 20; + m58.set(0xFF, 0xAA, 0x00, 0x00); + m44 = 13; } /* 8019BF14-8019CB5C .text screenSet__15dMenu_Collect_cFv */ void dMenu_Collect_c::screenSet() { /* Nonmatching */ + char* print_format; + + static const u32 l_ft[] = { + 'ft00', 'ft01', 'ft02', 'ft03', 'ft04', 'ft05', 'ft06', 'ft07', + 'ft08', 'ft09', 'ft10', 'ft11', 'ft12', 'ft13', 'ft14', + }; + + static const u32 l_fd[] = { + 'fd00', 'fd01', 'fd02', 'fd03', 'fd04', 'fd05', 'fd06', 'fd07', + 'fd08', 'fd09', 'fd10', 'fd11', 'fd12', 'fd13', 'fd14', + }; + + static const u32 l_car[] = { + 'car1', 'car2', 'car3', 'car4', + }; + + static const u32 l_tri[] = { + 'tri0', 'tri1', 'tri2', 'tri3', 'tri4', 'tri5', 'tri6', 'tri7', + }; + + static const u32 l_sit[] = { + 'it16', 'it14', 'it15', + }; + + static const u32 l_sik[] = { + 'ik16', 'ik14', 'ik15', + }; + + static const u32 l_ci[] = { + 'ci10', 'ci09', 'ci08', 'ci07', 'ci06', 'ci05', + 'ci04', 'ci03', 'ci02', 'ci01', 'ci00', + }; + + static const u32 l_htp[] = { + 'htp2', 'htp1', 'htp3', + }; + + static const u32 l_tit[] = { + 'it08', 'it09', 'it10', 'it11', 'it12', 'it13', + }; + + static const u32 l_tik[] = { + 'ik08', 'ik09', 'ik10', 'ik11', 'ik12', 'ik13' + }; + + static const u32 l_cn[] = { + 'cn01', 'cn02', 'cn03', 'cn04', 'cn05', 'cn06' + }; + + static const u32 l_wn[] = { + 'wn01', 'wn02', 'wn03', 'wn04', 'wn05', 'wn06' + }; + + static const u32 l_i0[] = { + 'i011', 'i021', 'i031', 'i041', 'i051', + 'i061' + }; + + static const u32 l_i1[] = { + 'i012', 'i022', 'i032', 'i042', 'i052', 'i062' + }; + + static const u32 l_bs[] = { + 'bs01', 'bs02', 'bs03', 'bs04', 'bs05', 'bs06' + }; + + static const u32 l_hmb[] = { + 'hmb1', 'hmb2', 'hmb3', 'hmb4', 'hmb5', 'hmb6' + }; + + static const u32 l_wit[] = { + 'it00', 'it01', 'it02', 'it03', 'it04' + }; + + static const u32 l_wik[] = { + 'ik00', 'ik01', 'ik02', 'ik03', 'ik04' + }; + + static const u32 l_ip[] = { + 'ip09', 'ip07', 'ip05', 'ip03', 'ip01' + }; + + static const u32 l_wk[] = { + 'wk00', 'wk01', 'wk02', 'wk03', + }; + + static char* triTex[8] = { + "triforce_00.bti", "triforce_01.bti", "triforce_02.bti", "triforce_03.bti", + "triforce_04.bti", "triforce_05.bti", "triforce_06.bti", "triforce_07.bti", + }; + static char* symTex[3] = { + "god_symbol_02.bti", "god_symbol_00.bti", "god_symbol_01.bti", + }; + static char* wepTex[5] = { + "sword_00.bti", "shield_00.bti", "gloves_00.bti", "amulet_00.bti", "amulet_01.bti", + }; + + J2DPane* mPane = m004->search('ROOT'); + m2478 = mPane; + + fopMsgM_setPaneData(&m008, m004, 'ft15'); + fopMsgM_setPaneData(&m040, m004, 'ft16'); + fopMsgM_setPaneData(&m078, m004, 'ft17'); + + for (int i = 0; i < (s32)ARRAY_SIZE(m0B0); i++) { + fopMsgM_setPaneData(&m0B0[i], m004, l_ft[i]); + fopMsgM_setPaneData(&m3F8[i], m004, l_fd[i]); + + m0B0[i].mUserArea = 0xFFFF; + } + + fopMsgM_setPaneData(&m740, m004, 'str0'); + fopMsgM_setPaneData(&m778, m004, 'st00'); + fopMsgM_setPaneData(&m7B0, m004, 'nt00'); + fopMsgM_setPaneData(&m7E8, m004, 'nk00'); + fopMsgM_setPaneData(&m820, m004, 'no11'); + + m820.mUserArea = m820.pane->mRotation; + + if (m820.mUserArea > 180) m820.mUserArea -= 360; + + ((J2DTextBox*)(m740).pane)->setFont(m2474); + ((J2DTextBox*)(m778).pane)->setFont(m2470); + + // Couple of functions missing here + ((J2DTextBox*)(m740).pane)->setWhite(0xFFFFFFFF); + ((J2DTextBox*)(m740).pane)->setCharColor(0xFFFFFFFF); + ((J2DTextBox*)(m740).pane)->setGradColor(0xFFFFFFFF); + + ((J2DTextBox*)(m778).pane)->setWhite(0xFFFFFFFF); + ((J2DTextBox*)(m778).pane)->setCharColor(0xFFFFFFFF); + ((J2DTextBox*)(m778).pane)->setGradColor(0xFFFFFFFF); + + + fopMsgM_setPaneData(&m858, m004, 'wd'); + ((J2DTextBox*)(m858).pane)->setFont(m2470); + + m2460->setPane(m2470, &m858, &m008, &m040, &m078); + + fopMsgM_setPaneData(&m890, m004, 'nm00'); + ((J2DTextBox*)(m890).pane)->setFont(m2470); + + fopMsgM_setPaneData(&m8C8, m004, 'nm01'); + ((J2DTextBox*)(m8C8).pane)->setFont(m2470); + + fopMsgM_setPaneData(&m900, m004, 'itnm'); + fopMsgM_setPaneData(&m938, m004, 'itnk'); + fopMsgM_setPaneData(&m970, m004, 'msk0'); + fopMsgM_setPaneData(&m9A8, m004, 'tl00'); + fopMsgM_setPaneData(&m9E0, m004, 'tk00'); + + for(int i = 0; i < 4; i++) { + fopMsgM_setPaneData(&mA18[i], m004, l_car[i]); + } + + fopMsgM_setPaneData(&mAF8, m004, 'wdsv'); + fopMsgM_setPaneData(&mB30, m004, 'wdop'); + + for(int i = 0; i < 4; i++) { + fopMsgM_setPaneData(&mB68[i], m004, l_wk[i]); + } + + fopMsgM_setPaneData(&mC48, m004, 'num1'); + fopMsgM_setPaneData(&mC80, m004, 'num2'); + fopMsgM_setPaneData(&mCB8, m004, 'numc'); + fopMsgM_setPaneData(&mCF0, m004, 'cmap'); + fopMsgM_setPaneData(&mD28, m004, 'wk1'); + fopMsgM_setPaneData(&mD60, m004, 'wk0'); + fopMsgM_setPaneData(&mD98, m004, 'trim'); + fopMsgM_setPaneData(&mDD0, m004, 'tril'); + + mD98.pane->mDrawAlpha = 1; + mDD0.pane->mDrawAlpha = 1; + + for(int i = 0; i < 8; i++) { + fopMsgM_setPaneData(&mE08[i], m004, l_tri[i]); + } + + fopMsgM_setPaneData(&mFC8, m004, 'trib'); + + for(int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m10A8[i], m004, l_sit[i]); + fopMsgM_setPaneData(&m3F8[i], m004, l_sik[i]); + } + + if (dComIfGs_isEventBit(0x1480)) { + m1000[1].mInitAlpha *= 0.5f; + m10A8[1].mInitAlpha *= 0.5f; + } + + if (dComIfGs_isEventBit(0x1440)) { + m1000[2].mInitAlpha *= 0.5f; + m10A8[2].mInitAlpha *= 0.5f; + } + + if (dComIfGs_isEventBit(0x1410)) { + m1000[0].mInitAlpha *= 0.5f; + m10A8[0].mInitAlpha *= 0.5f; + } + + for(int i = 0; i < 11; i++) { + fopMsgM_setPaneData(&m1150[i], m004, l_ci[i]); + } + + for(int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m10A8[i], m004, l_htp[i]); + } + + fopMsgM_setPaneData(&m1460, m004, 'htpb'); + + for(int i = 0; i < 6; i++) { + fopMsgM_setPaneData(&m1498[i], m004, l_tit[i]); + fopMsgM_setPaneData(&m15E8[i], m004, l_tik[i]); + fopMsgM_setPaneData(&m17A8[i], m004, l_cn[i]); + fopMsgM_pane_class* pPane = &m18F8[i]; + fopMsgM_setPaneData(pPane, m004, l_wn[i]); + fopMsgM_setPaneData(&m1A48[i], m004, l_i0[i]); + fopMsgM_setPaneData(&m1B98[i], m004, l_i1[i]); + fopMsgM_setPaneData(&m1CE8[i], m004, l_bs[i]); + fopMsgM_setPaneData(&m1E38[i], m004, l_hmb[i]); + + pPane->mPosCenterOrig.x -= 4.0f; + pPane->mPosCenterOrig.y -= 4.0f; + + fopMsgM_paneTrans(pPane, 0.0f, 0.0f); + } + + fopMsgM_setPaneData(&m1738, m004, 'i111'); + fopMsgM_setPaneData(&m1770, m004, 'i122'); + fopMsgM_setPaneData(&m1F88, m004, 'cc43'); + fopMsgM_setPaneData(&m1FC0, m004, 'cc32'); + fopMsgM_setPaneData(&m1FF8, m004, 'cc21'); + + for (int i = 0; i < 5; i++) { + fopMsgM_setPaneData(&m2030[i], m004, l_wit[i]); + fopMsgM_setPaneData(&m2148[i], m004, l_wik[i]); + } + + for (int i = 0; i < 5; i++) { + fopMsgM_setPaneData(&m2260[i], m004, l_ip[i]); + } + + fopMsgM_setPaneData(&m2378, m004, 'ip00'); + fopMsgM_setPaneData(&m23B0, m004, 'cc14'); + fopMsgM_setPaneData(&m23E8, m004, 'cc07'); + fopMsgM_setPaneData(&m2420, m004, 'cc00'); + + JKRArchive::readTypeResource(m2498, 0xc00, 'TIMG', "baton.bti", dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m2498, 0xc00); + + JKRArchive::readTypeResource(m249C, 0xc00, 'TIMG', "cmap_treasure2.bti", dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m249C, 0xc00); + + for(int i = 0; i < 6; i++) { + ((J2DPicture*)m1498[i].pane)->changeTexture(m2498, 0); + ((J2DPicture*)m15E8[i].pane)->changeTexture(m2498, 0); + } + + ((J2DPicture*)mCF0.pane)->changeTexture(m249C, 0); + + for(int i = 0; i < 8; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', triTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)mE08[i].pane)->changeTexture(m24A0[i], 0); + } + + mE08[4].mUserArea = -1; + m27A8 = mE08[4].mPosCenterOrig.x - mFC8.mPosCenterOrig.x; + m27AC = mE08[4].mPosCenterOrig.y - mFC8.mPosCenterOrig.y; + + for(int i = 0; i < 3; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', symTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)m1000[i].pane)->changeTexture(m24A0[i], 0); + ((J2DPicture*)m10A8[i].pane)->changeTexture(m24A0[i], 0); + } + + for(int i = 0; i < 5; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', wepTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)m2030[i].pane)->changeTexture(m24A0[i], 0); + ((J2DPicture*)m2148[i].pane)->changeTexture(m24A0[i], 0); + } + + sprintf(print_format, "rupy_num_%02d.bti", dComIfGs_getCollectMapNum() / 10); + ((J2DPicture*)mC48.pane)->changeTexture(print_format, 0); + + sprintf(print_format, "rupy_num_%02d.bti", dComIfGs_getCollectMapNum() % 10); + ((J2DPicture*)mC80.pane)->changeTexture(print_format, 0); + return; } /* 8019CB5C-8019CD40 .text initialize__15dMenu_Collect_cFv */ diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 94e6ad176..fa43b0a66 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -7,8 +7,12 @@ #include "JSystem/J2DGraph/J2DTextBox.h" #include "JSystem/JUtility/JUTAssert.h" #include "d/d_lib.h" -#include "f_op/f_op_msg_mng.h" +#include "m_Do/m_Do_audio.h" +#include "m_Do/m_Do_controller_pad.h" #include "global.h" +#include "d/d_meter.h" +#include "f_op/f_op_msg_mng.h" +#include "d/d_com_inf_game.h" dMo_HIO_c g_moHIO; @@ -40,13 +44,13 @@ void dMenu_Option_c::screenSet() { fopMsgM_blendInit(&m0B0[i], "font_00.bti"); } - fopMsgM_setPaneData(&m778, scrn->search('str0')); - fopMsgM_setPaneData(&m740, scrn->search('st00')); + fopMsgM_setPaneData(&m740[1], scrn->search('str0')); + fopMsgM_setPaneData(&m740[0], scrn->search('st00')); fopMsgM_setPaneData(&m7B0, scrn->search('nt00')); fopMsgM_setPaneData(&m7E8, scrn->search('nk00')); fopMsgM_setPaneData(&m820, scrn->search('no11')); - fopMsgM_setPaneData(&m858, scrn->search('yaz2')); - fopMsgM_setPaneData(&m890, scrn->search('yaz1')); + fopMsgM_setPaneData(&m858[0], scrn->search('yaz2')); + fopMsgM_setPaneData(&m858[1], scrn->search('yaz1')); fopMsgM_setPaneData(&m8C8[0], scrn->search('ttyu')); fopMsgM_setPaneData(&m9A8[0], scrn->search('thld')); fopMsgM_setPaneData(&m9A8[1], scrn->search('tsic')); @@ -57,16 +61,16 @@ void dMenu_Option_c::screenSet() { fopMsgM_setPaneData(&m8C8[2], scrn->search('tvib')); fopMsgM_setPaneData(&mAC0[1], scrn->search('tari')); fopMsgM_setPaneData(&mAC0[0], scrn->search('tnas')); - fopMsgM_setPaneData(&mB30, scrn->search('cr32')); - fopMsgM_setPaneData(&mB68, scrn->search('cr31')); - fopMsgM_setPaneData(&mBA0, scrn->search('cc22')); - fopMsgM_setPaneData(&mBD8, scrn->search('cc21')); - fopMsgM_setPaneData(&mC10, scrn->search('cc12')); - fopMsgM_setPaneData(&mC48, scrn->search('cr11')); - fopMsgM_setPaneData(&mC80, scrn->search('bs09')); - fopMsgM_setPaneData(&mCB8, scrn->search('bs00')); + fopMsgM_setPaneData(&mB30[0], scrn->search('cr32')); + fopMsgM_setPaneData(&mB30[1], scrn->search('cr31')); + fopMsgM_setPaneData(&mB30[2], scrn->search('cc22')); + fopMsgM_setPaneData(&mB30[3], scrn->search('cc21')); + fopMsgM_setPaneData(&mB30[4], scrn->search('cc12')); + fopMsgM_setPaneData(&mB30[5], scrn->search('cr11')); + fopMsgM_setPaneData(&mC80[0], scrn->search('bs09')); + fopMsgM_setPaneData(&mC80[1], scrn->search('bs00')); fopMsgM_setPaneData(&mCF0, scrn->search('blak')); - + fopMsgM_messageGet(mD48, 0x19D); fopMsgM_messageGet(mD5C[0], 0x19B); fopMsgM_messageGet(mD5C[1], 0x1A9); @@ -82,8 +86,8 @@ void dMenu_Option_c::screenSet() { ((J2DTextBox*)m008.pane)->setFont(mD2C); ((J2DTextBox*)m008.pane)->setString(mD48); - ((J2DTextBox*)m740.pane)->setFont(mD2C); - ((J2DTextBox*)m778.pane)->setFont(mD30); + ((J2DTextBox*)m740[0].pane)->setFont(mD2C); + ((J2DTextBox*)m740[1].pane)->setFont(mD30); for (int i = 0; i < 2; i++) { ((J2DTextBox*)m9A8[i].pane)->setFont(mD2C); @@ -111,6 +115,7 @@ void dMenu_Option_c::screenSet() { m008.mUserArea = m008.pane->mRotation; m040.mUserArea = m040.pane->mRotation; m078.mUserArea = m078.pane->mRotation; + if (m820.mUserArea > 180) m820.mUserArea -= 360; if (m008.mUserArea > 180) m008.mUserArea -= 360; if (m040.mUserArea > 180) m040.mUserArea -= 360; @@ -119,113 +124,617 @@ void dMenu_Option_c::screenSet() { /* 801D3388-801D3518 .text mainInit__14dMenu_Option_cFv */ void dMenu_Option_c::mainInit() { - /* Nonmatching */ + fopMsgM_setNowAlphaZero(&mCF0); + + for (int i = 0; i < 2; i++) { + fopMsgM_paneTrans(&m858[i], 0.0f, 0.0f); + + // Potential bug: Why access 0th index multiple times? + m858[0].pane->rotate(m858[0].mSize.x / 2.0f, m858[0].mSize.y / 2.0f, ROTATE_Z, 90.0f); + + fopMsgM_setNowAlphaZero(&mC80[i]); + fopMsgM_setNowAlphaZero(&m858[i]); + fopMsgM_setNowAlphaZero(&m9A8[i]); + fopMsgM_setNowAlphaZero(&mAC0[i]); + } + + for (int i = 0; i < 3; i++) { + fopMsgM_setNowAlphaZero(&mA18[i]); + } + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setNowAlphaZero(&m8C8[i]); + } + } + + for (int i = 0; i < 6; i++) { + fopMsgM_paneTrans(&mB30[i], 0.0f, 0.0f); + fopMsgM_setNowAlphaZero(&mB30[i]); + } + + mB30[0].mUserArea = 0; + mB30[1].mUserArea = 0; + mB30[2].mUserArea = 0; + m858[0].mUserArea = 0; + m858[1].mUserArea = 0; + + cursorMove(); } /* 801D3518-801D35DC .text noteInit__14dMenu_Option_cFv */ -void dMenu_Option_c::noteInit() { - /* Nonmatching */ +void dMenu_Option_c::noteInit() { + fopMsgM_paneTrans(&m820, 0.0f, 35.0f); + + m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, m820.mUserArea + -12.0f); + + fopMsgM_setNowAlphaZero(&m740[0]); + fopMsgM_setNowAlphaZero(&m740[1]); + fopMsgM_setNowAlphaZero(&m7B0); + fopMsgM_setNowAlphaZero(&m7E8); + fopMsgM_setNowAlphaZero(&m820); } /* 801D35DC-801D37C8 .text titleInit__14dMenu_Option_cFv */ -void dMenu_Option_c::titleInit() { - /* Nonmatching */ +void dMenu_Option_c::titleInit() { + float rotate_angle = m008.mUserArea + 20; + if (rotate_angle > 180.0f) { + rotate_angle -= 360.0f; + } + + if (rotate_angle < -180.0f) { + rotate_angle += 360.0f; + } + + fopMsgM_paneTrans(&m008, 0.0f, -50.0f); + fopMsgM_paneTrans(&m040, 0.0f, -50.0f); + fopMsgM_paneTrans(&m078, 0.0f, -50.0f); + + m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m008.mUserArea); + m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m040.mUserArea); + m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m078.mUserArea); + + fopMsgM_setNowAlphaZero(&m008); + fopMsgM_setNowAlphaZero(&m040); + fopMsgM_setNowAlphaZero(&m078); } /* 801D37C8-801D38E0 .text mainMove__14dMenu_Option_cFv */ void dMenu_Option_c::mainMove() { - /* Nonmatching */ + float alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea, 0); + + fopMsgM_setNowAlpha(&mCF0, alpha); + + fopMsgM_setNowAlpha(&m9A8[mE3C], alpha); + fopMsgM_setNowAlpha(&mAC0[mE3F], alpha); + fopMsgM_setNowAlpha(&mA18[mE3E], alpha); + + for(int i = 0; i < 2; i++) { + fopMsgM_setNowAlpha(&mC80[i], alpha); + fopMsgM_setNowAlpha(&m858[i], alpha); + } + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setNowAlpha(&m8C8[i], alpha); + } + } + + fopMsgM_setNowAlpha(&mB30[0], alpha); + fopMsgM_setNowAlpha(&mB30[1], alpha); } /* 801D38E0-801D39F4 .text noteMove__14dMenu_Option_cFv */ void dMenu_Option_c::noteMove() { - /* Nonmatching */ + float alpha; + + alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea + -7, 0); + fopMsgM_paneTrans(&m820, 0.0f, (1.0f - alpha) * 35.0f); + + m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, (1.0f - alpha) * -12.0f + m820.mUserArea); + + fopMsgM_setNowAlpha(&m740[0], alpha); + fopMsgM_setNowAlpha(&m740[1], alpha); + fopMsgM_setNowAlpha(&m7B0, alpha); + fopMsgM_setNowAlpha(&m7E8, alpha); } /* 801D39F4-801D3C6C .text titleMove__14dMenu_Option_cFv */ void dMenu_Option_c::titleMove() { - /* Nonmatching */ + float alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea + -7,0); + + float rotate_angle = m008.mUserArea + 20; + if (rotate_angle > 180.0f) { + rotate_angle -= 360.0f; + } + + if (rotate_angle < -180.0f) { + rotate_angle += 360.0f; + } + + f32 f30 = rotate_angle * (1.0f - alpha); + + if (mC80[0].mUserArea == 8) { + mDoAud_seStart(JA_SE_ITM_MENU_OPT_STR, NULL, 0, 0); + } + + float y = 1.0f - alpha; + + fopMsgM_paneTrans(&m008, 0.0f, y * -50.0f); + fopMsgM_paneTrans(&m040, 0.0f, y * -50.0f); + fopMsgM_paneTrans(&m078, 0.0f, y * -50.0f); + + m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, f30 + m008.mUserArea); + m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, f30 + m040.mUserArea); + m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, f30 + m078.mUserArea); + + fopMsgM_setNowAlpha(&m008, alpha); + fopMsgM_setNowAlpha(&m040, alpha); + fopMsgM_setNowAlpha(&m078, alpha); } /* 801D3C6C-801D3D34 .text cursorMove__14dMenu_Option_cFv */ void dMenu_Option_c::cursorMove() { - /* Nonmatching */ + short sVar2 = mB30[1].mUserArea; + + for (int i = 0; i < 6; i++) { + mB30[i].mPosCenter.x = m8C8[sVar2].mPosCenterOrig.x; + mB30[i].mPosCenter.y = m8C8[sVar2].mPosCenterOrig.y; + + mB30[i].mSize.x = m8C8[sVar2].mSizeOrig.x; + + fopMsgM_cposMove(&mB30[i]); + + J2DPane* mpPane = mB30[i].pane; + mpPane->rotate(mB30[i].mSize.x / 2.0f, mB30[i].mSize.y / 2.0f, ROTATE_Z, mpPane->getRotate()); + } + + cursorScale(); } /* 801D3D34-801D3E70 .text cursorScale__14dMenu_Option_cFv */ void dMenu_Option_c::cursorScale() { - /* Nonmatching */ + float x[2]; + float y; + + switch (mB30[1].mUserArea) { + case 0: { + x[0] = m9A8[mE3C].mPosTopLeftOrig.x - 20.0f; + x[1] = m9A8[mE3C].mPosTopLeftOrig.x + m9A8[mE3C].mSizeOrig.x + 20.0f; + y = m9A8[mE3C].mPosCenterOrig.y; + break; + } + case 3: { + x[0] = mA18[mE3E].mPosTopLeftOrig.x - 20.0f; + x[1] = mA18[mE3E].mPosTopLeftOrig.x + mA18[mE3E].mSizeOrig.x + 20.0f; + y = mA18[mE3E].mPosCenterOrig.y; + break; + } + case 2: { + x[0] = mAC0[mE3F].mPosTopLeftOrig.x - 20.0f; + x[1] = mAC0[mE3F].mPosTopLeftOrig.x + mAC0[mE3F].mSizeOrig.x + 20.0f; + y = mAC0[mE3F].mPosCenterOrig.y; + break; + } + } + + for (int i = 0; i < 2; i++) { + m858[i].mPosCenter.x = x[i]; + m858[i].mPosCenter.y = y; + fopMsgM_cposMove(&m858[i]); + } } /* 801D3E70-801D3F98 .text typeMove__14dMenu_Option_cFv */ -void dMenu_Option_c::typeMove() { - /* Nonmatching */ +void dMenu_Option_c::typeMove() { + switch (mB30[1].mUserArea) { + case 0: { + for (int i = 0; i < 2; i++) { + if(i == mE3C) { + fopMsgM_setInitAlpha(&m9A8[i]); + } + else { + fopMsgM_setNowAlphaZero(&m9A8[i]); + } + } + break; + } + case 3: { + for (int i = 0; i < 3; i++) { + if(i == mE3E) { + fopMsgM_setInitAlpha(&mA18[i]); + } + else { + fopMsgM_setNowAlphaZero(&mA18[i]); + } + } + break; + } + case 2: { + for (int i = 0; i < 2; i++) { + if(i == mE3F) { + fopMsgM_setInitAlpha(&mAC0[i]); + } + else { + fopMsgM_setNowAlphaZero(&mAC0[i]); + } + } + break; + } + } + + cursorScale(); } /* 801D3F98-801D41C4 .text yazAnime__14dMenu_Option_cFv */ void dMenu_Option_c::yazAnime() { - /* Nonmatching */ - static const u32 moveX[6] = { 0, 2, 8, 18, 8, 2}; + static const int moveX[6] = { 0, 2, 8, 18, 8, 2}; + float fVar1; + + if (m858[0].mUserArea < 10) { + fVar1 = 6.0f; + } + else { + fVar1 = -6.0f; + } + + m858[0].pane->rotate(m858[0].mSize.x / 2.0f, m858[0].mSize.y / 2.0f, ROTATE_Z, 90.0f + fVar1); + m858[1].pane->rotate(m858[1].mSize.x / 2.0f, m858[1].mSize.y / 2.0f, ROTATE_Z, 90.0f + fVar1); + + m858[0].mUserArea++; + + if(m858[1].mUserArea > 0) { + m858[1].mUserArea--; + int x = (int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea]; + int y = (int)(m858[1].mPosTopLeft.y + 0.5f); + m858[1].pane->move(x, y); + } + else if (m858[1].mUserArea < 0) { + m858[1].mUserArea++; + int x = (int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)]; + int y = (int)(m858[0].mPosTopLeft.y + 0.5f); + m858[0].pane->move(x, y); + } + + if (m858[0].mUserArea >= 20) { + m858[0].mUserArea = 0; + } } /* 801D41C4-801D428C .text ccAnime__14dMenu_Option_cFv */ void dMenu_Option_c::ccAnime() { - /* Nonmatching */ + int r29 = mB30[0].mUserArea / 7; + for (int i = 0; i < 3; i++) { + if (i == r29) { + fopMsgM_setInitAlpha(&mB30[(i*2)+0]); + fopMsgM_setInitAlpha(&mB30[(i*2)+1]); + } + else { + fopMsgM_setNowAlphaZero(&mB30[(i*2)+0]); + fopMsgM_setNowAlphaZero(&mB30[(i*2)+1]); + } + } + + mB30[0].mUserArea++; + + if (mB30[0].mUserArea >= 0x15) { + mB30[0].mUserArea = 0; + } } /* 801D428C-801D47A4 .text stickMove__14dMenu_Option_cFUc */ -void dMenu_Option_c::stickMove(u8) { - /* Nonmatching */ +void dMenu_Option_c::stickMove(u8 param_1) { + switch (param_1) { + case 4: { + if (mB30[1].mUserArea > 0) { + mB30[1].mUserArea--; + if (mB30[1].mUserArea == 1) { + mB30[1].mUserArea = 0; + } + cursorMove(); + noteSet(); + mDoAud_seStart(JA_SE_ITM_MENU_CURSOR, NULL, 0, 0); + } + break; + } + case 8: { + if (mB30[1].mUserArea < 3) { + mB30[1].mUserArea++; + if (mB30[1].mUserArea == 1) { + mB30[1].mUserArea = 2; + } + cursorMove(); + noteSet(); + mDoAud_seStart(JA_SE_ITM_MENU_CURSOR, NULL, 0, 0); + } + break; + } + case 2: { + switch (mB30[1].mUserArea) { + case 0: { + if (mE3C) { + mE3C = 0; + } + else { + mE3C = 1; + } + m858[1].mUserArea = 6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + break; + } + case 1: { + if (mE3D) { + mE3D = 0; + } + else { + mE3D = 1; + } + m858[1].mUserArea = 6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + ; + break; + } + case 3: { + if (mE3E < 2) { + mE3E++; + } + else { + mE3E = 0; + } + m858[1].mUserArea = 6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); + break; + } + case 2: { + if ((JUTGamePad::sRumbleSupported & 0x80000000) != 0) { + if (mE3F) { + mE3F = 0; + } + else { + mE3F = 1; + g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); + } + m858[1].mUserArea = 6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + } + break; + } + } + typeMove(); + break; + } + case 1: { + switch (mB30[1].mUserArea) { + case 0: { + if (mE3C) { + mE3C = 0; + } + else { + mE3C = 1; + } + m858[1].mUserArea = -6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + break; + } + case 1: { + if (mE3D) { + mE3D = 0; + } + else { + mE3D = 1; + } + m858[1].mUserArea = -6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + break; + } + case 3: { + if (mE3E) { + mE3E--; + } + else { + mE3E = 2; + } + m858[1].mUserArea = -6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); + break; + } + case 2: { + if ((JUTGamePad::sRumbleSupported & 0x80000000) != 0) { + if (mE3F) { + mE3F = 0; + } + else { + mE3F = 1; + g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); + } + m858[1].mUserArea = -6; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); + } + break; + } + } + typeMove(); + break; + } + } } /* 801D47A4-801D4C00 .text noteSet__14dMenu_Option_cFv */ void dMenu_Option_c::noteSet() { - /* Nonmatching */ + /* Nonmatching - heavily inlined, Ghidra output isn't helpful */ + fopMsgM_itemMsgGet_c msgGet; + fopMsgM_msgDataProc_c msgDataProc; + + strcpy(mD38, ""); + strcpy(mD3C, ""); + strcpy(mD40, ""); + strcpy(mD44, ""); + + outFontInit(); + + float fVar1 = m740[0].pane[1].mBounds.getHeight(); + float fVar2 = m740[1].pane[1].mBounds.getHeight(); + + mesg_header* head_p = msgGet.getMesgHeader(0x262); + + JUT_ASSERT(0x313, head_p); + + const char* mesg = msgGet.getMessage(head_p); + mesg_entry msg_entry = msgGet.getMesgEntry(head_p); + + msgDataProc.dataInit(); + + msgDataProc.stringLength(); + msgDataProc.stringShift(); + msgDataProc.iconIdxRefresh(); + + msgDataProc.stringSet(); + + ((J2DTextBox*)m740[0].pane)->setString(mD38); + ((J2DTextBox*)m740[1].pane)->setString(mD3C); + + for (int i = 0; i < 0xf; i++) { + if(m0B0[i].mUserArea == -1) { + m0B0[i].mPosTopLeft.x = m740[0].mPosTopLeft.x; + m0B0[i].mPosTopLeftOrig.x = m740[0].mPosTopLeftOrig.x; + + m0B0[i].mPosTopLeft.y = m740[0].mPosTopLeft.y; + m0B0[i].mPosTopLeftOrig.y = m740[0].mPosTopLeftOrig.y; + + fopMsgM_outFontSet((J2DPicture*)&m0B0[i], &m0B0[i].mUserArea, 0, 0); + } + } } /* 801D4C00-801D4C88 .text outFontInit__14dMenu_Option_cFv */ void dMenu_Option_c::outFontInit() { - /* Nonmatching */ + for (int i = 0; i < 15; i++) { + m0B0[i].mUserArea = -1; + m0B0[i].pane->rotate(0.0f); + fopMsgM_setNowAlphaZero(&m0B0[i]); + } } /* 801D4C88-801D4D74 .text outFontMove__14dMenu_Option_cFv */ -void dMenu_Option_c::outFontMove() { - /* Nonmatching */ +void dMenu_Option_c::outFontMove() { + for (int i = 0; i < 15; i++) { + if (m0B0[i].mUserArea != -1) { + m3F8[i].mPosTopLeft.x = m0B0[i].mPosTopLeft.x + (m740[0].mPosTopLeft.x + (m820.mPosTopLeft.x + m7B0.mPosTopLeft.x)); + m3F8[i].mPosTopLeft.y = m0B0[i].mPosTopLeft.y + (m740[0].mPosTopLeft.y + (m820.mPosTopLeft.y + m7B0.mPosTopLeft.y)); + + f32 rotation_offset_x = m820.mPosCenter.x - m3F8[i].mPosTopLeft.x; + f32 rotation_offset_y = m820.mPosCenter.y - m3F8[i].mPosTopLeft.y; + m3F8[i].pane->rotate(rotation_offset_x, rotation_offset_y, ROTATE_Z, m820.pane->mRotation); + } + else { + fopMsgM_setNowAlphaZero(&m0B0[i]); + } + } } /* 801D4D74-801D4E34 .text outFontDraw__14dMenu_Option_cFv */ void dMenu_Option_c::outFontDraw() { - /* Nonmatching */ + for (int i = 0; i < 15; i++) { + if (m0B0[i].mUserArea != -1) { + m0B0[i].mNowAlpha = m740[0].pane->getAlpha(); + fopMsgM_outFontDraw2((J2DPicture*)m0B0[i].pane, (J2DPicture*)m3F8[i].pane, m3F8[i].mPosTopLeft.x, m3F8[i].mPosTopLeft.y, 0x19, 0x19, &m0B0[i].mUserArea, m0B0[i].mNowAlpha, m0B0[i].mPosTopLeftOrig.y); + } + else { + fopMsgM_setAlpha(&m0B0[i]); + } + } } /* 801D4E34-801D505C .text stringlength__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { - /* Nonmatching */ +f32 dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { + /* Nonmatching - also heavily inlined */ } /* 801D505C-801D50A0 .text changeScaleCenter__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class*, char*) { - /* Nonmatching */ +void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class* param_1, char* i_str) { + f32 str_length = stringlength(param_1, i_str); + + param_1->mSize.x = str_length; + param_1->mSizeOrig.x = str_length; + + fopMsgM_cposMove(param_1); + + param_1->mPosTopLeftOrig.x = param_1->mPosTopLeft.x; } /* 801D50A0-801D50E8 .text setSoundMode__14dMenu_Option_cFUl */ -void dMenu_Option_c::setSoundMode(u32) { - /* Nonmatching */ +void dMenu_Option_c::setSoundMode(u32 i_soundMode) { + switch(i_soundMode) { + case 0: + OSSetSoundMode(0); + break; + case 1: + case 2: + OSSetSoundMode(1); + break; + default: + break; + } } /* 801D50E8-801D5148 .text changeScaleRight__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class*, char*) { - /* Nonmatching */ +void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class* param_1, char* i_str) { + float str_length = stringlength(param_1, i_str); + float str_pos = (param_1->mPosTopLeft.x + param_1->mSize.x); + + param_1->mSize.x = str_length; + param_1->mSizeOrig.x = str_length; + + float new_str_pos = str_pos - param_1->mSize.x / 2.0f; + + param_1->mPosCenter.x = new_str_pos; + param_1->mPosCenterOrig.x = new_str_pos; + + fopMsgM_cposMove(param_1); } /* 801D5148-801D5224 .text initialize__14dMenu_Option_cFv */ void dMenu_Option_c::initialize() { - /* Nonmatching */ + mainInit(); + + noteInit(); + + titleInit(); + + outFontInit(); + + mE40 = 1; + + mCF0.mUserArea = 0; + m7B0.mUserArea = 0; + + mC80[0].mUserArea = 0; + mC80[1].mUserArea = 0; + + mE3C = dComIfGs_getOptAttentionType(); + mE3D = dComIfGs_getOptRuby(); + mE3E = dComIfGs_getOptSound(); + + if ((JUTGamePad::sRumbleSupported & 0x80000000)) { + mE3F = dComIfGp_getNowVibration(); + } + else { + mE3F = 0; + } + + mE41 = 0; + + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); } /* 801D5224-801D53F0 .text _create__14dMenu_Option_cFv */ void dMenu_Option_c::_create() { - /* Nonmatching */ + /* Nonmatching - Code 100% */ scrn = new J2DScreen(); JUT_ASSERT(1074, scrn != NULL); scrn->set("option.blo", mpArchive); @@ -247,25 +756,253 @@ void dMenu_Option_c::_create() { /* 801D53F0-801D546C .text _delete__14dMenu_Option_cFv */ void dMenu_Option_c::_delete() { - /* Nonmatching */ + mpArchive->removeResourceAll(); + delete scrn; + delete stick; + mDoHIO_deleteChild(g_moHIO.mNo); } /* 801D546C-801D576C .text _move__14dMenu_Option_cFv */ void dMenu_Option_c::_move() { - /* Nonmatching */ + u8 check_trigger = stick->checkTrigger(); + + if (mE3F) { + if ((JUTGamePad::sRumbleSupported & 0x80000000U) == 0) { + mE3F = 0; + + for(int i = 0; i < 2; i++) { + if (i == mE3F) { + fopMsgM_setInitAlpha(&mAC0[i]); + } + else { + fopMsgM_setNowAlphaZero(&mAC0[i]); + } + } + + cursorScale(); + } + } + + if (CPad_CHECK_TRIG_A(0) && + !CPad_CHECK_TRIG_START(0) && + !CPad_CHECK_TRIG_B(0) && + !CPad_CHECK_TRIG_UP(0) && + !CPad_CHECK_TRIG_DOWN(0) && + !CPad_CHECK_TRIG_LEFT(0) && + !CPad_CHECK_TRIG_RIGHT(0) + ) { + mE40 = 3; + + mC80[0].mUserArea = 0; + + mE41 = 1; + + dComIfGs_setOptAttentionType(mE3C); + dComIfGs_setOptRuby(mE3D); + + if (JUTGamePad::sRumbleSupported & 0x80000000) { + dComIfGs_setOptVibration(mE3F); + } + + dComIfGp_setNowVibration(mE3F); + dComIfGs_setOptSound(mE3E); + + mDoAud_seStart(JA_SE_ITM_MENU_OPT_OUT, NULL, 0); + } + else if (CPad_CHECK_TRIG_B(0) && + !CPad_CHECK_TRIG_START(0) && + !CPad_CHECK_TRIG_A(0) && + !CPad_CHECK_TRIG_UP(0) && + !CPad_CHECK_TRIG_DOWN(0) && + !CPad_CHECK_TRIG_LEFT(0) && + !CPad_CHECK_TRIG_RIGHT(0) + ) { + mE40 = 3; + mE41 = 1; + mC80[0].mUserArea = 0; + mDoAud_seStart(JA_SE_ITM_MENU_OPT_OUT, NULL, 0); + } + else { + if (!check_trigger) { + m7B0.mUserArea = 0; + mC80[1].mUserArea = 0; + } + else { + if (mC80[1].mUserArea == 0) { + stickMove(check_trigger); + } + + int sVar2; + if (m7B0.mUserArea < 2) { + sVar2 = 10; + } else { + sVar2 = 4; + } + + mC80[1].mUserArea++; + + if (mC80[1].mUserArea > sVar2) { + sVar2 = m7B0.mUserArea; + + if (sVar2 < 2) { + m7B0.mUserArea = sVar2 + 1; + } + + mC80[1].mUserArea = 0; + } + } + } + + yazAnime(); + + if (mB30[1].mUserArea != 2 || JUTGamePad::sRumbleSupported & 0x80000000) + { + m858[0].pane->show(); + m858[1].pane->show(); + } + else { + m858[0].pane->hide(); + m858[1].pane->hide(); + } + + ccAnime(); + + outFontMove(); + + if (mE3D) { + m740[1].pane->hide(); + } + else { + m740[1].pane->show(); + } } /* 801D576C-801D5C04 .text _draw__14dMenu_Option_cFv */ void dMenu_Option_c::_draw() { - /* Nonmatching */ + /* Nonmatching - probably some inlining, tried using `setAlpha` and `getAlpha` but didn't work */ + if (mE41 == 0) { + fopMsgM_setAlpha(&m008); + fopMsgM_setAlpha(&m040); + fopMsgM_setAlpha(&m078); + + for (int i = 0; i < 2; i++) { + fopMsgM_setAlpha(&m740[i]); + fopMsgM_setAlpha(&m858[i]); + fopMsgM_setAlpha(&m9A8[i]); + fopMsgM_setAlpha(&mAC0[i]); + fopMsgM_setAlpha(&mC80[i]); + } + + fopMsgM_setAlpha(&m7B0); + fopMsgM_setAlpha(&m7E8); + fopMsgM_setAlpha(&m820); + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setAlpha(&m8C8[i]); + } + } + + for (int i = 0; i < 3; i++) { + fopMsgM_setAlpha(&mA18[i]); + } + + for (int i = 0; i < 6; i++) { + fopMsgM_setAlpha(&mB30[i]); + } + + fopMsgM_setAlpha(&mCF0); + } + else { + float alpha_scale = 1.0f - fopMsgM_valueIncrease(10, mC80[0].mUserArea, 0); + + m008.pane->mAlpha *= alpha_scale; + m040.pane->mAlpha *= alpha_scale; + m078.pane->mAlpha *= alpha_scale; + + for (int i = 0; i < 2; i++) { + m740[i].pane->mAlpha *= alpha_scale; + m8C8[i].pane->mAlpha *= alpha_scale; + m9A8[i].pane->mAlpha *= alpha_scale; + mAC0[i].pane->mAlpha *= alpha_scale; + mC80[i].pane->mAlpha *= alpha_scale; + } + + m7B0.pane->mAlpha *= alpha_scale; + m7E8.pane->mAlpha *= alpha_scale; + m820.pane->mAlpha *= alpha_scale; + + for (int i = 0; i < 4; i++) { + if (i != 1) { + m8C8[i].pane->mAlpha *= alpha_scale; + } + } + + for (int i = 0; i < 3; i++) { + mA18[i].pane->mAlpha *= alpha_scale; + } + + for (int i = 0; i < 6; i++) { + mAC0[i].pane->mAlpha = mB30[i].pane->mAlpha * alpha_scale; + } + + mCF0.pane->mAlpha *= alpha_scale; + } + + outFontDraw(); + + scrn->draw(0.0f, 0.0f, (J2DGrafContext*)dComIfGp_getCurrentGrafPort()); } /* 801D5C04-801D5CBC .text _open__14dMenu_Option_cFv */ -void dMenu_Option_c::_open() { - /* Nonmatching */ +bool dMenu_Option_c::_open() { + bool ret = false; + + dMenu_setPushMenuButton(0); + + if (mC80[0].mUserArea == 0) { + noteSet(); + } + + mC80[0].mUserArea++; + + if (mC80[0].mUserArea <= 7) { + mainMove(); + } + else if (mC80[0].mUserArea <= 0xe) { + noteMove(); + + titleMove(); + + _move(); + + if (mC80[0].mUserArea == 0xe) { + mE40 = 2; + + mC80[0].mUserArea = 0; + + ret = true; + } + } + + return ret; } /* 801D5CBC-801D5D38 .text _close__14dMenu_Option_cFv */ -void dMenu_Option_c::_close() { - /* Nonmatching */ +bool dMenu_Option_c::_close() { + bool ret = false; + + int value = ++mC80[0].mUserArea; + + fopMsgM_valueIncrease(10, value, 0); + + dMenu_setPushMenuButton(2); + + if (value >= 10) { + initialize(); + mE40 = 0; + ret = true; + } + + return ret; } diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index 00ebfb66b..b91c0ec47 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -36,28 +36,6 @@ struct mesg_header : JUTDataFileHeader { // first block is mesg_info }; -struct mesg_entry { - // mesg_entry() {} // fixes fopMsgM_selectMessageGet, but messes up getMesgEntry - - /* 0x00 */ u32 mDataOffs; - /* 0x04 */ u16 mMesgID; - /* 0x06 */ s16 mItemPrice; - /* 0x08 */ u16 mNextMessageID; - /* 0x0A */ u16 field_0x0a; - /* 0x0C */ u8 mTextboxType; - /* 0x0D */ u8 mDrawType; - /* 0x0E */ u8 mTextboxPosition; - /* 0x0F */ u8 mItemImage; - /* 0x10 */ u8 field_0x10; - /* 0x11 */ u8 mInitialSound; - /* 0x12 */ u8 mInitialCamera; - /* 0x13 */ u8 mInitialAnimation; - /* 0x14 */ u8 field_0x14; - /* 0x15 */ u8 field_0x15; - /* 0x16 */ u8 field_0x16; - /* 0x17 */ u8 field_0x17; -}; - struct mesg_info : JUTDataBlockHeader { /* 0x08 */ u16 mNumEntry; /* 0x0A */ u16 mEntrySize;