diff --git a/configure.py b/configure.py index a1dc1bce2..94220e853 100755 --- a/configure.py +++ b/configure.py @@ -615,7 +615,7 @@ config.libs = [ Object(NonMatching, "d/d_menu_item.cpp"), Object(NonMatching, "d/d_menu_option.cpp"), Object(NonMatching, "d/d_menu_save.cpp"), - Object(NonMatching, "d/d_menu_window.cpp"), + Object(Equivalent, "d/d_menu_window.cpp"), Object(NonMatching, "d/d_mesg.cpp"), Object(NonMatching, "d/d_message.cpp"), Object(NonMatching, "d/d_message_paper.cpp"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 61ad45a81..6fa910484 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -290,7 +290,7 @@ public: mPlayerInfo[idx].mpPlayer = player; mPlayerInfo[idx].mCameraID = cam; } - + fopAc_ac_c* getPlayerPtr(int idx) { return (fopAc_ac_c*)mpPlayerPtr[idx]; } void setPlayerPtr(int idx, fopAc_ac_c* playerPtr) { mpPlayerPtr[idx] = playerPtr; } int getCameraPlayer1ID(int i) { return mCameraInfo[i].mCamP1Id; } @@ -304,6 +304,20 @@ public: } void startItemTimer() { mStartItemTimer = true; } + void decItemTimer() { + if (mStartItemTimer != true) { + return; + } + + if (mItemTimer > 0) { + mItemTimer--; + + return; + } + + resetItemTimer(0); + } + int getMessageRupee() { return mMessageRupee; } void setMessageRupee(s16 count) { mMessageRupee = count; } @@ -365,7 +379,10 @@ public: int getTimerLimitTimeMs() { return mTimerInfo.mTimerLimitTimeMs; } void setWaveFrame(u16 frame) { mTimerInfo.mWaveFrame = frame; } u16 getWaveFrame() { return mTimerInfo.mWaveFrame; } - void fmapOpenOn() { mFmapOpen = true; } + + u8 fmapOpenCheck() { return mFmapOpen; } + void fmapOpenOn() { mFmapOpen = 1; } + void fmapOpenOff() { mFmapOpen = 0; } s16 getItemMagicCount() { return mItemMagicCount; } void setItemMagicCount(s16 magic) { mItemMagicCount += magic; } @@ -453,6 +470,7 @@ public: void setDoStatusForce(u8 value) { mDoStatusForce = value; } u8 getPictureStatus() { return mPictureStatus; } + void setPictureStatus(u8 status) { mPictureStatus = status; } void setPictureStatusOn() { mPictureStatus = 2; } void setPictureStatusGetOn(u8 to_set) { mPictureStatus = 3; @@ -522,13 +540,18 @@ public: void setLkDArc(JKRArchive * pArc) { mpLkDArc = pArc; } void setFmapArchive(JKRArchive * pArc) { mpFmapArchive = pArc; } void setItemResArchive(JKRArchive * pArc) { mpItemResArchive = pArc; } + JKRArchive* getItemResArchive() { return mpItemResArchive; } void setCollectResArchive(JKRArchive * pArc) { mpCollectResArchive = pArc; } + JKRArchive* getCollectResArchive() { return mpCollectResArchive; } void setFmapResArchive(JKRArchive * pArc) { mpFmapResArchive = pArc; } void setDmapResArchive(JKRArchive * pArc) { mpDmapResArchive = pArc; } + JKRArchive* getDmapResArchive() { return mpDmapResArchive; } void setOptionResArchive(JKRArchive * pArc) { mpOptionResArchive = pArc; } + JKRArchive* getOptionResArchive() { return mpOptionResArchive; } JKRArchive* getClothResArchive() { return mpClothResArchive; } void setClothResArchive(JKRArchive * pArc) { mpClothResArchive = pArc; } void setSaveResArchive(JKRArchive * pArc) { mpSaveResArchive = pArc; } + JKRArchive* getSaveResArchive() { return mpSaveResArchive; } void setItemIconArchive(JKRArchive * pArc) { mpItemIconArchive = pArc; } JKRArchive* getItemIconArchive() { return mpItemIconArchive; } void setNameResArchive(JKRArchive * pArc) { mpNameResArchive = pArc; } @@ -616,10 +639,14 @@ public: u8 getDirection() { return mDirection; } void setDirection(u8 direction) { mDirection = direction; } + bool isMenuCollect() { return mMenuCollect; } void onMenuCollect() { mMenuCollect = true; } + void offMenuCollect() { mMenuCollect = false; } - void nameOpenOn() { field_0x4952 = 2; } - u8 nameOpenCheck() { return field_0x4952; } + void nameOpenOn() { mNameOpen = 2; } + void nameOpenChangeOff() { mNameOpen = 1; } + void nameOpenCancelOff() { mNameOpen = 0; } + u8 nameOpenCheck() { return mNameOpen; } /* 0x0000 */ dBgS mBgS; /* 0x1404 */ dCcS mCcS; @@ -750,8 +777,8 @@ public: /* 0x4949 */ u8 mMesgCancelButton; /* 0x494A */ u8 field_0x494a[6]; /* 0x4950 */ u8 mMelodyNum; - /* 0x4951 */ bool mFmapOpen; - /* 0x4952 */ u8 field_0x4952; + /* 0x4951 */ u8 mFmapOpen; + /* 0x4952 */ u8 mNameOpen; /* 0x4953 */ u8 field_0x4953; /* 0x4954 */ u8 field_0x4954; /* 0x4955 */ bool mStartItemTimer; @@ -759,7 +786,7 @@ public: /* 0x4957 */ u8 mPlacenameIndex; /* 0x4958 */ u8 mPlacenameState; /* 0x4959 */ u8 mGameoverStatus; - /* 0x495A */ u8 mMenuCollect; + /* 0x495A */ bool mMenuCollect; /* 0x495B */ u8 mPictureFlag; /* 0x495C */ u8 mPictureResult; /* 0x495D */ u8 mPictureResultDetail; @@ -897,7 +924,7 @@ inline void dComIfGp_resetItemTimer(s16 timer) { } inline void dComIfGp_decItemTimer() { - // TODO + g_dComIfG_gameInfo.play.decItemTimer(); } inline int dComIfGp_getMessageRupee() { @@ -2639,10 +2666,18 @@ inline void dComIfGp_clearPlayerStatus1(int param_0, u32 flag) { g_dComIfG_gameInfo.play.clearPlayerStatus(param_0, 1, flag); } +inline bool dComIfGp_isMenuCollect() { + return g_dComIfG_gameInfo.play.isMenuCollect(); +} + inline void dComIfGp_onMenuCollect() { g_dComIfG_gameInfo.play.onMenuCollect(); } +inline void dComIfGp_offMenuCollect() { + g_dComIfG_gameInfo.play.offMenuCollect(); +} + /** * Returns which item is on a specific button. * @param i_itemBtn The dItemButton_e of the button. @@ -2845,6 +2880,10 @@ inline u8 dComIfGp_getPictureStatus() { return g_dComIfG_gameInfo.play.getPictureStatus(); } +inline void dComIfGp_setPictureStatus(u8 status) { + g_dComIfG_gameInfo.play.setPictureStatus(status); +} + inline void dComIfGp_setPictureStatusOn() { g_dComIfG_gameInfo.play.setPictureStatusOn(); } @@ -3269,6 +3308,10 @@ inline u8 dComIfGp_event_getTactFreeCStick(int which) { return g_dComIfG_gameInfo.play.getEvent()->getTactFreeCStick(which); } +inline void dComIfGp_event_photoCheck() { + g_dComIfG_gameInfo.play.getEvent()->photoCheck(); +} + inline bool dComIfGp_getMetronome() { return g_dComIfG_gameInfo.play.getMetronome(); } @@ -3659,13 +3702,18 @@ inline JKRArchive* dComIfGp_getRubyArchive() { return g_dComIfG_gameInfo.play.ge inline void dComIfGp_setLkDArc(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setLkDArc(pArc); } inline void dComIfGp_setFmapArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFmapArchive(pArc); } inline void dComIfGp_setItemResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setItemResArchive(pArc); } +inline JKRArchive* dComIfGp_getItemResArchive() { return g_dComIfG_gameInfo.play.getItemResArchive(); } inline void dComIfGp_setCollectResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setCollectResArchive(pArc); } +inline JKRArchive* dComIfGp_getCollectResArchive() { return g_dComIfG_gameInfo.play.getCollectResArchive(); } inline void dComIfGp_setFmapResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFmapResArchive(pArc); } inline void dComIfGp_setDmapResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setDmapResArchive(pArc); } +inline JKRArchive* dComIfGp_getDmapResArchive() { return g_dComIfG_gameInfo.play.getDmapResArchive(); } inline void dComIfGp_setOptionResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setOptionResArchive(pArc); } +inline JKRArchive* dComIfGp_getOptionResArchive() { return g_dComIfG_gameInfo.play.getOptionResArchive(); } inline JKRArchive* dComIfGp_getClothResArchive() { return g_dComIfG_gameInfo.play.getClothResArchive(); } inline void dComIfGp_setClothResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setClothResArchive(pArc); } inline void dComIfGp_setSaveResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setSaveResArchive(pArc); } +inline JKRArchive* dComIfGp_getSaveResArchive() { return g_dComIfG_gameInfo.play.getSaveResArchive(); } inline void dComIfGp_setItemIconArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setItemIconArchive(pArc); } inline JKRArchive* dComIfGp_getItemIconArchive() { return g_dComIfG_gameInfo.play.getItemIconArchive(); } inline void dComIfGp_setNameResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setNameResArchive(pArc); } @@ -4099,7 +4147,10 @@ inline int dComIfG_getTimerNowTimeMs() { return g_dComIfG_gameInfo.play.getTimer inline void dComIfGp_setWaveFrame(u16 frame) { g_dComIfG_gameInfo.play.setWaveFrame(frame); } inline u16 dComIfGp_getWaveFrame() { return g_dComIfG_gameInfo.play.getWaveFrame(); } +inline u8 dComIfGp_fmapOpenCheck() { return g_dComIfG_gameInfo.play.fmapOpenCheck(); } inline void dComIfGp_fmapOpenOn() { g_dComIfG_gameInfo.play.fmapOpenOn(); } +inline void dComIfGp_fmapOpenOff() { g_dComIfG_gameInfo.play.fmapOpenOff(); } + inline int dComIfG_getTimerRestTimeMs() { int limit = g_dComIfG_gameInfo.play.getTimerLimitTimeMs(); @@ -4136,12 +4187,17 @@ BOOL dComIfG_resetToOpening(scene_class* i_scene); int dComIfG_changeOpeningScene(scene_class* i_scene, s16 i_procName); +inline u8 dComIfGp_InputPasswordOpenCheck() { + return g_dComIfG_gameInfo.play.nameOpenCheck(); +} inline void dComIfGp_InputPasswordOpenOn() { g_dComIfG_gameInfo.play.nameOpenOn(); } - -inline u8 dComIfGp_InputPasswordOpenCheck() { - return g_dComIfG_gameInfo.play.nameOpenCheck(); +inline void dComIfGp_InputPasswordOpenChangeOff() { + g_dComIfG_gameInfo.play.nameOpenChangeOff(); +} +inline void dComIfGp_InputPasswordOpenCancelOff() { + g_dComIfG_gameInfo.play.nameOpenCancelOff(); } inline char* dComIfGp_getInputPassword() { diff --git a/include/d/d_menu_base.h b/include/d/d_menu_base.h new file mode 100644 index 000000000..64dd5b0e6 --- /dev/null +++ b/include/d/d_menu_base.h @@ -0,0 +1,17 @@ +#ifndef D_MENU_BASE_H +#define D_MENU_BASE_H + +#include "d/d_drawlist.h" + +class dMenu_base_c : public dDlst_base_c { +public: + virtual void draw() {} + virtual void _create() {} + virtual void _delete() {} + virtual void _move() {} + virtual void _draw() {} + virtual bool _open() = 0; + virtual bool _close() = 0; +}; + +#endif //D_MENU_BASE_H diff --git a/include/d/d_menu_capture.h b/include/d/d_menu_capture.h new file mode 100644 index 000000000..a8863f169 --- /dev/null +++ b/include/d/d_menu_capture.h @@ -0,0 +1,117 @@ +#ifndef D_MENU_CAPTURE_H +#define D_MENU_CAPTURE_H + +#include "d/d_drawlist.h" +#include "d/d_menu_cloth.h" +#include "d/d_menu_item.h" +#include "f_ap/f_ap_game.h" +#include "m_Do/m_Do_graphic.h" +#include "JSystem/J2DGraph/J2DOrthoGraph.h" + + +extern dMCloth_c* cloth_c; + +class dDlst_MENU_CLOTH_c : public dDlst_base_c { +public: + virtual ~dDlst_MENU_CLOTH_c() {} + + virtual void draw() { + Mtx44 mtx; + + const view_port_class* viewport = dComIfGp_getCurrentViewport(); + const f32 aspect = viewport->mWidth / viewport->mHeight; + C_MTXPerspective(mtx, 30.0f, aspect * g_HIO.mAspectRatio, 1.0f, 100000.0f); + + GXSetProjection(mtx, GX_PERSPECTIVE); + + GXColor clothColor = g_miHIO.mClothColor; + GXColor shadowColor = g_miHIO.mShadowColor; + + cloth_c->draw(0.0f, clothColor, shadowColor, 1); + + dComIfGp_getCurrentGrafPort()->setPort(); + } +}; + +class dDlst_MENU_CAPTURE_c : public dDlst_base_c { +public: + virtual void draw() { + if (checkDrawFlag() == 1) { + setDrawFlagOn2(); + GXSetTexCopySrc(0, 0, 0x280, 0x1e0); + GXSetTexCopyDst(0x140, 0xf0, GXTexFmt(mDoGph_gInf_c::mFrameBufferTimg->format), 1); + GXCopyTex(mDoGph_gInf_c::mFrameBufferTex, 0); + GXPixModeSync(); + } else { + GXSetTexCopySrc(0, 0, 0x280, 0x1e0); + GXSetTexCopyDst(0x140, 0xf0, GX_TF_RGB565, 1); + GXCopyTex(mDoGph_gInf_c::mZbufferTex, 0); + GXPixModeSync(); + GXTexObj tex_obj; + GXInitTexObj(&tex_obj, mDoGph_gInf_c::mFrameBufferTex, 0x140, 0xf0, GXTexFmt(mDoGph_gInf_c::mFrameBufferTimg->format), GX_CLAMP, GX_CLAMP, false); + GXInitTexObjLOD(&tex_obj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1); + GXLoadTexObj(&tex_obj, GX_TEXMAP0); + GXSetNumChans(0); + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY); + GXSetNumTevStages(1); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetZCompLoc(1); + GXSetZMode(false, GX_ALWAYS, false); + GXSetBlendMode(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_OR); + GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0); + GXColor local_68 = g_clearColor; + GXSetFog(GX_FOG_NONE, 0.0, 0.0, 0.0, 0.0, local_68); + GXSetFogRangeAdj(false, 0, NULL); + GXSetCullMode(GX_CULL_NONE); + GXSetDither(1); + Mtx44 mtx; + C_MTXOrtho(mtx, 0.0, 1.0, 0.0, 1.0, 0.0, 10.0); + GXSetProjection(mtx, GX_ORTHOGRAPHIC); + GXLoadPosMtxImm(mDoMtx_getIdentity(), 0); + GXSetCurrentMtx(0); + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_S8, 0); + + { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + GXPosition3s8(0, 0, -5); + GXTexCoord2s8(0, 0); + + GXPosition3s8(1, 0, -5); + GXTexCoord2s8(1, 0); + + GXPosition3s8(1, 1, -5); + GXTexCoord2s8(1, 1); + + GXPosition3s8(0, 1, -5); + GXTexCoord2s8(0, 1); + + GXEnd(); + } + } + } + + virtual ~dDlst_MENU_CAPTURE_c() {} + + dDlst_MENU_CAPTURE_c() { setDrawFlagOff(); } + + u8 checkDrawFlag() { return mStatus; } + void setDrawFlagOff() { mStatus = 0; } + void setDrawFlagOn() { mStatus = 1; } + void setDrawFlagOn2() { mStatus = 2; } + +public: + /* 0x04 */ u8 mStatus; +}; + +#endif //D_MENU_CAPTURE_H diff --git a/include/d/d_menu_collect.h b/include/d/d_menu_collect.h index 8b33a2ad9..4430a872a 100644 --- a/include/d/d_menu_collect.h +++ b/include/d/d_menu_collect.h @@ -4,32 +4,48 @@ #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" +#include "d/d_menu_base.h" +#include "f_op/f_op_msg_mng.h" struct fopMsgM_pane_class; class JKRArchive; class JUTFont; -class dMenu_Collect_c { +class dMenu_Collect_c : public dMenu_base_c { public: + virtual void draw() {} - void alphaChange(fopMsgM_pane_class*, float) {} - void draw() {} + void alphaChange(fopMsgM_pane_class* pane, float alpha) { pane->mInitAlpha *= alpha; } void getCollectMode() {} void getNowItem() {} - void setArchive(JKRArchive*) {} - void setFont(JUTFont*, JUTFont*) {} - void setItemTexBuffer(int, void*) {} - void setMapTexBuffer(void*) {} void setNowItem(unsigned char) {} - void setOptionArchive(JKRArchive*) {} - void setQuitArchive(JKRArchive*) {} - void setSymbolTexBuffer(int, void*) {} - void setTactTexBuffer(void*) {} - void setTextArea(char*, char*, char*, char*, char*, char*) {} - void setTimer(short) {} - void setTriforceTexBuffer(int, void*) {} + + void setArchive(JKRArchive* arc) { mpArc = arc; } + void setOptionArchive(JKRArchive* arc) { mpOptArc = arc; } + void setQuitArchive(JKRArchive* arc) { mpSaveArc = arc; } + + void setFont(JUTFont* font, JUTFont* rfont) { + mFont = font; + mRFont = rfont; + } + + void setTactTexBuffer(void* ptr) { mTactTexBuffer = (ResTIMG*)ptr; } + void setMapTexBuffer(void* ptr) { mMapTexBuffer = (ResTIMG*)ptr; } + void setTriforceTexBuffer(int idx, void* ptr) { mTriforceTexBuffer[idx] = (ResTIMG*)ptr; } + void setSymbolTexBuffer(int idx, void* ptr) { mSymbolTexBuffer[idx] = ptr; } + void setItemTexBuffer(int idx, void* ptr) { mItemTexBuffer[idx] = ptr; } + + void setTextArea(char* name0, char* name1, char* note0, char* note1, char* dummy0, char* dummy1) { + name[0] = name0; + name[1] = name1; + note[0] = note0; + note[1] = note1; + dummy[0] = dummy0; + dummy[1] = dummy1; + } + + void setTimer(short timer) { mTimer = timer; } void setTriggerInfo(unsigned char) {} void screenSet(); @@ -37,7 +53,7 @@ public: void cursorAnime(); void stickDirection(unsigned char); void cursorMainMove(); - void noteCheck(); + u8 noteCheck(); void noteInit(); void noteAppear(); void noteOpen(); @@ -72,57 +88,57 @@ public: void outFontMove(); void outFontDraw(); void collectItemGetCheck(unsigned char); - void _create(); + virtual void _create(); void _create3(); - void _delete(); - void _move(); + virtual void _delete(); + virtual void _move(); void _move3(); - void _draw(); - void _open(); - void _open3(); - void _close(); - void _close3(); + virtual void _draw(); + bool _open(); + bool _open3(); + bool _close(); + bool _close3(); void animeStep1(short, short); void animeStep2(short, short); void animeStep3(short, short); void animeStep4(short, short); - void _open2(); - void _close2(); + bool _open2(); + bool _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; + /* 0x0000 */ // vtable + /* 0x0004 */ J2DScreen* m004; + /* 0x0008 */ fopMsgM_pane_class m008; + /* 0x0040 */ fopMsgM_pane_class m040; + /* 0x0078 */ fopMsgM_pane_class m078; + /* 0x00B0 */ fopMsgM_pane_class m0B0[15]; + /* 0x03F8 */ fopMsgM_pane_class m3F8[15]; + /* 0x0740 */ fopMsgM_pane_class m740; + /* 0x0778 */ fopMsgM_pane_class m778; + /* 0x07B0 */ fopMsgM_pane_class m7B0; + /* 0x07E8 */ fopMsgM_pane_class m7E8; + /* 0x0820 */ fopMsgM_pane_class m820; + /* 0x0858 */ fopMsgM_pane_class m858; + /* 0x0890 */ fopMsgM_pane_class m890; + /* 0x08C8 */ fopMsgM_pane_class m8C8; + /* 0x0900 */ fopMsgM_pane_class m900; + /* 0x0938 */ fopMsgM_pane_class m938; + /* 0x0970 */ fopMsgM_pane_class m970; + /* 0x09A8 */ fopMsgM_pane_class m9A8; + /* 0x09E0 */ fopMsgM_pane_class m9E0; + /* 0x0A18 */ fopMsgM_pane_class mA18[4]; + /* 0x0AF8 */ fopMsgM_pane_class mAF8; + /* 0x0B30 */ fopMsgM_pane_class mB30; + /* 0x0B68 */ fopMsgM_pane_class mB68[4]; + /* 0x0C48 */ fopMsgM_pane_class mC48; + /* 0x0C80 */ fopMsgM_pane_class mC80; + /* 0x0CB8 */ fopMsgM_pane_class mCB8; + /* 0x0CF0 */ fopMsgM_pane_class mCF0; + /* 0x0D28 */ fopMsgM_pane_class mD28; + /* 0x0D60 */ fopMsgM_pane_class mD60; + /* 0x0D98 */ fopMsgM_pane_class mD98; + /* 0x0DD0 */ fopMsgM_pane_class mDD0; + /* 0x0E08 */ fopMsgM_pane_class mE08[8]; + /* 0x0FC8 */ fopMsgM_pane_class mFC8; /* 0x1000 */ fopMsgM_pane_class m1000[3]; /* 0x10A8 */ fopMsgM_pane_class m10A8[3]; /* 0x1150 */ fopMsgM_pane_class m1150[11]; @@ -150,18 +166,39 @@ public: /* 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; + /* 0x2464 */ JKRArchive* mpArc; + /* 0x2468 */ JKRArchive* mpOptArc; + /* 0x246C */ JKRArchive* mpSaveArc; + /* 0x2470 */ JUTFont* mFont; + /* 0x2474 */ JUTFont* mRFont; /* 0x2478 */ J2DPane* m2478; - /* 0x247C */ u8 m247C[0x2498 - 0x247C]; - /* 0x2498 */ ResTIMG* m2498; - /* 0x249C */ ResTIMG* m249C; - /* 0x24A0 */ ResTIMG* m24A0[6]; - /* 0x24B8 */ u8 m24B8[0x27A8 - 0x24B8]; + /* 0x247C */ u8 m247C[0x2488 - 0x247C]; + /* 0x2488 */ JUtility::TColor color_2488; + /* 0x248C */ JUtility::TColor color_248C; + /* 0x2490 */ JUtility::TColor color_2490; + /* 0x2494 */ JUtility::TColor color_2494; + /* 0x2498 */ ResTIMG* mTactTexBuffer; + /* 0x249C */ ResTIMG* mMapTexBuffer; + /* 0x24A0 */ ResTIMG* mTriforceTexBuffer[8]; + /* 0x24C0 */ void* mSymbolTexBuffer[3]; + /* 0x24CC */ void* mItemTexBuffer[5]; + /* 0x24E0 */ fopMsgM_msgDataProc_c mMsgProc; + /* 0x2780 */ u8 m2780[0x27A8 - 0x2780]; /* 0x27A8 */ f32 m27A8; /* 0x27AC */ f32 m27AC; -}; + /* 0x27B0 */ char* name[2]; + /* 0x27B8 */ char* note[2]; + /* 0x27C0 */ char* dummy[2]; + /* 0x27C8 */ u8 m27C8[0x27E2 - 0x27C8]; + /* 0x27E2 */ u16 mTimer; + /* 0x27E4 */ u8 m27E4[0x27EC - 0x27E4]; + /* 0x27EC */ u8 m27EC; + /* 0x27ED */ u8 m27ED; + /* 0x27EE */ u8 mCollectMode; + /* 0x27EF */ u8 m27EF[0x27F4 - 0x27EF]; +}; // Size: 0x27F4 + +STATIC_ASSERT(sizeof(dMenu_Collect_c) == 0x27F4); class dMc_HIO_c { public: diff --git a/include/d/d_menu_dmap.h b/include/d/d_menu_dmap.h index 54d8679da..746716622 100644 --- a/include/d/d_menu_dmap.h +++ b/include/d/d_menu_dmap.h @@ -2,20 +2,31 @@ #define D_MENU_DMAP_H #include "dolphin/types.h" +#include "d/d_menu_base.h" class J2DPane; struct fopMsgM_pane_class; class JKRArchive; class JUTFont; -class dMenu_Dmap_c { +class dMenu_Dmap_c : public dMenu_base_c { public: void alphaChange(fopMsgM_pane_class*, float) {} - void draw() {} - void setArchive(JKRArchive*) {} - void setFont(JUTFont*, JUTFont*) {} + virtual void draw() {} + void setArchive(JKRArchive* arc) { mpArc = arc; } + void setFont(JUTFont* font, JUTFont* rfont) { + mFont = font; + mRFont = rfont; + } void setItemTexBuffer(int, void*) {} - void setTextArea(char*, char*, char*, char*, char*, char*) {} + void setTextArea(char* name0, char* name1, char* note0, char* note1, char* dummy0, char* dummy1) { + name[0] = name0; + name[1] = name1; + note[0] = note0; + note[1] = note1; + dummy[0] = dummy0; + dummy[1] = dummy1; + } void changeFloorTexture(J2DPane*, int); void screenSet(); @@ -28,7 +39,7 @@ public: void cursorMove(); void cursorAnime(); void noteInit(); - void noteCheck(); + bool noteCheck(); void noteAppear(); void noteOpen(); void noteClose(); @@ -45,13 +56,37 @@ public: void linkAnime(); void bossAnime(); void bossEyeAnime(); - void _create(); - void _delete(); - void _move(); - void _draw(); - void _open(); - void _close(); -}; + virtual void _create(); + virtual void _delete(); + virtual void _move(); + virtual void _draw(); + virtual bool _open(); + virtual bool _close(); + +public: + /* 0x0004 */ u8 field_0x0004[0x972 - 0x4]; + /* 0x0972 */ s16 field_0x0972; + /* 0x0974 */ u8 field_0x0974[0x14A4 - 0x974]; + /* 0x14A4 */ JKRArchive* mpArc; + /* 0x14A8 */ JUTFont* mFont; + /* 0x14AC */ JUTFont* mRFont; + /* 0x14B0 */ u8 field_0x14B0[0x14B4 - 0x14B0]; + /* 0x14B4 */ JUtility::TColor color_0x14B4; + /* 0x14B8 */ JUtility::TColor color_0x14B8; + /* 0x14BC */ JUtility::TColor color_0x14BC; + /* 0x14C0 */ JUtility::TColor color_0x14C0; + /* 0x14C4 */ JUtility::TColor color_0x14C4; + /* 0x14C8 */ JUtility::TColor color_0x14C8; + /* 0x14CC */ u8 padding_0x14CC[0x1AFC - 0x14CC]; + /* 0x1AFC */ void* arr_0x1AFC[3]; + /* 0x1B08 */ fopMsgM_msgDataProc_c mMsgProc; + /* 0x1DA8 */ char* name[2]; + /* 0x1DB0 */ char* note[2]; + /* 0x1DB8 */ char* dummy[2]; + /* 0x1DC0 */ u8 padding_0x1DC0[0x1E38 - 0x1DC0]; +}; // Size: 0x1E38 + +STATIC_ASSERT(sizeof(dMenu_Dmap_c) == 0x1E38); class dMd_HIO_c { public: diff --git a/include/d/d_menu_fmap.h b/include/d/d_menu_fmap.h index b1acbbcf4..b87312a89 100644 --- a/include/d/d_menu_fmap.h +++ b/include/d/d_menu_fmap.h @@ -3,6 +3,7 @@ #include "dolphin/types.h" #include "SSystem/SComponent/c_xyz.h" +#include "d/d_menu_fmap2.h" class JUTFont; class J2DScreen; @@ -11,9 +12,17 @@ class dMenu_FmapSv_c; struct cursorTable_t; struct aramCmapDatPat_t; +class dDlst_FMAP_c : public dDlst_base_c { +public: + virtual ~dDlst_FMAP_c() {} + virtual void draw(); +}; + class dMenu_Fmap_c { public: - void draw() {} + virtual ~dMenu_Fmap_c() {} + + void draw() { _draw(); } void getCtCurWX() {} void getCtCurWY() {} void getCtCurX() {} @@ -34,9 +43,19 @@ public: void setCtFmapZoom(unsigned char) {} void setCtZoomGridX(signed char) {} void setCtZoomGridY(signed char) {} - void setFont(JUTFont*, JUTFont*) {} - void setSvPtr(dMenu_FmapSv_c*) {} - void setTextArea_New(char*, char*, char*, char*, char*, char*) {} + void setFont(JUTFont* font, JUTFont* rfont) { + mFont = font; + mRFont = rfont; + } + void setSvPtr(dMenu_FmapSv_c* i_ptr) { fmapSv = i_ptr; } + void setTextArea_New(char* name0, char* name1, char* note0, char* note1, char* dummy0, char* dummy1) { + name[0] = name0; + name[1] = name1; + note[0] = note0; + note[1] = note1; + dummy[0] = dummy0; + dummy[1] = dummy1; + } void stopWrapBackEmitter() {} void stopWrapSpotEmitter(int) {} @@ -51,7 +70,7 @@ public: void checkMarkCheck1(); void checkMarkCheck2(); void checkMarkCheck3(); - void isFmapClose(); + bool isFmapClose(); void setPaneOnOff(J2DScreen*, unsigned long, bool); void childPaneMoveSp(fopMsgM_pane_class*, fopMsgM_pane_class*, float, float, float); void selGridMaskAlphaCtrl(short, unsigned char, unsigned char, int); @@ -92,8 +111,8 @@ public: void dispEndSalvageHugeMark(float, float); void checkDspHugeMapLink(); void checkDspHugeMapShip(); - void _open(); - void _close(); + bool _open(); + bool _close(); void _close_normalMode(); void _move(); void _draw(); @@ -123,7 +142,7 @@ public: void PaneAlphaSelvageItem(short, unsigned char); void gShipMarkAnimeInit(); void gShipMarkAnime(); - void _open_warpMode(); + bool _open_warpMode(); void init_warpMode(); void selCursorMoveWarp(); void _close_warpMode(); @@ -153,7 +172,7 @@ public: void setDspWarpBackCornerColor(float); void setWrapBackEmitter(cXyz); void setWrapSpotEmitter(int, cXyz); - void _open_fishManMode(); + bool _open_fishManMode(); void _close_fishManMode(); void init_fishManMode(); void movefishManMode(); @@ -167,14 +186,35 @@ public: void fmZoomGridLv2Out(); void fmZoomGridLv1Out(); void fmEndWait(); - void _open_wallPaper(); - void getButtonIconMode(); -}; + bool _open_wallPaper(); + u8 getButtonIconMode(); -class dDlst_FMAP_c { public: - void draw(); -}; + /* 0x0004 */ u8 padding_0x4[0x1C - 0x4]; + /* 0x001C */ dDlst_FMAP_c mDlst; + /* 0x0020 */ J2DScreen* scrn; + /* 0x0024 */ dMenu_Fmap2_c mFmap2; + /* 0x2874 */ u8 padding_0x2874[0x2878 - 0x2874]; + /* 0x2878 */ dMenu_FmapSv_c* fmapSv; + /* 0x287C */ u8 padding_0x287C[0x50D0 - 0x287C]; + /* 0x50D0 */ JUTFont* mFont; + /* 0x50D4 */ JUTFont* mRFont; + /* 0x50D8 */ u8 padding_0x50D8[0x5148 - 0x50D8]; + /* 0x5148 */ char* name[2]; + /* 0x5150 */ u8 padding_0x5150[0x5154 - 0x5150]; + /* 0x5154 */ char* note[2]; + /* 0x515C */ char* dummy[2]; + /* 0x5164 */ u8 padding_0x5164[0x5194 - 0x5164]; + /* 0x5194 */ JUtility::TColor color_0x5194; + /* 0x5198 */ JUtility::TColor color_0x5198; + /* 0x519C */ JUtility::TColor color_0x519C; + /* 0x51A0 */ JUtility::TColor color_0x51A0; + /* 0x51A4 */ JUtility::TColor color_0x51A4; + /* 0x51A8 */ JUtility::TColor color_0x51A8; + /* 0x51AC */ u8 padding_0x51AC[0x51B4 - 0x51AC]; +}; // Size: 0x51B4 + +STATIC_ASSERT(sizeof(dMenu_Fmap_c) == 0x51B4); class dMf_HIO_c { public: diff --git a/include/d/d_menu_fmap2.h b/include/d/d_menu_fmap2.h index 96f6a0bca..6a44db4e4 100644 --- a/include/d/d_menu_fmap2.h +++ b/include/d/d_menu_fmap2.h @@ -9,8 +9,22 @@ struct ResTIMG; class aramCmapDat_c; class dMenu_FmapSv_c; +class dDlst_FMAP2GS_c : public dDlst_base_c { +public: + virtual ~dDlst_FMAP2GS_c() {} + virtual void draw(); +}; + +class dDlst_FMAP2_c : public dDlst_base_c { +public: + virtual ~dDlst_FMAP2_c() {} + virtual void draw(); +}; + class dMenu_Fmap2_c { public: + virtual ~dMenu_Fmap2_c() {} + void getCmapDatPnt(int) {} void getCmapDatValue() {} void getCtActive() {} @@ -138,17 +152,22 @@ public: void isOpenCollectMapTriforce(signed char); void getCollectMapKind(signed char); void isCompleteCollectMap(signed char); -}; -class dDlst_FMAP2_c { public: - void draw(); -}; + /* 0x0004 */ u8 padding_0x4[0x1C - 0x4]; + /* 0x001C */ void* mpFmapDatPnt; + /* 0x0020 */ dDlst_FMAP2_c mDlst; + /* 0x0024 */ u8 padding_0x24[0x28 - 0x24]; + /* 0x0028 */ dDlst_FMAP2GS_c mDlstGs; + /* 0x002C */ u8 padding_0x2C[0x2820 - 0x2C]; + /* 0x2820 */ JUtility::TColor color_0x2820; + /* 0x2824 */ JUtility::TColor color_0x2824; + /* 0x2828 */ JUtility::TColor color_0x2828; + /* 0x282C */ JUtility::TColor color_0x282C; + /* 0x2830 */ u8 padding_0x2830[0x2850 - 0x2830]; +}; // Size: 0x2850? -class dDlst_FMAP2GS_c { -public: - void draw(); -}; +STATIC_ASSERT(sizeof(dMenu_Fmap2_c) == 0x2850); class dMf2_HIO_c { public: diff --git a/include/d/d_menu_fmap_sv.h b/include/d/d_menu_fmap_sv.h new file mode 100644 index 000000000..52071d1c7 --- /dev/null +++ b/include/d/d_menu_fmap_sv.h @@ -0,0 +1,66 @@ +#ifndef D_MENU_FMAP_SV_H +#define D_MENU_FMAP_SV_H + +#include "dolphin/types.h" + +class dMenu_FmapSv_c { +public: + dMenu_FmapSv_c() { + field_0x0 = 0; + field_0x1 = 0; + field_0x2 = -10; + field_0x3 = -10; + field_0x4 = -10; + field_0x5 = -10; + field_0x6 = -10; + field_0x7 = -10; + field_0x8 = 0; + field_0x9 = -1; + field_0xA = -10; + field_0xB = -10; + } + + ~dMenu_FmapSv_c() {} + + // TODO + u8 getActive() {} + void setActive(u8 val) {} + s8 getCmapSelNo() {} + void setCmapSelNo(s8 val) {} + s8 getCurX() {} + void setCurX(s8 val) {} + s8 getCurY() {} + void setCurY(s8 val) {} + s8 getCurWX() {} + void setCurWX(s8 val) {} + s8 getCurWY() {} + void setCurWY(s8 val) {} + s8 getCurHX() {} + void setCurHX(s8 val) {} + s8 getCurHY() {} + void setCurHY(s8 val) {} + u8 getDispMode() {} + void setDispMode(u8 val) {} + u8 getFmapZoom() {} + void setFmapZoom(u8 val) {} + s8 getZoomGridX() {} + void setZoomGridX(s8 val) {} + s8 getZoomGridY() {} + void setZoomGridY(s8 val) {} + +public: + /* 0x0 */ s8 field_0x0; + /* 0x1 */ s8 field_0x1; + /* 0x2 */ s8 field_0x2; + /* 0x3 */ s8 field_0x3; + /* 0x4 */ s8 field_0x4; + /* 0x5 */ s8 field_0x5; + /* 0x6 */ s8 field_0x6; + /* 0x7 */ s8 field_0x7; + /* 0x8 */ s8 field_0x8; + /* 0x9 */ s8 field_0x9; + /* 0xA */ s8 field_0xA; + /* 0xB */ s8 field_0xB; +}; + +#endif //D_MENU_FMAP_SV_H diff --git a/include/d/d_menu_item.h b/include/d/d_menu_item.h index 2c4a028ea..afa19350c 100644 --- a/include/d/d_menu_item.h +++ b/include/d/d_menu_item.h @@ -2,24 +2,35 @@ #define D_MENU_ITEM_H #include "dolphin/types.h" +#include "d/d_menu_base.h" struct fopMsgM_pane_class; class JKRArchive; class JUTFont; class J2DPane; -class dMenu_Item_c { +class dMenu_Item_c : public dMenu_base_c { public: void alphaChange(fopMsgM_pane_class*, float) {} - void draw() {} + virtual void draw() {} void getItemMode() {} void getNowItem() {} - void setArchive(JKRArchive*) {} - void setFont(JUTFont*, JUTFont*) {} + void setArchive(JKRArchive* arc) { mpArc = arc; } + void setFont(JUTFont* font, JUTFont* rfont) { + mFont = font; + mRFont = rfont; + } void setItemTexBuffer(int, void*) {} void setNowItem(unsigned char) {} void setSubItemTexBuffer(int, void*) {} - void setTextArea(char*, char*, char*, char*, char*, char*) {} + void setTextArea(char* name0, char* name1, char* note0, char* note1, char* dummy0, char* dummy1) { + name[0] = name0; + name[1] = name1; + note[0] = note0; + note[1] = note1; + dummy[0] = dummy0; + dummy[1] = dummy1; + } void setTimer(short) {} void setTriggerInfo(unsigned char) {} @@ -42,7 +53,7 @@ public: void outFontInit(); void outFontMove(); void outFontDraw(); - void noteCheck(); + u8 noteCheck(); void noteInit(); void noteAppear(); void noteOpen(); @@ -65,20 +76,86 @@ public: void recollectBossCheck(); void cornerMove(); void equipBeastItem(int); - void _create(); - void _delete(); - void _move(); - void _draw(); - void _open(); - void _close(); - void _open2(); - void _close2(); -}; + virtual void _create(); + virtual void _delete(); + virtual void _move(); + virtual void _draw(); + virtual bool _open(); + virtual bool _close(); + bool _open2(); + bool _close2(); -class dMi_HIO_c { +public: + /* 0x0004 */ u8 field_0x0004[0x2310 - 0x4]; + /* 0x2310 */ JKRArchive* mpArc; + /* 0x2314 */ JUTFont* mFont; + /* 0x2318 */ JUTFont* mRFont; + /* 0x231C */ u8 padding_0x231C[0x2320 - 0x231C]; + /* 0x2320 */ JUtility::TColor color_0x2320; + /* 0x2324 */ JUtility::TColor color_0x2324; + /* 0x2328 */ JUtility::TColor color_0x2328; + /* 0x232C */ JUtility::TColor color_0x232C; + /* 0x2330 */ u8 field_0x2330[0x2334 - 0x2330]; + /* 0x2334 */ void* arr_0x2334[21]; + /* 0x2388 */ u8 padding_0x2388[0x2394 - 0x2388]; + /* 0x2394 */ void* arr_0x2394[9]; + /* 0x23B8 */ u8 padding_0x23B8[0x23E0 - 0x23B8]; + /* 0x23E0 */ char* name[2]; + /* 0x23E8 */ char* note[2]; + /* 0x23F0 */ char* dummy[2]; + /* 0x23F8 */ u16 field_0x23F8; + /* 0x23FA */ u8 field_0x23FA[0x23FE - 0x23FA]; + /* 0x23FE */ u8 mItemMode; + /* 0x23FF */ u8 field_0x23FF; + /* 0x2400 */ u8 padding_0x2400[0x2421 - 0x2400]; + /* 0x2421 */ u8 field_0x2421; + /* 0x2422 */ u8 field_0x2422; + /* 0x2423 */ u8 field_0x2423; +}; // Size: 0x2424 + +STATIC_ASSERT(sizeof(dMenu_Item_c) == 0x2424); + +class dMi_HIO_c : public JORReflexible { public: dMi_HIO_c(); + virtual ~dMi_HIO_c() {} + + static const int ARR_SIZE = 5; + +public: + /* 0x04 */ s8 mNo; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ s16 field_0x0C; + /* 0x0E */ s16 arr_0x0E[ARR_SIZE]; + /* 0x18 */ s16 field_0x18; + /* 0x1A */ s16 arr_0x1A[ARR_SIZE]; + /* 0x24 */ s16 field_0x24; + /* 0x26 */ s16 field_0x26; + /* 0x28 */ s16 field_0x28; + /* 0x2A */ s16 field_0x2A; + /* 0x2C */ s16 field_0x2C; + /* 0x2E */ s16 field_0x2E; + /* 0x30 */ s16 field_0x30; + /* 0x32 */ s16 field_0x32; + /* 0x34 */ s16 field_0x34; + /* 0x36 */ s16 field_0x36; + /* 0x38 */ s16 field_0x38; + /* 0x3A */ s16 field_0x3A; + /* 0x3C */ s16 field_0x3C; + /* 0x3E */ s16 field_0x3E; + /* 0x40 */ s16 field_0x40; + /* 0x42 */ s16 field_0x42; + /* 0x44 */ s16 field_0x44; + /* 0x46 */ s16 field_0x46; + /* 0x48 */ s16 field_0x48; + /* 0x4A */ u8 padding_0x4A[0x4C - 0x4A]; + /* 0x4C */ JUtility::TColor mBlackColor; + /* 0x50 */ JUtility::TColor mWhiteColor; + /* 0x54 */ GXColor mClothColor; + /* 0x58 */ GXColor mShadowColor; + /* 0x5C */ u8 field_0x5C; }; +extern dMi_HIO_c g_miHIO; #endif /* D_MENU_ITEM_H */ diff --git a/include/d/d_menu_window.h b/include/d/d_menu_window.h index 619a20a21..347da562d 100644 --- a/include/d/d_menu_window.h +++ b/include/d/d_menu_window.h @@ -3,23 +3,159 @@ #include "dolphin/types.h" +class dMCloth_c; class JKRExpHeap; +class dMenu_FmapSv_c; -class sub_ms_screen_class { -public: - u8 field_0x00[0xFC - 0x00]; - JKRHeap* parentHeap_0xfc; - JKRHeap* childHeap; +enum dMw_Status { + MENU_STATE_NO_MENU = 0, + + // Item Screen + MENU_STATE_ITEM_OPEN = 1, + MENU_STATE_ITEM_OPEN_FROM_COLLECT_LEFT = 2, + MENU_STATE_ITEM_OPEN_FROM_COLLECT_RIGHT = 3, + MENU_STATE_ITEM_MOVE = 4, + MENU_STATE_ITEM_CLOSE = 5, + MENU_STATE_ITEM_TO_COLLECT_LEFT = 6, + MENU_STATE_ITEM_TO_COLLECT_RIGHT = 7, + + // Collect Screen + MENU_STATE_COLLECT_OPEN = 8, + MENU_STATE_COLLECT_OPEN_LEFT = 9, + MENU_STATE_COLLECT_OPEN_RIGHT = 10, + MENU_STATE_COLLECT_OPEN_TACT = 11, + MENU_STATE_COLLECT_OPEN_ALT = 12, + MENU_STATE_COLLECT_MOVE = 13, + MENU_STATE_COLLECT_MOVE_TACT = 14, + MENU_STATE_COLLECT_MOVE_ALT = 15, + MENU_STATE_COLLECT_CLOSE = 16, + MENU_STATE_COLLECT_TO_ITEM_LEFT = 17, + MENU_STATE_COLLECT_TO_ITEM_RIGHT = 18, + MENU_STATE_COLLECT_CLOSE_TACT = 19, + MENU_STATE_COLLECT_CLOSE_ALT = 20, + + // Field Map Screen + MENU_STATE_FMAP_OPEN = 21, + MENU_STATE_FMAP_OPEN_WARP_MODE = 22, + MENU_STATE_FMAP_OPEN_WALLPAPER = 23, + MENU_STATE_FMAP_OPEN_FISHMAN_MODE = 24, + MENU_STATE_FMAP_MOVE = 25, + MENU_STATE_FMAP_MOVE_WARP_MODE = 26, + MENU_STATE_FMAP_MOVE_WALLPAPER = 27, + MENU_STATE_FMAP_MOVE_FISHMAN_MODE = 28, + MENU_STATE_FMAP_CLOSE = 29, + + // Dungeon Map Screen + MENU_STATE_DMAP_OPEN = 30, + MENU_STATE_DMAP_MOVE = 31, + MENU_STATE_DMAP_CLOSE = 32, + + // Name Entry Screen + MENU_STATE_NAME_OPEN = 33, + MENU_STATE_NAME_MOVE = 34, + MENU_STATE_NAME_CLOSE = 35, + + // Save Screen + MENU_STATE_SAVE_OPEN = 36, + MENU_STATE_SAVE_MOVE = 37, + MENU_STATE_SAVE_CLOSE = 38, }; -class dMw_HIO_c { +class sub_ms_screen_class : public msg_class { +public: + /* 0x00FC */ JKRHeap* parentHeap_0xfc; + /* 0x0100 */ JKRHeap* childHeap; + /* 0x0104 */ JKRArchive* arc; + /* 0x0108 */ fpc_ProcID mMsgID; + /* 0x010C */ char* name[2]; + /* 0x0114 */ char* note[2]; + /* 0x011C */ char* dummy[2]; + /* 0x0124 */ u8 field_0x124[0x128 - 0x124]; + /* 0x0128 */ void* buffer_p[33]; + /* 0x01AC */ char* title_p; + /* 0x01B0 */ u16 field_0x1B0; + /* 0x01B2 */ u8 field_0x1B2; + /* 0x01B3 */ u8 field_0x1B3[0x1B5 - 0x1B3]; + /* 0x01B5 */ u8 mMenuProc; // dMw_Status + /* 0x01B6 */ u8 mButtonsPressed; +}; + +class dMw_HIO_c : public JORReflexible { public: dMw_HIO_c(); + virtual ~dMw_HIO_c() {} + + /* 0x04 */ s8 mNo; + /* 0x06 */ u16 field_0x06; + /* 0x08 */ u16 field_0x08; + /* 0x0A */ u8 field_0x0A; + /* 0x0B */ u8 field_0x0B; + /* 0x0C */ u16 field_0x0C; + /* 0x0E */ u16 field_0x0E; + /* 0x10 */ u8 field_0x10; + /* 0x11 */ u8 field_0x11; + /* 0x12 */ u16 field_0x12; + /* 0x14 */ u16 field_0x14; + /* 0x16 */ u8 field_0x16; + /* 0x17 */ u8 field_0x17; + /* 0x18 */ u16 field_0x18; + /* 0x1A */ u16 field_0x1A; + /* 0x1C */ u8 field_0x1C; + /* 0x1D */ u8 field_0x1D; + /* 0x1E */ u8 field_0x1E; + /* 0x1F */ u8 field_0x1F; + /* 0x20 */ u8 arr_0x20[21]; + /* 0x35 */ u8 padding_0x35[0x38 - 0x35]; + /* 0x38 */ u8 arr_0x38[21]; + /* 0x4D */ u8 padding_0x4D[0x50 - 0x4D]; + /* 0x50 */ u8 arr_0x50[8]; + /* 0x58 */ u8 arr_0x58[8]; + /* 0x60 */ u8 arr_0x60[8]; + /* 0x68 */ u8 arr_0x68[8]; + /* 0x70 */ u8 arr_0x70[8]; + /* 0x78 */ u8 arr_0x78[8]; + /* 0x80 */ u8 field_0x80; + /* 0x81 */ u8 field_0x81; + /* 0x82 */ u8 field_0x82; + /* 0x83 */ u8 arr_0x83[8]; + /* 0x8B */ u8 arr_0x8B[8]; + /* 0x93 */ u8 field_0x93; + /* 0x94 */ u8 field_0x94; + /* 0x95 */ u8 field_0x95; + /* 0x96 */ u8 field_0x96; + /* 0x97 */ u8 field_0x97; + /* 0x98 */ u8 field_0x98; + /* 0x99 */ u8 field_0x99; + /* 0x9A */ u8 field_0x9A; + /* 0x9B */ u8 field_0x9B; + /* 0x9C */ u8 field_0x9C; + /* 0x9D */ u8 field_0x9D; + /* 0x9E */ u8 arr_0x9E[8]; + /* 0xA6 */ u8 arr_0xA6[8]; + /* 0xAE */ u8 padding_0xAE[0xB6 - 0xAE]; + /* 0xB6 */ u8 arr_0xB6[6]; + /* 0xBC */ u8 arr_0xBC[6]; + /* 0xC2 */ u8 arr_0xC2[8]; + /* 0xCA */ u8 arr_0xCA[8]; + /* 0xD2 */ u8 arr_0xD2[3]; + /* 0xD5 */ u8 arr_0xD5[3]; + /* 0xD8 */ u8 arr_0xD8[8]; + /* 0xE0 */ u8 arr_0xE0[8]; }; -class dMw_DHIO_c { +class dMw_DHIO_c : public JORReflexible { public: dMw_DHIO_c(); + virtual ~dMw_DHIO_c() {} + + /* 0x04 */ s8 mNo; + /* 0x05 */ u8 arr_0x05[0xC][0x10]; }; +extern dMenu_FmapSv_c dMv_CIO_c; +extern dMw_HIO_c g_mwHIO; +extern dMw_DHIO_c g_mwDHIO; + +extern dMCloth_c* cloth_c; + #endif /* D_MENU_WINDOW_H */ diff --git a/include/d/d_meter.h b/include/d/d_meter.h index 32bdb08db..9bd8b614d 100644 --- a/include/d/d_meter.h +++ b/include/d/d_meter.h @@ -546,9 +546,11 @@ public: ~dMeter_info_c() {} /* 0x00 */ u8 field_0x0; - /* 0x01 */ u8 field_0x1; + /* 0x01 */ u8 mButtonIconMode; }; +extern dMeter_info_c dMeter_Info; + enum dMeterStatus_e { dMtrStts_UNK1_e = 0x00000001, dMtrStts_UNK2_e = 0x00000002, @@ -760,6 +762,15 @@ public: /* 0x302B */ u8 field_0x302b[0x302C - 0x302B]; }; +enum MenuStatus { + MENU_STATUS_NONE = 0, + MENU_STATUS_ITEM = 1, + MENU_STATUS_COLLECT = 2, + MENU_STATUS_MAP = 3, + MENU_STATUS_NAME = 4, + MENU_STATUS_SAVE = 5, +}; + extern dMeter_map_HIO_c g_meter_mapHIO; extern dMeter_HIO_c g_meterHIO; extern dMeter_menuHIO_c g_menuHIO; @@ -771,8 +782,19 @@ void dMenu_flagSet(u8); void dMeter_mtrShow(); void dMeter_mtrHide(); + +// Use enum MenuStatus. +u8 dMenu_getMenuStatus(); +void dMenu_setMenuStatus(u8); +void dMenu_setMenuStatusOld(u8); void dMenu_setPushMenuButton(u8); +u8 dMenu_getCollectMode(); +void dMenu_setCollectMode(u8); + +u8 dMenu_getItemMode(); +void dMenu_setItemMode(u8); + void dMeter_weponChange(sub_meter_class* i_Meter); void dMeter_weponAnime(sub_meter_class* i_Meter); void dMeter_weponTrans(sub_meter_class* i_Meter); @@ -814,6 +836,8 @@ void dMeter_magicAlpha(sub_meter_class* i_Meter); void dMeter_menuLRMove(sub_meter_class* i_Meter); void dMeter_menuPlusMove(sub_meter_class* i_Meter); +bool dMeter_subWinFlag(); + void dMeter_walletChange(sub_meter_class* i_Meter); void dMeter_compassDirOpen(sub_meter_class* i_Meter); diff --git a/include/d/d_name.h b/include/d/d_name.h index ca4051676..73e55d4bf 100644 --- a/include/d/d_name.h +++ b/include/d/d_name.h @@ -6,20 +6,25 @@ class dNm_HIO_c { public: dNm_HIO_c(); + + void genMessage(JORMContext* ctx) { /* TODO */ } }; class dDlst_NameIN_c : public dDlst_base_c { + virtual ~dDlst_NameIN_c() {} void draw(); }; class dName_c { public: + dName_c() {} + virtual ~dName_c() {} + void draw() { _draw(); } int isInputEnd() { return mIsInputEnd; } char* getInputStrPtr() { return mInputStr; } void setNextNameStr(char* i_name) { strcpy(mNextNameStr, i_name); } - virtual ~dName_c() {} void _create(); void initial(); void _delete(); @@ -75,4 +80,6 @@ public: /* 0x2AD0 */ char mNextNameStr[0x2AE8 - 0x2AD0]; }; +STATIC_ASSERT(sizeof(dName_c) == 0x2AE8); + #endif /* D_NAME_H */ diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index d0e433d55..9fefb949e 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -676,6 +676,7 @@ void mDoExt_modelEntryDL(J3DModel* i_model); void mDoExt_modelTexturePatch(J3DModelData*); +JKRHeap* mDoExt_getCurrentHeap(); JKRExpHeap* mDoExt_getCommandHeap(); JKRExpHeap* mDoExt_getZeldaHeap(); JKRExpHeap* mDoExt_getGameHeap(); diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index bcb848a3d..825471e8a 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -145,7 +145,7 @@ void dComIfG_play_c::itemInit() { mMelodyNum = 0; mFmapOpen = false; - field_0x4952 = 0; + mNameOpen = 0; field_0x4953 = 0; field_0x4954 = 0; mStartItemTimer = false; diff --git a/src/d/d_menu_cloth.cpp b/src/d/d_menu_cloth.cpp index 40084ef58..e0ad3dca2 100644 --- a/src/d/d_menu_cloth.cpp +++ b/src/d/d_menu_cloth.cpp @@ -153,7 +153,7 @@ void dMCloth_c::lightSet1(cXyz) { } // This is to get the floats in the right order. -void dummy0() { +static void dummy0() { vf32 a; a = 0.0f; a = 90.0f; @@ -244,7 +244,7 @@ void dMCloth_c::cloth_init() { } // This is to get the floats in the right order. -void dummy1() { +static void dummy1() { vf32 a = 305.0f; } @@ -807,7 +807,7 @@ void dMCloth_c::draw(float, GXColor clothColor, GXColor shadowColor, unsigned ch } // This is to get the floats in the right order. -void dummy2() { +static void dummy2() { vf32 a = 0.5f; } diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index d543c4ef5..ce2ee282f 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -11,6 +11,16 @@ static dMc_HIO_c g_mcHIO; +// Number of beats in each baton song. +static const u32 tact_beat[] = { + /* Wind's Requiem */ 3, + /* Ballad of Gales */ 4, + /* Command Melody */ 4, + /* Earth God's Lyric */ 6, + /* Wind God's Aria */ 6, + /* Song of Passing */ 3, +}; + /* 8019BE8C-8019BF14 .text __ct__9dMc_HIO_cFv */ dMc_HIO_c::dMc_HIO_c() { m46 = 40; @@ -29,102 +39,149 @@ dMc_HIO_c::dMc_HIO_c() { /* 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', + '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', + 'fd00', + 'fd01', + 'fd02', + 'fd03', + 'fd04', + 'fd05', + 'fd06', + 'fd07', + 'fd08', + 'fd09', + 'fd10', + 'fd11', + 'fd12', + 'fd13', + 'fd14', }; static const u32 l_car[] = { - 'car1', 'car2', 'car3', 'car4', + 'car1', + 'car2', + 'car3', + 'car4', }; static const u32 l_tri[] = { - 'tri0', 'tri1', 'tri2', 'tri3', 'tri4', 'tri5', 'tri6', 'tri7', + 'tri0', + 'tri1', + 'tri2', + 'tri3', + 'tri4', + 'tri5', + 'tri6', + 'tri7', }; static const u32 l_sit[] = { - 'it16', 'it14', 'it15', + 'it16', + 'it14', + 'it15', }; static const u32 l_sik[] = { - 'ik16', 'ik14', 'ik15', + 'ik16', + 'ik14', + 'ik15', }; static const u32 l_ci[] = { - 'ci10', 'ci09', 'ci08', 'ci07', 'ci06', 'ci05', - 'ci04', 'ci03', 'ci02', 'ci01', 'ci00', + 'ci10', + 'ci09', + 'ci08', + 'ci07', + 'ci06', + 'ci05', + 'ci04', + 'ci03', + 'ci02', + 'ci01', + 'ci00', }; static const u32 l_htp[] = { - 'htp2', 'htp1', 'htp3', + 'htp2', + 'htp1', + 'htp3', }; static const u32 l_tit[] = { - 'it08', 'it09', 'it10', 'it11', 'it12', 'it13', + 'it08', + 'it09', + 'it10', + 'it11', + 'it12', + 'it13', }; - static const u32 l_tik[] = { - 'ik08', 'ik09', 'ik10', 'ik11', 'ik12', 'ik13' - }; + 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_cn[] = {'cn01', 'cn02', 'cn03', 'cn04', 'cn05', 'cn06'}; - static const u32 l_wn[] = { - 'wn01', 'wn02', 'wn03', 'wn04', 'wn05', 'wn06' - }; + 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_i0[] = {'i011', 'i021', 'i031', 'i041', 'i051', 'i061'}; - static const u32 l_i1[] = { - 'i012', 'i022', 'i032', 'i042', 'i052', 'i062' - }; + 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_bs[] = {'bs01', 'bs02', 'bs03', 'bs04', 'bs05', 'bs06'}; - static const u32 l_hmb[] = { - 'hmb1', 'hmb2', 'hmb3', 'hmb4', 'hmb5', 'hmb6' - }; + 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_wit[] = {'it00', 'it01', 'it02', 'it03', 'it04'}; - static const u32 l_wik[] = { - 'ik00', 'ik01', 'ik02', 'ik03', 'ik04' - }; + static const u32 l_wik[] = {'ik00', 'ik01', 'ik02', 'ik03', 'ik04'}; - static const u32 l_ip[] = { - 'ip09', 'ip07', 'ip05', 'ip03', 'ip01' - }; + static const u32 l_ip[] = {'ip09', 'ip07', 'ip05', 'ip03', 'ip01'}; static const u32 l_wk[] = { - 'wk00', 'wk01', 'wk02', 'wk03', + '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", + "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", + "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", + "sword_00.bti", + "shield_00.bti", + "gloves_00.bti", + "amulet_00.bti", + "amulet_01.bti", }; J2DPane* mPane = m004->search('ROOT'); @@ -149,31 +206,30 @@ void dMenu_Collect_c::screenSet() { m820.mUserArea = m820.pane->mRotation; - if (m820.mUserArea > 180) m820.mUserArea -= 360; + if (m820.mUserArea > 180) + m820.mUserArea -= 360; - ((J2DTextBox*)(m740).pane)->setFont(m2474); - ((J2DTextBox*)(m778).pane)->setFont(m2470); + ((J2DTextBox*)(m740).pane)->setFont(mRFont); + ((J2DTextBox*)(m778).pane)->setFont(mFont); - // Couple of functions missing here ((J2DTextBox*)(m740).pane)->setWhite(0xFFFFFFFF); - ((J2DTextBox*)(m740).pane)->setCharColor(0xFFFFFFFF); - ((J2DTextBox*)(m740).pane)->setGradColor(0xFFFFFFFF); + ((J2DTextBox*)(m740).pane)->setCharColor(0x000000FF); + ((J2DTextBox*)(m740).pane)->setGradColor(0x000000FF); ((J2DTextBox*)(m778).pane)->setWhite(0xFFFFFFFF); - ((J2DTextBox*)(m778).pane)->setCharColor(0xFFFFFFFF); - ((J2DTextBox*)(m778).pane)->setGradColor(0xFFFFFFFF); - + ((J2DTextBox*)(m778).pane)->setCharColor(0x000000FF); + ((J2DTextBox*)(m778).pane)->setGradColor(0x000000FF); fopMsgM_setPaneData(&m858, m004, 'wd'); - ((J2DTextBox*)(m858).pane)->setFont(m2470); + ((J2DTextBox*)(m858).pane)->setFont(mFont); - m2460->setPane(m2470, &m858, &m008, &m040, &m078); + m2460->setPane(mFont, &m858, &m008, &m040, &m078); fopMsgM_setPaneData(&m890, m004, 'nm00'); - ((J2DTextBox*)(m890).pane)->setFont(m2470); + ((J2DTextBox*)(m890).pane)->setFont(mFont); fopMsgM_setPaneData(&m8C8, m004, 'nm01'); - ((J2DTextBox*)(m8C8).pane)->setFont(m2470); + ((J2DTextBox*)(m8C8).pane)->setFont(mFont); fopMsgM_setPaneData(&m900, m004, 'itnm'); fopMsgM_setPaneData(&m938, m004, 'itnk'); @@ -181,17 +237,17 @@ void dMenu_Collect_c::screenSet() { fopMsgM_setPaneData(&m9A8, m004, 'tl00'); fopMsgM_setPaneData(&m9E0, m004, 'tk00'); - for(int i = 0; i < 4; i++) { + 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++) { + 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'); @@ -200,61 +256,60 @@ void dMenu_Collect_c::screenSet() { 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++) { + mD98.pane->show(); + mDD0.pane->show(); + + 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]); + for (int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m1000[i], m004, l_sit[i]); + fopMsgM_setPaneData(&m10A8[i], m004, l_sik[i]); } - + if (dComIfGs_isEventBit(dSv_event_flag_c::PLACED_DINS_PEARL)) { - m1000[1].mInitAlpha *= 0.5f; - m10A8[1].mInitAlpha *= 0.5f; + alphaChange(&m1000[1], 0.5f); + alphaChange(&m10A8[1], 0.5f); } if (dComIfGs_isEventBit(dSv_event_flag_c::PLACED_FARORES_PEARL)) { - m1000[2].mInitAlpha *= 0.5f; - m10A8[2].mInitAlpha *= 0.5f; + alphaChange(&m1000[2], 0.5f); + alphaChange(&m10A8[2], 0.5f); } if (dComIfGs_isEventBit(dSv_event_flag_c::PLACED_NAYRUS_PEARL)) { - m1000[0].mInitAlpha *= 0.5f; - m10A8[0].mInitAlpha *= 0.5f; + alphaChange(&m1000[0], 0.5f); + alphaChange(&m10A8[0], 0.5f); } - for(int i = 0; i < 11; i++) { + 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]); + for (int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m13B8[i], m004, l_htp[i]); } - fopMsgM_setPaneData(&m1460, m004, 'htpb'); + fopMsgM_setPaneData(&m1460, m004, 'htpb'); - for(int i = 0; i < 6; i++) { + 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(&m18F8[i], 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; + m18F8[i].mPosCenterOrig.x -= 4.0f; + m18F8[i].mPosCenterOrig.y -= 4.0f; - fopMsgM_paneTrans(pPane, 0.0f, 0.0f); + fopMsgM_paneTrans(&m18F8[i], 0.0f, 0.0f); } fopMsgM_setPaneData(&m1738, m004, 'i111'); @@ -266,8 +321,8 @@ void dMenu_Collect_c::screenSet() { 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]); } @@ -276,50 +331,60 @@ void dMenu_Collect_c::screenSet() { 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); + { + JKRArchive* archive = dComIfGp_getItemIconArchive(); + JKRArchive::readTypeResource(mTactTexBuffer, 0xc00, 'TIMG', "baton.bti", archive); + DCStoreRangeNoSync(mTactTexBuffer, 0xc00); } - ((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); + { + JKRArchive* archive = dComIfGp_getItemIconArchive(); + JKRArchive::readTypeResource(mMapTexBuffer, 0xc00, 'TIMG', "cmap_treasure2.bti", archive); + DCStoreRangeNoSync(mMapTexBuffer, 0xc00); + } + + for (int i = 0; i < 6; i++) { + ((J2DPicture*)m1498[i].pane)->changeTexture(mTactTexBuffer, 0); + ((J2DPicture*)m15E8[i].pane)->changeTexture(mTactTexBuffer, 0); + } + + ((J2DPicture*)mCF0.pane)->changeTexture(mMapTexBuffer, 0); + + for (int i = 0; i < 8; i++) { + JKRArchive* archive = dComIfGp_getItemIconArchive(); + JKRArchive::readTypeResource(mTriforceTexBuffer[i], 0xc00, 'TIMG', triTex[i], archive); + DCStoreRangeNoSync(mTriforceTexBuffer[i], 0xc00); + ((J2DPicture*)mE08[i].pane)->changeTexture(mTriforceTexBuffer[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 < 3; i++) { + JKRArchive* archive = dComIfGp_getItemIconArchive(); + JKRArchive::readTypeResource(mSymbolTexBuffer[i], 0xc00, 'TIMG', symTex[i], archive); + DCStoreRangeNoSync(mSymbolTexBuffer[i], 0xc00); + ((J2DPicture*)m1000[i].pane)->changeTexture((ResTIMG*)mSymbolTexBuffer[i], 0); + ((J2DPicture*)m10A8[i].pane)->changeTexture((ResTIMG*)mSymbolTexBuffer[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); - } + for (int i = 0; i < 5; i++) { + JKRArchive* archive = dComIfGp_getItemIconArchive(); + JKRArchive::readTypeResource(mItemTexBuffer[i], 0xc00, 'TIMG', wepTex[i], archive); + DCStoreRangeNoSync(mItemTexBuffer[i], 0xc00); + ((J2DPicture*)m2030[i].pane)->changeTexture((ResTIMG*)mItemTexBuffer[i], 0); + ((J2DPicture*)m2148[i].pane)->changeTexture((ResTIMG*)mItemTexBuffer[i], 0); + } + + char print_format[0x10]; 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 */ @@ -343,8 +408,9 @@ void dMenu_Collect_c::cursorMainMove() { } /* 8019E570-8019E584 .text noteCheck__15dMenu_Collect_cFv */ -void dMenu_Collect_c::noteCheck() { +u8 dMenu_Collect_c::noteCheck() { /* Nonmatching */ + return 0; } /* 8019E584-8019E624 .text noteInit__15dMenu_Collect_cFv */ @@ -548,22 +614,25 @@ void dMenu_Collect_c::_draw() { } /* 801A68EC-801A6B28 .text _open__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_open() { +bool dMenu_Collect_c::_open() { /* Nonmatching */ + return false; } /* 801A6B28-801A6CC8 .text _open3__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_open3() { +bool dMenu_Collect_c::_open3() { /* Nonmatching */ + return false; } /* 801A6CC8-801A71EC .text _close__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_close() { +bool dMenu_Collect_c::_close() { /* Nonmatching */ + return false; } /* 801A71EC-801A7710 .text _close3__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_close3() { +bool dMenu_Collect_c::_close3() { /* Nonmatching */ } @@ -588,11 +657,13 @@ void dMenu_Collect_c::animeStep4(short, short) { } /* 801A7D60-801A7F88 .text _open2__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_open2() { +bool dMenu_Collect_c::_open2() { /* Nonmatching */ + return false; } /* 801A7F88-801A84B4 .text _close2__15dMenu_Collect_cFv */ -void dMenu_Collect_c::_close2() { +bool dMenu_Collect_c::_close2() { /* Nonmatching */ + return false; } diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index bb6d4029a..39dfdb88f 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -73,8 +73,8 @@ void dMenu_Dmap_c::noteInit() { } /* 801AC2D8-801AC2EC .text noteCheck__12dMenu_Dmap_cFv */ -void dMenu_Dmap_c::noteCheck() { - /* Nonmatching */ +bool dMenu_Dmap_c::noteCheck() { + return field_0x0972 == 1 ? TRUE : FALSE; } /* 801AC2EC-801AC390 .text noteAppear__12dMenu_Dmap_cFv */ @@ -178,11 +178,11 @@ void dMenu_Dmap_c::_draw() { } /* 801AF0C0-801AF294 .text _open__12dMenu_Dmap_cFv */ -void dMenu_Dmap_c::_open() { +bool dMenu_Dmap_c::_open() { /* Nonmatching */ } /* 801AF294-801AF3B8 .text _close__12dMenu_Dmap_cFv */ -void dMenu_Dmap_c::_close() { +bool dMenu_Dmap_c::_close() { /* Nonmatching */ } diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp index 19790c552..244ff33c6 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -67,8 +67,9 @@ void dMenu_Fmap_c::checkMarkCheck3() { } /* 801B190C-801B1914 .text isFmapClose__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::isFmapClose() { +bool dMenu_Fmap_c::isFmapClose() { /* Nonmatching */ + return false; } /* 801B1914-801B1978 .text setPaneOnOff__12dMenu_Fmap_cFP9J2DScreenUlb */ @@ -272,13 +273,15 @@ void dMenu_Fmap_c::checkDspHugeMapShip() { } /* 801B4B44-801B4C0C .text _open__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::_open() { +bool dMenu_Fmap_c::_open() { /* Nonmatching */ + return false; } /* 801B4C0C-801B4C78 .text _close__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::_close() { +bool dMenu_Fmap_c::_close() { /* Nonmatching */ + return false; } /* 801B4C78-801B4D78 .text _close_normalMode__12dMenu_Fmap_cFv */ @@ -427,8 +430,9 @@ void dMenu_Fmap_c::gShipMarkAnime() { } /* 801B78B0-801B79E8 .text _open_warpMode__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::_open_warpMode() { +bool dMenu_Fmap_c::_open_warpMode() { /* Nonmatching */ + return false; } /* 801B79E8-801B7CD0 .text init_warpMode__12dMenu_Fmap_cFv */ @@ -577,8 +581,9 @@ void dMenu_Fmap_c::setWrapSpotEmitter(int, cXyz) { } /* 801BA110-801BA19C .text _open_fishManMode__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::_open_fishManMode() { +bool dMenu_Fmap_c::_open_fishManMode() { /* Nonmatching */ + return false; } /* 801BA19C-801BA214 .text _close_fishManMode__12dMenu_Fmap_cFv */ @@ -647,13 +652,15 @@ void dMenu_Fmap_c::fmEndWait() { } /* 801BAF18-801BAFCC .text _open_wallPaper__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::_open_wallPaper() { +bool dMenu_Fmap_c::_open_wallPaper() { /* Nonmatching */ + return false; } /* 801BAFCC-801BB024 .text getButtonIconMode__12dMenu_Fmap_cFv */ -void dMenu_Fmap_c::getButtonIconMode() { +u8 dMenu_Fmap_c::getButtonIconMode() { /* Nonmatching */ + return 0; } /* 801BB024-801BB088 .text draw__12dDlst_FMAP_cFv */ diff --git a/src/d/d_menu_item.cpp b/src/d/d_menu_item.cpp index 9f79d1278..9c14d94a0 100644 --- a/src/d/d_menu_item.cpp +++ b/src/d/d_menu_item.cpp @@ -6,9 +6,55 @@ #include "d/dolzel.h" // IWYU pragma: keep #include "d/d_menu_item.h" +dMi_HIO_c g_miHIO; + /* 801C7B4C-801C7C7C .text __ct__9dMi_HIO_cFv */ dMi_HIO_c::dMi_HIO_c() { - /* Nonmatching */ + field_0x08 = 0.8f; + field_0x0C = 15; + + for (int i = 0; i < ARR_SIZE; i++) { + arr_0x0E[i] = 0; + arr_0x1A[i] = 10; + } + + field_0x18 = 0; + field_0x24 = 1; + field_0x26 = -100; + field_0x28 = -100; + field_0x2A = -45; + field_0x2C = 50; + field_0x2E = 30; + field_0x30 = -3; + field_0x32 = 10; + field_0x34 = 7; + field_0x36 = 14; + field_0x38 = 5; + field_0x3A = 12; + field_0x3C = 10; + field_0x40 = 320; + field_0x42 = 240; + field_0x3E = 200; + field_0x46 = 0; + field_0x48 = 20; + field_0x44 = -120; + + // Light Yellow-Green + mClothColor.r = 0xE3; + mClothColor.g = 0xFF; + mClothColor.b = 0xB3; + mClothColor.a = 0xDC; + + // Transparent + mShadowColor.r = 0x00; + mShadowColor.g = 0x00; + mShadowColor.b = 0x00; + mShadowColor.a = 0x00; + + field_0x5C = 130; + + mBlackColor.set(0x00, 0x00, 0x00, 0xFF); // Black + // mWhiteColor stays as default. } /* 801C7C7C-801C7DC4 .text initialize__12dMenu_Item_cFv */ @@ -107,8 +153,9 @@ void dMenu_Item_c::outFontDraw() { } /* 801CC0F8-801CC10C .text noteCheck__12dMenu_Item_cFv */ -void dMenu_Item_c::noteCheck() { +u8 dMenu_Item_c::noteCheck() { /* Nonmatching */ + return 0; } /* 801CC10C-801CC1AC .text noteInit__12dMenu_Item_cFv */ @@ -224,6 +271,8 @@ void dMenu_Item_c::equipBeastItem(int) { /* 801CF12C-801CF510 .text _create__12dMenu_Item_cFv */ void dMenu_Item_c::_create() { /* Nonmatching */ + + g_miHIO.mNo = mDoHIO_createChild("アイテム画面", &g_miHIO); // "Item Screen" } /* 801CF510-801CF618 .text _delete__12dMenu_Item_cFv */ @@ -242,21 +291,23 @@ void dMenu_Item_c::_draw() { } /* 801D0F50-801D1438 .text _open__12dMenu_Item_cFv */ -void dMenu_Item_c::_open() { +bool dMenu_Item_c::_open() { /* Nonmatching */ } /* 801D1438-801D1CD4 .text _close__12dMenu_Item_cFv */ -void dMenu_Item_c::_close() { +bool dMenu_Item_c::_close() { /* Nonmatching */ } /* 801D1CD4-801D21A0 .text _open2__12dMenu_Item_cFv */ -void dMenu_Item_c::_open2() { +bool dMenu_Item_c::_open2() { /* Nonmatching */ + return false; } /* 801D21A0-801D2A4C .text _close2__12dMenu_Item_cFv */ -void dMenu_Item_c::_close2() { +bool dMenu_Item_c::_close2() { /* Nonmatching */ + return false; } diff --git a/src/d/d_menu_window.cpp b/src/d/d_menu_window.cpp index 6fcee77e8..464c88011 100644 --- a/src/d/d_menu_window.cpp +++ b/src/d/d_menu_window.cpp @@ -9,10 +9,25 @@ #include "JSystem/JKernel/JKRExpHeap.h" #include "f_op/f_op_msg.h" #include "d/d_menu_cloth.h" +#include "d/d_menu_capture.h" +#include "d/d_menu_collect.h" +#include "d/d_menu_dmap.h" +#include "d/d_menu_fmap.h" +#include "d/d_menu_fmap_sv.h" +#include "d/d_menu_item.h" +#include "d/d_menu_save.h" +#include "d/d_meter.h" +#include "d/d_name.h" +#include "d/d_priority.h" +#include "d/d_procname.h" +#include "d/actor/d_a_player_main.h" +#include "f_op/f_op_overlap_mng.h" +#include "m_Do/m_Do_controller_pad.h" +#include "m_Do/m_Do_graphic.h" // TODO: Remove me when all the JUT asserts and other strings are filled out. // This is temporary, just to make the strings match. -void dummy0() { +static void dummy0() { OSReport("cmap_tri.bti"); OSReport("cmap_treasure.bti"); OSReport("cmap_tingle.bti"); @@ -30,6 +45,9 @@ void dummy0() { OSReport("i_Ms->note[i] != 0"); OSReport("i_Ms->dummy[i] != 0"); OSReport("i_Ms->buffer_p[i] != 0"); +#if VERSION == VERSION_PAL + OSReport("i_Ms->title_p != 0"); +#endif OSReport("dMi_c != 0"); OSReport("dMc_c != 0"); OSReport("dMf_c != 0"); @@ -48,87 +66,559 @@ void dummy0() { OSReport("rfonttype != 0"); } -class dDlst_MENU_CLOTH_c : public dDlst_base_c {}; - -class dDlst_MENU_CAPTURE_c : public dDlst_base_c { -public: - dDlst_MENU_CAPTURE_c() { mStatus = 0; } - - /* 0x04 */ u8 mStatus; -}; +dMenu_FmapSv_c dMv_CIO_c; +dMw_HIO_c g_mwHIO; +dMw_DHIO_c g_mwDHIO; static dMCloth_c* cloth_c; -static dDlst_MENU_CLOTH_c* dMs_cloth_c; + +static JUTFont* fonttype; +static JUTFont* rfonttype; + static dDlst_MENU_CAPTURE_c* dMs_capture_c; +static dDlst_MENU_CLOTH_c* dMs_cloth_c; +static dMenu_Item_c* dMi_c; +static dMenu_Collect_c* dMc_c; +static dMenu_Dmap_c* dMd_c; +static dMenu_Fmap_c* dMf_c; +static dName_c* dNm_c; +static dMenu_save_c* dMs_c; + +static s8 event_wait_frame; + +static void dMs_onButtonBit(sub_ms_screen_class* i_Ms, u8 i_Bit); +static void dMs_offButtonBit(sub_ms_screen_class* i_Ms, u8 i_Bit); /* 801DB384-801DB50C .text __ct__9dMw_HIO_cFv */ dMw_HIO_c::dMw_HIO_c() { - /* Nonmatching */ + field_0x12 = 0; + field_0x06 = 0; + field_0x14 = 0; + field_0x08 = 0; + field_0x16 = 0; + field_0x0A = 0; + field_0x17 = 0; + field_0x0B = 0; + field_0x18 = 0; + field_0x0C = 0; + field_0x1A = 0; + field_0x0E = 0; + field_0x1C = 0; + field_0x10 = 0; + field_0x1D = 0; + field_0x11 = 0; + field_0x1F = 0; + field_0x1E = 0; + + for (int i = 0; i < 21; i++) { + arr_0x38[i] = 0xFF; + arr_0x20[i] = 0xFF; + } + + field_0x9D = 0; + field_0x9C = 0; + field_0x9B = 0; + + field_0x82 = 0; + field_0x81 = 0; + field_0x80 = 0; + + for (int i = 0; i < 8; i++) { + arr_0x58[i] = 0; + arr_0x50[i] = 0; + arr_0x68[i] = 0; + arr_0x60[i] = 0; + arr_0xA6[i] = 0; + arr_0x9E[i] = 0; + arr_0x8B[i] = 0; + arr_0x83[i] = 0; + } + + for (int i = 0; i < 8; i++) { + arr_0x78[i] = 0xFF; + arr_0x70[i] = 0xFF; + } + + for (int i = 0; i < 6; i++) { + arr_0xBC[i] = 0; + arr_0xB6[i] = 0; + } + + for (int i = 0; i < 8; i++) { + arr_0xCA[i] = 0; + arr_0xC2[i] = 0; + } + + for (int i = 0; i < 3; i++) { + arr_0xD5[i] = 0; + arr_0xD2[i] = 0; + } + + for (int i = 0; i < 8; i++) { + arr_0xE0[i] = 0; + arr_0xD8[i] = 0; + } } /* 801DB50C-801DB568 .text __ct__10dMw_DHIO_cFv */ dMw_DHIO_c::dMw_DHIO_c() { - /* Nonmatching */ + for (int i = 0; i < 0x10; i++) { + arr_0x05[0][i] = 0; + arr_0x05[1][i] = 0; + arr_0x05[2][i] = 0; + arr_0x05[3][i] = 0; + arr_0x05[4][i] = 0; + arr_0x05[5][i] = 0; + arr_0x05[6][i] = 0; + arr_0x05[7][i] = 0; + arr_0x05[8][i] = 0; + arr_0x05[9][i] = 0; + arr_0x05[10][i] = 0; + arr_0x05[11][i] = 0; + } } +static u8 lockFlag = 0; + /* 801DB568-801DB91C .text dMs_item_create__FP19sub_ms_screen_class */ -void dMs_item_create(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_item_create(sub_ms_screen_class* i_Ms) { + i_Ms->arc = dComIfGp_getItemResArchive(); + + for (int i = 0; i < 2; i++) { + i_Ms->name[i] = (char*)i_Ms->childHeap->alloc(0x20, 4); + JUT_ASSERT(1936, i_Ms->name[i] != NULL); + strcpy(i_Ms->name[i], ""); + + i_Ms->note[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(1939, i_Ms->note[i] != NULL); + strcpy(i_Ms->note[i], ""); + + i_Ms->dummy[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(1942, i_Ms->dummy[i] != NULL); + strcpy(i_Ms->dummy[i], ""); + } + + i_Ms->field_0x1B2 = 0; + + for (int i = 0; i < 33; i++) { + i_Ms->buffer_p[i] = i_Ms->childHeap->alloc(0xC00, 0x20); + JUT_ASSERT(1951, i_Ms->buffer_p[i] != NULL); + i_Ms->field_0x1B2++; + } + +#if VERSION == VERSION_PAL + i_Ms->title_p = (char*)i_Ms->childHeap->alloc(0x1000, 0x20); + JUT_ASSERT(1957, i_Ms->title_p != NULL); +#endif + + dMi_c = new dMenu_Item_c(); + JUT_ASSERT(1962, dMi_c != NULL); + + for (int i = 0; i < 21; i++) { + dMi_c->arr_0x2334[i] = i_Ms->buffer_p[i]; + } + + for (int i = 0; i < 9; i++) { + dMi_c->arr_0x2394[i] = i_Ms->buffer_p[i + 24]; + } + + dMi_c->setArchive(i_Ms->arc); + dMi_c->setFont(fonttype, rfonttype); + dMi_c->setTextArea(i_Ms->name[0], i_Ms->name[1], i_Ms->note[0], i_Ms->note[1], i_Ms->dummy[0], i_Ms->dummy[1]); + + dMi_c->field_0x23FF = g_dComIfG_gameInfo.play.field_0x4943; // FIXME + + dMi_c->_create(); + + if (mDoCPd_L_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 1); + } else if (mDoCPd_R_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 2); + } + + lockFlag = 0; } /* 801DB91C-801DBA58 .text dMs_item_delete__FP19sub_ms_screen_class */ -void dMs_item_delete(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_item_delete(sub_ms_screen_class* i_Ms) { + for (int i = 0; i < 2; i++) { + if (i_Ms->name[i] != NULL) { + i_Ms->childHeap->free(i_Ms->name[i]); + i_Ms->name[i] = NULL; + } + if (i_Ms->note[i] != NULL) { + i_Ms->childHeap->free(i_Ms->note[i]); + i_Ms->note[i] = NULL; + } + if (i_Ms->dummy[i] != NULL) { + i_Ms->childHeap->free(i_Ms->dummy[i]); + i_Ms->dummy[i] = NULL; + } + } + + for (int i = 0; i < i_Ms->field_0x1B2; i++) { + if (i_Ms->buffer_p[i] != NULL) { + i_Ms->childHeap->free(i_Ms->buffer_p[i]); + i_Ms->buffer_p[i] = NULL; + } + } + + if (dMi_c != NULL) { + g_dComIfG_gameInfo.play.field_0x4943 = dMi_c->field_0x23FF; // FIXME + + dMi_c->_delete(); + delete dMi_c; + dMi_c = NULL; + } + + lockFlag = 1; } /* 801DBA58-801DBE44 .text dMs_collect_create__FP19sub_ms_screen_class */ -void dMs_collect_create(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_collect_create(sub_ms_screen_class* i_Ms) { + i_Ms->arc = dComIfGp_getCollectResArchive(); + + for (int i = 0; i < 2; i++) { + i_Ms->name[i] = (char*)i_Ms->childHeap->alloc(0x20, 4); + JUT_ASSERT(2089, i_Ms->name[i] != NULL); + + i_Ms->note[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(2091, i_Ms->note[i] != NULL); + + i_Ms->dummy[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(2093, i_Ms->dummy[i] != NULL); + } + + i_Ms->field_0x1B2 = 0; + + for (int i = 0; i < 21; i++) { + i_Ms->buffer_p[i] = i_Ms->childHeap->alloc(0xC00, 0x20); + JUT_ASSERT(2101, i_Ms->buffer_p[i] != NULL); + i_Ms->field_0x1B2++; + } + + dMc_c = new dMenu_Collect_c(); + JUT_ASSERT(2112, dMc_c != NULL); + + dMc_c->setTactTexBuffer(i_Ms->buffer_p[0]); + + for (int i = 0; i < 3; i++) { + dMc_c->setSymbolTexBuffer(i, i_Ms->buffer_p[i + 1]); + } + + for (int i = 0; i < 5; i++) { + dMc_c->setItemTexBuffer(i, i_Ms->buffer_p[i + 4]); + } + + for (int i = 0; i < 8; i++) { + dMc_c->setTriforceTexBuffer(i, i_Ms->buffer_p[i + 9]); + } + + dMc_c->setMapTexBuffer(i_Ms->buffer_p[17]); + + dMc_c->setArchive(dComIfGp_getCollectResArchive()); + dMc_c->setOptionArchive(dComIfGp_getOptionResArchive()); + dMc_c->setQuitArchive(dComIfGp_getSaveResArchive()); + + dMc_c->setFont(fonttype, rfonttype); + + dMc_c->setTextArea(i_Ms->name[0], i_Ms->name[1], i_Ms->note[0], i_Ms->note[1], i_Ms->dummy[0], i_Ms->dummy[1]); + + dMc_c->m27ED = g_dComIfG_gameInfo.play.field_0x4944; // FIXME + + dMc_c->_create(); + + if (mDoCPd_L_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 1); + } else if (mDoCPd_R_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 2); + } + + lockFlag = 0; } /* 801DBE44-801DC224 .text dMs_collect_create2__FP19sub_ms_screen_class */ -void dMs_collect_create2(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_collect_create2(sub_ms_screen_class* i_Ms) { + i_Ms->arc = dComIfGp_getCollectResArchive(); + + for (int i = 0; i < 2; i++) { + i_Ms->name[i] = (char*)i_Ms->childHeap->alloc(0x20, 4); + JUT_ASSERT(2183, i_Ms->name[i] != NULL); + + i_Ms->note[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(2185, i_Ms->note[i] != NULL); + + i_Ms->dummy[i] = (char*)i_Ms->childHeap->alloc(0x200, 4); + JUT_ASSERT(2187, i_Ms->dummy[i] != NULL); + } + + i_Ms->field_0x1B2 = 0; + + for (int i = 0; i < 21; i++) { + i_Ms->buffer_p[i] = i_Ms->childHeap->alloc(0xC00, 0x20); + JUT_ASSERT(2195, i_Ms->buffer_p[i] != NULL); + i_Ms->field_0x1B2++; + } + + dMc_c = new dMenu_Collect_c(); + JUT_ASSERT(2205, dMc_c != NULL); + + dMc_c->setTactTexBuffer(i_Ms->buffer_p[0]); + + for (int i = 0; i < 3; i++) { + dMc_c->setSymbolTexBuffer(i, i_Ms->buffer_p[i + 1]); + } + + for (int i = 0; i < 5; i++) { + dMc_c->setItemTexBuffer(i, i_Ms->buffer_p[i + 4]); + } + + for (int i = 0; i < 8; i++) { + dMc_c->setTriforceTexBuffer(i, i_Ms->buffer_p[i + 9]); + } + + dMc_c->setMapTexBuffer(i_Ms->buffer_p[17]); + + dMc_c->setArchive(dComIfGp_getCollectResArchive()); + dMc_c->setOptionArchive(dComIfGp_getOptionResArchive()); + dMc_c->setQuitArchive(dComIfGp_getSaveResArchive()); + + dMc_c->setFont(fonttype, rfonttype); + + dMc_c->setTextArea(i_Ms->name[0], i_Ms->name[1], i_Ms->note[0], i_Ms->note[1], i_Ms->dummy[0], i_Ms->dummy[1]); + + dMc_c->m27ED = g_dComIfG_gameInfo.play.field_0x4944; // FIXME + + dMc_c->_create3(); + + if (mDoCPd_L_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 1); + } else if (mDoCPd_R_LOCK_BUTTON(0)) { + dMs_onButtonBit(i_Ms, 2); + } + + lockFlag = 0; } /* 801DC224-801DC360 .text dMs_collect_delete__FP19sub_ms_screen_class */ -void dMs_collect_delete(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_collect_delete(sub_ms_screen_class* i_Ms) { + for (int i = 0; i < 2; i++) { + if (i_Ms->name[i] != NULL) { + i_Ms->childHeap->free(i_Ms->name[i]); + i_Ms->name[i] = NULL; + } + if (i_Ms->note[i] != NULL) { + i_Ms->childHeap->free(i_Ms->note[i]); + i_Ms->note[i] = NULL; + } + if (i_Ms->dummy[i] != NULL) { + i_Ms->childHeap->free(i_Ms->dummy[i]); + i_Ms->dummy[i] = NULL; + } + } + + for (int i = 0; i < i_Ms->field_0x1B2; i++) { + if (i_Ms->buffer_p[i] != NULL) { + i_Ms->childHeap->free(i_Ms->buffer_p[i]); + i_Ms->buffer_p[i] = NULL; + } + } + + if (dMc_c != NULL) { + g_dComIfG_gameInfo.play.field_0x4944 = dMc_c->m27ED; // FIXME + + dMc_c->_delete(); + delete dMc_c; + dMc_c = NULL; + } + + lockFlag = 1; } /* 801DC360-801DC694 .text dMs_fmap_create__FP19sub_ms_screen_class */ -void dMs_fmap_create(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_fmap_create(sub_ms_screen_class* i_Ms) { + dComIfGp_setHeapLockFlag(2); + + for (int i = 0; i < 2; i++) { + i_Ms->name[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x40, 4); + JUT_ASSERT(2343, i_Ms->name[i] != NULL); + + i_Ms->note[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x200, 4); + JUT_ASSERT(2345, i_Ms->note[i] != NULL); + + i_Ms->dummy[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x200, 4); + JUT_ASSERT(2347, i_Ms->dummy[i] != NULL); + } + + dMf_c = new dMenu_Fmap_c(); + JUT_ASSERT(2352, dMf_c != NULL); + + dMf_c->setSvPtr(&dMv_CIO_c); + dMf_c->setFont(fonttype, rfonttype); + + dMf_c->setTextArea_New(i_Ms->name[0], i_Ms->name[1], i_Ms->note[0], i_Ms->note[1], i_Ms->dummy[0], i_Ms->dummy[1]); + + dMf_c->_create(); + + dMs_capture_c = new dDlst_MENU_CAPTURE_c(); + JUT_ASSERT(2362, dMs_capture_c != NULL); + + if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN_WALLPAPER) { + dMs_capture_c->setDrawFlagOn(); + } + + if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN) { + dMf_c->backClothDispInit(); + } } /* 801DC694-801DC798 .text dMs_fmap_delete__FP19sub_ms_screen_class */ -void dMs_fmap_delete(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_fmap_delete(sub_ms_screen_class* i_Ms) { + for (int i = 0; i < 2; i++) { + if (i_Ms->name[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->name[i]); + i_Ms->name[i] = NULL; + } + if (i_Ms->note[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->note[i]); + i_Ms->note[i] = NULL; + } + if (i_Ms->dummy[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->dummy[i]); + i_Ms->dummy[i] = NULL; + } + } + + if (dMf_c != NULL) { + dMf_c->_delete(); + delete dMf_c; + dMf_c = NULL; + } + + if (dMs_capture_c != NULL) { + delete dMs_capture_c; + dMs_capture_c = NULL; + } } /* 801DC798-801DCB30 .text dMs_dmap_create__FP19sub_ms_screen_class */ -void dMs_dmap_create(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_dmap_create(sub_ms_screen_class* i_Ms) { + i_Ms->arc = dComIfGp_getDmapResArchive(); + + dComIfGp_setHeapLockFlag(3); + + for (int i = 0; i < 2; i++) { + i_Ms->name[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x20, 4); + JUT_ASSERT(2464, i_Ms->name[i] != NULL); + + i_Ms->note[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x200, 4); + JUT_ASSERT(2466, i_Ms->note[i] != NULL); + + i_Ms->dummy[i] = (char*)i_Ms->parentHeap_0xfc->alloc(0x200, 4); + JUT_ASSERT(2468, i_Ms->dummy[i] != NULL); + } + + i_Ms->field_0x1B2 = 0; + + for (int i = 0; i < 3; i++) { + i_Ms->buffer_p[i] = i_Ms->parentHeap_0xfc->alloc(0xC00, 0x20); + JUT_ASSERT(2475, i_Ms->buffer_p[i] != NULL); + i_Ms->field_0x1B2++; + } + + dMd_c = new dMenu_Dmap_c(); + JUT_ASSERT(2480, dMd_c != NULL); + + for (int i = 0; i < 3; i++) { + dMd_c->arr_0x1AFC[i] = i_Ms->buffer_p[i]; + } + + dMd_c->setArchive(i_Ms->arc); + dMd_c->setFont(fonttype, rfonttype); + + dMd_c->setTextArea(i_Ms->name[0], i_Ms->name[1], i_Ms->note[0], i_Ms->note[1], i_Ms->dummy[0], i_Ms->dummy[1]); + + dMd_c->_create(); + + dMs_capture_c = new dDlst_MENU_CAPTURE_c(); + JUT_ASSERT(2491, dMs_capture_c != NULL); } /* 801DCB30-801DCC80 .text dMs_dmap_delete__FP19sub_ms_screen_class */ -void dMs_dmap_delete(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_dmap_delete(sub_ms_screen_class* i_Ms) { + for (int i = 0; i < 2; i++) { + if (i_Ms->name[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->name[i]); + i_Ms->name[i] = NULL; + } + if (i_Ms->note[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->note[i]); + i_Ms->note[i] = NULL; + } + if (i_Ms->dummy[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->dummy[i]); + i_Ms->dummy[i] = NULL; + } + } + + for (int i = 0; i < i_Ms->field_0x1B2; i++) { + if (i_Ms->buffer_p[i] != NULL) { + i_Ms->parentHeap_0xfc->free(i_Ms->buffer_p[i]); + i_Ms->buffer_p[i] = NULL; + } + } + + if (dMd_c != NULL) { + dMd_c->_delete(); + delete dMd_c; + dMd_c = NULL; + } + + if (dMs_capture_c != NULL) { + delete dMs_capture_c; + dMs_capture_c = NULL; + } } /* 801DCC80-801DCDA0 .text dMs_name_create__FP19sub_ms_screen_class */ void dMs_name_create(sub_ms_screen_class*) { - /* Nonmatching */ + dComIfGp_setHeapLockFlag(10); + + dNm_c = new dName_c(); + JUT_ASSERT(2569, dNm_c != NULL); + + dNm_c->_create(); + + dMs_capture_c = new dDlst_MENU_CAPTURE_c(); + JUT_ASSERT(2573, dMs_capture_c != NULL); } /* 801DCDA0-801DCE20 .text dMs_name_delete__FP19sub_ms_screen_class */ void dMs_name_delete(sub_ms_screen_class*) { - /* Nonmatching */ + if (dNm_c != NULL) { + dNm_c->_delete(); + delete dNm_c; + dNm_c = NULL; + } + + if (dMs_capture_c != NULL) { + delete dMs_capture_c; + dMs_capture_c = NULL; + } } /* 801DCE20-801DCEA0 .text dMs_save_delete__FP19sub_ms_screen_class */ void dMs_save_delete(sub_ms_screen_class*) { - /* Nonmatching */ + if (dMs_c != NULL) { + dMs_c->_delete(); + delete dMs_c; + dMs_c = NULL; + } + + if (dMs_capture_c != NULL) { + delete dMs_capture_c; + dMs_capture_c = NULL; + } } /* 801DCEA0-801DD090 .text dMs_cloth_create__FP19sub_ms_screen_class */ @@ -201,66 +691,895 @@ void dMs_clothOnly_delete(sub_ms_screen_class*) { } /* 801DD308-801DD318 .text dMs_onButtonBit__FP19sub_ms_screen_classUc */ -void dMs_onButtonBit(sub_ms_screen_class*, unsigned char) { - /* Nonmatching */ +void dMs_onButtonBit(sub_ms_screen_class* i_Ms, u8 bit) { + i_Ms->mButtonsPressed |= bit; } /* 801DD318-801DD328 .text dMs_offButtonBit__FP19sub_ms_screen_classUc */ -void dMs_offButtonBit(sub_ms_screen_class*, unsigned char) { - /* Nonmatching */ +void dMs_offButtonBit(sub_ms_screen_class* i_Ms, u8 bit) { + i_Ms->mButtonsPressed &= ~bit; } /* 801DD328-801DD340 .text dMs_isButtonBit__FP19sub_ms_screen_classUc */ -void dMs_isButtonBit(sub_ms_screen_class*, unsigned char) { - /* Nonmatching */ +BOOL dMs_isButtonBit(sub_ms_screen_class* i_Ms, u8 bit) { + return (i_Ms->mButtonsPressed & bit) ? TRUE : FALSE; } /* 801DD340-801DD3A4 .text dMs_isPush_L_Button__FP19sub_ms_screen_class */ -void dMs_isPush_L_Button(sub_ms_screen_class*) { - /* Nonmatching */ +BOOL dMs_isPush_L_Button(sub_ms_screen_class* i_Ms) { + if (g_mDoCPd_cpadInfo[0].mHoldLockL != 0 && !dMs_isButtonBit(i_Ms, 1)) { + dMs_onButtonBit(i_Ms, 1); + return TRUE; + } else { + return FALSE; + } } /* 801DD3A4-801DD408 .text dMs_isPush_R_Button__FP19sub_ms_screen_class */ -void dMs_isPush_R_Button(sub_ms_screen_class*) { - /* Nonmatching */ +BOOL dMs_isPush_R_Button(sub_ms_screen_class* i_Ms) { + if (g_mDoCPd_cpadInfo[0].mHoldLockR != 0 && !dMs_isButtonBit(i_Ms, 2)) { + dMs_onButtonBit(i_Ms, 2); + return TRUE; + } else { + return FALSE; + } } /* 801DD408-801DD434 .text dMs_childHeap_freeAll__FP19sub_ms_screen_class */ -void dMs_childHeap_freeAll(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_childHeap_freeAll(sub_ms_screen_class* i_Ms) { + if (i_Ms->childHeap) { + i_Ms->childHeap->freeAll(); + } } /* 801DD434-801DD5CC .text dMs_telescopeMove__FP19sub_ms_screen_class */ -void dMs_telescopeMove(sub_ms_screen_class*) { - /* Nonmatching */ +void dMs_telescopeMove(sub_ms_screen_class* i_Ms) { + if (dComIfGp_isHeapLockFlag() == 0) { + dComIfGp_event_photoCheck(); + if (dComIfGp_checkCameraAttentionStatus(0, 8)) { + i_Ms->field_0x1B0 = 99; + } else { + if (dComIfGp_checkCameraAttentionStatus(0, 0x40)) { + i_Ms->field_0x1B0 = 89; + } else { + if (dComIfGp_getScopeType() == 2) { + i_Ms->field_0x1B0 = 98; + } else if (dComIfGp_getPictureStatus() == 2 || dComIfGp_getPictureStatus() == 3) { + i_Ms->field_0x1B0 = 89; + dMenu_flagSet(1); + } + } + } + + if (i_Ms->field_0x1B0 == 99 || i_Ms->field_0x1B0 == 89 || i_Ms->field_0x1B0 == 98) { + if (i_Ms->mMsgID == fpcM_ERROR_PROCESS_ID_e) { + cXyz pos(0.0f, 0.0f, 0.0f); + i_Ms->mMsgID = fopMsgM_messageSet(i_Ms->field_0x1B0 << 0x10, &pos); + + switch (i_Ms->field_0x1B0) { + case 98: + case 99: { + dComIfGp_setHeapLockFlag(5); + } break; + case 89: { + dComIfGp_setHeapLockFlag(6); + } break; + } + } + } + } else { + if (i_Ms->mMsgID != fpcM_ERROR_PROCESS_ID_e) { + msg_class* msg = fopMsgM_SearchByID(i_Ms->mMsgID); + if (msg != NULL) { + if (msg->mStatus == fopMsgStts_MSG_DISPLAYED_e) { + msg->mStatus = fopMsgStts_MSG_ENDS_e; + } else if (msg->mStatus == fopMsgStts_BOX_CLOSED_e) { + msg->mStatus = fopMsgStts_MSG_DESTROYED_e; + i_Ms->mMsgID = fpcM_ERROR_PROCESS_ID_e; + i_Ms->field_0x1B0 = 0; + } + } + } + } } /* 801DD5CC-801DD6D8 .text dMs_placenameMove__FP19sub_ms_screen_class */ void dMs_placenameMove(sub_ms_screen_class*) { - /* Nonmatching */ + if (dComIfGp_event_getMode() == 0) { + return; + } + + if (dComIfGp_evmng_startCheck("awake")) { + if (dComIfGp_demo_get()) { + if (dComIfGp_demo_get()->getFrameNoMsg() == 0xC8) { + dComIfGp_setStageNameOn(0); + dComIfGs_onEventBit(dSv_event_flag_c::UNK_3510); + } else if (dComIfGp_demo_get()->getFrameNoMsg() == 0x15E) { + dComIfGp_setStageNameOff(); + } + } + } else if (dComIfGp_evmng_startCheck("majyuu_shinnyuu")) { + if (dComIfGp_demo_get()) { + if (dComIfGp_demo_get()->getFrameNoMsg() == 0xB54) { + dComIfGp_setStageNameOn(1); + } else if (dComIfGp_demo_get()->getFrameNoMsg() == 0xBEA) { + dComIfGp_setStageNameOff(); + } + } + } } /* 801DD6D8-801DD960 .text dMs_Draw__FP19sub_ms_screen_class */ static BOOL dMs_Draw(sub_ms_screen_class*) { - /* Nonmatching */ + if (dMenu_flag() == 1 || dMs_capture_c && dMs_capture_c->checkDrawFlag() != 0) { + if (dMs_capture_c) { + dComIfGd_set2DOpa(dMs_capture_c); + + if (dMs_capture_c->checkDrawFlag() == 2) { + dMs_capture_c->setDrawFlagOff(); + dMenu_flagSet(1); + } + } + + if (dMenu_getMenuStatus() == MENU_STATUS_ITEM) { + // Item screen + if (dMs_cloth_c) { + dComIfGd_set2DOpa(dMs_cloth_c); + } + if (dMi_c) { + dComIfGd_set2DOpa(dMi_c); + } + } else if (dMenu_getMenuStatus() == MENU_STATUS_COLLECT) { + // Collect screen + if (dMs_cloth_c) { + dComIfGd_set2DOpa(dMs_cloth_c); + } + if (dMc_c) { + dComIfGd_set2DOpa(dMc_c); + } + } else if (dMenu_getMenuStatus() == MENU_STATUS_MAP) { + // Map screen + if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 1) { + // Dungeon map + if (dMd_c) { + dComIfGd_set2DOpa(dMd_c); + } + } else if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0) { + // Sea chart + if (dMs_cloth_c) { + dComIfGd_set2DOpa(dMs_cloth_c); + } + if (dMf_c) { + dMf_c->draw(); + } + } + } else if (dMenu_getMenuStatus() == MENU_STATUS_NAME) { + // Name entry screen + if (dNm_c) { + dNm_c->draw(); + } + } else if (dMenu_getMenuStatus() == MENU_STATUS_SAVE) { + // Save screen + if (dMs_c) { + dMs_c->_draw2(); + } + } + } else if (dMenu_flag() == 3) { + if (dMs_capture_c) { + dComIfGd_set2DOpa(dMs_capture_c); + } + } + + return TRUE; } /* 801DD960-801DF340 .text dMs_Execute__FP19sub_ms_screen_class */ -static BOOL dMs_Execute(sub_ms_screen_class*) { - /* Nonmatching */ +static BOOL dMs_Execute(sub_ms_screen_class* i_Ms) { + static s16 timer = 0; + + JKRHeap* heap = mDoExt_setCurrentHeap(i_Ms->parentHeap_0xfc); + + if (dComIfGp_event_runCheck()) { + event_wait_frame = 5; + } else if (event_wait_frame > 0) { + event_wait_frame--; + } else { + event_wait_frame = 0; + } + +#define CAN_PROCEED() (dMenu_flag() == 0 && dComIfGp_isEnableNextStage() == 0 && !fopOvlpM_IsDoingReq()) + + if (i_Ms->mMenuProc == MENU_STATE_NO_MENU && !dComIfGp_isHeapLockFlag() && dComIfGp_getMesgStatus() == 0) { + { + if (CAN_PROCEED() && dComIfGp_fmapOpenCheck() == 1) { + timer = 0; + i_Ms->mMenuProc = MENU_STATE_FMAP_OPEN_WARP_MODE; + dMs_fmap_create(i_Ms); + dMenu_flagSet(1); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_MAP); + dComIfGp_fmapOpenOff(); + mDoAud_seStart(JA_SE_SHIPPU_CHART_OPEN); + + } else if (CAN_PROCEED() && dComIfGp_InputPasswordOpenCheck() == 2) { + timer = 0; + i_Ms->mMenuProc = MENU_STATE_NAME_OPEN; + dMs_name_create(i_Ms); + dMenu_flagSet(1); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_NAME); + + } else if (CAN_PROCEED() && dComIfGp_isMenuCollect()) { + dMs_cloth_create(i_Ms); + timer = 0; + dMenu_flagSet(1); + i_Ms->mMenuProc = MENU_STATE_COLLECT_OPEN_ALT; + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMs_collect_create2(i_Ms); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_COLLECT); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_PAGE); + dComIfGp_offMenuCollect(); + + } else if (CAN_PROCEED() && dComIfGp_fmapOpenCheck() == 2) { + timer = 0; + i_Ms->mMenuProc = MENU_STATE_FMAP_OPEN_FISHMAN_MODE; + dMs_fmap_create(i_Ms); + dMenu_flagSet(1); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_MAP); + dComIfGp_fmapOpenOff(); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_MAP_IN); + + } else if (dMenu_flag() == 0 && !fopOvlpM_IsDoingReq() && !(CPad_CHECK_TRIG_A(0) || CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_Z(0))) { + + if (event_wait_frame == 0 || daPy_getPlayerLinkActorClass()->getTactNormalWait() && CPad_CHECK_TRIG_START(0) || + dComIfGp_getOperateWind() == 2 && CPad_CHECK_TRIG_UP(0) && dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0 && + dComIfGs_isEventBit(dSv_event_flag_c::UNK_0908)) + { + + if (dComIfGp_getMesgStatus() == 0 && dComIfGp_getScopeMesgStatus() == 0) { + if (!dComIfGp_checkCameraAttentionStatus(0, 8) && !dComIfGp_checkCameraAttentionStatus(0, 0x40) && + !dComIfGp_checkPlayerStatus0(0, daPyStts0_UNK800000_e)) + { + + { + if (dComIfGp_getOperateWind() != 2 || + (dComIfGp_getOperateWind() == 2 && CPad_CHECK_TRIG_UP(0) && dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0 && + dComIfGs_isEventBit(dSv_event_flag_c::UNK_0908))) + { + + if (CPad_CHECK_TRIG_START(0) && dComIfGp_isEnableNextStage() == 0 && + daPy_getPlayerActorClass() == daPy_getPlayerLinkActorClass()) + { + + dMs_cloth_create(i_Ms); + timer = 0; + dMenu_flagSet(1); + + if (dMenu_getMenuStatus() == 2 || daPy_getPlayerLinkActorClass()->getTactNormalWait()) { + + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMs_collect_create(i_Ms); + dMc_c->m27EC = 2; + + if (daPy_getPlayerLinkActorClass()->getTactNormalWait()) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_OPEN_TACT; + } else { + i_Ms->mMenuProc = MENU_STATE_COLLECT_OPEN; + } + + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_COLLECT); + dMenu_setPushMenuButton(2); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_PAGE); + + } else { + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMs_item_create(i_Ms); + dMi_c->field_0x2421 = 2; + i_Ms->mMenuProc = MENU_STATE_ITEM_OPEN; + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_ITEM); + dMenu_setPushMenuButton(1); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_PAGE); + } + + } else if (CAN_PROCEED() && CPad_CHECK_TRIG_UP(0)) { + + timer = 0; + + if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 1) { + i_Ms->mMenuProc = MENU_STATE_DMAP_OPEN; + dMs_dmap_create(i_Ms); + dMenu_flagSet(1); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_MAP); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_MAP_IN); + + } else { + if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0 && + dComIfGs_isEventBit(dSv_event_flag_c::UNK_0908) && dComIfGp_getMiniGameType() != 1 && + dComIfGp_getMiniGameType() != 6) + { + + if (dComIfGp_getOperateWind() == 2) { + i_Ms->mMenuProc = MENU_STATE_FMAP_OPEN_WALLPAPER; + } else { + i_Ms->mMenuProc = MENU_STATE_FMAP_OPEN; + dMs_clothOnly_create(i_Ms); + dMenu_flagSet(1); + } + + dMs_fmap_create(i_Ms); + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_MAP); + mDoAud_seStart(JA_SE_ITM_MENU_IN); + mDoAud_seStart(JA_SE_ITM_MENU_MAP_IN); + } + } + } + } + } + } + } + } + } + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_OPEN) { + timer++; + cloth_c->cloth_move(); + if (timer > g_menuHIO.field_0x90) { + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_open()) { + i_Ms->mMenuProc = MENU_STATE_ITEM_MOVE; + } + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN || i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN_TACT) { + timer++; + cloth_c->cloth_move(); + if (timer > g_menuHIO.field_0x90) { + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_open()) { + if (i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN_TACT) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_MOVE_TACT; + } else { + i_Ms->mMenuProc = MENU_STATE_COLLECT_MOVE; + } + } + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN_ALT) { + timer++; + cloth_c->cloth_move(); + if (timer > g_menuHIO.field_0x90) { + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_open3()) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_MOVE_ALT; + } + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_TO_ITEM_LEFT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_close2()) { + i_Ms->mMenuProc = MENU_STATE_ITEM_OPEN_FROM_COLLECT_LEFT; + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_ITEM); + dMs_collect_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + dMs_item_create(i_Ms); + dMi_c->field_0x2421 = 1; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_TO_ITEM_RIGHT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_close2()) { + i_Ms->mMenuProc = MENU_STATE_ITEM_OPEN_FROM_COLLECT_RIGHT; + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_ITEM); + dMs_collect_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + dMs_item_create(i_Ms); + dMi_c->field_0x2421 = 2; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_OPEN_FROM_COLLECT_LEFT || i_Ms->mMenuProc == MENU_STATE_ITEM_OPEN_FROM_COLLECT_RIGHT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_open2()) { + i_Ms->mMenuProc = MENU_STATE_ITEM_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_TO_COLLECT_LEFT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_close2()) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_OPEN_LEFT; + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_COLLECT); + dMs_item_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + dMs_collect_create(i_Ms); + dMc_c->m27EC = 1; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_TO_COLLECT_RIGHT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_close2()) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_OPEN_RIGHT; + dMenu_setMenuStatusOld(dMenu_getMenuStatus()); + dMenu_setMenuStatus(MENU_STATUS_COLLECT); + dMs_item_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + dMs_collect_create(i_Ms); + dMc_c->m27EC = 2; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN_LEFT || i_Ms->mMenuProc == MENU_STATE_COLLECT_OPEN_RIGHT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_open2()) { + i_Ms->mMenuProc = MENU_STATE_COLLECT_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_MOVE) { + cloth_c->cloth_move(); + if ((CPad_CHECK_TRIG_START(0) || CPad_CHECK_TRIG_B(0)) && !dMi_c->noteCheck() && dMi_c->mItemMode == 0 && !dMeter_subWinFlag()) { + + cloth_c->alpha_out(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_ITEM_CLOSE; + dMi_c->field_0x2421 = 0; + dMi_c->field_0x23F8 = 10; + dMenu_setPushMenuButton(0); + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + + } else if (dMs_isPush_R_Button(i_Ms) && !dMi_c->noteCheck() && dMi_c->mItemMode == 0) { + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_ITEM_TO_COLLECT_RIGHT; + dMi_c->field_0x2421 = 2; + dMi_c->field_0x23F8 = g_menuHIO.field_0x92; + dMenu_setPushMenuButton(2); + mDoAud_seStart(JA_SE_ITEM_COL_SW); + + } else if (dMs_isPush_L_Button(i_Ms) && !dMi_c->noteCheck() && dMi_c->mItemMode == 0) { + + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_ITEM_TO_COLLECT_LEFT; + dMi_c->field_0x2421 = 1; + dMi_c->field_0x23F8 = g_menuHIO.field_0x92; + dMenu_setPushMenuButton(2); + mDoAud_seStart(JA_SE_ITEM_COL_SW); + + } else { + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMi_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_MOVE) { + cloth_c->cloth_move(); + if ((CPad_CHECK_TRIG_START(0) || CPad_CHECK_TRIG_B(0)) && !dMc_c->noteCheck() && (dMc_c->mCollectMode == 0 || dMc_c->mCollectMode == 2)) { + + cloth_c->alpha_out(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_COLLECT_CLOSE; + dMc_c->m27EC = 0; + dMc_c->setTimer(10); + dMenu_setPushMenuButton(0); + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + + } else if (dMs_isPush_R_Button(i_Ms) && !dMc_c->noteCheck() && (dMc_c->mCollectMode == 0 || dMc_c->mCollectMode == 2)) { + + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_COLLECT_TO_ITEM_RIGHT; + dMc_c->m27EC = 2; + dMc_c->setTimer(g_menuHIO.field_0x92); + dMenu_setPushMenuButton(1); + mDoAud_seStart(JA_SE_ITEM_COL_SW); + + } else if (dMs_isPush_L_Button(i_Ms) && !dMc_c->noteCheck() && (dMc_c->mCollectMode == 0 || dMc_c->mCollectMode == 2)) { + + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_COLLECT_TO_ITEM_LEFT; + dMc_c->m27EC = 1; + dMc_c->setTimer(g_menuHIO.field_0x92); + dMenu_setPushMenuButton(1); + mDoAud_seStart(JA_SE_ITEM_COL_SW); + + } else { + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMc_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_MOVE_TACT) { + cloth_c->cloth_move(); + if ((CPad_CHECK_TRIG_START(0) || CPad_CHECK_TRIG_B(0)) && !dMc_c->noteCheck() && (dMc_c->mCollectMode == 0 || dMc_c->mCollectMode == 2)) { + cloth_c->alpha_out(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_COLLECT_CLOSE_TACT; + dMc_c->m27EC = 0; + dMc_c->setTimer(10); + dMenu_setPushMenuButton(0); + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + } else { + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMc_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_MOVE_ALT) { + cloth_c->cloth_move(); + if (dMc_c->mCollectMode != 5) { + cloth_c->alpha_out(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + i_Ms->mMenuProc = MENU_STATE_COLLECT_CLOSE_ALT; + dMc_c->m27EC = 0; + dMc_c->setTimer(10); + dMenu_setPushMenuButton(0); + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + } else { + mDoExt_setCurrentHeap(i_Ms->childHeap); + dMc_c->_move3(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_ITEM_CLOSE) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c->_close()) { + dMs_item_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + mDoExt_setCurrentHeap(i_Ms->parentHeap_0xfc); + dMs_cloth_delete(i_Ms); + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_CLOSE || i_Ms->mMenuProc == MENU_STATE_COLLECT_CLOSE_TACT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_close()) { + dMs_collect_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + mDoExt_setCurrentHeap(i_Ms->parentHeap_0xfc); + dMs_cloth_delete(i_Ms); + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + daPy_getPlayerLinkActorClass()->resetTactCount(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_COLLECT_CLOSE_ALT) { + cloth_c->cloth_move(); + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMc_c->_close3()) { + dMs_collect_delete(i_Ms); + dMs_childHeap_freeAll(i_Ms); + mDoExt_setCurrentHeap(i_Ms->parentHeap_0xfc); + dMs_cloth_delete(i_Ms); + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_DMAP_OPEN) { + if (dMd_c->_open()) { + i_Ms->mMenuProc = MENU_STATE_DMAP_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_DMAP_MOVE) { + if ((CPad_CHECK_TRIG_DOWN(0) || CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_LEFT(0)) && dMd_c->noteCheck() == 0) { + + i_Ms->mMenuProc = MENU_STATE_DMAP_CLOSE; + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + + } else { + dMd_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_DMAP_CLOSE) { + if (dMd_c->_close()) { + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + dMs_dmap_delete(i_Ms); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN) { + cloth_c->cloth_move(); + if (dMf_c->_open()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN_WARP_MODE) { + if (dMf_c->_open_warpMode()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_MOVE_WARP_MODE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN_WALLPAPER) { + if (dMenu_flag() && dMf_c->_open_wallPaper()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_MOVE_WALLPAPER; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_OPEN_FISHMAN_MODE) { + if (dMenu_flag() && dMf_c->_open_fishManMode()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_MOVE_FISHMAN_MODE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_MOVE || i_Ms->mMenuProc == MENU_STATE_FMAP_MOVE_WARP_MODE) { + if (cloth_c) { + cloth_c->cloth_move(); + } + + if (dMf_c->isFmapClose()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_CLOSE; + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + } else { + dMf_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_MOVE_WALLPAPER) { + if (dMf_c->isFmapClose() || CPad_CHECK_TRIG_DOWN(0) || CPad_CHECK_TRIG_A(0) || CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_X(0) || CPad_CHECK_TRIG_Y(0) || + dComIfGp_getOperateWind() != 2) + { + + i_Ms->mMenuProc = MENU_STATE_FMAP_CLOSE; + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + + } else { + dMf_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_MOVE_FISHMAN_MODE) { + if (dMf_c->isFmapClose()) { + i_Ms->mMenuProc = MENU_STATE_FMAP_CLOSE; + mDoAud_seStart(JA_SE_ITM_MENU_OUT); + } else { + dMf_c->_move(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_FMAP_CLOSE) { + if (cloth_c) { + cloth_c->alpha_out(); + } + + if (dMf_c->_close()) { + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + dMs_clothOnly_delete(i_Ms); + dMs_fmap_delete(i_Ms); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_NAME_OPEN) { + if (dNm_c->_open()) { + i_Ms->mMenuProc = MENU_STATE_NAME_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_NAME_MOVE) { + dNm_c->_move(); + + if (dNm_c->isInputEnd() == 1) { + dComIfGp_setInputPassword(dNm_c->getInputStrPtr()); + i_Ms->mMenuProc = MENU_STATE_NAME_CLOSE; + dComIfGp_InputPasswordOpenChangeOff(); + + } else if (dNm_c->isInputEnd() == 2) { + dComIfGp_setInputPassword(""); + i_Ms->mMenuProc = MENU_STATE_NAME_CLOSE; + dComIfGp_InputPasswordOpenCancelOff(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_NAME_CLOSE) { + if (dNm_c->_close()) { + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + dMs_name_delete(i_Ms); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else if (i_Ms->mMenuProc == MENU_STATE_SAVE_OPEN) { + if (dMs_c->_open()) { + i_Ms->mMenuProc = MENU_STATE_SAVE_MOVE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_SAVE_MOVE) { + dMs_c->_move(); + + if (dMs_c->getSaveStatus() == 3) { + if (dMs_c->getEndStatus() == 0) { + dComIfGp_setGameoverStatus(3); + } else if (dMs_c->getEndStatus() == 1) { + dComIfGp_setGameoverStatus(2); + } + i_Ms->mMenuProc = MENU_STATE_SAVE_CLOSE; + } + + } else if (i_Ms->mMenuProc == MENU_STATE_SAVE_CLOSE) { + if (dMs_c->_close()) { + i_Ms->mMenuProc = MENU_STATE_NO_MENU; + dMenu_flagSet(0); + dMs_save_delete(i_Ms); + i_Ms->parentHeap_0xfc->freeAll(); + dComIfGp_offHeapLockFlag(); + } + + } else { + // default + } + + if (!mDoCPd_L_LOCK_BUTTON(0) && dMs_isButtonBit(i_Ms, 1)) { + dMs_offButtonBit(i_Ms, 1); + } + + if (dMi_c) { + dMenu_setItemMode(dMi_c->mItemMode); + } else { + dMenu_setItemMode(0); + } + + if (dMc_c) { + dMenu_setCollectMode(dMc_c->mCollectMode); + } else { + dMenu_setCollectMode(0); + } + + if (!mDoCPd_R_LOCK_BUTTON(0) && dMs_isButtonBit(i_Ms, 2)) { + dMs_offButtonBit(i_Ms, 2); + } + + if (dComIfGp_demo_mode() == 1) { + dMs_placenameMove(i_Ms); + } + + dMs_telescopeMove(i_Ms); + + if (dMenu_flag() == 0 && !dComIfGp_event_getMode()) { + dComIfGs_getpItemRecord()->decTimer(); + } + + dComIfGp_decItemTimer(); + + if (dMf_c) { + dMeter_Info.mButtonIconMode = dMf_c->getButtonIconMode(); + } else { + dMeter_Info.mButtonIconMode = 3; + } + + mDoExt_setCurrentHeap(heap); + return TRUE; } /* 801DF340-801DF368 .text dMs_IsDelete__FP19sub_ms_screen_class */ static BOOL dMs_IsDelete(sub_ms_screen_class*) { - /* Nonmatching */ + dMenu_flagSet(0); + return TRUE; } /* 801DF368-801DF4C4 .text dMs_Delete__FP19sub_ms_screen_class */ -static BOOL dMs_Delete(sub_ms_screen_class*) { - /* Nonmatching */ +static BOOL dMs_Delete(sub_ms_screen_class* i_Ms) { + dMenu_setPushMenuButton(0); + dComIfGp_setPictureStatus(0); + + JKRHeap* heap = mDoExt_getCurrentHeap(); + + if (i_Ms->childHeap) { + mDoExt_setCurrentHeap(i_Ms->childHeap); + if (dMi_c) { + dMs_item_delete(i_Ms); + } + if (dMc_c) { + dMs_collect_delete(i_Ms); + } + dMs_childHeap_freeAll(i_Ms); + } + + mDoExt_setCurrentHeap(i_Ms->parentHeap_0xfc); + + if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 1) { + // Dungeon map + dMs_dmap_delete(i_Ms); + } else if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0) { + // Sea chart + dMs_fmap_delete(i_Ms); + } + + dMs_name_delete(i_Ms); + dMs_save_delete(i_Ms); + dMs_cloth_delete(i_Ms); + + mDoExt_setCurrentHeap(heap); + mDoExt_removeMesgFont(); + mDoExt_removeRubyFont(); + + mDoHIO_deleteChild(g_mwHIO.mNo); + mDoHIO_deleteChild(g_mwDHIO.mNo); + + return TRUE; } /* 801DF4C4-801DF684 .text dMs_Create__FP9msg_class */ -static cPhs_State dMs_Create(msg_class*) { - /* Nonmatching */ +static cPhs_State dMs_Create(msg_class* i_this) { + sub_ms_screen_class* i_Ms = (sub_ms_screen_class*)i_this; + + g_mwHIO.mNo = mDoHIO_createChild("アイテムビット", &g_mwHIO); // Item Bit + g_mwDHIO.mNo = mDoHIO_createChild("ダンジョンビット", &g_mwDHIO); // Dungeon Bit + + i_Ms->parentHeap_0xfc = dComIfGp_getExpHeap2D(); + + fonttype = mDoExt_getMesgFont(); + JUT_ASSERT(4097, fonttype != NULL); + + rfonttype = mDoExt_getRubyFont(); + JUT_ASSERT(4100, rfonttype != NULL); + + event_wait_frame = 0; + + dComIfGp_InputPasswordOpenCancelOff(); + + i_Ms->mButtonsPressed = 0; + i_Ms->mMsgID = fpcM_ERROR_PROCESS_ID_e; + i_Ms->field_0x1B0 = 0; + + dComIfGp_offHeapLockFlag(); + + if (dComIfGs_getFwaterTimer() != 0) { + dComIfGs_startFwaterTimer(); + } + + dMenu_setMenuStatus(MENU_STATUS_ITEM); + + dMv_CIO_c.field_0x0 = 0; + dMv_CIO_c.field_0x1 = 0; + dMv_CIO_c.field_0x2 = -10; + dMv_CIO_c.field_0x3 = -10; + dMv_CIO_c.field_0x4 = -10; + dMv_CIO_c.field_0x5 = -10; + dMv_CIO_c.field_0x6 = -10; + dMv_CIO_c.field_0x7 = -10; + dMv_CIO_c.field_0x8 = 0; + dMv_CIO_c.field_0x9 = -1; + dMv_CIO_c.field_0xA = -10; + dMv_CIO_c.field_0xB = -10; + + fopMsgM_setStageLayer(i_Ms); + + return cPhs_COMPLEATE_e; } + +msg_method_class l_dMs_Method = { + /* Create */ (process_method_func)dMs_Create, + /* Delete */ (process_method_func)dMs_Delete, + /* Execute */ (process_method_func)dMs_Execute, + /* IsDelete */ (process_method_func)dMs_IsDelete, + /* Draw */ (process_method_func)dMs_Draw, +}; + +msg_process_profile_definition g_profile_MENUWINDOW = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 0x000C, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_MENUWINDOW, + /* Proc SubMtd */ &g_fpcLf_Method.base, + /* Size */ sizeof(sub_ms_screen_class), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopMsg_Method, + /* Priority */ PRIO_MENUWINDOW, + /* Msg SubMtd */ &l_dMs_Method, +}; diff --git a/src/d/d_meter.cpp b/src/d/d_meter.cpp index 9bd4d5b13..b63365120 100644 --- a/src/d/d_meter.cpp +++ b/src/d/d_meter.cpp @@ -1744,19 +1744,19 @@ void dMeter_weponTrans(sub_meter_class* i_Meter) { } moveStatus = 9; } else if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0) { - if ((((dMeter_Info.field_0x1 == 0) || (dMeter_Info.field_0x1 == 1)) || (dMeter_Info.field_0x1 == 2)) || (dMeter_Info.field_0x1 == 3)) { + if ((((dMeter_Info.mButtonIconMode == 0) || (dMeter_Info.mButtonIconMode == 1)) || (dMeter_Info.mButtonIconMode == 2)) || (dMeter_Info.mButtonIconMode == 3)) { if (moveStatus != 8) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 2); } moveStatus = 8; - } else if (((dMeter_Info.field_0x1 == 7) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9 || (dMeter_Info.field_0x1 == 10))) { + } else if (((dMeter_Info.mButtonIconMode == 7) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9 || (dMeter_Info.mButtonIconMode == 10))) { if (moveStatus != 10) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 2); } moveStatus = 10; - } else if (dMeter_Info.field_0x1 == 6) { + } else if (dMeter_Info.mButtonIconMode == 6) { if (moveStatus != 1) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 2); @@ -2050,19 +2050,19 @@ void dMeter_actionForce(sub_meter_class* i_Meter) { dComIfGp_setAStatus(dActStts_RETURN_e); } if ((i_Meter->mStatusFlags & dMtrStts_UNK20_e) && (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0)) { - if (((dMeter_Info.field_0x1 == 0) || (dMeter_Info.field_0x1 == 1 || (dMeter_Info.field_0x1 == 2))) || (dMeter_Info.field_0x1 == 3)) { - if (dMeter_Info.field_0x1 == 0) { + if (((dMeter_Info.mButtonIconMode == 0) || (dMeter_Info.mButtonIconMode == 1 || (dMeter_Info.mButtonIconMode == 2))) || (dMeter_Info.mButtonIconMode == 3)) { + if (dMeter_Info.mButtonIconMode == 0) { dComIfGp_setDoStatus(dActStts_ba_zoom01); - } else if (dMeter_Info.field_0x1 == 1) { + } else if (dMeter_Info.mButtonIconMode == 1) { dComIfGp_setDoStatus(dActStts_ba_zoom02); - } else if ((dMeter_Info.field_0x1 == 2) || (dMeter_Info.field_0x1 == 3)) { + } else if ((dMeter_Info.mButtonIconMode == 2) || (dMeter_Info.mButtonIconMode == 3)) { dComIfGp_setDoStatus(dActStts_BLANK_e); } dComIfGp_setRStatus(dActStts_CHARTS_e); return; } - if ((((dMeter_Info.field_0x1 == 7) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9)) || (dMeter_Info.field_0x1 == 10)) { - if (dMeter_Info.field_0x1 == 10) { + if ((((dMeter_Info.mButtonIconMode == 7) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9)) || (dMeter_Info.mButtonIconMode == 10)) { + if (dMeter_Info.mButtonIconMode == 10) { dComIfGp_setDoStatus(dActStts_OPEN_e); } else { dComIfGp_setDoStatus(dActStts_BLANK_e); @@ -2070,7 +2070,7 @@ void dMeter_actionForce(sub_meter_class* i_Meter) { dComIfGp_setRStatus(dActStts_SEA_CHART_e); return; } - if (dMeter_Info.field_0x1 == 4) { + if (dMeter_Info.mButtonIconMode == 4) { dComIfGp_setDoStatus(dActStts_CHOOSE_e); dComIfGp_setRStatus(dActStts_BLANK_e); return; @@ -2180,19 +2180,19 @@ void dMeter_actionTrans(sub_meter_class* i_Meter) { moveStatus = 9; } else { if (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0) { - if ((((dMeter_Info.field_0x1 == 0) || (dMeter_Info.field_0x1 == 1)) || (dMeter_Info.field_0x1 == 2)) || (dMeter_Info.field_0x1 == 3)) { + if ((((dMeter_Info.mButtonIconMode == 0) || (dMeter_Info.mButtonIconMode == 1)) || (dMeter_Info.mButtonIconMode == 2)) || (dMeter_Info.mButtonIconMode == 3)) { if (moveStatus != 8) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 1); } moveStatus = 8; - } else if (((dMeter_Info.field_0x1 == 7) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9 || (dMeter_Info.field_0x1 == 10))) { + } else if (((dMeter_Info.mButtonIconMode == 7) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9 || (dMeter_Info.mButtonIconMode == 10))) { if (moveStatus != 0xb) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 1); } moveStatus = 0xb; - } else if ((dMeter_Info.field_0x1 == 0xb) || (dMeter_Info.field_0x1 == 6)) { + } else if ((dMeter_Info.mButtonIconMode == 0xb) || (dMeter_Info.mButtonIconMode == 6)) { if (moveStatus != 1) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 1); @@ -2379,8 +2379,8 @@ void dMeter_actionAlpha(sub_meter_class* i_Meter) { static s16 alphaNowFrame = 0; if (((i_Meter->mStatusFlags & dMtrStts_UNK20_e) && (dStage_stagInfo_GetUpButton(dComIfGp_getStageStagInfo()) == 0)) && - (dMeter_Info.field_0x1 == 2 || - (((dMeter_Info.field_0x1 == 3 || (dMeter_Info.field_0x1 == 7)) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9)))) + (dMeter_Info.mButtonIconMode == 2 || + (((dMeter_Info.mButtonIconMode == 3 || (dMeter_Info.mButtonIconMode == 7)) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9)))) { if (alphaNowFrame > 3) { alphaNowFrame--; @@ -3121,13 +3121,13 @@ void dMeter_xyTrans(sub_meter_class* i_Meter) { } } else { if (i_Meter->mStatusFlags & dMtrStts_UNK20_e) { - if ((((dMeter_Info.field_0x1 == 0) || (dMeter_Info.field_0x1 == 1)) || (dMeter_Info.field_0x1 == 2)) || (dMeter_Info.field_0x1 == 3)) { + if ((((dMeter_Info.mButtonIconMode == 0) || (dMeter_Info.mButtonIconMode == 1)) || (dMeter_Info.mButtonIconMode == 2)) || (dMeter_Info.mButtonIconMode == 3)) { if (moveStatus != 3) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 4); } moveStatus = 3; - } else if (((dMeter_Info.field_0x1 == 7) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9 || (dMeter_Info.field_0x1 == 10))) { + } else if (((dMeter_Info.mButtonIconMode == 7) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9 || (dMeter_Info.mButtonIconMode == 10))) { if (moveStatus != 4) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 4); @@ -3371,14 +3371,14 @@ void dMeter_rTrans(sub_meter_class* i_Meter) { moveStatus = 1; } else { if (i_Meter->mStatusFlags & dMtrStts_UNK20_e) { - if (((dMeter_Info.field_0x1 == 0) || (dMeter_Info.field_0x1 == 1)) || (dMeter_Info.field_0x1 == 2 || (dMeter_Info.field_0x1 == 3))) { + if (((dMeter_Info.mButtonIconMode == 0) || (dMeter_Info.mButtonIconMode == 1)) || (dMeter_Info.mButtonIconMode == 2 || (dMeter_Info.mButtonIconMode == 3))) { if (moveStatus != 3) { moveFlag = 1; dMeter_offBit8(&i_Meter->field_0x3026, 8); } moveStatus = 3; - } else if ((((dMeter_Info.field_0x1 == 7) || (dMeter_Info.field_0x1 == 8)) || (dMeter_Info.field_0x1 == 9)) || - (dMeter_Info.field_0x1 == 10)) + } else if ((((dMeter_Info.mButtonIconMode == 7) || (dMeter_Info.mButtonIconMode == 8)) || (dMeter_Info.mButtonIconMode == 9)) || + (dMeter_Info.mButtonIconMode == 10)) { if (moveStatus != 5) { moveFlag = 1; diff --git a/src/d/d_msg.cpp b/src/d/d_msg.cpp index 7d62c5dc8..36ec3453d 100644 --- a/src/d/d_msg.cpp +++ b/src/d/d_msg.cpp @@ -22,8 +22,6 @@ #include "m_Do/m_Do_lib.h" #include -extern dMeter_info_c dMeter_Info; - class J2DTextBox; struct fopMsgM_pane_class;