diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h index 417a2eb35..f1bec69f2 100644 --- a/include/JSystem/J2DGraph/J2DTextBox.h +++ b/include/JSystem/J2DGraph/J2DTextBox.h @@ -24,6 +24,11 @@ struct J2DTbxBlockHeader { class J2DTextBox : public J2DPane { public: + struct TFontSize { + /* 0x0 */ f32 mSizeX; + /* 0x4 */ f32 mSizeY; + }; + J2DTextBox(const char*, const char*); J2DTextBox(J2DPane*, JSURandomInputStream*); J2DTextBox(u32, const JGeometry::TBox2&, const ResFONT*, const char*, J2DTextBoxHBinding, @@ -32,21 +37,15 @@ public: void initiate(const ResFONT*, const char*, J2DTextBoxHBinding, J2DTextBoxVBinding); void setFont(JUTFont*); void setFontSize(f32 sizeX, f32 sizeY) { - f32 x; - if (sizeX > 0.0f) { - x = sizeX; - } else { - x = 0.0f; - } - mFontSizeX = x; - - f32 y; - if (sizeY > 0.0f) { - y = sizeY; - } else { - y = 0.0f; - } - mFontSizeY = y; + mFontSizeX = sizeX > 0.0f ? sizeX : 0.0f; + mFontSizeY = sizeY > 0.0f ? sizeY : 0.0f; + } + void setFontSize(TFontSize size) { + setFontSize(size.mSizeX, size.mSizeY); + } + void getFontSize(TFontSize& size) const { + size.mSizeX = mFontSizeX; + size.mSizeY = mFontSizeY; } void setCharColor(JUtility::TColor c) { mCharColor = c; } void setGradColor(JUtility::TColor c) { mGradColor = c; } diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index abc8dd2d1..73f8d73c5 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -52,10 +52,16 @@ BOOL fpcM_IsCreating(unsigned int pID) { return fpcCt_IsCreatingByID(pID); } +struct BMG_INF1 : BlockHeader { + /* 0x08 */ u8 m08[0x10 - 0x08]; + /* 0x10 */ u32 entries[6]; +}; + /* 8003E3D0-8003E9F0 .text messageSet__FUl */ -void messageSet(unsigned long status) { - const u32 * inf1_tbl = (u32*)&msg_data[0x30]; - const char * msg = (const char*)((&msg_data[0x68]) + inf1_tbl[status]); +void messageSet(u32 status) { + /* Nonmatching - TColor stack order and TWidth load */ + BMG_INF1* inf1 = (BMG_INF1*)&msg_data[0x20]; + const char * msg = (const char*)((u8*)inf1->getNext() + sizeof(BlockHeader) + inf1->entries[status]); J2DTextBox * tpane = new J2DTextBox('TXT1', JGeometry::TBox2(0.0f, 0.0f, 660.0f, 200.0f), (ResFONT*)font_data, msg, HBIND_CENTER, VBIND_CENTER); JUT_ASSERT(0x141, tpane != 0); @@ -66,16 +72,23 @@ void messageSet(unsigned long status) { J2DPicture * ppane = new J2DPicture('PIC1', JGeometry::TBox2(0.0f, 0.0f, 665.0f, 530.0f), (ResTIMG*)black_tex, NULL); JUT_ASSERT(0x14e, ppane != 0); - tpane->setFontSize(27.0f, 27.0f); - tpane->setCharColor(JUtility::TColor(0xFFC800FF)); - tpane->setGradColor(JUtility::TColor(0xFFB400FF)); + J2DTextBox::TFontSize size; + size.mSizeX = 27.0f; + size.mSizeY = 27.0f; + tpane->setFontSize(size); + JUtility::TColor charCol1 = JUtility::TColor(0xFF, 0xC8, 0x00, 0xFF); + tpane->setCharColor(charCol1); + JUtility::TColor gradCol1 = JUtility::TColor(0xFF, 0xB4, 0x00, 0xFF); + tpane->setGradColor(gradCol1); tpane->setCharSpace(0.0f); tpane->setLineSpace(27.0f); - tpane->setBlack(JUtility::TColor(0xFFFFFF00)); + tpane->setBlack(JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00)); - spane->setFontSize(27.0f, 27.0f); - spane->setCharColor(JUtility::TColor(0x000000FF)); - spane->setGradColor(JUtility::TColor(0x000000FF)); + spane->setFontSize(size); + JUtility::TColor charCol2 = JUtility::TColor(0x00, 0x00, 0x00, 0xC8); + spane->setCharColor(charCol2); + JUtility::TColor gradCol2 = JUtility::TColor(0x00, 0x00, 0x00, 0xC8); + spane->setGradColor(gradCol2); spane->setCharSpace(0.0f); spane->setLineSpace(27.0f); @@ -83,13 +96,16 @@ void messageSet(unsigned long status) { JUTResFont * font = new JUTResFont((ResFONT*)font_data, NULL); - s32 height = 27; - s32 curLine = 0; - u8 ch; + s16 height = 27; + s32 ch; f32 maxWidth = 0.0f; - f32 lineWidth[6] = {}; - for (; ch = *msg, ch != '\0'; msg++) { - if (ch == '\n') { + s32 curLine = 0; + f32 lineWidth[6]; + for (s32 i = 0; i < (s32)ARRAY_SIZE(lineWidth); i++) { + lineWidth[i] = 0.0f; + } + for (; ch = (u8)*msg, (s8)ch != '\0'; msg++) { + if ((s8)ch == '\n') { height += 27; curLine++; continue; @@ -97,22 +113,21 @@ void messageSet(unsigned long status) { JUTFont::TWidth wid; font->getWidthEntry(ch, &wid); - lineWidth[curLine] += wid.field_0x0; + lineWidth[curLine] += (int)wid.field_0x1; } for (s32 i = 0; i < (s32)ARRAY_SIZE(lineWidth); i++) { - f32 width = lineWidth[curLine]; - if (width > maxWidth) + f32 width = lineWidth[i]; + if (maxWidth < width) maxWidth = width; } - f32 x = (659.0f - maxWidth) / 2.0f + -21.0f; + f32 x = (659.0f - maxWidth) / 2.0f + -9.0f; f32 y = (524 - height) / 2.0f + -21.0f; ppane->draw(-12.0f, -24.0f, 665.0f, 530.0f, false, false, false); - y += 10.0f; - spane->draw(x + 2.0f, y + 2.0f, 660.0f, HBIND_LEFT); - tpane->draw(x, y, 660.0f, HBIND_LEFT); + spane->draw(x + 2.0f, y + 10.0f + 2.0f, 660.0f, HBIND_LEFT); + tpane->draw(x, y + 10.0f, 660.0f, HBIND_LEFT); delete font; delete ppane; @@ -130,14 +145,14 @@ namespace JAInter { /* 8003E9F0-8003EBD4 .text drawDvdCondition__Fl */ void drawDvdCondition(long status) { JFWDisplay::getManager()->setFader(NULL); - GXColor backColor = mDoGph_gInf_c::getBackColor(); + JUtility::TColor backColor = mDoGph_gInf_c::getBackColor(); JFWDisplay::getManager()->setClearColor(backColor); JFWDisplay::getManager()->beginRender(); GXSetAlphaUpdate(GX_FALSE); j3dSys.drawInit(); J2DOrthoGraph draw2D(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0); - draw2D.setOrtho(-9.0f, -21.0f, 650.0f, 503.0f, -1.0f, 1.0f); + draw2D.setOrtho(-9.0f, -21.0f, 659.0f, 524.0f, -1.0f, 1.0f); draw2D.setPort(); dComIfGp_setCurrentGrafPort(&draw2D);