From 5ab99df86e6ac02ba282f1c53015fc2566df3cd3 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 14 Jan 2024 20:34:06 -0800 Subject: [PATCH] d_timer start --- include/d/d_com_inf_game.h | 8 + include/d/d_meter.h | 5 +- include/d/d_timer.h | 59 ++++-- include/f_op/f_op_msg_mng.h | 20 +- src/d/d_timer.cpp | 410 ++++++++++++++++++++++++++++++++---- 5 files changed, 432 insertions(+), 70 deletions(-) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 327f0e49d..5e39447cb 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -439,6 +439,8 @@ public: dTimer_c* getTimerPtr() { return mTimerInfo.mTimerPtr; } s32 getTimerMode() { return mTimerInfo.mTimerMode; } + s32 getTimerNowTimeMs() { return mTimerInfo.mTimerNowTimeMs; } + s32 getTimerLimitTimeMs() { return mTimerInfo.mTimerLimitTimeMs; } s16 getItemMagicCount() { return mItemMagicCount; } void setItemMagicCount(s16 magic) { mItemMagicCount += magic; } @@ -523,6 +525,7 @@ public: void setClothResArchive(JKRArchive * pArc) { mpClothResArchive = pArc; } void setSaveResArchive(JKRArchive * pArc) { mpSaveResArchive = pArc; } void setItemIconArchive(JKRArchive * pArc) { mpItemIconArchive = pArc; } + JKRArchive* getItemIconArchive() { return mpItemIconArchive; } void setNameResArchive(JKRArchive * pArc) { mpNameResArchive = pArc; } void setErrorResArchive(JKRArchive * pArc) { mpErrorResArchive = pArc; } void setActionIconArchive(JKRArchive * pArc) { mpActionIconArchive = pArc; } @@ -2774,6 +2777,7 @@ inline void dComIfGp_setOptResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.pl 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 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); } inline void dComIfGp_setErrorResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setErrorResArchive(pArc); } inline void dComIfGp_setActionIconArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setActionIconArchive(pArc); } @@ -3078,6 +3082,10 @@ inline u8 dComIfG_getBrightness() { return g_dComIfG_gameInfo.mBrightness; } +inline u32 dComIfG_getTimerRestTimeMs() { + return g_dComIfG_gameInfo.play.getTimerLimitTimeMs() - g_dComIfG_gameInfo.play.getTimerNowTimeMs(); +} + int dComIfG_changeOpeningScene(scene_class* i_scene, s16 i_procName); #endif /* D_COM_D_COM_INF_GAME_H */ diff --git a/include/d/d_meter.h b/include/d/d_meter.h index 0fe382751..34d419167 100644 --- a/include/d/d_meter.h +++ b/include/d/d_meter.h @@ -247,8 +247,9 @@ public: /* 0x94 */ f32 field_0x94; /* 0x98 */ u8 field_0x98; /* 0x99 */ u8 field_0x99; - /* 0x9A */ short field_0x9a; - /* 0x9C */ u8 field_0x9C[0xA0 - 0x9C]; + /* 0x9A */ s16 field_0x9a; + /* 0x9C */ s16 field_0x9c; + /* 0x9E */ s16 field_0x9e; /* 0xA0 */ f32 field_0xa0; /* 0xA4 */ short field_0xa4; /* 0xA6 */ short field_0xa6; diff --git a/include/d/d_timer.h b/include/d/d_timer.h index e3b628904..ca3904c2f 100644 --- a/include/d/d_timer.h +++ b/include/d/d_timer.h @@ -1,18 +1,20 @@ #ifndef D_TIMER_H #define D_TIMER_H -#include "SSystem/SComponent/c_phase.h" #include "f_op/f_op_msg_mng.h" +#include "d/d_drawlist.h" +#include "SSystem/SComponent/c_phase.h" class J2DPane; class JKRArchive; +class JKRSolidHeap; -class dDlst_TimerScrnDraw_c { +class dDlst_TimerScrnDraw_c : public dDlst_base_c { public: ~dDlst_TimerScrnDraw_c(); void setScreen(const char*, JKRArchive*); void changeNumberTexture(J2DPane*, int); - void getNumber(int); + const char* getNumber(int); void setTimer(int); void setRupee(s16); void setPaneInitialPos(fopMsgM_pane_class*, f32, f32); @@ -21,17 +23,46 @@ public: void setShowType(u8); void setIconType(void*, u8); void anime(); - void closeAnime(); - void hide(); + bool closeAnime(); + bool hide(); void draw(); + +public: + /* 0x004 */ J2DScreen* scrn; + /* 0x008 */ fopMsgM_pane_class field_0x008; + /* 0x040 */ fopMsgM_pane_class field_0x040; + /* 0x078 */ fopMsgM_pane_class field_0x078; + /* 0x0B0 */ fopMsgM_pane_class field_0x0b0; + /* 0x0E8 */ fopMsgM_pane_class field_0x0e8; + /* 0x120 */ fopMsgM_pane_class field_0x120; + /* 0x158 */ fopMsgM_pane_class field_0x158; + /* 0x190 */ fopMsgM_pane_class field_0x190; + /* 0x1C8 */ fopMsgM_pane_class field_0x1c8; + /* 0x200 */ J2DPane* field_0x200; + /* 0x204 */ J2DPane* field_0x204; + /* 0x208 */ J2DPane* field_0x208; + /* 0x20C */ J2DPane* field_0x20c; + /* 0x210 */ J2DPane* field_0x210; + /* 0x214 */ J2DPane* field_0x214; + /* 0x218 */ J2DPane* field_0x218; + /* 0x21C */ J2DPane* field_0x21c; + /* 0x220 */ J2DPane* field_0x220; + /* 0x224 */ J2DPane* field_0x224; + /* 0x228 */ J2DPane* field_0x228; + /* 0x22C */ J2DPicture* field_0x22c; + /* 0x230 */ u32 field_0x230; + /* 0x234 */ s8 field_0x234; + /* 0x235 */ u8 field_0x235; + /* 0x236 */ u8 field_0x236; + /* 0x237 */ u8 field_0x237; }; -class dTimer_c { +class dTimer_c : public msg_class { public: - void _create(); - void _execute(); - void _draw(); - void _delete(); + s32 _create(); + BOOL _execute(); + BOOL _draw(); + BOOL _delete(); void RestTimeCheck(int); void deleteCheck(); void SetSE(); @@ -47,14 +78,14 @@ public: void getLimitTimeMs(); void getRestTimeMs(); - /* 0x000 */ msg_class parent; /* 0x0FC */ dDlst_TimerScrnDraw_c* mpScrnDraw; - /* 0x100 */ u8 field_0x100[0x104 - 0x100]; + /* 0x100 */ void* iconTex; /* 0x104 */ request_of_phase_process_class mPhs; /* 0x10C */ u8 field_0x10C[0x154 - 0x10C]; - /* 0x154 */ int field_0x154; + /* 0x154 */ u32 mType; /* 0x158 */ u8 field_0x158[0x170 - 0x158]; - /* 0x170 */ JKRHeap* mpSolidHeap; + /* 0x170 */ JKRSolidHeap* mpSolidHeap; + /* 0x174 */ u32 field_0x174; }; #endif /* D_TIMER_H */ diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 0d44efb76..033b87bd4 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -25,20 +25,16 @@ struct fopMsg_prm_class { /* 0x18 */ int field_0x18; }; // Size: 0x1C -struct fopMsg_prm_timer { - /* 0x00 */ int field_0x0; - /* 0x04 */ cXyz field_0x4; - /* 0x10 */ int field_0x10; - /* 0x14 */ int field_0x14; - /* 0x18 */ u32 field_0x18; +struct fopMsg_prm_timer : public fopMsg_prm_class { /* 0x1C */ int field_0x1c; - /* 0x20 */ u32 field_0x20; + /* 0x20 */ u8 field_0x20; + /* 0x21 */ u8 field_0x21; + /* 0x22 */ u8 mShowType; + /* 0x23 */ u8 mIconType; /* 0x24 */ u8 field_0x24; /* 0x25 */ u8 field_0x25; - /* 0x28 */ f32 field_0x28; - /* 0x2C */ f32 field_0x2c; - /* 0x30 */ f32 field_0x30; - /* 0x34 */ f32 field_0x34; + /* 0x28 */ cXy mTimerPos; + /* 0x30 */ cXy mRupeePos; }; // Size: 0x38 class J2DScreen; @@ -80,7 +76,7 @@ int fopMsgM_messageSet(u32 param_0); int fopMsgM_messageSetDemo(u32 param_0); msg_class* fopMsgM_SearchByID(unsigned int param_0); char* fopMsgM_messageGet(char* msg, u32 string_id); -s32 fop_Timer_create(s16 param_0, u8 param_1, u32 param_2, u8 param_3, u8 param_4, f32 param_5, +s32 fop_Timer_create(s16 param_0, u8 param_1, u16 param_2, u8 param_3, u8 param_4, f32 param_5, f32 param_6, f32 param_7, f32 param_8, fopMsgCreateFunc createFunc); inline s32 fopMsgM_Timer_create(s16 param_0, u8 param_1, u32 param_2, u8 param_3, u8 param_4, f32 param_5, f32 param_6, f32 param_7, f32 param_8, diff --git a/src/d/d_timer.cpp b/src/d/d_timer.cpp index 0ffac5be0..a4a759bfa 100644 --- a/src/d/d_timer.cpp +++ b/src/d/d_timer.cpp @@ -4,25 +4,101 @@ // #include "d/d_timer.h" -#include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "d/d_item.h" +#include "d/d_meter.h" +#include "d/d_procname.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DOrthoGraph.h" +#include "JSystem/JKernel/JKRArchive.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JKernel/JKRSolidHeap.h" + +u32 ShipRaceSeTable[] = { + 0x7530, JA_SE_SGAME_TIMER_30, + 0x4E20, JA_SE_SGAME_TIMER_30, + 0x2710, JA_SE_SGAME_TIMER_10, + 0x2328, JA_SE_SGAME_TIMER_10, + 0x1F40, JA_SE_SGAME_TIMER_10, + 0x1B58, JA_SE_SGAME_TIMER_10, + 0x1770, JA_SE_SGAME_TIMER_10, + 0x1388, JA_SE_SGAME_TIMER_10, + 0x0FA0, JA_SE_SGAME_TIMER_10, + 0x0BB8, JA_SE_SGAME_TIMER_10, + 0x07D0, JA_SE_SGAME_TIMER_10, + 0x03E8, JA_SE_SGAME_TIMER_10, + 0xFFFFFFFF, 0x0000, +}; + +u32 VolcanoSeTable[] = { + 0xEA60, JA_SE_MINIGAME_TIMER_30, + 0x7530, JA_SE_MINIGAME_TIMER_30, + 0x2710, JA_SE_MINIGAME_TIMER_10, + 0x2328, JA_SE_MINIGAME_TIMER_10, + 0x1F40, JA_SE_MINIGAME_TIMER_10, + 0x1B58, JA_SE_MINIGAME_TIMER_10, + 0x1770, JA_SE_MINIGAME_TIMER_10, + 0x1388, JA_SE_MINIGAME_TIMER_10, + 0x0FA0, JA_SE_MINIGAME_TIMER_10, + 0x0BB8, JA_SE_MINIGAME_TIMER_10, + 0x07D0, JA_SE_MINIGAME_TIMER_10, + 0x03E8, JA_SE_MINIGAME_TIMER_10, + 0xFFFFFFFF, 0x0000, +}; /* 8023B860-8023BCD8 .text _create__8dTimer_cFv */ -void dTimer_c::_create() { +s32 dTimer_c::_create() { /* Nonmatching */ + s32 rt = dComIfG_resLoad(&mPhs, "Timer"); + if (rt == cPhs_COMPLEATE_e) { + fopMsg_prm_timer* prm = (fopMsg_prm_timer*)fopMsgM_GetAppend(this); + if (prm == NULL) + return cPhs_ERROR_e; + + dRes_info_c* resInfo = dComIfG_getObjectResInfo("Timer"); + JUT_ASSERT(0x44, resInfo != 0); + + if (prm->mIconType != 0) { + mpSolidHeap = mDoExt_createSolidHeapFromGameToCurrent(0x4260, 0x20); + } else { + mpSolidHeap = mDoExt_createSolidHeapFromGameToCurrent(0x34C0, 0x20); + } + + if (mpSolidHeap == NULL) + return cPhs_ERROR_e; + + mpScrnDraw = new dDlst_TimerScrnDraw_c(); + mpScrnDraw->setScreen("ship_race0.blo", resInfo->getArchive()); + if (prm->mIconType != 0) { + iconTex = JKRAllocFromHeap(mpSolidHeap, 0xC00, 0x20); + JUT_ASSERT(0x5a, iconTex != 0); + mpScrnDraw->setIconType(iconTex, prm->mIconType); + } + + mDoExt_restoreCurrentHeap(); + mDoExt_adjustSolidHeap(mpSolidHeap); + + mpScrnDraw->setRupeePos(prm->mRupeePos.x, prm->mRupeePos.y); + mpScrnDraw->setTimerPos(prm->mTimerPos.x, prm->mTimerPos.y); + mpScrnDraw->setShowType(prm->mShowType); + mType = prm->field_0x1c; + if (mType == 7) { + } + } } /* 8023BCD8-8023BF88 .text _execute__8dTimer_cFv */ -void dTimer_c::_execute() { +BOOL dTimer_c::_execute() { /* Nonmatching */ } /* 8023BF88-8023BFE4 .text _draw__8dTimer_cFv */ -void dTimer_c::_draw() { +BOOL dTimer_c::_draw() { /* Nonmatching */ } /* 8023BFE4-8023C0B8 .text _delete__8dTimer_cFv */ -void dTimer_c::_delete() { +BOOL dTimer_c::_delete() { /* Nonmatching */ } @@ -97,58 +173,231 @@ void dTimer_c::getRestTimeMs() { } /* 8023C69C-8023CA24 .text setScreen__21dDlst_TimerScrnDraw_cFPCcP10JKRArchive */ -void dDlst_TimerScrnDraw_c::setScreen(const char*, JKRArchive*) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::setScreen(const char* file, JKRArchive* arc) { + scrn = new J2DScreen(); + scrn->set(file, arc); + field_0x22c = NULL; + fopMsgM_setPaneData(&field_0x008, scrn->search('tim0')); + fopMsgM_setPaneData(&field_0x040, scrn->search('cn00')); + fopMsgM_setPaneData(&field_0x078, scrn->search('tt01')); + fopMsgM_setPaneData(&field_0x0b0, scrn->search('tn01')); + fopMsgM_setPaneData(&field_0x0e8, scrn->search('tn00')); + fopMsgM_setPaneData(&field_0x120, scrn->search('tk00')); + fopMsgM_setPaneData(&field_0x158, scrn->search('\x00rup')); + fopMsgM_setPaneData(&field_0x190, scrn->search('ruxk')); + fopMsgM_setPaneData(&field_0x1c8, scrn->search('rupk')); + field_0x200 = scrn->search('tt02'); + field_0x204 = scrn->search('tt03'); + field_0x208 = scrn->search('tt04'); + field_0x20c = scrn->search('tt05'); + field_0x210 = scrn->search('tt06'); + + field_0x214 = scrn->search('\x00ru1'); + field_0x218 = scrn->search('\x00ru2'); + field_0x21c = scrn->search('\x00ru3'); + + field_0x220 = scrn->search('ruk1'); + field_0x224 = scrn->search('ruk2'); + field_0x228 = scrn->search('ruk3'); + + setShowType(3); } /* 8023CA24-8023CA78 .text changeNumberTexture__21dDlst_TimerScrnDraw_cFP7J2DPanei */ -void dDlst_TimerScrnDraw_c::changeNumberTexture(J2DPane*, int) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::changeNumberTexture(J2DPane* pane, int no) { + if (no < 0 || no >= 10) + no = 0; + + ((J2DPicture*)pane)->changeTexture(getNumber(no), 0); } /* 8023CA78-8023CA8C .text getNumber__21dDlst_TimerScrnDraw_cFi */ -void dDlst_TimerScrnDraw_c::getNumber(int) { - /* Nonmatching */ +const char* dDlst_TimerScrnDraw_c::getNumber(int no) { + static const char* number[] = { + "s_rupy_num_00.bti", + "s_rupy_num_01.bti", + "s_rupy_num_02.bti", + "s_rupy_num_03.bti", + "s_rupy_num_04.bti", + "s_rupy_num_05.bti", + "s_rupy_num_06.bti", + "s_rupy_num_07.bti", + "s_rupy_num_08.bti", + "s_rupy_num_09.bti", + }; + + return number[no]; } /* 8023CA8C-8023CCD8 .text setTimer__21dDlst_TimerScrnDraw_cFi */ -void dDlst_TimerScrnDraw_c::setTimer(int) { +void dDlst_TimerScrnDraw_c::setTimer(int time) { /* Nonmatching */ + s32 minsec = time / 1000; + s32 min = minsec / 60; + s32 sec = minsec % 60; + changeNumberTexture(field_0x078.pane, min / 10); + changeNumberTexture(field_0x200, min % 10); + changeNumberTexture(field_0x204, sec / 10); + changeNumberTexture(field_0x208, sec % 10); + changeNumberTexture(field_0x20c, (time % 1000) / 100); + changeNumberTexture(field_0x210, ((time % 1000) / 100) / 10); + if (dComIfGp_event_getMode() == 1) { + if (field_0x008.mUserArea < 5) { + field_0x008.mUserArea++; + s16 alphaStep = 5 - field_0x008.mUserArea; + f32 alpha = ((f32)alphaStep * (f32)alphaStep) / 25.0f; + fopMsgM_setNowAlpha(&field_0x008, alpha); + fopMsgM_setNowAlpha(&field_0x040, alpha); + fopMsgM_setNowAlpha(&field_0x078, alpha); + fopMsgM_setNowAlpha(&field_0x0b0, alpha); + fopMsgM_setNowAlpha(&field_0x0e8, alpha); + fopMsgM_setNowAlpha(&field_0x120, alpha); + } + } else { + if (field_0x008.mUserArea > 0) { + field_0x008.mUserArea--; + int alphaStep = 5 - field_0x008.mUserArea; + f32 alpha = ((f32)alphaStep * (f32)alphaStep) / 25.0f; + fopMsgM_setNowAlpha(&field_0x008, alpha); + fopMsgM_setNowAlpha(&field_0x040, alpha); + fopMsgM_setNowAlpha(&field_0x078, alpha); + fopMsgM_setNowAlpha(&field_0x0b0, alpha); + fopMsgM_setNowAlpha(&field_0x0e8, alpha); + fopMsgM_setNowAlpha(&field_0x120, alpha); + } + } } /* 8023CCD8-8023CEF0 .text setRupee__21dDlst_TimerScrnDraw_cFs */ -void dDlst_TimerScrnDraw_c::setRupee(s16) { +void dDlst_TimerScrnDraw_c::setRupee(s16 num) { /* Nonmatching */ + if (num != field_0x230) { + if (num > field_0x230) { + field_0x230++; + } else { + field_0x230--; + } + + if (field_0x230 < 0) + field_0x230 = 0; + + changeNumberTexture(field_0x21c, field_0x230 % 10); + changeNumberTexture(field_0x218, (field_0x230 % 100) / 10); + changeNumberTexture(field_0x214, field_0x230 / 100); + + changeNumberTexture(field_0x228, field_0x230 % 10); + changeNumberTexture(field_0x224, (field_0x230 % 100) / 10); + changeNumberTexture(field_0x220, field_0x230 / 100); + } + + + if (dComIfGp_event_getMode() == 1) { + if (field_0x158.mUserArea < 5) { + field_0x158.mUserArea++; + s16 alphaStep = 5 - field_0x008.mUserArea; + f32 alpha = 1.0f - ((f32)alphaStep * (f32)alphaStep) / 25.0f; + fopMsgM_setNowAlpha(&field_0x158, alpha); + fopMsgM_setNowAlpha(&field_0x190, alpha); + fopMsgM_setNowAlpha(&field_0x1c8, alpha); + } + } else { + if (field_0x158.mUserArea > 0) { + field_0x158.mUserArea--; + s16 alphaStep = 5 - field_0x008.mUserArea; + f32 alpha = 1.0f - ((f32)alphaStep * (f32)alphaStep) / 25.0f; + fopMsgM_setNowAlpha(&field_0x158, alpha); + fopMsgM_setNowAlpha(&field_0x190, alpha); + fopMsgM_setNowAlpha(&field_0x1c8, alpha); + } + } } /* 8023CEF0-8023CF48 .text dTm_parentPaneScale__FP18fopMsgM_pane_classP18fopMsgM_pane_classf */ -void dTm_parentPaneScale(fopMsgM_pane_class*, fopMsgM_pane_class*, f32) { - /* Nonmatching */ +void dTm_parentPaneScale(fopMsgM_pane_class* pane, fopMsgM_pane_class* parent, f32 scale) { + pane->mPosCenter.x = parent->mPosCenter.x + scale * (pane->mPosCenterOrig.x - parent->mPosCenterOrig.x); + pane->mPosCenter.y = parent->mPosCenter.y + scale * (pane->mPosCenterOrig.y - parent->mPosCenterOrig.y); + fopMsgM_paneScaleXY(pane, scale); } /* 8023CF48-8023CF98 .text setPaneInitialPos__21dDlst_TimerScrnDraw_cFP18fopMsgM_pane_classff */ -void dDlst_TimerScrnDraw_c::setPaneInitialPos(fopMsgM_pane_class*, f32, f32) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::setPaneInitialPos(fopMsgM_pane_class* pane, f32 x, f32 y) { + pane->mPosCenterOrig.x = x + pane->mSizeOrig.x / 2.0f; + pane->mPosCenterOrig.y = y + pane->mSizeOrig.y / 2.0f; + fopMsgM_paneTrans(pane, 0.0f, 0.0f); } /* 8023CF98-8023D0CC .text setTimerPos__21dDlst_TimerScrnDraw_cFff */ -void dDlst_TimerScrnDraw_c::setTimerPos(f32, f32) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::setTimerPos(f32 x, f32 y) { + setPaneInitialPos(&field_0x008, x, y); + setPaneInitialPos(&field_0x040, x + field_0x040.mPosTopLeftOrig.x - field_0x008.mPosTopLeftOrig.x, y + field_0x040.mPosTopLeftOrig.y - field_0x008.mPosTopLeftOrig.y); + setPaneInitialPos(&field_0x078, x + field_0x078.mPosTopLeftOrig.x - field_0x008.mPosTopLeftOrig.x, y + field_0x078.mPosTopLeftOrig.y - field_0x008.mPosTopLeftOrig.y); + setPaneInitialPos(&field_0x0b0, x + field_0x0b0.mPosTopLeftOrig.x - field_0x008.mPosTopLeftOrig.x, y + field_0x0b0.mPosTopLeftOrig.y - field_0x008.mPosTopLeftOrig.y); + setPaneInitialPos(&field_0x0e8, x + field_0x0e8.mPosTopLeftOrig.x - field_0x008.mPosTopLeftOrig.x, y + field_0x0e8.mPosTopLeftOrig.y - field_0x008.mPosTopLeftOrig.y); + setPaneInitialPos(&field_0x120, x + field_0x120.mPosTopLeftOrig.x - field_0x008.mPosTopLeftOrig.x, y + field_0x120.mPosTopLeftOrig.y - field_0x008.mPosTopLeftOrig.y); } /* 8023D0CC-8023D128 .text setRupeePos__21dDlst_TimerScrnDraw_cFff */ -void dDlst_TimerScrnDraw_c::setRupeePos(f32, f32) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::setRupeePos(f32 x, f32 y) { + setPaneInitialPos(&field_0x158, x, y); + setPaneInitialPos(&field_0x1c8, x, y); } /* 8023D128-8023D1F8 .text setShowType__21dDlst_TimerScrnDraw_cFUc */ -void dDlst_TimerScrnDraw_c::setShowType(u8) { - /* Nonmatching */ +void dDlst_TimerScrnDraw_c::setShowType(u8 type) { + if (type & 1) { + field_0x008.pane->show(); + field_0x040.pane->show(); + field_0x078.pane->show(); + field_0x0b0.pane->show(); + field_0x0e8.pane->show(); + field_0x120.pane->show(); + } else { + field_0x008.pane->hide(); + field_0x040.pane->hide(); + field_0x078.pane->hide(); + field_0x0b0.pane->hide(); + field_0x0e8.pane->hide(); + field_0x120.pane->hide(); + } + + if (type & 2) { + field_0x158.pane->show(); + field_0x1c8.pane->show(); + if (field_0x22c != NULL) + field_0x22c->show(); + } else { + field_0x158.pane->hide(); + field_0x1c8.pane->hide(); + if (field_0x22c != NULL) + field_0x22c->hide(); + } } /* 8023D1F8-8023D318 .text setIconType__21dDlst_TimerScrnDraw_cFPvUc */ -void dDlst_TimerScrnDraw_c::setIconType(void*, u8) { +void dDlst_TimerScrnDraw_c::setIconType(void* tex, u8 type) { /* Nonmatching */ + + u32 itemNo; + switch (type) { + case 0: + case 1: + case 2: + case 3: + itemNo = dComIfGs_getSelectEquip(0); + break; + case 4: + itemNo = LETTER00; + break; + default: + itemNo = (u32)tex; + break; + } + + JKRArchive::readTypeResource(tex, 0xC00, 'TIMG', dItem_data::getTexture(itemNo), dComIfGp_getItemIconArchive()); + field_0x22c = new J2DPicture(); + ((J2DPicture*)field_0x158.pane)->setWhite(JUtility::TColor(0)); + ((J2DPicture*)field_0x1c8.pane)->setWhite(JUtility::TColor(0)); + field_0x22c->setAlpha(0); } /* 8023D318-8023D644 .text anime__21dDlst_TimerScrnDraw_cFv */ @@ -157,56 +406,133 @@ void dDlst_TimerScrnDraw_c::anime() { } /* 8023D644-8023D848 .text closeAnime__21dDlst_TimerScrnDraw_cFv */ -void dDlst_TimerScrnDraw_c::closeAnime() { +bool dDlst_TimerScrnDraw_c::closeAnime() { /* Nonmatching */ + bool ret = false; + field_0x234++; + if (field_0x234 <= 7) { + s32 alphaStep = 7 - field_0x234; + f32 alpha = ((f32)alphaStep * (f32)alphaStep) / 49.0f; + f32 x = (((f32)field_0x234 * (f32)field_0x234) / 49.0f) * -50.0f; + fopMsgM_paneTrans(&field_0x008, x, 0.0f); + fopMsgM_paneTrans(&field_0x040, x, 0.0f); + fopMsgM_paneTrans(&field_0x0b0, x, 0.0f); + fopMsgM_paneTrans(&field_0x0e8, x, 0.0f); + fopMsgM_paneTrans(&field_0x120, x, 0.0f); + fopMsgM_setNowAlpha(&field_0x008, alpha); + fopMsgM_setNowAlpha(&field_0x040, alpha); + fopMsgM_setNowAlpha(&field_0x078, alpha); + fopMsgM_setNowAlpha(&field_0x0b0, alpha); + fopMsgM_setNowAlpha(&field_0x0e8, alpha); + fopMsgM_setNowAlpha(&field_0x120, alpha); + fopMsgM_paneTrans(&field_0x158, x + g_menuHIO.field_0x9a, g_menuHIO.field_0x9c); + fopMsgM_setNowAlpha(&field_0x158, alpha); + fopMsgM_setNowAlpha(&field_0x190, alpha); + fopMsgM_setNowAlpha(&field_0x1c8, alpha); + } + + if (field_0x234 >= 7) + ret = true; + + return ret; } /* 8023D848-8023D8BC .text hide__21dDlst_TimerScrnDraw_cFv */ -void dDlst_TimerScrnDraw_c::hide() { - /* Nonmatching */ +bool dDlst_TimerScrnDraw_c::hide() { + fopMsgM_setNowAlphaZero(&field_0x008); + fopMsgM_setNowAlphaZero(&field_0x040); + fopMsgM_setNowAlphaZero(&field_0x078); + fopMsgM_setNowAlphaZero(&field_0x0b0); + fopMsgM_setNowAlphaZero(&field_0x0e8); + fopMsgM_setNowAlphaZero(&field_0x120); + fopMsgM_setNowAlphaZero(&field_0x158); + fopMsgM_setNowAlphaZero(&field_0x190); + fopMsgM_setNowAlphaZero(&field_0x1c8); + return true; } /* 8023D8BC-8023D9A0 .text draw__21dDlst_TimerScrnDraw_cFv */ void dDlst_TimerScrnDraw_c::draw() { /* Nonmatching */ + fopMsgM_setAlpha(&field_0x008); + fopMsgM_setAlpha(&field_0x040); + fopMsgM_setAlpha(&field_0x078); + fopMsgM_setAlpha(&field_0x0b0); + fopMsgM_setAlpha(&field_0x0e8); + fopMsgM_setAlpha(&field_0x120); + fopMsgM_setAlpha(&field_0x158); + fopMsgM_setAlpha(&field_0x190); + fopMsgM_setAlpha(&field_0x1c8); + J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort(); + graf->setPort(); + scrn->draw(0.0f, 0.0f, graf); + if (field_0x22c != NULL) { + field_0x22c->draw(field_0x158.mPosTopLeft.x, field_0x158.mPosTopLeft.y, field_0x158.mSize.x, field_0x158.mSize.y, false, false, false); + field_0x22c->setAlpha(field_0x158.mNowAlpha); + } } /* 8023D9A0-8023D9C0 .text dTimer_Draw__FP8dTimer_c */ -void dTimer_Draw(dTimer_c*) { - /* Nonmatching */ +BOOL dTimer_Draw(dTimer_c* i_this) { + return i_this->_draw(); } /* 8023D9C0-8023D9E0 .text dTimer_Execute__FP8dTimer_c */ -void dTimer_Execute(dTimer_c*) { - /* Nonmatching */ +BOOL dTimer_Execute(dTimer_c* i_this) { + return i_this->_execute(); } /* 8023D9E0-8023D9E8 .text dTimer_IsDelete__FP8dTimer_c */ -void dTimer_IsDelete(dTimer_c*) { - /* Nonmatching */ +BOOL dTimer_IsDelete(dTimer_c* i_this) { + return TRUE; } /* 8023D9E8-8023DA08 .text dTimer_Delete__FP8dTimer_c */ -void dTimer_Delete(dTimer_c*) { - /* Nonmatching */ +BOOL dTimer_Delete(dTimer_c* i_this) { + return i_this->_delete(); } /* 8023DA08-8023DA28 .text dTimer_Create__FP9msg_class */ -void dTimer_Create(msg_class*) { - /* Nonmatching */ +s32 dTimer_Create(msg_class* i_this) { + return ((dTimer_c*)i_this)->_create(); } /* 8023DA28-8023DA88 .text dTimer_createTimer__FiUsUcUcffff */ -void dTimer_createTimer(int, u16, u8, u8, f32, f32, f32, f32) { - /* Nonmatching */ +s32 dTimer_createTimer(int param_1, u16 param_2, u8 param_3, u8 param_4, f32 param_5, f32 param_6, f32 param_7, f32 param_8) { + if (dComIfG_getTimerMode() == -1) + return fop_Timer_create(PROC_TIMER, param_1, param_2, param_3, param_4, param_5, param_6, param_7, param_8, NULL); + return -1; } /* 8023DA88-8023DAEC .text dTimer_createStockTimer__Fv */ -void dTimer_createStockTimer() { - /* Nonmatching */ +s32 dTimer_createStockTimer() { + if (dComIfG_getTimerMode() != -1) + return fop_Timer_create(PROC_TIMER, 7, 0, 3, 0, 221.0f, 439.0f, 32.0f, 419.0f, NULL); + return -1; } /* 8023DAEC-8023DB48 .text __dt__21dDlst_TimerScrnDraw_cFv */ dDlst_TimerScrnDraw_c::~dDlst_TimerScrnDraw_c() { - /* Nonmatching */ } + +msg_method_class l_dTimer_Method = { + (process_method_func)dTimer_Create, + (process_method_func)dTimer_Delete, + (process_method_func)dTimer_Execute, + (process_method_func)dTimer_IsDelete, + (process_method_func)dTimer_Draw, +}; + +msg_process_profile_definition g_profile_TIMER = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 12, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_TIMER, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(dTimer_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopMsg_Method, + /* Priority */ 0x01D2, + /* Msg SubMtd */ &l_dTimer_Method, +};