Skip to content

Commit

Permalink
d_ovlp_fade4 work
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Jul 13, 2024
1 parent 18b82cd commit 2a65dfd
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 206 deletions.
4 changes: 2 additions & 2 deletions include/JSystem/JFramework/JFWDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class JFWAlarm : public OSAlarm {
class JFWDisplay {
public:
enum EDrawDone {
/* 0x0 */ UNK_METHOD_0 = 0,
/* 0x1 */ UNK_METHOD_1 = 1
/* 0x0 */ Sync = 0,
/* 0x1 */ Async = 1,
};

void ctor_subroutine(const _GXRenderModeObj*, bool enableAlpha);
Expand Down
15 changes: 8 additions & 7 deletions include/JSystem/JUtility/JUTFader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
class JUTFader {
public:
enum EStatus {
UNKSTATUS_M1 = -1,
UNKSTATUS_0 = 0,
WaitOut,
WaitIn,
FadeIn,
FadeOut,
};

JUTFader(int, int, int, int, JUtility::TColor);
void control();
void setStatus(JUTFader::EStatus, int);

virtual ~JUTFader() {};
virtual bool startFadeIn(int);
Expand All @@ -24,12 +25,12 @@ class JUTFader {
void setColor(JUtility::TColor& color) { mColor.set(color); }

/* 0x04 */ s32 mStatus;
/* 0x08 */ u16 field_0x8;
/* 0x0A */ u16 field_0xa;
/* 0x08 */ u16 mFadeTime;
/* 0x0A */ u16 mTimer;
/* 0x0C */ JUtility::TColor mColor;
/* 0x10 */ JGeometry::TBox2<f32> mBox;
/* 0x20 */ int mEStatus;
/* 0x24 */ u32 field_0x24;
/* 0x20 */ int mDelayTimer;
/* 0x24 */ u32 mDelayStatus;
};

#endif /* JUTFADER_H */
7 changes: 3 additions & 4 deletions include/JSystem/JUtility/JUTXfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ class JKRHeap;
class JUTXfb {
public:
enum EXfbNumber { // TODO: placeholder
UNK_0 = 0,
UNK_1 = 1,
UNK_2 = 2,
UNK_3 = 3,
Single = 1,
Double = 2,
Triple = 3,
};

void clearIndex();
Expand Down
46 changes: 23 additions & 23 deletions include/d/d_ovlp_fade4.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ class dDlst_2DtEff1_c : public dDlst_base_c {
void init(_GXColor);
void draw();

/* 0x004 */ f32 field_0x4;
/* 0x008 */ u8 field_0x8;
/* 0x00C */ dDlst_snapShot2_c field_0xc;
/* 0x018 */ dDlst_2Dt_Sp_c field_0x18;
/* 0x064 */ dDlst_snapShot2_c field_0x64;
/* 0x070 */ dDlst_2Dt_Sp_c field_0x70;
/* 0x0BC */ dDlst_snapShot2_c field_0xbc;
/* 0x0C8 */ dDlst_2Dt_Sp_c field_0xc8;
/* 0x114 */ u16 field_0x114;
/* 0x116 */ u16 field_0x116;
/* 0x004 */ f32 timer;
/* 0x008 */ bool first;
/* 0x00C */ dDlst_snapShot2_c snap_dlst;
/* 0x018 */ dDlst_2Dt_Sp_c redraw_dlst;
/* 0x064 */ dDlst_snapShot2_c save_dlst;
/* 0x070 */ dDlst_2Dt_Sp_c blur0_dlst;
/* 0x0BC */ dDlst_snapShot2_c blur0Snap_dlst;
/* 0x0C8 */ dDlst_2Dt_Sp_c composite_dlst;
/* 0x114 */ u16 curWidth;
/* 0x116 */ u16 curHeight;
};

class dOvlpFd4_c : public overlap_task_class {
Expand All @@ -84,22 +84,22 @@ class dOvlpFd4_c : public overlap_task_class {

/* 0x0CC */ ExecuteFunc mExecuteFunc;
/* 0x0D8 */ DrawFunc mDrawFunc;
/* 0x0E4 */ dDlst_snapShot2_c field_0xe4;
/* 0x0F0 */ dDlst_snapShot2_c field_0xf0;
/* 0x0FC */ dDlst_2Dt_Sp_c field_0xfc;
/* 0x148 */ dDlst_2Dt_Sp_c field_0x148;
/* 0x194 */ dDlst_2DtEff1_c tEff1_dlst;
/* 0x2AC */ u8 field_0x2ac;
/* 0x2AD */ u8 field_0x2ad;
/* 0x2AE */ s8 field_0x2ae;
/* 0x2B0 */ s16 field_0x2b0;
/* 0x2B4 */ f32 field_0x2b4;
/* 0x0E4 */ dDlst_snapShot2_c fadeOutBlur0_dlst;
/* 0x0F0 */ dDlst_snapShot2_c fadeOutSnap_dlst;
/* 0x0FC */ dDlst_2Dt_Sp_c fadeOutComposite_dlst;
/* 0x148 */ dDlst_2Dt_Sp_c fadeOutBlur1_dlst;
/* 0x194 */ dDlst_2DtEff1_c fadeIn_dlst;
/* 0x2AC */ u8 first;
/* 0x2AD */ u8 fadeOutStatus;
/* 0x2AE */ s8 totalTime;
/* 0x2B0 */ s16 timer;
/* 0x2B4 */ f32 delayPercent;
/* 0x2B8 */ u8 field_0x2b8[0x2BC - 0x2B8];
/* 0x2BC */ f32 field_0x2bc;
/* 0x2C0 */ u8 field_0x2c0;
/* 0x2C1 */ s8 field_0x2c1;
/* 0x2C0 */ u8 sizeStep;
/* 0x2C1 */ s8 startTime;
/* 0x2C2 */ u8 field_0x2c2[0x2C8 - 0x2C2];
/* 0x2C8 */ f32 field_0x2c8;
/* 0x2C8 */ f32 timerStep;
/* 0x2CC */ u8 field_0x2cc;
};

Expand Down
11 changes: 5 additions & 6 deletions src/JSystem/JFramework/JFWDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void JFWDisplay::ctor_subroutine(const _GXRenderModeObj* mode, bool enableAlpha)
field_0x38 = 0;
field_0x3C = 0;
field_0x3E = 0;
mDrawDoneMethod = UNK_METHOD_0;
mDrawDoneMethod = Sync;
clearEfb_init();
JUTProcBar::create();
JUTProcBar::clear();
Expand Down Expand Up @@ -141,15 +141,14 @@ void JFWDisplay::exchangeXfb_double() {
if(0 <= xfbMng->getDrawingXfbIndex()) {
prepareCopyDisp();
GXCopyDisp(xfbMng->getDrawingXfb(), (GXBool)1);
if(mDrawDoneMethod == 0) {
if (mDrawDoneMethod == Sync) {
GXDrawDone();
JUTVideo::dummyNoDrawWait();
}
else {
} else {
JUTVideo::drawDoneStart();
}

if(mDrawDoneMethod == 0) {
if (mDrawDoneMethod == Sync) {
callDirectDraw();
}
}
Expand Down Expand Up @@ -237,7 +236,7 @@ void JFWDisplay::endGX() {
ortho.setPort();
JUTProcBar::getManager()->draw();

if (mDrawDoneMethod != UNK_METHOD_0 || JUTXfb::getManager()->getBufferNum() == 1) {
if (mDrawDoneMethod != Sync || JUTXfb::getManager()->getBufferNum() == 1) {
JUTAssertion::flushMessage_dbPrint();
}
GXFlush();
Expand Down
64 changes: 29 additions & 35 deletions src/JSystem/JUtility/JUTFader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,35 @@
/* 802C8544-802C85F0 .text __ct__8JUTFaderFiiiiQ28JUtility6TColor */
JUTFader::JUTFader(int x, int y, int width, int height, JUtility::TColor pColor) : mColor(pColor), mBox(x, y, x + width, y + height) {
mStatus = 0;
field_0x8 = 0;
field_0xa = 0;
field_0x24 = 0;
mEStatus = UNKSTATUS_M1;
mFadeTime = 0;
mTimer = 0;
mDelayStatus = 0;
mDelayTimer = -1;
}

/* 802C85F0-802C86F0 .text control__8JUTFaderFv */
void JUTFader::control() {
if (0 <= mEStatus && mEStatus-- == 0) {
mStatus = field_0x24;
if (0 <= mDelayTimer && mDelayTimer-- == 0) {
mStatus = mDelayStatus;
}

if (mStatus == 1) {
if (mStatus == WaitIn) {
return;
}

switch (mStatus) {
case 0:
case WaitOut:
mColor.a = 0xFF;
break;
case 2:
mColor.a = 0xFF - ((++field_0xa * 0xFF) / field_0x8);

if (field_0xa >= field_0x8) {
mStatus = 1;
}

case FadeIn:
mColor.a = 0xFF - ((++mTimer * 0xFF) / mFadeTime);
if (mTimer >= mFadeTime)
mStatus = WaitIn;
break;
case 3:
mColor.a = ((++field_0xa * 0xFF) / field_0x8);

if (field_0xa >= field_0x8) {
mStatus = 0;
}

case FadeOut:
mColor.a = ((++mTimer * 0xFF) / mFadeTime);
if (mTimer >= mFadeTime)
mStatus = WaitOut;
break;
}
draw();
Expand All @@ -56,32 +50,32 @@ void JUTFader::draw() {
return;
}

J2DOrthoGraph orthograph;
orthograph.setColor(mColor);
orthograph.fillBox(mBox);
J2DOrthoGraph graf;
graf.setColor(mColor);
graf.fillBox(mBox);
}

/* 802C8780-802C87B0 .text startFadeIn__8JUTFaderFi */
bool JUTFader::startFadeIn(int param_0) {
bool statusCheck = mStatus == 0;
bool JUTFader::startFadeIn(int fadeTime) {
bool statusCheck = mStatus == WaitOut;

if (statusCheck) {
mStatus = 2;
field_0xa = 0;
field_0x8 = param_0;
mStatus = FadeIn;
mTimer = 0;
mFadeTime = fadeTime;
}

return statusCheck;
}

/* 802C87B0-802C87E4 .text startFadeOut__8JUTFaderFi */
bool JUTFader::startFadeOut(int param_0) {
bool statusCheck = mStatus == 1;
bool JUTFader::startFadeOut(int fadeTime) {
bool statusCheck = mStatus == WaitIn;

if (statusCheck) {
mStatus = 3;
field_0xa = 0;
field_0x8 = param_0;
mStatus = FadeOut;
mTimer = 0;
mFadeTime = fadeTime;
}

return statusCheck;
Expand Down
Loading

0 comments on commit 2a65dfd

Please sign in to comment.