Skip to content

Commit

Permalink
f_op_msg_mng work
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Dec 28, 2024
1 parent f543b7b commit 72bbd3e
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 81 deletions.
2 changes: 1 addition & 1 deletion include/JSystem/J2DGraph/J2DTextBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ class J2DTextBox : public J2DPane {
/* 0xFE */ bool mTextFontOwned;
}; // Size: 0x100

#endif /* J2DTEXTBOX_H */
#endif /* J2DTEXTBOX_H */
11 changes: 11 additions & 0 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class dComIfG_play_c {
int getItemRupeeCount() { return mItemRupeeCount; }
void setItemRupeeCount(s32 count) { mItemRupeeCount += count; }
void setMessageCountNumber(s16 num) { mMsgCountNumber = num; }
s16 getMessageCountNumber() { return mMsgCountNumber; }

void setMessageSetNumber(s16 num) { mMsgSetNumber = num; }
s16 getMessageSetNumber() { return mMsgSetNumber; }
Expand Down Expand Up @@ -467,6 +468,7 @@ class dComIfG_play_c {

void setMsgArchive(JKRArchive * pArc) { mpMsgArchive = pArc; }
void setDmsgArchive(JKRArchive * pArc) { mpDmsgArchive = pArc; }
JKRArchive* getDmsgArchive() { return mpDmsgArchive; }
void setTmsgArchive(JKRArchive * pArc) { mpTmsgArchive = pArc; }
JKRArchive* getTmsgArchive() { return mpTmsgArchive; }
void setMenuArchive(JKRArchive * pArc) { mpMenuArchive = pArc; }
Expand Down Expand Up @@ -498,8 +500,10 @@ class dComIfG_play_c {
void setWindResArchive(JKRArchive * pArc) { mpWindResArchive = pArc; }
void setFontArchive(JKRArchive * pArc) { mpFont0Archive = pArc; }
void setMsgDtArchive(JKRArchive * pArc) { mpEnglishTextArchive = pArc; }
JKRArchive* getMsgDtArchive() { return mpEnglishTextArchive; }
#if VERSION != VERSION_JPN
void setMsgDt2Archive(JKRArchive * pArc) { mpHyruleTextArchive = pArc; }
JKRArchive* getMsgDt2Archive() { return mpHyruleTextArchive; }
#endif

void setItemTable(void * pData) { mpItemTable = (ItemTableList*)pData; }
Expand Down Expand Up @@ -2358,6 +2362,10 @@ inline void dComIfGp_setMessageCountNumber(s16 num) {
g_dComIfG_gameInfo.play.setMessageCountNumber(num);
}

inline s16 dComIfGp_getMessageCountNumber() {
return g_dComIfG_gameInfo.play.getMessageCountNumber();
}

inline s32 dComIfGp_checkStatus(u16 flags) {
return g_dComIfG_gameInfo.play.checkStatus(flags);
}
Expand Down Expand Up @@ -3154,6 +3162,7 @@ inline void dComIfGp_setAnmArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.
inline JKRArchive* dComIfGp_getAnmArchive() { return g_dComIfG_gameInfo.play.getAnmArchive(); }
inline void dComIfGp_setMsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgArchive(pArc); }
inline void dComIfGp_setDmsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setDmsgArchive(pArc); }
inline JKRArchive* dComIfGp_getDmsgArchive() { return g_dComIfG_gameInfo.play.getDmsgArchive(); }
inline void dComIfGp_setTmsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setTmsgArchive(pArc); }
inline JKRArchive* dComIfGp_getTmsgArchive() { return g_dComIfG_gameInfo.play.getTmsgArchive(); }
inline void dComIfGp_setMenuArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMenuArchive(pArc); }
Expand Down Expand Up @@ -3183,8 +3192,10 @@ inline void dComIfGp_setSwimResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.p
inline void dComIfGp_setWindResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setWindResArchive(pArc); }
inline void dComIfGp_setFontArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFontArchive(pArc); }
inline void dComIfGp_setMsgDtArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgDtArchive(pArc); }
inline JKRArchive* dComIfGp_getMsgDtArchive() { return g_dComIfG_gameInfo.play.getMsgDtArchive(); }
#if VERSION != VERSION_JPN
inline void dComIfGp_setMsgDt2Archive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgDt2Archive(pArc); }
inline JKRArchive* dComIfGp_getMsgDt2Archive() { return g_dComIfG_gameInfo.play.getMsgDt2Archive(); }
#endif

inline void dComIfGp_setItemTable(void * pData) { g_dComIfG_gameInfo.play.setItemTable(pData); }
Expand Down
25 changes: 12 additions & 13 deletions include/d/d_s_open.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef D_S_OPEN
#define D_S_OPEN

#include "JSystem/J2DGraph/J2DPane.h"
#include "d/d_drawlist.h"
#include "f_op/f_op_msg_mng.h"
#include "f_op/f_op_scene.h"
Expand All @@ -12,13 +13,21 @@ class dScnOpen_message_c {
public:
dScnOpen_message_c(JKRExpHeap*);
virtual ~dScnOpen_message_c();
inline void set_pane_pointer(J2DPane* tx1, J2DPane* tx2);
void set_message(u32, int);
void exec();

public:
/* 0x0000 */ u8 field_0x00[0x2000];
/* 0x0004 */ char msg1[0x800];
/* 0x0804 */ char msg2[0x800];
/* 0x1004 */ char msg3[0x800];
/* 0x1804 */ char msg4[0x800];
/* 0x2004 */ fopMsgM_msgDataProc_c mMsgDataProc;
/* 0x22A4 */ u8 field_0x22a4[0x22c0 - 0x22a4];
/* 0x22A4 */ u8 field_0x22a4[0x22bc - 0x22a4];
/* 0x22BC */ u8 field_0x22bc;
/* 0x22BD */ u8 field_0x22bd;
/* 0x22BE */ u8 field_0x22be;
/* 0x22BF */ u8 field_0x22bf;
/* 0x22C0 */ u32 field_0x22c0;
/* 0x22C4 */ J2DTextBox* field_0x22c4;
/* 0x22C8 */ J2DTextBox* field_0x22c8;
Expand All @@ -45,17 +54,7 @@ class dScnOpen_proc_c : public dDlst_base_c {
/* 0x004 */ JKRExpHeap* exp_heap;
/* 0x008 */ dScnOpen_message_c* m_message;
/* 0x00C */ J2DScreen* m_Screen;
/* 0x010 */ J2DPane* d1;
/* 0x014 */ J2DPane* d2;
/* 0x018 */ J2DPane* d3;
/* 0x01C */ J2DPane* d4;
/* 0x020 */ J2DPane* d42;
/* 0x024 */ J2DPane* d5;
/* 0x028 */ J2DPane* d6;
/* 0x02C */ J2DPane* mak1;
/* 0x030 */ J2DPane* mak2;
/* 0x034 */ J2DTextBox* tx1;
/* 0x038 */ J2DTextBox* tx2;
/* 0x010 */ J2DPane* pane2d[11];
/* 0x03C */ fopMsgM_pane_class pane[11];
/* 0x2A4 */ f32 mPosX;
/* 0x2A8 */ f32 mAlpha;
Expand Down
45 changes: 44 additions & 1 deletion include/f_op/f_op_msg_mng.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class msg_class;
class J2DPane;
class J2DScreen;
class J2DPicture;
class JUTFont;
struct mesg_header;
struct mesg_data;
struct mesg_info;
struct mesg_entry;

struct msg_process_profile_definition {
/* 0x00 */ leaf_process_profile_definition base;
Expand Down Expand Up @@ -56,12 +61,43 @@ struct fopMsgM_pane_alpha_class {
/* 0x05 */ u8 mNowAlpha;
};

class fopMsgM_msgGet_c {
public:
virtual ~fopMsgM_msgGet_c() {}
mesg_header* getMesgHeader(u32);
mesg_info* getMesgInfo(mesg_header*);
mesg_data* getMesgData(mesg_header*);
mesg_entry getMesgEntry(mesg_header*);
const char* getMessage(mesg_header*);

public:
/* 0x04 */ u32 mMsgIdx;
/* 0x08 */ u16 mGroupID;
/* 0x0A */ u16 mMsgID;
/* 0x0C */ u16 mResMsgIdx;
};

class fopMsgM_itemMsgGet_c {
public:
virtual ~fopMsgM_itemMsgGet_c() {}
mesg_header* getMesgHeader(u32);
mesg_info* getMesgInfo(mesg_header*);
mesg_data* getMesgData(mesg_header*);
mesg_entry getMesgEntry(mesg_header*);
const char* getMessage(mesg_header*);

public:
/* 0x04 */ u32 mMsgIdx;
/* 0x08 */ u16 mMsgID;
/* 0x0A */ u16 mResMsgIdx;
};

class fopMsgM_msgDataProc_c {
public:
fopMsgM_msgDataProc_c();
virtual ~fopMsgM_msgDataProc_c();
void dataInit();
void charLength(int, int, bool);
f32 charLength(int, int, bool);
void rubyLength(int, bool);
void stringLength();
void stringShift();
Expand Down Expand Up @@ -148,6 +184,13 @@ class fopMsgM_msgDataProc_c {
void tag_input_kenshi();

public:
/* 0x004 */ JUTFont* font[2];
/* 0x00C */ mesg_entry* mesg_entry;
/* 0x010 */ u32 field_0x010;
/* 0x014 */ f32 field_0x014;
/* 0x018 */ f32 field_0x018;
/* 0x01C */ f32 field_0x01C;
/* 0x020 */ f32 field_0x020;
/* 0x000 */ u8 field_0x00[0x29C];
};

Expand Down
76 changes: 52 additions & 24 deletions src/d/d_s_open_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Translation Unit: d_s_open_sub.cpp
//

#include "JSystem/J2DGraph/J2DPane.h"
#include "d/d_s_open.h"
#include "d/d_com_inf_game.h"
#include "f_op/f_op_msg_mng.h"
Expand All @@ -16,16 +17,26 @@
/* 80232EFC-8023334C .text set_message__18dScnOpen_message_cFUli */
void dScnOpen_message_c::set_message(u32, int) {
/* Nonmatching */
JKRHeap* old_heap = mDoExt_setCurrentHeap(exp_heap);
if (field_0x22bc != 13 && field_0x22bc != 14) { // fopMsg_MessageStatus_e?
mMsgDataProc.stringSet();
}
strcpy(msg1, "");
strcpy(msg2, "");
strcpy(msg3, "");
strcpy(msg4, "");
mDoExt_setCurrentHeap(old_heap);
}

/* 8023334C-80233524 .text exec__18dScnOpen_message_cFv */
void dScnOpen_message_c::exec() {
/* Nonmatching */
void* head_p = NULL;
JUT_ASSERT(0x5d, head_p);
}

/* 80233524-80233620 .text __ct__18dScnOpen_message_cFP10JKRExpHeap */
dScnOpen_message_c::dScnOpen_message_c(JKRExpHeap* heap) {
/* Nonmatching */
exp_heap = heap;
JKRHeap* old_heap = mDoExt_setCurrentHeap(exp_heap);
tFont = mDoExt_getMesgFont();
Expand All @@ -44,9 +55,30 @@ dScnOpen_message_c::~dScnOpen_message_c() {
mDoExt_setCurrentHeap(old_heap);
}

void dScnOpen_message_c::set_pane_pointer(J2DPane* tx1, J2DPane* tx2) {
field_0x22c4 = (J2DTextBox*)tx1;
field_0x22c8 = (J2DTextBox*)tx2;
field_0x22c4->setFont(tFont);
field_0x22c8->setFont(rFont);
field_0x22c8->setLineSpace(field_0x22c4->getLineSpace());
}

enum {
PANE_d1,
PANE_d2,
PANE_d3,
PANE_d4,
PANE_d42,
PANE_d5,
PANE_d6,
PANE_mak1,
PANE_mak2,
PANE_tx1,
PANE_tx2,
};

/* 80233698-80233B0C .text __ct__15dScnOpen_proc_cFv */
dScnOpen_proc_c::dScnOpen_proc_c() {
/* Nonmatching */
exp_heap = fopMsgM_createExpHeap(0x20000);
JUT_ASSERT(0xe2, exp_heap != NULL);
JKRHeap* old_heap = mDoExt_setCurrentHeap(exp_heap);
Expand All @@ -57,25 +89,22 @@ dScnOpen_proc_c::dScnOpen_proc_c() {
dRes_info_c* resInfo = dComIfG_getObjectResInfo("Opening");
JUT_ASSERT(0xeb, resInfo != NULL);
m_Screen->set("Opening.blo", resInfo->getArchive());
d1 = m_Screen->search('\0\0d1');
d2 = m_Screen->search('\0\0d2');
d3 = m_Screen->search('\0\0d3');
d4 = m_Screen->search('\0\0d4');
d42 = m_Screen->search('\0d42');
d5 = m_Screen->search('\0\0d5');
d6 = m_Screen->search('\0\0d6');
mak1 = m_Screen->search('mak1');
mak2 = m_Screen->search('mak2');
tx1 = (J2DTextBox*)m_Screen->search('\0tx1');
tx2 = (J2DTextBox*)m_Screen->search('\0tx2');
tx1->move(tx1->mBounds.i.x, 376.0f);
m_message->field_0x22c4 = tx1;
m_message->field_0x22c8 = tx2;
m_message->field_0x22c4->setFont(m_message->tFont);
m_message->field_0x22c8->setFont(m_message->rFont);
m_message->field_0x22c8->setLineSpace(m_message->field_0x22c4->getLineSpace());
pane2d[PANE_d1] = m_Screen->search('\0\0d1');
pane2d[PANE_d2] = m_Screen->search('\0\0d2');
pane2d[PANE_d3] = m_Screen->search('\0\0d3');
pane2d[PANE_d4] = m_Screen->search('\0\0d4');
pane2d[PANE_d42] = m_Screen->search('\0d42');
pane2d[PANE_d5] = m_Screen->search('\0\0d5');
pane2d[PANE_d6] = m_Screen->search('\0\0d6');
pane2d[PANE_mak1] = m_Screen->search('mak1');
pane2d[PANE_mak2] = m_Screen->search('mak2');
pane2d[PANE_tx1] = m_Screen->search('\0tx1');
pane2d[PANE_tx2] = m_Screen->search('\0tx2');
pane2d[PANE_tx1]->move(pane2d[PANE_tx1]->mBounds.i.x, 376.0f);
m_message->set_pane_pointer(pane2d[PANE_tx1], pane2d[PANE_tx2]);

for (s32 i = 0; i < (s32)ARRAY_SIZE(pane); i++) {
fopMsgM_setPaneData(&pane[i], &d1[i]);
fopMsgM_setPaneData(&pane[i], pane2d[i]);
fopMsgM_setNowAlpha(&pane[i], 0.0f);
fopMsgM_setAlpha(&pane[i]);
}
Expand Down Expand Up @@ -103,7 +132,6 @@ dScnOpen_proc_c::~dScnOpen_proc_c() {

/* 80233BE4-802344D8 .text proc_execute__15dScnOpen_proc_cFv */
void dScnOpen_proc_c::proc_execute() {
/* Nonmatching */
JKRHeap* old_heap = mDoExt_setCurrentHeap(exp_heap);
m_message->exec();
switch (mState) {
Expand Down Expand Up @@ -293,7 +321,7 @@ void dScnOpen_proc_c::proc_execute() {
break;
case 32:
mTimer = 0;
mState = 31;
mState = 33;
case 33:
if (mTimer >= 90)
mState = 34;
Expand Down Expand Up @@ -331,8 +359,8 @@ void dScnOpen_proc_c::proc_execute() {
mAlpha = 1.0f;
mState = 40;
}
fopMsgM_setNowAlpha(&pane[7], mAlpha);
fopMsgM_paneScaleXY(&pane[7], mScale);
fopMsgM_setNowAlpha(&pane[6], mAlpha);
fopMsgM_paneScaleXY(&pane[6], mScale);
break;
case 40:
m_message->set_message(0x58a, 4);
Expand Down
Loading

0 comments on commit 72bbd3e

Please sign in to comment.