diff --git a/configure.py b/configure.py index 05d98548..e9cfae33 100755 --- a/configure.py +++ b/configure.py @@ -1086,7 +1086,7 @@ def MatchingFor(*versions): Object(NonMatching, "Kameda/PauseManager.cpp"), Object(NonMatching, "Kameda/Pause2D.cpp"), Object(Matching, "Kameda/WipeManager.cpp"), - Object(NonMatching, "Kameda/Fade.cpp"), + Object(Matching, "Kameda/Fade.cpp"), Object(Matching, "Kameda/K2DPicture.cpp"), Object(Matching, "Kameda/Scene.cpp"), Object(Matching, "Kameda/SceneApp.cpp"), diff --git a/include/Kameda/Fade.h b/include/Kameda/Fade.h index 557e26ea..910b1cf1 100644 --- a/include/Kameda/Fade.h +++ b/include/Kameda/Fade.h @@ -1,24 +1,30 @@ #ifndef _FADE_H #define _FADE_H -#include -#include - +#include "JSystem/J2D/J2DGrafContext.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/TColor.h" #include "types.h" -// Considering this is similar to Mario.h, the might be some sort of inheritance going on? - class Fade -{ // Autogenerated +{ public: - Fade(JKRHeap *); // 0x8013b318 - void init(); // 0x8013b76c - void draw(int, f32, JUTColor); // 0x8013b770 - // Inline/Unused + Fade(JKRHeap *heap); // 0x8013b318 ~Fade(); + void init(); // 0x8013b76c + void draw(int status, f32 f, JUTColor color); // 0x8013b770 + private: - u8 _0[0x34]; -}; // class Fade + void *_0; // 0x0 + + J2DOrthoGraph *mOrthoGraph[4]; // 0x4 + + struct + { + f32 mWidth; // 0x14 + f32 mHeight; // 0x18 + } mSizes[4]; +}; -#endif +#endif // _FADE_H diff --git a/include/Kameda/WipeManager.h b/include/Kameda/WipeManager.h index 49da119b..07833c4c 100644 --- a/include/Kameda/WipeManager.h +++ b/include/Kameda/WipeManager.h @@ -70,6 +70,8 @@ class WipeManager void killWipe(int idx) { mKillFlag[idx] = true; } void startWipe(int idx) { mMoveFlag[idx] = true; } void stopWipe(int idx) { mMoveFlag[idx] = false; } + int getScreenCount() const { return mScrnCount; } + static WipeManager *getManager() { return mThis; } private: diff --git a/src/Kameda/Fade.cpp b/src/Kameda/Fade.cpp index 9a158810..79253161 100644 --- a/src/Kameda/Fade.cpp +++ b/src/Kameda/Fade.cpp @@ -1,9 +1,91 @@ #include "Kameda/Fade.h" -Fade::Fade(JKRHeap *) {} +#include "JSystem/JAudio/JASFakeMatch2.h" // For static initializer +#include "JSystem/JUtility/JUTAssert.h" +#include "Kameda/WipeManager.h" +#include "Osako/system.h" + +Fade::Fade(JKRHeap *heap) +{ + switch (WipeManager::getManager()->getScreenCount()) + { + case 1: + mOrthoGraph[0] = new (heap, 0) J2DOrthoGraph(System::get3DVpX(), + System::get3DVpY(), + System::get3DVpW(), + System::get3DVpH(), + -1.0f, + 1.0f); + mOrthoGraph[0]->scissor(System::get3DScisX(), + System::get3DScisY(), + System::get3DScisW(), + System::get3DScisH()); + mSizes[0].mWidth = System::get3DVpW(); + mSizes[0].mHeight = System::get3DVpH(); + break; + case 2: + for (u8 i = 0; i < 2; ++i) + { + mOrthoGraph[i] = new (heap, 0) J2DOrthoGraph(System::get3DVpDiv2X(i), + System::get3DVpDiv2Y(i), + System::get3DVpDiv2W(i), + System::get3DVpDiv2H(i), + -1.0f, + 1.0f); + mOrthoGraph[i]->scissor(System::get3DScisDiv2X(i), + System::get3DScisDiv2Y(i), + System::get3DScisDiv2W(i), + System::get3DScisDiv2H(i)); + mSizes[i].mWidth = System::get3DVpDiv2W(i); + mSizes[i].mHeight = System::get3DVpDiv2H(i); + } + break; + case 3: + case 4: + for (u8 i = 0; i < 4; ++i) + { + mOrthoGraph[i] = new (heap, 0) J2DOrthoGraph(System::get3DVpDiv4X(i), + System::get3DVpDiv4Y(i), + System::get3DVpDiv4W(i), + System::get3DVpDiv4H(i), + -1.0f, + 1.0f); + mOrthoGraph[i]->scissor(System::get3DScisDiv4X(i), + System::get3DScisDiv4Y(i), + System::get3DScisDiv4W(i), + System::get3DScisDiv4H(i)); + mSizes[i].mWidth = System::get3DVpDiv4W(i); + mSizes[i].mHeight = System::get3DVpDiv4H(i); + } + break; + default: +#line 71 + JUT_ASSERT(0); + break; + } + + init(); +} void Fade::init() {} -void Fade::draw(int, float, JUTColor) {} +Fade::~Fade() +{ + _0 = nullptr; + + for (int i = 0; i < 4; ++i) + { + delete mOrthoGraph[i]; + mOrthoGraph[i] = nullptr; + } +} + +void Fade::draw(int status, f32 f, JUTColor color) +{ +#line 113 + JUT_MINMAX_ASSERT(0, status, 4); -#include "JSystem/JAudio/JASFakeMatch2.h" + mOrthoGraph[status]->setPort(); + mOrthoGraph[status]->setColor(JUTColor(color.r, color.g, color.b, color.a * f)); + mOrthoGraph[status]->fillBox(0.0f, 0.0f, mSizes[status].mWidth, mSizes[status].mHeight); +}