misc ogawa cleanup

This commit is contained in:
HeartPiece 2024-05-24 17:36:17 +10:00
parent bc7496aaa5
commit d09eff96b2
12 changed files with 296 additions and 546 deletions

View File

@ -96,7 +96,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiPrimitives.cpp">aiPrimitives.cpp</a> | 117085 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pelletMgr.cpp">pelletMgr.cpp</a> | 141213 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/navi.cpp">navi.cpp</a> | 152216 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pikiState.cpp">pikiState.cpp</a> | 155487 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_Zukan.cpp">singleGS_Zukan.cpp</a> | 163799 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameMapParts.cpp">gameMapParts.cpp</a> | 164131 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviState.cpp">naviState.cpp</a> | 182713 | | |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviState.cpp">naviState.cpp</a> | 182701 | | |
### <section id="plugProjectKonoU">plugProjectKonoU</section>
| File | Size (bytes) | File | Size (bytes) |
@ -113,7 +113,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/panModoki.cpp">panModoki.cpp</a> | 44955 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/kingChappyState.cpp">kingChappyState.cpp</a> | 50795 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/umiMushi.cpp">umiMushi.cpp</a> | 60143 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/kingChappy.cpp">kingChappy.cpp</a> | 64705 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/hiScore2D.cpp">hiScore2D.cpp</a> | 103202 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/blackMan.cpp">blackMan.cpp</a> | 121693 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/zukan2D.cpp">zukan2D.cpp</a> | 134239 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/challengeResult2D.cpp">challengeResult2D.cpp</a> | 143588 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/zukan2D.cpp">zukan2D.cpp</a> | 134239 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/challengeResult2D.cpp">challengeResult2D.cpp</a> | 143638 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/challengeSelect2D.cpp">challengeSelect2D.cpp</a> | 185921 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/vsSelect2D.cpp">vsSelect2D.cpp</a> | 196135 |
### <section id="plugProjectNishimuraU">plugProjectNishimuraU</section>
@ -151,9 +151,9 @@
### <section id="plugProjectOgawaU">plugProjectOgawaU</section>
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCopyPane.cpp">ogCopyPane.cpp</a> | 7678 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCounterSlot.cpp">ogCounterSlot.cpp</a> | 15118 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCopyPane.cpp">ogCopyPane.cpp</a> | 7678 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCounterSlot.cpp">ogCounterSlot.cpp</a> | 15278 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogObjSMenuItem.cpp">ogObjSMenuItem.cpp</a> | 26365 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogMenuMgr.cpp">ogMenuMgr.cpp</a> | 26684 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogObjContena.cpp">ogObjContena.cpp</a> | 31585 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCounterRV.cpp">ogCounterRV.cpp</a> | 33659 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogCounterRV.cpp">ogCounterRV.cpp</a> | 28223 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogObjContena.cpp">ogObjContena.cpp</a> | 31532 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogObjVs.cpp">ogObjVs.cpp</a> | 67702 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectOgawaU/ogObjSMenuMap.cpp">ogObjSMenuMap.cpp</a> | 74769 |
### <section id="plugProjectYamashitaU">plugProjectYamashitaU</section>

View File

@ -18,16 +18,16 @@ struct ContenaCounter : public P2DScreen::Mgr_tuning {
// _00 = VTBL
// _00-_148 = P2DScreen::Mgr_tuning
DispMemberContena* mDisp; // _148
CallBack_CounterRV* mCounter1; // _14C in onion
CallBack_CounterRV* mCounter2; // _150
CallBack_CounterRV* mCounter3; // _154
CallBack_CounterRV* mCounter4; // _158
u8 _15C[0x8]; // _15C, unknown
u32* mInOnion; // _164, pikmin in the onion
u32* mInTransfer; // _168, pikmin involved in transfer
u32* mNewCount; // _16C, new number of this pikmin type on field
u32* mOnField; // _170, total pikmin on field
DispMemberContena* mDisp; // _148
CallBack_CounterRV* mInOnionCounter; // _14C in onion
CallBack_CounterRV* mInTransferCounter; // _150
CallBack_CounterRV* mInSquadCounter; // _154
CallBack_CounterRV* mOnFieldCounter; // _158
u8 _15C[0x8]; // _15C, unknown
u32* mInOnion; // _164, pikmin in the onion
u32* mInTransfer; // _168, pikmin involved in transfer
u32* mInSquad; // _16C, new number of this pikmin type in squad
u32* mOnField; // _170, new number of total pikmin on field
};
} // namespace Screen
} // namespace og

View File

@ -6,7 +6,12 @@
namespace og {
namespace Screen {
struct ScaleMgr {
enum State { SCM_Inactive = 0, SCM_Growing, SCM_Shrinking, SCM_GrowWait };
enum State {
SCM_Inactive = 0,
SCM_Up = 1,
SCM_Down = 2,
SCM_DelayedUp = 3,
};
ScaleMgr();
@ -14,19 +19,21 @@ struct ScaleMgr {
void up();
void down();
void up(f32, f32, f32, f32);
void down(f32, f32, f32);
void setParam(f32, f32, f32);
void up(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime, f32 delayTime);
void down(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime);
void setParam(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime);
f32 calc();
State mState; // _00
f32 mElapsedSeconds; // _04
f32 mScale; // _08
f32 mScaleChangeLevel; // _0C
f32 mPeriodModifier; // _10 sin(elapsedSeconds*periodModifier).
// Larger = shorter periods.
f32 mDurationInSeconds; // _14
f32 mWaitTimer; // _18
// unused/inlined:
void up(f32 delayTime);
State mState; // _00
f32 mRestoreTimer; // _04
f32 mScale; // _08
f32 mRestoreAmplitude; // _0C
f32 mAngularFreq; // _10, i.e. sin(mRestoreTimer * mAngularFreq); larger ang freq = shorter periods
f32 mMaxRestoreTime; // _14, in seconds
f32 mDelayTimer; // _18
};
} // namespace Screen
} // namespace og

View File

@ -37,6 +37,8 @@ struct CounterKeta {
void setSuji(ResTIMG**, u32);
void calcScale();
inline J2DPicture* getPicture() { return mPicture; }
J2DPicture* mPicture; // _00
u32 mTextureIndex; // _04
ScaleMgr* mScaleMgr; // _08
@ -66,33 +68,32 @@ struct CallBack_CatchPiki : public P2DScreen::CallBackNode {
struct CallBack_CounterRV : public P2DScreen::CallBackNode {
enum EnumCenteringMode { ECM_Unknown0 = 0, ECM_Unknown1 = 1, ECM_UNKNOWN_2 = 2 };
CallBack_CounterRV(char**, u16, u16, JKRArchive*);
CallBack_CounterRV(char** charTexturePaths, u16 maxDigits, u16 minDigits, JKRArchive* arc);
virtual ~CallBack_CounterRV() { } // _08 (weak)
virtual void update(); // _10
virtual void draw(Graphics&, J2DGrafContext&); // _14
virtual void init(J2DScreen*, u64, u64, u64, u32*,
bool); // _1C
virtual void show(); // _20
virtual void hide(); // _24
virtual void setValue(bool, bool); // _28
virtual void setValue(); // _2C (weak)
virtual ~CallBack_CounterRV() { } // _08 (weak)
virtual void update(); // _10
virtual void draw(Graphics& gfx, J2DGrafContext& graf); // _14
virtual void init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u32* countPtr, bool hasMother); // _1C
virtual void show(); // _20
virtual void hide(); // _24
virtual void setValue(bool isUp, bool isDown); // _28
virtual void setValue(); // _2C (weak)
inline int getMaxCounter() { return (mCurrentCounters >= mCounterLimit) ? mCounterLimit : mCurrentCounters; }
inline int getMaxCounter() { return (mCurrentDigitNum >= mMaxDisplayDigitNum) ? mMaxDisplayDigitNum : mCurrentDigitNum; }
J2DPane* getMotherPane();
void setBlind(bool);
void setCenteringMode(EnumCenteringMode);
void setCounterUpDown(int, bool, bool);
void setKetaSub(int, bool, bool);
void setPuyoAnim(bool);
void setPuyoAnimZero(bool);
void setBlind(bool isBlind);
void setCenteringMode(EnumCenteringMode centerMode);
void setCounterUpDown(int digitID, bool isUp, bool isDown);
void setKetaSub(int displayDigitNum, bool isUp, bool isDown);
void setPuyoAnim(bool isPuyoAnim);
void setPuyoAnimZero(bool isPuyoAnimZero);
void setRandMode(bool);
void setValPtr(u32*);
void setZeroAlpha(u8);
void startPuyoUp(f32);
void setZeroAlpha(u8 alpha);
void startPuyoUp(f32 scaleDelayFactor);
inline J2DPicture* getKetaPicture(int i) { return mCounters[i]->mPicture; }
inline J2DPicture* getKetaPicture(int i) { return mCounterDigits[i]->mPicture; }
// _00 = VTBL
// _00-_1C = P2DScreen::CallBackNode
@ -100,9 +101,9 @@ struct CallBack_CounterRV : public P2DScreen::CallBackNode {
u32* mCountPtr; // _20
u32 mInitialDisplayValue; // _24
u32 mCurrDisplayValue; // _28
u16 mCurrentCounters; // _2C
u16 mCounterLimit; // _2E
u16 mMaxCounterLimit; // _30
u16 mCurrentDigitNum; // _2C
u16 mMaxDisplayDigitNum; // _2E
u16 mMinDisplayDigitNum; // _30
f32 mPane12DistX; // _34
f32 mPane13DistX; // _38
f32 mKetaScaleX; // _3C
@ -117,7 +118,7 @@ struct CallBack_CounterRV : public P2DScreen::CallBackNode {
J2DPane* mPic2; // _70
J2DPane* mPic3; // _74
J2DPane* mMotherPane; // _78
CounterKeta** mCounters; // _7C
CounterKeta** mCounterDigits; // _7C
ResTIMG** mImgResources; // _80
bool mIsPuyoAnim; // _84
bool mIsPuyoAnimZero; // _85
@ -136,14 +137,16 @@ struct CallBack_CounterRV : public P2DScreen::CallBackNode {
static struct StaticValues {
inline StaticValues()
{
_00 = 0.5f;
_04 = 30.0f;
_08 = 0.8f;
// the funny thing is, these are just the default values.
// they should've just called mScaleMgr->up(f32), but that's stripped
mScaleRestoreAmplitude = 0.5f;
mScaleAngularFreq = 30.0f;
mScaleMaxRestoreTime = 0.8f;
}
f32 _00; // _00
f32 _04; // _04
f32 _08; // _08
f32 mScaleRestoreAmplitude; // _00
f32 mScaleAngularFreq; // _04
f32 mScaleMaxRestoreTime; // _08
} msVal;
};
@ -180,7 +183,7 @@ struct CallBack_CounterSlot : public CallBack_CounterRV {
inline void hidePicture(int i)
{
J2DPicture* pic = mCounters[i]->mPicture;
J2DPicture* pic = mCounterDigits[i]->mPicture;
pic->hide();
}

View File

@ -68,9 +68,12 @@ void setCallBack_CStickSmall(JKRArchive*, P2DScreen::Mgr*, u64);
CallBack_CounterDay* setCallBack_CounterDay(P2DScreen::Mgr*, u64, u64, u64, u32*, u16, JKRArchive*);
CallBack_CounterDay* setCallBack_CounterDay(char**, P2DScreen::Mgr*, u64, u64, u64, u32*, u16, JKRArchive*);
void setCallBack_CounterMap(P2DScreen::Mgr*, u64, u64, u64, u32*, u16, u16, bool, JKRArchive*);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, u64, u64, u64, u32*, u16, u16, bool, JKRArchive*);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, u64, u32*, u16, bool, bool, JKRArchive*);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, u64, u32, u16, bool, bool, JKRArchive*);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag1, u64 tag2, u64 tag3, u32* countPtr, u16 maxDigits, u16 minDigits,
bool isPuyo, JKRArchive* arc);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32* countPtr, u16 maxDigits, bool hasMother, bool isPuyo,
JKRArchive* arc);
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32 value, u16 maxDigits, bool isPuyo, bool hasMother,
JKRArchive* arc);
void setCallBack_CounterRV2(P2DScreen::Mgr*, u64, u32*, u16, bool, bool, JKRArchive*);
CallBack_CounterSlot* setCallBack_CounterSlot(P2DScreen::Mgr*, u64, u32*, u16, bool, bool, JKRArchive*);
CallBack_DrawAfter* setCallBack_DrawAfter(P2DScreen::Mgr*, u64);

View File

@ -769,8 +769,8 @@ TCounterRV::TCounterRV(char** a1, u16 a2, u16 a3, JKRArchive* arc)
, _B1(false)
{
setColor(255);
mEfxCountKiras = new efx2d::T2DCountKira*[mCounterLimit];
for (int i = 0; i < mCounterLimit; i++) {
mEfxCountKiras = new efx2d::T2DCountKira*[mMaxDisplayDigitNum];
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
mEfxCountKiras[i] = new efx2d::T2DCountKira;
}
setPuyoAnim(false);
@ -783,7 +783,7 @@ TCounterRV::TCounterRV(char** a1, u16 a2, u16 a3, JKRArchive* arc)
void TCounterRV::update()
{
og::Screen::CallBack_CounterRV::update();
for (int i = 0; i < mCounterLimit; i++) {
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
J2DPicture* pic = getKetaPicture(i);
P2ASSERTLINE(557, pic);
pic->setWhite(mColor);
@ -801,7 +801,7 @@ void TCounterRV::setValue(bool flag1, bool flag2)
setPuyoAnim(true);
u16 max = og::Screen::CalcKeta(mInitialDisplayValue);
for (int i = 0; i < max; i++) {
mCounters[i]->mScaleMgr->up(0.4f, 50.0f, 0.8f, 0.05f * f32(max - i));
mCounterDigits[i]->mScaleMgr->up(0.4f, 50.0f, 0.8f, 0.05f * f32(max - i));
}
} else {
og::Screen::CallBack_CounterRV::setValue(flag1, flag2);
@ -815,7 +815,7 @@ void TCounterRV::setValue(bool flag1, bool flag2)
void TCounterRV::createKiraEffect(f32 scale, int max)
{
for (int i = 0; i < max; i++) {
J2DPicture* pic = mCounters[i]->mPicture;
J2DPicture* pic = mCounterDigits[i]->mPicture;
P2ASSERTLINE(597, pic);
pic->setBasePosition(J2DPOS_Center);
Vector2f pos;
@ -833,7 +833,7 @@ void TCounterRV::createKiraEffect(f32 scale, int max)
*/
void TCounterRV::fadeKiraEffect()
{
for (int j = 0; j < mCounterLimit; j++) {
for (int j = 0; j < mMaxDisplayDigitNum; j++) {
P2ASSERTLINE(619, mEfxCountKiras[j]);
mEfxCountKiras[j]->fade();
}
@ -857,7 +857,7 @@ void TCounterRV::reset()
mEnabled = false;
_B1 = false;
setPuyoAnim(false);
for (int i = 0; i < mCounterLimit; i++) {
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
P2ASSERTLINE(619, mEfxCountKiras[i]);
mEfxCountKiras[i]->fade();
}
@ -3706,7 +3706,7 @@ void TChallengeResult::updateDemo()
}
if (check) {
for (int i = 0; i < 3; i++) {
mOnyonMovePane[i]->startStick(mCounter1->mCounters[0]->mPicture);
mOnyonMovePane[i]->startStick(mCounter1->mCounterDigits[0]->mPicture);
}
PSSystem::spSysIF->playSystemSe(PSSE_SY_CHALLENGE_ONY_MOVE, 0);
mDemoState = 3;
@ -3741,7 +3741,7 @@ void TChallengeResult::updateDemo()
if (mOnyonMovePane[i]->mCounter > 0) {
P2ASSERTLINE(1977, mRankInSlot >= 0);
J2DPicture* pic = mHighScoreCounter[mRankInSlot]->mCounters[0]->mPicture;
J2DPicture* pic = mHighScoreCounter[mRankInSlot]->mCounterDigits[0]->mPicture;
TMovePane* mpane = mOnyonMovePane[i];
f32 x = _168._00.x + pic->mGlobalMtx[1][3];
mpane->mOffset = Vector2f(x, pic->mGlobalMtx[0][3] - 1000.0f);

View File

@ -325,8 +325,8 @@ void TScaleUpCounter::forceScaleUp(bool flag)
void TScaleUpCounter::setScale(f32 scale, f32 scalesub)
{
mPane12DistX = _AC * scale;
for (int i = 0; i < mCurrentCounters; i++) {
og::Screen::CounterKeta* keta = mCounters[i];
for (int i = 0; i < mCurrentDigitNum; i++) {
og::Screen::CounterKeta* keta = mCounterDigits[i];
keta->mSize.x = scale;
keta->mSize.y = scalesub;
}

View File

@ -11,15 +11,15 @@ namespace Screen {
*/
ContenaCounter::ContenaCounter(DispMemberContena* contena)
{
mDisp = contena;
mInOnion = &mDisp->mDataContena.mInOnionCount;
mInTransfer = &mDisp->mDataContena.mInTransfer;
mNewCount = &mDisp->mDataContena.mInSquadCount;
mOnField = &mDisp->mDataContena.mOnMapCount;
mCounter1 = nullptr;
mCounter2 = nullptr;
mCounter3 = nullptr;
mCounter4 = nullptr;
mDisp = contena;
mInOnion = &mDisp->mDataContena.mInOnionCount;
mInTransfer = &mDisp->mDataContena.mInTransfer;
mInSquad = &mDisp->mDataContena.mInSquadCount;
mOnField = &mDisp->mDataContena.mOnMapCount;
mInOnionCounter = nullptr;
mInTransferCounter = nullptr;
mInSquadCounter = nullptr;
mOnFieldCounter = nullptr;
}
/**
@ -34,10 +34,13 @@ void ContenaCounter::setblo(char* filename, JKRArchive* archive)
setAlphaScreen(this);
setAlpha(255);
mCounter1 = setCallBack_CounterRV(this, 'a_k1', mInOnion, 5, true, true, archive);
mCounter2 = setCallBack_CounterRV(this, 'b_k1', mInTransfer, 4, false, true, archive);
mCounter3 = setCallBack_CounterRV(this, 'c_k1', mNewCount, 4, true, true, archive);
mCounter4 = setCallBack_CounterRV(this, 'd_k1', mOnField, 4, true, true, archive);
mInOnionCounter = setCallBack_CounterRV(this, 'a_k1', mInOnion, 5, true, true, archive); // room for 5 digits in onion count
mInTransferCounter = setCallBack_CounterRV(this, 'b_k1', mInTransfer, 4, false, true,
archive); // room for 4 digits in transfer count (3 + buffer space)
mInSquadCounter
= setCallBack_CounterRV(this, 'c_k1', mInSquad, 4, true, true, archive); // room for 4 digits in squad count (3 + buffer space)
mOnFieldCounter
= setCallBack_CounterRV(this, 'd_k1', mOnField, 4, true, true, archive); // room for 4 digits in field count (3 + buffer space)
}
} // namespace Screen

View File

@ -61,7 +61,7 @@ void CallBack_CounterDay::setValue()
CallBack_CounterRV::setValue(false, false);
}
J2DPicture* picture = mCounters[0]->mPicture;
J2DPicture* picture = mCounterDigits[0]->mPicture;
mDayPic->changeTexture(picture->getTexture(0)->mTexInfo, 0);
if (mIsHidden) {
@ -101,8 +101,8 @@ void CallBack_CounterDay::show()
void CallBack_CounterDay::hide()
{
mIsHidden = true;
for (int i = 0; i < mCounterLimit; i++) {
mCounters[i]->mPicture->hide();
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
mCounterDigits[i]->mPicture->hide();
}
mDayPic->hide();
}

View File

@ -12,25 +12,25 @@ namespace Screen {
* @note Address: 0x8030B524
* @note Size: 0x1E0
*/
CallBack_CounterRV::CallBack_CounterRV(char** characterTexturePaths, u16 ketaCount, u16 p3, JKRArchive* archive)
CallBack_CounterRV::CallBack_CounterRV(char** characterTexturePaths, u16 maxDigits, u16 minDigits, JKRArchive* archive)
: P2DScreen::CallBackNode()
{
mCharacterTexturePaths = characterTexturePaths;
if (10 < ketaCount) {
ketaCount = 10;
if (maxDigits > 10) {
maxDigits = 10;
}
if (ketaCount < 2) {
ketaCount = 2;
if (maxDigits < 2) {
maxDigits = 2;
}
mCounterLimit = ketaCount;
mMaxCounterLimit = p3;
mMaxDisplayDigitNum = maxDigits;
mMinDisplayDigitNum = minDigits;
mCountPtr = nullptr;
mInitialDisplayValue = 0;
mCurrDisplayValue = 0;
mImgResources = og::Screen::makeSujiFontTable(mCharacterTexturePaths, archive);
mCounters = new CounterKeta*[ketaCount];
for (int i = 0; i < ketaCount; i++) {
mCounters[i] = nullptr;
mCounterDigits = new CounterKeta*[maxDigits];
for (int i = 0; i < maxDigits; i++) {
mCounterDigits[i] = nullptr;
}
mPic1 = nullptr;
mPic2 = nullptr;
@ -76,9 +76,9 @@ void CallBack_CounterRV::setValue() { setValue(false, false); }
void CallBack_CounterRV::hide()
{
mIsHidden = true;
for (int i = 0; i < mCounterLimit; i++) {
if (mCounters[i]) {
mCounters[i]->mPicture->hide();
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
if (mCounterDigits[i]) {
mCounterDigits[i]->mPicture->hide();
}
}
}
@ -100,19 +100,19 @@ J2DPane* CallBack_CounterRV::getMotherPane()
* @note Address: 0x8030B7D8
* @note Size: 0x8
*/
void CallBack_CounterRV::setPuyoAnim(bool a1) { mIsPuyoAnim = a1; }
void CallBack_CounterRV::setPuyoAnim(bool isPuyoAnim) { mIsPuyoAnim = isPuyoAnim; }
/**
* @note Address: 0x8030B7E0
* @note Size: 0x8
*/
void CallBack_CounterRV::setPuyoAnimZero(bool a1) { mIsPuyoAnimZero = a1; }
void CallBack_CounterRV::setPuyoAnimZero(bool isPuyoAnimZero) { mIsPuyoAnimZero = isPuyoAnimZero; }
/**
* @note Address: 0x8030B7E8
* @note Size: 0x8
*/
void CallBack_CounterRV::setBlind(bool a1) { mIsBlind = a1; }
void CallBack_CounterRV::setBlind(bool isBlind) { mIsBlind = isBlind; }
/**
* @note Address: N/A
@ -136,18 +136,19 @@ void CallBack_CounterRV::setValPtr(u32*)
* @note Address: 0x8030B7F0
* @note Size: 0x8
*/
void CallBack_CounterRV::setZeroAlpha(u8 a1) { mZeroAlpha = a1; }
void CallBack_CounterRV::setZeroAlpha(u8 alpha) { mZeroAlpha = alpha; }
/**
* @note Address: 0x8030B7F8
* @note Size: 0xE4
*/
void CallBack_CounterRV::startPuyoUp(f32 p1)
void CallBack_CounterRV::startPuyoUp(f32 scaleDelayFactor)
{
mIsPuyoAnim = true;
int max = (mCurrentCounters >= mCounterLimit) ? mCounterLimit : mCurrentCounters;
setPuyoAnim(true);
u16 max = (mCurrentDigitNum >= mMaxDisplayDigitNum) ? mMaxDisplayDigitNum : mCurrentDigitNum;
for (int i = 0; i < max; i++) {
mCounters[i]->mScaleMgr->up(msVal._00, msVal._04, msVal._08, 0.025f * i * p1);
mCounterDigits[i]->mScaleMgr->up(msVal.mScaleRestoreAmplitude, msVal.mScaleAngularFreq, msVal.mScaleMaxRestoreTime,
(0.025f * f32(i)) * scaleDelayFactor);
}
/*
stwu r1, -0x60(r1)
@ -226,9 +227,9 @@ void CallBack_CounterRV::setCenteringMode(EnumCenteringMode centeringMode) { mCe
* @note Address: 0x8030B8E4
* @note Size: 0x4D0
*/
void CallBack_CounterRV::init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u32* data, bool flag)
void CallBack_CounterRV::init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u32* countPtr, bool hasMother)
{
mIsMother = flag;
mIsMother = hasMother;
mPic1 = static_cast<J2DPictureEx*>(og::Screen::TagSearch(screen, tag1));
mPic2 = og::Screen::TagSearch(screen, tag2);
mPic1->setBasePosition(J2DPOS_Center);
@ -239,8 +240,8 @@ void CallBack_CounterRV::init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u
} else {
mPic3 = mPic2;
}
mCountPtr = data;
mInitialDisplayValue = *data;
mCountPtr = countPtr;
mInitialDisplayValue = *countPtr;
mCurrDisplayValue = mInitialDisplayValue;
mPaneScale.x = mPic1->mScale.x;
mPaneScale.y = mPic1->mScale.y;
@ -265,29 +266,29 @@ void CallBack_CounterRV::init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u
mPic1->calcMtx();
mPaneBounds.x = box->i.x;
mPaneBounds.y = box->i.y;
if (flag) {
for (int i = 0; i < mCounterLimit; i++) {
if (hasMother) {
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
J2DPane* newpane = CopyPictureToPane(mPic1, mMotherPane, mPanePosition.x, mPanePosition.y, 'ogPic_0' + i);
newpane->setBasePosition((J2DBasePosition)mBasePosition);
newpane->setInfluencedAlpha(alphatype, false);
mCounters[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
mCounterDigits[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
}
} else {
J2DPane* newpane = CopyPictureToPane(mPic1, mMotherPane, mPanePosition.x, mPanePosition.y, 'ogPic_0');
newpane->setBasePosition((J2DBasePosition)mBasePosition);
newpane->setInfluencedAlpha(alphatype, false);
mCounters[0] = new CounterKeta(static_cast<J2DPicture*>(newpane));
mCounterDigits[0] = new CounterKeta(static_cast<J2DPicture*>(newpane));
for (int i = 1; i < mMaxCounterLimit; i++) {
J2DPane* newpane = screen->search(0);
mCounters[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
for (int i = 1; i < mMinDisplayDigitNum; i++) {
J2DPane* newpane = screen->search(0);
mCounterDigits[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
}
for (int i = mMaxCounterLimit / 2; i < mCounterLimit; i++) {
for (int i = mMinDisplayDigitNum / 2; i < mMaxDisplayDigitNum; i++) {
J2DPane* newpane = CopyPictureToPane(mPic1, mMotherPane, mPanePosition.x, mPanePosition.y, 'ogPic_0' + i);
newpane->setBasePosition((J2DBasePosition)mBasePosition);
newpane->setInfluencedAlpha(alphatype, false);
mCounters[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
mCounterDigits[i] = new CounterKeta(static_cast<J2DPicture*>(newpane));
}
}
mIsInitialized = true;
@ -648,36 +649,36 @@ void CallBack_CounterRV::init(J2DScreen* screen, u64 tag1, u64 tag2, u64 tag3, u
* @note Address: 0x8030BDB4
* @note Size: 0x220
*/
void CallBack_CounterRV::setKetaSub(int count, bool flag1, bool flag2)
void CallBack_CounterRV::setKetaSub(int displayDigitNum, bool isUp, bool isDown)
{
for (int i = 0; i < mCounterLimit; i++) {
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
u32 temp = pow(10.0f, i);
temp = u16((mInitialDisplayValue / temp) % 10);
if (mIsBlind) {
mCounters[i]->setSuji(mImgResources, 10);
mCounterDigits[i]->setSuji(mImgResources, 10);
} else if (mDoUseRandomValue) {
mCounters[i]->setSuji(mImgResources, (u16)(randFloat() * 9.0f));
mCounterDigits[i]->setSuji(mImgResources, (u16)(randFloat() * 9.0f));
} else {
mCounters[i]->setSuji(mImgResources, temp);
mCounterDigits[i]->setSuji(mImgResources, temp);
}
if (i < count) {
mCounters[i]->mPicture->show();
if (i < displayDigitNum) {
mCounterDigits[i]->mPicture->show();
u8 alpha = mPaneAlpha;
if (i + 1 > mCurrentCounters && !mIsBlind) {
if (i + 1 > mCurrentDigitNum && !mIsBlind) {
alpha = mZeroAlpha;
}
mCounters[i]->mPicture->setAlpha(alpha);
if (i + 1 <= mCurrentCounters) {
setCounterUpDown(i, flag1, flag2);
mCounterDigits[i]->mPicture->setAlpha(alpha);
if (i + 1 <= mCurrentDigitNum) {
setCounterUpDown(i, isUp, isDown);
} else {
if (!mIsBlind && mIsPuyoAnimZero) {
setCounterUpDown(i, flag1, flag2);
setCounterUpDown(i, isUp, isDown);
}
}
mCounters[i]->calcScale();
mCounterDigits[i]->calcScale();
} else {
J2DPane* pane = mCounters[i]->mPicture;
J2DPane* pane = mCounterDigits[i]->mPicture;
if (pane)
pane->hide();
}
@ -688,16 +689,16 @@ void CallBack_CounterRV::setKetaSub(int count, bool flag1, bool flag2)
* @note Address: 0x8030BFD4
* @note Size: 0xB0
*/
void CallBack_CounterRV::setCounterUpDown(int i, bool isUp, bool flag2)
void CallBack_CounterRV::setCounterUpDown(int digitID, bool isUp, bool isDown)
{
ScaleMgr* scale = mCounters[i]->mScaleMgr;
ScaleMgr* scale = mCounterDigits[digitID]->mScaleMgr;
if (isUp) {
scale->up(msVal._00, msVal._04, msVal._08, 0.025f * i);
scale->up(msVal.mScaleRestoreAmplitude, msVal.mScaleAngularFreq, msVal.mScaleMaxRestoreTime, 0.025f * digitID);
u32 id = mScaleUpSoundID;
if (id) {
ogSound->setSE(id);
}
} else if (flag2) {
} else if (isDown) {
scale->down();
u32 id = mScaleDownSoundID;
if (id) {
@ -710,7 +711,7 @@ void CallBack_CounterRV::setCounterUpDown(int i, bool isUp, bool flag2)
* @note Address: 0x8030C084
* @note Size: 0x3F8
*/
void CallBack_CounterRV::setValue(bool flag1, bool flag2)
void CallBack_CounterRV::setValue(bool isUp, bool isDown)
{
if (!mIsHidden) {
if (mIsBlind) {
@ -718,22 +719,25 @@ void CallBack_CounterRV::setValue(bool flag1, bool flag2)
mCurrDisplayValue = 0;
}
mCurrentCounters = CalcKeta(mInitialDisplayValue);
u16 maxCounter = mCurrentCounters < (s32)mMaxCounterLimit ? mMaxCounterLimit : mCurrentCounters;
mCurrentDigitNum = CalcKeta(mInitialDisplayValue);
setKetaSub(maxCounter, flag1, flag2);
if (maxCounter > mCounterLimit) {
maxCounter = mCounterLimit;
int digits = (int)mCurrentDigitNum < (s32)mMinDisplayDigitNum ? mMinDisplayDigitNum : (int)mCurrentDigitNum;
setKetaSub(digits, isUp, isDown);
u16 displayNum = digits;
if (displayNum > mMaxDisplayDigitNum) {
displayNum = mMaxDisplayDigitNum;
}
mPaneOffsetX = 0.0f;
mKetaScaleX = 1.0f;
if (maxCounter >= 2) {
f32 temp = mPane12DistX * (maxCounter - 1) + mPaneSize.x;
if (displayNum >= 2) {
f32 temp = mPane12DistX * (displayNum - 1) + mPaneSize.x;
if (temp > mPane13DistX) {
mKetaScaleX = mPane13DistX / temp;
mPaneOffsetX = mPaneSize.x * 0.5f * (1.0f - mKetaScaleX);
mPaneOffsetX = mPaneSize.x / 2 * (1.0f - mKetaScaleX);
}
}
@ -746,47 +750,42 @@ void CallBack_CounterRV::setValue(bool flag1, bool flag2)
mPaneBounds.x = bounds->i.x;
mPaneBounds.y = bounds->i.y;
mPaneOffsetY = 0.0f;
if (mCenteringMode == ECM_Unknown1) {
if (mCurrentCounters < mMaxCounterLimit) {
f32 x = (mMaxCounterLimit - mCurrentCounters) * 0.5f;
mPaneOffsetY = (mKetaScaleX * mPane12DistX * -x);
if (mCurrentDigitNum < mMinDisplayDigitNum) {
// f32 x = f32(mMinDisplayDigitNum - mCurrentDigitNum);
mPaneOffsetY = -(mKetaScaleX * (mPane12DistX * f32(mMinDisplayDigitNum - mCurrentDigitNum))) / 2;
}
mPaneAlpha = 0;
mZeroAlpha = 0;
} else if (mCenteringMode == ECM_UNKNOWN_2) {
if (mCurrentCounters < mMaxCounterLimit) {
f32 x = -(mMaxCounterLimit - mCurrentCounters);
mPaneOffsetY = (mKetaScaleX * mPane12DistX * x);
if (mCurrentDigitNum < mMinDisplayDigitNum) {
f32 x = -(mMinDisplayDigitNum - mCurrentDigitNum);
mPaneOffsetY = (mKetaScaleX * (mPane12DistX * f32(-(mMinDisplayDigitNum - mCurrentDigitNum))));
}
mPaneAlpha = 0;
mZeroAlpha = 0;
}
for (int i = 0; i < mCounterLimit; i++) {
J2DPicture* pane = mCounters[i]->mPicture;
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
J2DPicture* pane = mCounterDigits[i]->getPicture();
if (pane) {
// Calculate the new x position
f32 newXPosition = static_cast<f32>(i) * (-mPane12DistX * mKetaScaleX);
f32 offset = mPaneOffsetX + (static_cast<f32>(i) * (-mPane12DistX * mKetaScaleX) + mPaneOffsetY);
// Create a new box
JGeometry::TBox2f box;
// Set the initial x and y positions of the box
box.i.x = mPaneBounds.x + mPaneOffsetX + newXPosition;
box.i.y = mPaneBounds.y + mPaneOffsetY;
// Set the final x and y positions of the box
box.f.x = box.i.x + mPaneSize.x;
box.f.y = box.i.y + mPaneSize.y;
JGeometry::TBox2f box(mPaneBounds.x + offset, mPaneBounds.y, offset + (mPaneBounds.x + mPaneSize.x),
mPaneBounds.y + mPaneSize.y);
// Place the pane at the calculated box position
pane->place(box);
if (mIsPuyoAnimZero) {
if (mIsPuyoAnim) {
pane->setBasePosition(J2DPOS_Center);
CounterKeta* keta = mCounters[i];
keta->mSize.x = mKetaScaleX;
keta->mSize.y = mPaneScale.y;
CounterKeta* keta = mCounterDigits[i];
keta->mSize = Vector2f(mKetaScaleX, mPaneScale.y);
} else {
pane->setBasePosition((J2DBasePosition)mBasePosition);
pane->updateScale(mKetaScaleX, mPaneScale.y);
@ -799,290 +798,6 @@ void CallBack_CounterRV::setValue(bool flag1, bool flag2)
}
}
}
/*
stwu r1, -0x80(r1)
mflr r0
stw r0, 0x84(r1)
stfd f31, 0x70(r1)
psq_st f31, 120(r1), 0, qr0
stfd f30, 0x60(r1)
psq_st f30, 104(r1), 0, qr0
stfd f29, 0x50(r1)
psq_st f29, 88(r1), 0, qr0
stw r31, 0x4c(r1)
stw r30, 0x48(r1)
stw r29, 0x44(r1)
stw r28, 0x40(r1)
mr r31, r3
mr r30, r4
lbz r0, 0x87(r3)
mr r28, r5
cmplwi r0, 0
bne lbl_8030C444
lbz r0, 0x86(r31)
cmplwi r0, 0
beq lbl_8030C0E8
li r0, 0
stw r0, 0x24(r31)
stw r0, 0x28(r31)
lbl_8030C0E8:
lwz r3, 0x24(r31)
bl CalcKeta__Q22og6ScreenFUl
sth r3, 0x2c(r31)
lhz r29, 0x2c(r31)
lhz r0, 0x30(r31)
cmpw r29, r0
bge lbl_8030C108
mr r29, r0
lbl_8030C108:
mr r3, r31
mr r4, r29
mr r5, r30
mr r6, r28
bl setKetaSub__Q32og6Screen18CallBack_CounterRVFibb
lhz r0, 0x2e(r31)
clrlwi r3, r29, 0x10
cmplw r3, r0
ble lbl_8030C130
mr r3, r0
lbl_8030C130:
lfs f0, lbl_8051D6A0@sda21(r2)
clrlwi r3, r3, 0x10
lfs f4, lbl_8051D6B0@sda21(r2)
cmplwi r3, 2
stfs f0, 0xa4(r31)
stfs f4, 0x3c(r31)
blt lbl_8030C1A8
addi r3, r3, -1
lis r0, 0x4330
xoris r3, r3, 0x8000
stw r0, 0x30(r1)
lfd f2, lbl_8051D6A8@sda21(r2)
stw r3, 0x34(r1)
lfs f3, 0x34(r31)
lfd f1, 0x30(r1)
lfs f0, 0x48(r31)
fsubs f1, f1, f2
lfs f2, 0x38(r31)
fmadds f0, f3, f1, f0
fcmpo cr0, f0, f2
ble lbl_8030C1A8
fdivs f0, f2, f0
lfs f1, lbl_8051D6C8@sda21(r2)
stfs f0, 0x3c(r31)
lfs f2, 0x48(r31)
lfs f0, 0x3c(r31)
fmuls f1, f2, f1
fsubs f0, f4, f0
fmuls f0, f1, f0
stfs f0, 0xa4(r31)
lbl_8030C1A8:
lwz r4, 0x6c(r31)
addi r3, r1, 0x14
lwz r12, 0(r4)
lfs f31, 0xb8(r4)
lwz r12, 0x138(r12)
lfs f30, 0xbc(r4)
lfs f29, 0xc0(r4)
mtctr r12
bctrl
lwz r4, 0x6c(r31)
addi r3, r1, 0x10
lwz r0, 0x14(r1)
lwz r12, 0(r4)
stw r0, 0x1c(r1)
lwz r12, 0x134(r12)
mtctr r12
bctrl
lwz r0, 0x10(r1)
lwz r3, 0x6c(r31)
stw r0, 0x18(r1)
bl getBounds__7J2DPaneFv
lfs f1, 0(r3)
lfs f0, lbl_8051D6A0@sda21(r2)
stfs f1, 0x58(r31)
lfs f1, 4(r3)
stfs f1, 0x5c(r31)
stfs f0, 0xa0(r31)
lwz r0, 0x8c(r31)
cmpwi r0, 1
bne lbl_8030C27C
lhz r0, 0x2c(r31)
lhz r3, 0x30(r31)
cmplw r0, r3
bge lbl_8030C270
subf r3, r0, r3
lis r0, 0x4330
xoris r3, r3, 0x8000
stw r0, 0x30(r1)
lfd f1, lbl_8051D6A8@sda21(r2)
stw r3, 0x34(r1)
lfs f2, 0x34(r31)
lfd f0, 0x30(r1)
lfs f3, 0x3c(r31)
fsubs f1, f0, f1
lfs f0, lbl_8051D6C8@sda21(r2)
fmuls f1, f2, f1
fmuls f1, f3, f1
fneg f1, f1
fmuls f0, f1, f0
stfs f0, 0xa0(r31)
lbl_8030C270:
li r0, 0
stb r0, 0x90(r31)
b lbl_8030C2D4
lbl_8030C27C:
cmpwi r0, 2
bne lbl_8030C2D4
lhz r0, 0x2c(r31)
lhz r3, 0x30(r31)
cmplw r0, r3
bge lbl_8030C2CC
subf r3, r0, r3
lis r0, 0x4330
neg r3, r3
stw r0, 0x30(r1)
xoris r0, r3, 0x8000
lfd f1, lbl_8051D6A8@sda21(r2)
stw r0, 0x34(r1)
lfs f2, 0x34(r31)
lfd f0, 0x30(r1)
lfs f3, 0x3c(r31)
fsubs f0, f0, f1
fmuls f0, f2, f0
fmuls f0, f3, f0
stfs f0, 0xa0(r31)
lbl_8030C2CC:
li r0, 0
stb r0, 0x90(r31)
lbl_8030C2D4:
li r28, 0
li r29, 0
b lbl_8030C438
lbl_8030C2E0:
lwz r3, 0x7c(r31)
lwzx r3, r3, r29
lwz r30, 0(r3)
cmplwi r30, 0
beq lbl_8030C430
xoris r3, r28, 0x8000
lfs f0, 0x34(r31)
lis r0, 0x4330
stw r3, 0x34(r1)
fneg f1, f0
lfs f0, 0x3c(r31)
stw r0, 0x30(r1)
mr r3, r30
lfd f4, lbl_8051D6A8@sda21(r2)
addi r4, r1, 0x20
lfd f3, 0x30(r1)
fmuls f2, f1, f0
lfs f1, 0xa0(r31)
fsubs f3, f3, f4
lfs f4, 0xa4(r31)
lfs f5, 0x58(r31)
lfs f0, 0x48(r31)
fmadds f2, f3, f2, f1
lfs f3, 0x5c(r31)
lfs f1, 0x4c(r31)
fadds f0, f5, f0
fadds f4, f4, f2
stfs f3, 0x24(r1)
fadds f2, f3, f1
fadds f1, f4, f0
fadds f0, f5, f4
stfs f2, 0x2c(r1)
stfs f1, 0x28(r1)
stfs f0, 0x20(r1)
bl "place__7J2DPaneFRCQ29JGeometry8TBox2<f>"
lbz r0, 0x84(r31)
cmplwi r0, 0
beq lbl_8030C3A0
mr r3, r30
li r4, 4
bl setBasePosition__7J2DPaneF15J2DBasePosition
lwz r3, 0x7c(r31)
lfs f1, 0x44(r31)
lwzx r3, r3, r29
lfs f0, 0x3c(r31)
stfs f0, 0xc(r3)
stfs f1, 0x10(r3)
b lbl_8030C3D0
lbl_8030C3A0:
lwz r4, 0x60(r31)
mr r3, r30
bl setBasePosition__7J2DPaneF15J2DBasePosition
lfs f1, 0x44(r31)
mr r3, r30
lfs f0, 0x3c(r31)
stfs f0, 0xcc(r30)
stfs f1, 0xd0(r30)
lwz r12, 0(r30)
lwz r12, 0x2c(r12)
mtctr r12
bctrl
lbl_8030C3D0:
stfs f31, 0xb8(r30)
mr r3, r30
stfs f30, 0xbc(r30)
stfs f29, 0xc0(r30)
lwz r12, 0(r30)
lwz r12, 0x2c(r12)
mtctr r12
bctrl
lwz r0, 0x1c(r1)
mr r3, r30
addi r4, r1, 0xc
stw r0, 0xc(r1)
lwz r12, 0(r30)
lwz r12, 0x12c(r12)
mtctr r12
bctrl
lwz r0, 0x18(r1)
mr r3, r30
addi r4, r1, 8
stw r0, 8(r1)
lwz r12, 0(r30)
lwz r12, 0x128(r12)
mtctr r12
bctrl
lbl_8030C430:
addi r29, r29, 4
addi r28, r28, 1
lbl_8030C438:
lhz r0, 0x2e(r31)
cmpw r28, r0
blt lbl_8030C2E0
lbl_8030C444:
psq_l f31, 120(r1), 0, qr0
lfd f31, 0x70(r1)
psq_l f30, 104(r1), 0, qr0
lfd f30, 0x60(r1)
psq_l f29, 88(r1), 0, qr0
lfd f29, 0x50(r1)
lwz r31, 0x4c(r1)
lwz r30, 0x48(r1)
lwz r29, 0x44(r1)
lwz r0, 0x84(r1)
lwz r28, 0x40(r1)
mtlr r0
addi r1, r1, 0x80
blr
*/
}
/**
@ -1124,11 +839,11 @@ void CallBack_CounterRV::draw(Graphics&, J2DGrafContext&) { }
* @note Address: 0x8030C530
* @note Size: 0xD8
*/
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* screen, u64 tag1, u64 tag2, u64 tag3, u32* data, u16 flag1, u16 flag2,
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* screen, u64 tag1, u64 tag2, u64 tag3, u32* countPtr, u16 maxDigits, u16 minDigits,
bool isPuyo, JKRArchive* arc)
{
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), flag1, flag2, arc);
counter->init(screen, tag1, tag2, tag3, data, true);
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), maxDigits, minDigits, arc);
counter->init(screen, tag1, tag2, tag3, countPtr, true);
counter->mIsPuyoAnim = isPuyo;
screen->addCallBack(tag1, counter);
return counter;
@ -1138,18 +853,19 @@ CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* screen, u64 tag1, u64
* @note Address: 0x8030C608
* @note Size: 0x17C
*/
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32* data, u16 flag1, bool flag2, bool isPuyo, JKRArchive* arc)
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32* countPtr, u16 maxDigits, bool hasMother, bool isPuyo,
JKRArchive* arc)
{
u64 tag1 = maskTag(tag, 1, 1);
u64 tag2 = maskTag(tag, 1, 2);
u64 tag3 = tag2;
u16 a = 1;
u64 tag1 = maskTag(tag, 1, 1);
u64 tag2 = maskTag(tag, 1, 2);
u64 tag3 = tag2;
u16 minDigits = 1;
for (int i = 3; i <= 10; i++) {
u64 tag4 = maskTag(tag, 1, i);
J2DPane* pane = mgr->search(tag4);
if (!pane) {
a = i - 1;
minDigits = i - 1;
break;
}
@ -1157,8 +873,8 @@ CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32* dat
pane->hide();
}
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), flag1, a, arc);
counter->init(mgr, tag1, tag2, tag2, data, flag2);
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), maxDigits, minDigits, arc);
counter->init(mgr, tag1, tag2, tag2, countPtr, hasMother);
counter->mIsPuyoAnim = isPuyo;
mgr->addCallBack(tag1, counter);
return counter;
@ -1283,28 +999,29 @@ void setCallBack_CounterRV2(P2DScreen::Mgr*, u64, u32*, u16, bool, bool, JKRArch
* @note Address: 0x8030C784
* @note Size: 0x18C
*/
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32 data, u16 flag1, bool isPuyo, bool flag2, JKRArchive* arc)
CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr* mgr, u64 tag, u32 value, u16 maxDigits, bool isPuyo, bool hasMother,
JKRArchive* arc)
{
u32* ptr = new u32(data);
u32* countPtr = new u32(value);
u64 tag1 = maskTag(tag, 1, 1);
u64 tag2 = maskTag(tag, 1, 2);
u64 tag3 = tag2;
u16 a = 1;
u64 tag1 = maskTag(tag, 1, 1);
u64 tag2 = maskTag(tag, 1, 2);
u64 tag3 = tag2;
u16 minDigits = 1;
for (int i = 3; i <= 10; i++) {
u64 tag4 = maskTag(tag, 1, i);
J2DPane* pane = mgr->search(tag4);
if (!pane) {
a = i - 1;
minDigits = i - 1;
break;
}
tag3 = tag4;
pane->hide();
}
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), flag1, a, arc);
counter->init(mgr, tag1, tag2, tag3, ptr, flag2);
CallBack_CounterRV* counter = new CallBack_CounterRV(const_cast<char**>(SujiTex32), maxDigits, minDigits, arc);
counter->init(mgr, tag1, tag2, tag3, countPtr, hasMother);
counter->mIsPuyoAnim = isPuyo;
mgr->addCallBack(tag1, counter);
return counter;

View File

@ -56,14 +56,14 @@ void CallBack_CounterSlot::setPuyoParam(f32 parm1, f32 parm2, f32 parm3)
*/
void CallBack_CounterSlot::update()
{
int goal = mCurrentCounters;
if (goal > mCounterLimit) {
goal = mCounterLimit;
int goal = mCurrentDigitNum;
if (goal > mMaxDisplayDigitNum) {
goal = mMaxDisplayDigitNum;
}
if (mSlotStarted && !_AC) {
for (int i = 0; i < goal; i++) {
J2DPane* pane = mCounters[i]->mPicture;
J2DPane* pane = mCounterDigits[i]->mPicture;
if (i <= (int)mCurrentDigitID && _A9) {
pane->show();
} else {
@ -74,8 +74,8 @@ void CallBack_CounterSlot::update()
if (mTimer >= mUpdateInterval) {
mTimer = 0.0f;
mCurrentDigitID++;
if ((int)mCurrentDigitID >= (int)mCurrentCounters) {
if ((int)mCurrentDigitID >= (int)mCounterLimit) {
if ((int)mCurrentDigitID >= (int)mCurrentDigitNum) {
if ((int)mCurrentDigitID >= (int)mMaxDisplayDigitNum) {
mSlotStarted = false;
_AB = true;
}
@ -101,10 +101,10 @@ void CallBack_CounterSlot::update()
*/
void CallBack_CounterSlot::slot_up(int k)
{
if (k > mCounterLimit) {
if (k > mMaxDisplayDigitNum) {
JUT_PANICLINE(169, "slot_up overflow ! (k=%d)\n", k);
} else if (k != mCounterLimit) {
mCounters[k]->mScaleMgr->up(mPuyoParm1, mPuyoParm2, mPuyoParm3, 0.0f);
} else if (k != mMaxDisplayDigitNum) {
mCounterDigits[k]->mScaleMgr->up(mPuyoParm1, mPuyoParm2, mPuyoParm3, 0.0f);
if ((u32)mChangeSoundID != 0) {
ogSound->setSE(mChangeSoundID);
}
@ -140,30 +140,30 @@ void CallBack_CounterSlot::setValue(bool flag1, bool flag2)
mInitialDisplayValue = 0;
mCurrDisplayValue = 0;
}
mCurrentCounters = CalcKeta(mInitialDisplayValue);
mCurrentDigitNum = CalcKeta(mInitialDisplayValue);
int counts = mCurrentCounters;
if (counts < mMaxCounterLimit) {
counts = mMaxCounterLimit;
int counts = mCurrentDigitNum;
if (counts < mMinDisplayDigitNum) {
counts = mMinDisplayDigitNum;
}
for (int i = 0; i < mCounterLimit; i++) {
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
u32 power = pow(10.0f, (f64)i);
u16 sujiVal = (mInitialDisplayValue / power) % 10;
if (mIsBlind) {
mCounters[i]->setSuji(mImgResources, 10);
mCounterDigits[i]->setSuji(mImgResources, 10);
} else if (mDoUseRandomValue) {
mCounters[i]->setSuji(mImgResources, (u16)randInt(9));
mCounterDigits[i]->setSuji(mImgResources, (u16)randInt(9));
} else {
mCounters[i]->setSuji(mImgResources, sujiVal);
mCounterDigits[i]->setSuji(mImgResources, sujiVal);
}
J2DPicture* keta = mCounters[i]->mPicture;
J2DPicture* keta = mCounterDigits[i]->mPicture;
if (keta) {
if (i < counts) {
if (_AC) {
keta->mIsVisible = true;
}
if (i + 1 > mCurrentCounters) {
if (i + 1 > mCurrentDigitNum) {
if (mIsBlind) {
keta->setAlpha(255);
} else {
@ -171,14 +171,14 @@ void CallBack_CounterSlot::setValue(bool flag1, bool flag2)
}
} else {
keta->setAlpha(255);
ScaleMgr* smgr = mCounters[i]->mScaleMgr;
ScaleMgr* smgr = mCounterDigits[i]->mScaleMgr;
if (flag1) {
smgr->up(msVal._00, msVal._04, msVal._08, 0.025f * i);
smgr->up(msVal.mScaleRestoreAmplitude, msVal.mScaleAngularFreq, msVal.mScaleMaxRestoreTime, 0.025f * i);
} else if (flag2) {
smgr->down();
}
}
mCounters[i]->calcScale();
mCounterDigits[i]->calcScale();
} else {
keta->hide();
}
@ -189,8 +189,8 @@ void CallBack_CounterSlot::setValue(bool flag1, bool flag2)
f32 temp3 = 0.0f;
u16 changedCounts = counts;
if (changedCounts > mCounterLimit) {
changedCounts = mCounterLimit;
if (changedCounts > mMaxDisplayDigitNum) {
changedCounts = mMaxDisplayDigitNum;
}
if (changedCounts >= 2) {
@ -212,8 +212,8 @@ void CallBack_CounterSlot::setValue(bool flag1, bool flag2)
mPaneBounds.x = box->i.x;
mPaneBounds.y = box->i.y;
for (int i = 0; i < mCounterLimit; i++) {
J2DPicture* cPane = mCounters[i]->mPicture;
for (int i = 0; i < mMaxDisplayDigitNum; i++) {
J2DPicture* cPane = mCounterDigits[i]->mPicture;
if (cPane) {
f32 boxVal = (f32)i * (-mPane12DistX * temp);
JGeometry::TBox2f cBox(mPaneBounds.x + boxVal, mPaneBounds.y, boxVal + (mPaneBounds.x + mPaneSize.x),
@ -222,7 +222,7 @@ void CallBack_CounterSlot::setValue(bool flag1, bool flag2)
if (mIsPuyoAnim && !_AC) {
cPane->setBasePosition(J2DPOS_Center);
CounterKeta* cKeta = mCounters[i];
CounterKeta* cKeta = mCounterDigits[i];
cKeta->mSize = Vector2f(temp, mPaneScale.y);
} else {

View File

@ -13,7 +13,7 @@ namespace Screen {
ScaleMgr::ScaleMgr()
: mState(SCM_Inactive)
{
setParam(1.0f, 1.0f, 1.0f);
setParam(1.0f, 1.0f, 1.0f); // restore amp 1, ang freq 1, max duration 1s
}
/**
@ -22,9 +22,9 @@ ScaleMgr::ScaleMgr()
*/
void ScaleMgr::up()
{
mState = SCM_Growing;
setParam(0.5f, 30.0f, 0.8f);
mWaitTimer = 0.0f;
mState = SCM_Up;
setParam(0.5f, 30.0f, 0.8f); // restore amp 0.5, ang freq 30, max duration 0.8s
mDelayTimer = 0.0f;
}
/**
@ -33,23 +33,38 @@ void ScaleMgr::up()
*/
void ScaleMgr::down()
{
mState = SCM_Shrinking;
setParam(0.25f, 35.0f, 0.8f);
mWaitTimer = 0.0f;
mState = SCM_Down;
setParam(0.25f, 35.0f, 0.8f); // restore amp 0.25, ang freq 35, max duration 0.8s
mDelayTimer = 0.0f;
}
/**
* @note Address: N/A
* @note Size: 0xA0
*/
void ScaleMgr::up(f32 delayTime)
{
setParam(0.5f, 30.0f, 0.8f); // restore amp 0.5, ang freq 30, max duration 0.8s
mDelayTimer = delayTime;
if (delayTime < 0.01f) {
mState = SCM_Up;
} else {
mState = SCM_DelayedUp;
}
}
/**
* @note Address: 0x80328ED8
* @note Size: 0x64
*/
void ScaleMgr::up(f32 p1, f32 periodModifier, f32 durationInSeconds, f32 time)
void ScaleMgr::up(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime, f32 delayTime)
{
setParam(p1, periodModifier, durationInSeconds);
mWaitTimer = time;
if (time < 0.01f) {
mState = SCM_Growing;
setParam(restoreAmp, angFreq, maxRestoreTime);
mDelayTimer = delayTime;
if (delayTime < 0.01f) {
mState = SCM_Up;
} else {
mState = SCM_GrowWait;
mState = SCM_DelayedUp;
}
}
@ -57,23 +72,23 @@ void ScaleMgr::up(f32 p1, f32 periodModifier, f32 durationInSeconds, f32 time)
* @note Address: 0x80328F3C
* @note Size: 0x28
*/
void ScaleMgr::down(f32 p1, f32 periodModifier, f32 durationInSeconds)
void ScaleMgr::down(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime)
{
mState = SCM_Shrinking;
setParam(p1, periodModifier, durationInSeconds);
mState = SCM_Down;
setParam(restoreAmp, angFreq, maxRestoreTime);
}
/**
* @note Address: 0x80328F64
* @note Size: 0x20
*/
void ScaleMgr::setParam(f32 strength, f32 periodModifier, f32 durationInSeconds)
void ScaleMgr::setParam(f32 restoreAmp, f32 angFreq, f32 maxRestoreTime)
{
mElapsedSeconds = 0.0f;
mScale = 1.0f;
mScaleChangeLevel = strength;
mPeriodModifier = periodModifier;
mDurationInSeconds = durationInSeconds;
mRestoreTimer = 0.0f;
mScale = 1.0f;
mRestoreAmplitude = restoreAmp;
mAngularFreq = angFreq;
mMaxRestoreTime = maxRestoreTime;
}
/**
@ -87,36 +102,38 @@ f32 ScaleMgr::calc()
mScale = 1.0f;
break;
case SCM_Growing:
mElapsedSeconds += sys->mDeltaTime;
if (mElapsedSeconds > mDurationInSeconds) {
mState = SCM_Inactive;
mScale = 1.0f;
mElapsedSeconds = 0.0f;
case SCM_Up:
mRestoreTimer += sys->mDeltaTime;
if (mRestoreTimer > mMaxRestoreTime) {
mState = SCM_Inactive;
mScale = 1.0f;
mRestoreTimer = 0.0f;
} else {
f32 sin = sinf(mElapsedSeconds * mPeriodModifier);
mScale = (mDurationInSeconds - mElapsedSeconds) * (mScaleChangeLevel * sin + mScaleChangeLevel) + 1.0f;
// jump up to a value based on max restore time and amplitude, then bounce back down to 1
f32 sin = sinf(mRestoreTimer * mAngularFreq);
mScale = (mMaxRestoreTime - mRestoreTimer) * (mRestoreAmplitude * sin + mRestoreAmplitude) + 1.0f;
}
break;
case SCM_Shrinking:
mElapsedSeconds += sys->mDeltaTime;
if (mElapsedSeconds > mDurationInSeconds) {
mState = SCM_Inactive;
mScale = 1.0f;
mElapsedSeconds = 0.0f;
case SCM_Down:
mRestoreTimer += sys->mDeltaTime;
if (mRestoreTimer > mMaxRestoreTime) {
mState = SCM_Inactive;
mScale = 1.0f;
mRestoreTimer = 0.0f;
} else {
f32 sin = sinf(mElapsedSeconds * mPeriodModifier);
mScale = -((mDurationInSeconds - mElapsedSeconds) * (mScaleChangeLevel * sin + mScaleChangeLevel) - 1.0f);
// jump down to a value based on max restore time and amplitude, then bounce back up to 1
f32 sin = sinf(mRestoreTimer * mAngularFreq);
mScale = 1.0f - (mMaxRestoreTime - mRestoreTimer) * (mRestoreAmplitude * sin + mRestoreAmplitude);
}
break;
case SCM_GrowWait:
case SCM_DelayedUp:
mScale = 1.0f;
mWaitTimer -= sys->mDeltaTime;
if (mWaitTimer < 0.0f) {
mState = SCM_Growing;
mWaitTimer = 0.0f;
mDelayTimer -= sys->mDeltaTime;
if (mDelayTimer < 0.0f) {
mState = SCM_Up;
mDelayTimer = 0.0f;
}
break;