summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2024-12-28 15:32:37 -0800
committerJasper St. Pierre <jstpierre@mecheye.net>2024-12-28 15:33:02 -0800
commit72bbd3ea1f2478d6926546f7207c5e418bb2f7ec (patch)
treec5e7967e0a79b941543b805bb63f61a42709cfa1
parentf543b7b4718a388aafd67203f10bc1f7cfa2bcf3 (diff)
f_op_msg_mng work
-rw-r--r--include/JSystem/J2DGraph/J2DTextBox.h2
-rw-r--r--include/d/d_com_inf_game.h11
-rw-r--r--include/d/d_s_open.h25
-rw-r--r--include/f_op/f_op_msg_mng.h45
-rw-r--r--src/d/d_s_open_sub.cpp76
-rw-r--r--src/f_op/f_op_msg_mng.cpp171
6 files changed, 249 insertions, 81 deletions
diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h
index 7ca55c48..2e7f53c6 100644
--- a/include/JSystem/J2DGraph/J2DTextBox.h
+++ b/include/JSystem/J2DGraph/J2DTextBox.h
@@ -83,4 +83,4 @@ private:
/* 0xFE */ bool mTextFontOwned;
}; // Size: 0x100
-#endif /* J2DTEXTBOX_H */ \ No newline at end of file
+#endif /* J2DTEXTBOX_H */
diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h
index b5b0d025..1b9fea2b 100644
--- a/include/d/d_com_inf_game.h
+++ b/include/d/d_com_inf_game.h
@@ -298,6 +298,7 @@ public:
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; }
@@ -467,6 +468,7 @@ public:
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; }
@@ -498,8 +500,10 @@ public:
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; }
@@ -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);
}
@@ -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); }
@@ -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); }
diff --git a/include/d/d_s_open.h b/include/d/d_s_open.h
index da1ce372..d6f48988 100644
--- a/include/d/d_s_open.h
+++ b/include/d/d_s_open.h
@@ -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"
@@ -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;
@@ -45,17 +54,7 @@ public:
/* 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;
diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h
index 5c1eabc6..c44ddca4 100644
--- a/include/f_op/f_op_msg_mng.h
+++ b/include/f_op/f_op_msg_mng.h
@@ -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;
@@ -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();
@@ -148,6 +184,13 @@ public:
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];
};
diff --git a/src/d/d_s_open_sub.cpp b/src/d/d_s_open_sub.cpp
index 02a6ae08..bddc85cb 100644
--- a/src/d/d_s_open_sub.cpp
+++ b/src/d/d_s_open_sub.cpp
@@ -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"
@@ -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();
@@ -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);
@@ -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]);
}
@@ -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) {
@@ -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;
@@ -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);
diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp
index 7ee6ef20..3ef145fa 100644
--- a/src/f_op/f_op_msg_mng.cpp
+++ b/src/f_op/f_op_msg_mng.cpp
@@ -4,6 +4,8 @@
//
#include "f_op/f_op_msg_mng.h"
+#include "JSystem/JKernel/JKRArchive.h"
+#include "JSystem/JUtility/JUTDataHeader.h"
#include "f_op/f_op_scene_mng.h"
#include "f_pc/f_pc_manager.h"
#include "f_pc/f_pc_layer_iter.h"
@@ -15,6 +17,39 @@
#include "SSystem/SComponent/c_malloc.h"
#include <stdio.h>
+struct mesg_header : JUTDataFileHeader {
+ // first block is mesg_info
+};
+
+struct mesg_entry {
+ /* 0x00 */ u32 mDataOffs;
+ /* 0x04 */ u16 mMesgID;
+ /* 0x06 */ u16 mItemPrice;
+ /* 0x08 */ u16 mNextMessageID;
+ /* 0x0A */ u16 field_0x0a;
+ /* 0x0C */ u8 mTextboxType;
+ /* 0x0D */ u8 mDrawType;
+ /* 0x0E */ u8 mTextboxPosition;
+ /* 0x0F */ u8 mItemImage;
+ /* 0x10 */ u8 field_0x10;
+ /* 0x11 */ u8 mInitialSound;
+ /* 0x12 */ u8 mInitialCamera;
+ /* 0x13 */ u8 mInitialAnimation;
+ /* 0x14 */ u8 field_0x14[4];
+};
+
+struct mesg_info : JUTDataBlockHeader {
+ /* 0x08 */ u16 mNumEntry;
+ /* 0x0A */ u16 mEntrySize;
+ /* 0x0C */ u16 mGroupID;
+ /* 0x10 */ u8 mColor;
+ /* 0x14 */ mesg_entry mEntries[1]; // variable-length array
+};
+
+struct mesg_data : JUTDataBlockHeader {
+ char mData[1]; // variable-length array
+};
+
static bool pushButton;
static bool pushButton2;
static bool demoFlag;
@@ -127,7 +162,7 @@ void MyPicture::drawFullSet2(f32, f32, f32, f32, J2DBinding, J2DMirror, bool, Mt
}
/* 8002AD4C-8002AE28 .text fopMsgM_hyrule_language_check__FUl */
-void fopMsgM_hyrule_language_check(u32) {
+bool fopMsgM_hyrule_language_check(u32) {
/* Nonmatching */
}
@@ -493,74 +528,105 @@ fpc_ProcID fopMsgM_Create(s16, fopMsgCreateFunc, void*) {
/* Nonmatching */
}
-class fopMsgM_msgGet_c {
-public:
- virtual ~fopMsgM_msgGet_c() {};
- mesg_header* getMesgHeader(u32);
- void* getMesgInfo(mesg_header*);
- void* getMesgData(mesg_header*);
- void* getMesgEntry(mesg_header*);
- void* getMessage(mesg_header*);
-};
-
/* 8002E254-8002E2D8 .text getMesgHeader__16fopMsgM_msgGet_cFUl */
-mesg_header* fopMsgM_msgGet_c::getMesgHeader(u32) {
- /* Nonmatching */
+mesg_header* fopMsgM_msgGet_c::getMesgHeader(u32 msg) {
+ mGroupID = (msg >> 16) & 0xFFFF;
+ mMsgID = msg & 0xFFFF;
+
+ if (fopMsgM_hyrule_language_check(msg)) {
+ JKRArchive* arc = dComIfGp_getMsgDt2Archive();
+ return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc);
+ } else {
+ JKRArchive* arc = dComIfGp_getMsgDtArchive();
+ return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc);
+ }
}
/* 8002E2D8-8002E2E0 .text getMesgInfo__16fopMsgM_msgGet_cFP11mesg_header */
-void* fopMsgM_msgGet_c::getMesgInfo(mesg_header*) {
- /* Nonmatching */
+mesg_info* fopMsgM_msgGet_c::getMesgInfo(mesg_header* msg) {
+ return (mesg_info*)&msg->mFirstBlock;
}
/* 8002E2E0-8002E308 .text getMesgData__16fopMsgM_msgGet_cFP11mesg_header */
-void* fopMsgM_msgGet_c::getMesgData(mesg_header*) {
- /* Nonmatching */
+mesg_data* fopMsgM_msgGet_c::getMesgData(mesg_header* msg) {
+ return (mesg_data*)getMesgInfo(msg)->getNext();
}
/* 8002E308-8002E378 .text getMesgEntry__16fopMsgM_msgGet_cFP11mesg_header */
-void* fopMsgM_msgGet_c::getMesgEntry(mesg_header*) {
- /* Nonmatching */
+mesg_entry fopMsgM_msgGet_c::getMesgEntry(mesg_header* msg) {
+ return getMesgInfo(msg)->mEntries[mMsgIdx];
}
/* 8002E378-8002E430 .text getMessage__16fopMsgM_msgGet_cFP11mesg_header */
-void* fopMsgM_msgGet_c::getMessage(mesg_header*) {
- /* Nonmatching */
-}
+const char* fopMsgM_msgGet_c::getMessage(mesg_header* msg) {
+ mesg_info* info = getMesgInfo(msg);
+ const char* data = getMesgData(msg)->mData;
-class fopMsgM_itemMsgGet_c {
-public:
- virtual ~fopMsgM_itemMsgGet_c() {};
- mesg_header* getMesgHeader(u32);
- void* getMesgInfo(mesg_header*);
- void* getMesgData(mesg_header*);
- void* getMesgEntry(mesg_header*);
- void* getMessage(mesg_header*);
-};
+ const char* ret = NULL;
+
+ for (u16 i = 0; i < info->mNumEntry; i++) {
+ if (info->mEntries[i].mDataOffs == 0)
+ continue;
+
+ mMsgIdx = i;
+ if (mMsgID == info->mEntries[i].mMesgID) {
+ mesg_entry* entry = &info->mEntries[mMsgIdx];
+ mResMsgIdx = entry->mMesgID;
+ ret = &data[entry->mDataOffs];
+ break;
+ }
+ }
+
+ return ret;
+}
/* 8002E430-8002E4AC .text getMesgHeader__20fopMsgM_itemMsgGet_cFUl */
-mesg_header* fopMsgM_itemMsgGet_c::getMesgHeader(u32) {
+mesg_header* fopMsgM_itemMsgGet_c::getMesgHeader(u32 msg) {
/* Nonmatching */
+ mMsgID = msg & 0xFFFF;
+
+ if (fopMsgM_hyrule_language_check(msg)) {
+ JKRArchive* arc = dComIfGp_getMsgDt2Archive();
+ return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc);
+ } else {
+ JKRArchive* arc = dComIfGp_getMsgDtArchive();
+ return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc);
+ }
}
/* 8002E4AC-8002E4B4 .text getMesgInfo__20fopMsgM_itemMsgGet_cFP11mesg_header */
-void* fopMsgM_itemMsgGet_c::getMesgInfo(mesg_header*) {
- /* Nonmatching */
+mesg_info* fopMsgM_itemMsgGet_c::getMesgInfo(mesg_header* msg) {
+ return (mesg_info*)&msg->mFirstBlock;
}
/* 8002E4B4-8002E4DC .text getMesgData__20fopMsgM_itemMsgGet_cFP11mesg_header */
-void* fopMsgM_itemMsgGet_c::getMesgData(mesg_header*) {
- /* Nonmatching */
+mesg_data* fopMsgM_itemMsgGet_c::getMesgData(mesg_header* msg) {
+ return (mesg_data*)getMesgInfo(msg)->getNext();
}
/* 8002E4DC-8002E54C .text getMesgEntry__20fopMsgM_itemMsgGet_cFP11mesg_header */
-void* fopMsgM_itemMsgGet_c::getMesgEntry(mesg_header*) {
- /* Nonmatching */
+mesg_entry fopMsgM_itemMsgGet_c::getMesgEntry(mesg_header* msg) {
+ return getMesgInfo(msg)->mEntries[mMsgIdx];
}
/* 8002E54C-8002E5FC .text getMessage__20fopMsgM_itemMsgGet_cFP11mesg_header */
-void* fopMsgM_itemMsgGet_c::getMessage(mesg_header*) {
- /* Nonmatching */
+const char* fopMsgM_itemMsgGet_c::getMessage(mesg_header* msg) {
+ mesg_info* info = getMesgInfo(msg);
+ const char* data = getMesgData(msg)->mData;
+
+ for (u16 i = 0; i < info->mNumEntry; i++) {
+ if (info->mEntries[i].mDataOffs == 0)
+ continue;
+
+ mMsgIdx = i;
+ if (mMsgID == info->mEntries[i].mMesgID) {
+ mesg_entry* entry = &info->mEntries[i];
+ mResMsgIdx = entry->mMesgID;
+ return &data[entry->mDataOffs];
+ }
+ }
+
+ return NULL;
}
/* 8002E7DC-8002E95C .text dataInit__21fopMsgM_msgDataProc_cFv */
@@ -569,8 +635,19 @@ void fopMsgM_msgDataProc_c::dataInit() {
}
/* 8002E95C-8002EA58 .text charLength__21fopMsgM_msgDataProc_cFiib */
-void fopMsgM_msgDataProc_c::charLength(int, int, bool) {
+f32 fopMsgM_msgDataProc_c::charLength(int scale, int charNo, bool mode) {
/* Nonmatching */
+ JUTFont::TWidth width;
+ font[0]->getWidthEntry(charNo, &width);
+ f32 charWidth = (f32)(int)width.field_0x1;
+ f32 cellWidth = (f32)scale / (f32)font[0]->getCellWidth();
+
+ if (mode) {
+ return charWidth * cellWidth;
+ } else {
+ // This should be field_0x11c
+ return field_0x010 + (charWidth * cellWidth);
+ }
}
/* 8002EA58-8002EB4C .text rubyLength__21fopMsgM_msgDataProc_cFib */
@@ -634,8 +711,9 @@ void fopMsgM_msgDataProc_c::selectArrow(J2DPicture*, f32, f32) {
}
/* 80032288-800322B4 .text colorAnime__21fopMsgM_msgDataProc_cFP10J2DPicture */
-void fopMsgM_msgDataProc_c::colorAnime(J2DPicture*) {
+void fopMsgM_msgDataProc_c::colorAnime(J2DPicture* pic) {
/* Nonmatching */
+ // fopMsgM_arrowAnime(pane, &field_0x260);
}
/* 800322B4-80034F3C .text stringSet__21fopMsgM_msgDataProc_cFv */
@@ -933,6 +1011,15 @@ void fopMsgM_msgDataProc_c::tag_forest_timer() {
/* 800394B4-8003966C .text tag_birdman__21fopMsgM_msgDataProc_cFv */
void fopMsgM_msgDataProc_c::tag_birdman() {
/* Nonmatching */
+ u16 num = dComIfGp_getMessageCountNumber();
+
+ char buf[16];
+ fopMsgM_int_to_char(buf, num, false);
+ if (num == 1) {
+ strcat(buf, " yard");
+ } else {
+ strcat(buf, " yards");
+ }
}
/* 8003966C-80039834 .text tag_point__21fopMsgM_msgDataProc_cFv */