From 9a889bfcf8a3147477c3bf106bcfb1b007c2d9a7 Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Tue, 13 Jan 2026 07:50:47 -0800 Subject: [PATCH] JAWWindow (#3039) --- include/JSystem/J2DGraph/J2DPane.h | 33 +++++++++++---- include/JSystem/J2DGraph/J2DWindow.h | 53 ++++++++++++++---------- include/JSystem/JAWExtSystem/JAWWindow.h | 22 +++++----- src/JSystem/J2DGraph/J2DPane.cpp | 45 +++----------------- src/JSystem/J2DGraph/J2DWindow.cpp | 39 ----------------- src/JSystem/JAWExtSystem/JAWWindow.cpp | 8 +++- 6 files changed, 81 insertions(+), 119 deletions(-) diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index 409b2257e7a..bde7118f37c 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -84,20 +84,33 @@ public: /* vt 0x10 */ virtual void move(f32 x, f32 y); /* vt 0x14 */ virtual void add(f32 x, f32 y); /* vt 0x18 */ virtual void resize(f32 x, f32 y); - /* vt 0x1C */ virtual void setCullBack(bool cull); + /* vt 0x1C */ virtual void setCullBack(bool cull) { + GXCullMode mode; + + if (cull) { + mode = GX_CULL_BACK; + } else { + mode = GX_CULL_NONE; + } + + setCullBack(mode); + } /* vt 0x20 */ virtual void setCullBack(_GXCullMode cmode); /* vt 0x24 */ virtual void setAlpha(u8 alpha) { mAlpha = alpha; }; - /* vt 0x28 */ virtual bool setConnectParent(bool connected); + /* vt 0x28 */ virtual bool setConnectParent(bool connected) { + mConnected = false; + return false; + } /* vt 0x2C */ virtual void calcMtx() { if (mPaneTree.getParent() != NULL) { makeMatrix(mTranslateX, mTranslateY); } } - /* vt 0x30 */ virtual void update(); - /* vt 0x34 */ virtual void drawSelf(f32 arg1, f32 arg2); - /* vt 0x38 */ virtual void drawSelf(f32 arg1, f32 arg2, Mtx* mtx); + /* vt 0x30 */ virtual void update() {} + /* vt 0x34 */ virtual void drawSelf(f32 arg1, f32 arg2) {} + /* vt 0x38 */ virtual void drawSelf(f32 arg1, f32 arg2, Mtx* mtx) {} /* vt 0x3C */ virtual J2DPane* search(u64 tag); /* vt 0x40 */ virtual J2DPane* searchUserInfo(u64 tag); /* vt 0x44 */ virtual void makeMatrix(f32 a, f32 b) { @@ -107,7 +120,7 @@ public: /* vt 0x4C */ virtual bool isUsed(const ResTIMG* timg); /* vt 0x50 */ virtual bool isUsed(const ResFONT* font); /* vt 0x54 */ virtual void clearAnmTransform(); - /* vt 0x58 */ virtual void rewriteAlpha(); + /* vt 0x58 */ virtual void rewriteAlpha() {} /* vt 0x5C */ virtual void setAnimation(J2DAnmBase* anm); /* vt 0x60 */ virtual void setAnimation(J2DAnmTransform* anm); /* vt 0x64 */ virtual void setAnimation(J2DAnmColor* anm) {} @@ -118,9 +131,13 @@ public: /* vt 0x78 */ virtual void setAnimation(J2DAnmVtxColor* anm) {} /* vt 0x7C */ virtual const J2DAnmTransform* animationTransform(const J2DAnmTransform* transform); /* vt 0x80 */ virtual void setVisibileAnimation(J2DAnmVisibilityFull* visibility); - /* vt 0x84 */ virtual void setAnimationVF(J2DAnmVisibilityFull* visibility); + /* vt 0x84 */ virtual void setAnimationVF(J2DAnmVisibilityFull* p_visibility) { + setAnimation(p_visibility); + } /* vt 0x88 */ virtual void setVtxColorAnimation(J2DAnmVtxColor* vtx_color); - /* vt 0x8C */ virtual void setAnimationVC(J2DAnmVtxColor* vtx_color); + /* vt 0x8C */ virtual void setAnimationVC(J2DAnmVtxColor* p_vtxColor) { + setAnimation(p_vtxColor); + } /* vt 0x90 */ virtual const J2DAnmTransform* animationPane(const J2DAnmTransform* transform); f32 getHeight() const { return mBounds.getHeight(); } diff --git a/include/JSystem/J2DGraph/J2DWindow.h b/include/JSystem/J2DGraph/J2DWindow.h index 0d194c49952..b688963f647 100644 --- a/include/JSystem/J2DGraph/J2DWindow.h +++ b/include/JSystem/J2DGraph/J2DWindow.h @@ -61,27 +61,38 @@ public: void setTevMode(JUTTexture*, JUtility::TColor, JUtility::TColor); virtual ~J2DWindow(); - virtual u16 getTypeID() const; - virtual void resize(f32, f32); - virtual void drawSelf(f32, f32); - virtual void drawSelf(f32, f32, Mtx*); - virtual bool isUsed(ResTIMG const*); - virtual bool isUsed(ResFONT const*); - virtual void rewriteAlpha(); - virtual void draw(JGeometry::TBox2 const&); - virtual void draw(JGeometry::TBox2 const&, JGeometry::TBox2 const&); - virtual void draw(f32, f32, f32, f32); - virtual bool setBlack(JUtility::TColor); - virtual bool setWhite(JUtility::TColor); - virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor); - virtual JUtility::TColor getBlack() const; - virtual JUtility::TColor getWhite() const; - virtual JUTTexture* getFrameTexture(u8, u8) const; - virtual JUTTexture* getContentsTexture(u8) const; - virtual void getMaterial(J2DWindow::TMaterial&) const; - virtual J2DMaterial* getFrameMaterial(u8) const; - virtual J2DMaterial* getContentsMaterial() const; - virtual void drawContents(JGeometry::TBox2 const&); + /* vt 0x0C */ virtual u16 getTypeID() const { return 17; } + /* vt 0x18 */ virtual void resize(f32, f32); + /* vt 0x34 */ virtual void drawSelf(f32, f32); + /* vt 0x38 */ virtual void drawSelf(f32, f32, Mtx*); + /* vt 0x94 */ virtual void draw(JGeometry::TBox2 const&); + /* vt 0x98 */ virtual void draw(JGeometry::TBox2 const&, JGeometry::TBox2 const&); + /* vt 0x9C */ virtual void draw(f32 left, f32 top, f32 width, f32 height) { draw(JGeometry::TBox2(left, top, left + width, top + height)); } + /* vt 0xA0 */ virtual bool setBlack(JUtility::TColor); + /* vt 0xA4 */ virtual bool setWhite(JUtility::TColor); + /* vt 0xA8 */ virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor); + /* vt 0xAC */ virtual JUtility::TColor getBlack() const; + /* vt 0xB0 */ virtual JUtility::TColor getWhite() const; + /* vt 0xB4 */ virtual JUTTexture* getFrameTexture(u8, u8) const; + /* vt 0xB8 */ virtual JUTTexture* getContentsTexture(u8 param_1) const { + if (param_1 != 0) { + return NULL; + } + return field_0x110; + } + /* vt 0xBC */ virtual void getMaterial(J2DWindow::TMaterial& mat) const { + mat.field_0x0 = NULL; + mat.field_0x4 = NULL; + mat.field_0x8 = NULL; + mat.field_0xc = NULL; + mat.field_0x10 = NULL; + } + /* vt 0xC0 */ virtual J2DMaterial* getFrameMaterial(u8) const { return NULL; } + /* vt 0xC4 */ virtual J2DMaterial* getContentsMaterial() const { return NULL; } + /* vt 0xC8 */ virtual void drawContents(JGeometry::TBox2 const&); + /* vt 0x4C */ virtual bool isUsed(const ResTIMG*); + /* vt 0x50 */ virtual bool isUsed(const ResFONT* font) { return J2DPane::isUsed(font); } + /* vt 0x58 */ virtual void rewriteAlpha() {} bool isField0x145Set(u8 flag) { return field_0x145 & flag; } diff --git a/include/JSystem/JAWExtSystem/JAWWindow.h b/include/JSystem/JAWExtSystem/JAWWindow.h index 942a25a90c1..6228c103765 100644 --- a/include/JSystem/JAWExtSystem/JAWWindow.h +++ b/include/JSystem/JAWExtSystem/JAWWindow.h @@ -22,19 +22,10 @@ public: class JAWWindow { public: - class TJ2DWindowDraw : public J2DWindow { - public: - TJ2DWindowDraw(u32, const JGeometry::TBox2&, const char*); - - void drawPane(int x, int y, const J2DGrafContext* p_grafCtx) { - J2DPane::draw(x, y, p_grafCtx, true, true); - calcMtx(); - } - }; - class TWindowText : public J2DPane { public: TWindowText(JAWWindow*); + virtual ~TWindowText(); virtual void drawSelf(f32, f32); virtual void drawSelf(f32, f32, Mtx*); @@ -43,6 +34,17 @@ public: /* 0x11C */ JUTPoint field_0x11c; }; + class TJ2DWindowDraw : public J2DWindow { + public: + TJ2DWindowDraw(u32 param_1, const JGeometry::TBox2& param_2, const char* param_3) : J2DWindow(param_1, param_2, param_3, TEXTUREBASE_0, NULL) {} + virtual ~TJ2DWindowDraw() {} + + void drawPane(int x, int y, const J2DGrafContext* p_grafCtx) { + J2DPane::draw(x, y, p_grafCtx, true, true); + calcMtx(); + } + }; + JAWWindow(const char*, int, int); virtual ~JAWWindow(); virtual void onDraw(JAWGraphContext*); diff --git a/src/JSystem/J2DGraph/J2DPane.cpp b/src/JSystem/J2DGraph/J2DPane.cpp index 18d7e876264..ccaa67aaa4b 100644 --- a/src/JSystem/J2DGraph/J2DPane.cpp +++ b/src/JSystem/J2DGraph/J2DPane.cpp @@ -337,7 +337,7 @@ void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGr } for (JSUTreeIterator iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { - iter.getObject()->draw(0, 0, p_grafCtx, isOrthoGraf, param_4); + iter->draw(0, 0, p_grafCtx, isOrthoGraf, param_4); } } } @@ -859,42 +859,9 @@ void J2DPane::updateTransform(J2DAnmTransform const* p_anmTransform) { } } -void J2DPane::drawSelf(f32, f32, f32 (*)[3][4]) { - /* empty function */ -} - -void J2DPane::rewriteAlpha() { - /* empty function */ -} - -void J2DPane::setAnimationVF(J2DAnmVisibilityFull* p_visibility) { - setAnimation(p_visibility); -} - -void J2DPane::setAnimationVC(J2DAnmVtxColor* p_vtxColor) { - setAnimation(p_vtxColor); -} - -void J2DPane::setCullBack(bool cull) { - GXCullMode mode; - - if (!cull) - mode = GX_CULL_NONE; - else - mode = GX_CULL_BACK; - - setCullBack(mode); -} - -bool J2DPane::setConnectParent(bool connected) { - mConnected = false; - return false; -} - -void J2DPane::update() { - /* empty function */ -} - -void J2DPane::drawSelf(f32, f32) { - /* empty function */ +static void dummy(J2DPane* pane) { + pane->drawSelf(0.0f, 0.0f); + pane->update(); + pane->setConnectParent(false); + pane->setCullBack(false); } diff --git a/src/JSystem/J2DGraph/J2DWindow.cpp b/src/JSystem/J2DGraph/J2DWindow.cpp index 78c89ff2b88..7907afc8c96 100644 --- a/src/JSystem/J2DGraph/J2DWindow.cpp +++ b/src/JSystem/J2DGraph/J2DWindow.cpp @@ -628,42 +628,3 @@ bool J2DWindow::isUsed(ResTIMG const* param_0) { } return J2DPane::isUsed(param_0); } - -u16 J2DWindow::getTypeID() const { - return 17; -} - -void J2DWindow::draw(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { - draw(JGeometry::TBox2(param_0, param_1, param_0 + param_2, param_1 + param_3)); -} - -JUTTexture* J2DWindow::getContentsTexture(u8 param_0) const { - if (param_0 != 0) { - return NULL; - } - return field_0x110; -} - -void J2DWindow::getMaterial(J2DWindow::TMaterial& param_0) const { - param_0.field_0x0 = NULL; - param_0.field_0x4 = NULL; - param_0.field_0x8 = NULL; - param_0.field_0xc = NULL; - param_0.field_0x10 = NULL; -} - -J2DMaterial* J2DWindow::getFrameMaterial(u8 param_0) const { - return NULL; -} - -J2DMaterial* J2DWindow::getContentsMaterial() const { - return NULL; -} - -bool J2DWindow::isUsed(ResFONT const* param_0) { - return J2DPane::isUsed(param_0); -} - -void J2DWindow::rewriteAlpha() { - /* empty function */ -} diff --git a/src/JSystem/JAWExtSystem/JAWWindow.cpp b/src/JSystem/JAWExtSystem/JAWWindow.cpp index 7153fd0d2d0..5163355615e 100644 --- a/src/JSystem/JAWExtSystem/JAWWindow.cpp +++ b/src/JSystem/JAWExtSystem/JAWWindow.cpp @@ -22,8 +22,6 @@ JAWWindow::JAWWindow(const char* param_1, int param_2, int param_3) : field_0x38.appendChild(&field_0x2b0); } -JAWWindow::TJ2DWindowDraw::TJ2DWindowDraw(u32 param_1, const JGeometry::TBox2& param_2, const char* param_3) : J2DWindow(param_1, param_2, param_3, TEXTUREBASE_0, NULL) {} - JAWWindow::~JAWWindow() {} BOOL JAWWindow::initIf() { @@ -194,6 +192,8 @@ JAWWindow::TWindowText::TWindowText(JAWWindow* window) : field_0x11c(0, 0) { } +JAWWindow::TWindowText::~TWindowText() {} + void JAWWindow::TWindowText::drawSelf(f32 param_1, f32 param_2) { Mtx mtx; MTXIdentity(mtx); @@ -211,3 +211,7 @@ void JAWWindow::TWindowText::drawSelf(f32, f32, Mtx* param_3) { m_pParent->setMatrix(stack_48); m_pParent->onDraw(&field_0xfc); } + +static void dummy(J2DPane* pane, J2DWindow* window) { + pane->rewriteAlpha(); +}