Delta time meters

This commit is contained in:
Irastris
2026-08-16 16:48:00 -04:00
parent f8ef48d74e
commit 115bb6d2ea
13 changed files with 364 additions and 111 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ public:
struct ScoreCount {
cXyz field_0x0;
u16 field_0xc;
u8 field_0xe;
DUSK_IF_ELSE(f32, u8) field_0xe;
u8 field_0xf;
};
+3 -5
View File
@@ -255,7 +255,7 @@ public:
/* 0x4B2 */ u16 mMsgID;
/* 0x4B4 */ s16 field_0x4b4;
/* 0x4B6 */ s16 field_0x4b6;
/* 0x4B8 */ s16 field_0x4b8[2];
/* 0x4B8 */ DUSK_IF_ELSE(f32, s16) field_0x4b8[2];
/* 0x4BC */ u8 field_0x4bc[2];
/* 0x4BE */ u8 field_0x4be[2];
/* 0x4C0 */ bool mPlayedButtonSound[BUTTON_NUM];
@@ -344,10 +344,8 @@ public:
/* 0x624 */ f32 mMidonaPosX;
/* 0x628 */ f32 mMidonaPosY;
/* 0x62C */ f32 mMidonaScale;
#ifdef TARGET_PC
bool mWasListen[2];
bool mWasRepeat[2];
#if TARGET_PC
u16 mBlinkButton = 0;
#endif
};
+8 -1
View File
@@ -4,6 +4,10 @@
#include "d/d_map_path_dmap.h"
#include "JSystem/JHostIO/JORReflexible.h"
#if TARGET_PC
#include "global.h"
#endif
class J2DPicture;
class dMap_c;
class dMap_HIO_c;
@@ -111,13 +115,16 @@ public:
/* 0x1C */ f32 mDrawPosY;
/* 0x20 */ f32 mSizeW;
/* 0x24 */ f32 mSizeH;
/* 0x28 */ s16 mSlidePositionOffset;
/* 0x28 */ DUSK_IF_ELSE(f32, s16) mSlidePositionOffset;
/* 0x2A */ u8 field_0x2a;
/* 0x2B */ u8 field_0x2b;
/* 0x2C */ u8 mMapAlpha;
/* 0x2D */ u8 mMapIsInside;
/* 0x2E */ u8 field_0x2e;
/* 0x30 */ int field_0x30;
#if TARGET_PC
f32 mSlidePositionOffsetTarget;
#endif
};
#endif /* D_METER_D_METER_MAP_H */
+6 -1
View File
@@ -17,7 +17,12 @@ public:
virtual int _execute(u32);
virtual int _delete();
f32 acc(s16 param_0, s16 param_1, s16 param_2) {
f32 acc(DUSK_IF_ELSE(f32, s16) param_0, DUSK_IF_ELSE(f32, s16) param_1, DUSK_IF_ELSE(f32, s16) param_2) {
#if TARGET_PC
if (param_0 == param_2) {
return 1.0f;
}
#endif
return ((f32)(param_1 - param_2) * (f32)(param_1 - param_2)) / ((f32)(param_0 - param_2) * (f32)(param_0 - param_2));
}
+17 -3
View File
@@ -57,6 +57,9 @@ public:
#endif
void drawPikari(int);
#if TARGET_PC
void presentAnims();
#endif
virtual void draw();
virtual ~dDlst_TimerScrnDraw_c();
@@ -68,10 +71,15 @@ public:
void resetCowID() { mCowID = 0; }
bool isVisible() { return mTimerVisible; }
f32 acc(s16 param_0, s16 param_1, s16 param_2) {
f32 acc(DUSK_IF_ELSE(f32, s16) param_0, DUSK_IF_ELSE(f32, s16) param_1, DUSK_IF_ELSE(f32, s16) param_2) {
#if TARGET_PC
if (param_0 == param_2) {
return 1.0f;
}
#endif
return ((f32)(param_1 - param_2) * (f32)(param_1 - param_2)) / ((f32)(param_0 - param_2) * (f32)(param_0 - param_2));
}
void setTimerTrans(f32 x, f32 y) {
mTimerTransX = x;
mTimerTransY = y;
@@ -103,7 +111,7 @@ public:
/* 0x3CC */ int field_0x3CC;
/* 0x3D0 */ int field_0x3D0;
/* 0x3D4 */ int field_0x3D4;
/* 0x3D8 */ int field_0x3D8;
/* 0x3D8 */ DUSK_IF_ELSE(f32, int) field_0x3D8;
/* 0x3DC */ u8 mCowID;
/* 0x3DD */ u8 mHIOType;
/* 0x3DE */ u8 field_0x3DE;
@@ -111,6 +119,12 @@ public:
/* 0x3E0 */ u8 field_0x3E0;
/* 0x3E1 */ u8 mTimerVisible;
/* 0x3E2 */ u8 field_0x3e2;
#if TARGET_PC
bool mPresentStep = false;
bool mPresentOpening = false;
bool mPresentClosing = false;
bool mPresentTimerSlide = false;
#endif
};
class dTimer_c : public msg_class {
+32 -13
View File
@@ -21,7 +21,10 @@
#include <cstring>
#if TARGET_PC
#include "dusk/interp/frame_interpolation.h"
#include "dusk/game_clock.h"
#include "dusk/interp/user_interface.h"
#include <cmath>
#endif
class daBalloon2D_HIO_c : public mDoHIO_entry_c {
@@ -270,12 +273,12 @@ int daBalloon2D_c::draw() {
int daBalloon2D_c::execute() {
#if TARGET_PC
updateOnWide();
#else
setAllAlpha();
setComboAlpha();
#if TARGET_PC
updateOnWide();
#endif
#endif
setHIO(false);
return 1;
@@ -283,6 +286,10 @@ int daBalloon2D_c::execute() {
void daBalloon2D_c::drawMeter() {
update();
#if TARGET_PC
setAllAlpha();
setComboAlpha();
#endif
mScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
drawAddScore();
}
@@ -344,7 +351,7 @@ void daBalloon2D_c::setComboNum(u8 comboNum) {
field_0x5a8[5]->changeTexture(resTimg, 0);
resTimg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', dMeter2Info_getNumberTextureName(comboNum % 10));
field_0x5a8[6]->changeTexture(resTimg, 0);
setComboAlpha();
IF_NOT_DUSK(setComboAlpha());
}
void daBalloon2D_c::setBalloonSize(u8 balloonSize) {
@@ -397,10 +404,14 @@ void daBalloon2D_c::setAllAlpha() {
mAllAlpha = field_0x578->getAlphaRate();
if (isVisible()) {
if (mAllAlpha != 1.0f) {
#if TARGET_PC
dusk::vdt::present_addCalc2(&mAllAlpha, 1.0f, 0.4f, 0.5f, 0.1f);
#else
cLib_addCalc2(&mAllAlpha, 1.0f, 0.4f, 0.5f);
if (fabsf(mAllAlpha - 1.0f) < 0.1f) {
mAllAlpha = 1.0f;
}
#endif
field_0x578->setAlphaRate(mAllAlpha);
field_0x580->setAlphaRate(l_HOSTIO.m.m5DNumberAlpha * mAllAlpha);
field_0x594->setAlphaRate(l_HOSTIO.m.m2DNumberComboAlpha * mAllAlpha);
@@ -409,10 +420,14 @@ void daBalloon2D_c::setAllAlpha() {
field_0x5a0->setAlphaRate(l_HOSTIO.m.mBalloonSmallAlpha * mAllAlpha);
}
} else if (mAllAlpha != 1.0f) {
#if TARGET_PC
dusk::vdt::present_addCalc2(&mAllAlpha, 0.0f, 0.4f, 0.5f, 0.1f);
#else
cLib_addCalc2(&mAllAlpha, 0.0f, 0.4f, 0.5f);
if (fabsf(mAllAlpha) < 0.1f) {
mAllAlpha = 0.0f;
}
#endif
field_0x578->setAlphaRate(mAllAlpha);
field_0x580->setAlphaRate(l_HOSTIO.m.m5DNumberAlpha * mAllAlpha);
field_0x594->setAlphaRate(l_HOSTIO.m.m2DNumberComboAlpha * mAllAlpha);
@@ -427,10 +442,14 @@ void daBalloon2D_c::setComboAlpha() {
mComboAlpha = field_0x5a4->getAlphaRate() * field_0x578->getAlphaRate();
if (mComboNum != 0) {
if (mComboAlpha != 1.0f) {
#if TARGET_PC
dusk::vdt::present_addCalc2(&mComboAlpha, 1.0f, 0.4f, 0.5f, 0.1f);
#else
cLib_addCalc2(&mComboAlpha, 1.0f, 0.4f, 0.5f);
if (fabsf(mComboAlpha - 1.0f) < 0.1f) {
mComboAlpha = 1.0f;
}
#endif
field_0x5a4->setAlphaRate(mComboAlpha);
}
} else if (mComboAlpha != 0.0f) {
@@ -442,20 +461,20 @@ void daBalloon2D_c::setComboAlpha() {
void daBalloon2D_c::drawAddScore() {
for (s32 i = 19; i >= 0; i--) {
if (field_0x5f8[i].field_0xe != 0) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
field_0x5f8[i].field_0xe--;
IF_DUSK_BLOCK_END
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(field_0x5f8[i].field_0xe, 0.0f, 1.0f), field_0x5f8[i].field_0xe--);
s32 score3;
s32 score2;
s32 score = field_0x5f8[i].field_0xc;
#if TARGET_PC
s16 temp0 = (s16)(fmodf(field_0x5f8[i].field_0xe, 60.0f) * 1024.0f);
#else
s16 temp0 = (field_0x5f8[i].field_0xe % 60) * 1024;
#endif
u8 local_88 = 0xff;
f32 dVar11 = 30.0f;
f32 dVar9 = 30.0f;
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
field_0x5f8[i].field_0x0.x += cM_ssin(temp0) * 0.3f;
field_0x5f8[i].field_0x0.y -= 1.0f;
IF_DUSK_BLOCK_END
field_0x5f8[i].field_0x0.x += cM_ssin(temp0) * 0.3f IF_DUSK(* dusk::game_clock::original_frames());
field_0x5f8[i].field_0x0.y -= 1.0f IF_DUSK(* dusk::game_clock::original_frames());
if (field_0x5f8[i].field_0xe < 10) {
f32 fVar5 = field_0x5f8[i].field_0xe / 10.0f;
local_88 = fVar5 * 255.0f;
+85 -42
View File
@@ -19,9 +19,29 @@
#include <cstring>
#if TARGET_PC
#include "dusk/interp/frame_interpolation.h"
#include "dusk/game_clock.h"
#include "dusk/interp/user_interface.h"
#include "dusk/version.hpp"
#include "helpers/string.hpp"
namespace {
bool advance_repeat_hit(f32& frame, u8& cycle, f32 period, f32& elapsedFrames) {
const f32 frames = dusk::game_clock::original_frames();
elapsedFrames = frames;
if (period <= 0.0f || frames <= 0.0f) {
return false;
}
f32 phase = frame + cycle * period;
const bool pulse = phase == 0.0f || phase + frames > 2.0f * period;
dusk::vdt::advance_looping_frame(phase, 1.0f, 2.0f * period);
if (pulse) {
elapsedFrames = phase == 0.0f ? 2.0f * period : phase;
}
cycle = phase >= period;
frame = phase - cycle * period;
return pulse;
}
} // namespace
#endif
#if TARGET_PC || VERSION == VERSION_GCN_JPN
@@ -51,6 +71,10 @@ int dMeterButton_c::_execute(u32 i_flags, bool i_drawA, bool i_drawB, bool i_dra
bool i_draw3DB, bool i_drawNURE, bool i_drawReel, bool i_drawReel2,
bool i_drawAB, bool i_drawTate, bool i_drawNunZ, bool i_drawNunC,
bool i_drawBin) {
#if TARGET_PC
mBlinkButton = g_meter2_info.mBlinkButton;
dMeter2Info_resetBlinkButton();
#endif
updateButton();
updateText(i_flags);
field_0x4b0 = 0;
@@ -228,6 +252,7 @@ int dMeterButton_c::_execute(u32 i_flags, bool i_drawA, bool i_drawB, bool i_dra
}
}
#if !TARGET_PC
for (int i = 0; i < 2; i++) {
if (field_0x2f4[i] != 0.0f) {
field_0x2fc[i] = field_0x2f4[i];
@@ -241,6 +266,7 @@ int dMeterButton_c::_execute(u32 i_flags, bool i_drawA, bool i_drawB, bool i_dra
trans_button(i, field_0x2fc[i]);
}
#endif
return 1;
}
@@ -248,6 +274,23 @@ void dMeterButton_c::draw() {
J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort();
graf_ctx->setup2D();
#if TARGET_PC
if (isButtonShowBit(BUTTON_Z_e) && mpButtonZ->getAlphaTimer() < 5.0f) {
mpButtonZ->setAlphaRate(1.0f);
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonZ, 5);
}
for (int i = 0; i < 2; i++) {
if (field_0x2f4[i] != 0.0f) {
field_0x2fc[i] = field_0x2f4[i];
} else {
dusk::vdt::present_chase(&field_0x2fc[i], field_0x2f4[i], 1.0f, 10.0f, 0.1f);
}
trans_button(i, field_0x2fc[i]);
}
#endif
mpButtonScreen->draw(0.0f, 0.0f, graf_ctx);
if (field_0x00c != NULL) {
field_0x00c->draw(0.0f, 0.0f, graf_ctx);
@@ -281,20 +324,28 @@ void dMeterButton_c::draw() {
SAFE_STRCPY(static_cast<J2DTextBox*>(mpTm_c[0]->getPanePtr())->getStringPtr(), tmp_buf);
}
#if TARGET_PC
const bool blinkA = (mBlinkButton & 1) != 0;
const bool blinkB = (mBlinkButton & 2) != 0;
#endif
for (int i = 0; i < 2; i++) {
bool var_r22 = 0;
bool var_r23 = 0;
IF_DUSK(f32 repeatFrames = 0.0f);
if (field_0x4be[i] == BUTTON_A_e && dComIfGp_isDoSetFlag(4)) {
var_r23 = 1;
if (field_0x4b8[i] == 0 && field_0x4bc[i] == 0) {
if (DUSK_IF_ELSE(advance_repeat_hit(field_0x4b8[i], field_0x4bc[i], g_drawHIO.mEmpButton.mRepeatHitFrameNum, repeatFrames),
field_0x4b8[i] == 0 && field_0x4bc[i] == 0))
{
field_0x2e8[i] = 18.0f - g_drawHIO.mEmpButton.mPikariRepeatHitAnimSpeed;
}
s16 temp_r6 = g_drawHIO.mEmpButton.mRepeatHitFrameNum;
s16 temp_r6_2 = g_drawHIO.mEmpButton.mRepeatHitFrameNum / 2;
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
#if !TARGET_PC
field_0x4b8[i]++;
if (field_0x4b8[i] >= temp_r6) {
@@ -306,7 +357,7 @@ void dMeterButton_c::draw() {
field_0x4bc[i] = 0;
}
}
IF_DUSK_BLOCK_END
#endif
f32 var_f2;
if (temp_r6_2 < field_0x4b8[i]) {
@@ -320,9 +371,9 @@ void dMeterButton_c::draw() {
} else if ((field_0x4be[i] == BUTTON_A_e &&
(dComIfGp_getDoStatus() == 0x3B || dComIfGp_getDoStatus() == 0x3F ||
dComIfGp_getDoStatus() == 0x40) &&
dMeter2Info_isBlinkButton(1)) ||
DUSK_IF_ELSE(blinkA, dMeter2Info_isBlinkButton(1))) ||
(field_0x4be[i] == BUTTON_B_e && dComIfGp_getAStatus() == 0x3A &&
dMeter2Info_isBlinkButton(2)))
DUSK_IF_ELSE(blinkB, dMeter2Info_isBlinkButton(2))))
{
var_r22 = 1;
if (field_0x2e8[i] <= 0.0f) {
@@ -378,18 +429,8 @@ void dMeterButton_c::draw() {
}
if (var_r3) {
#if TARGET_PC
if (dusk::interp::get_ui_tick_pending()) {
mWasListen[i] = var_r22;
mWasRepeat[i] = var_r23;
} else {
var_r22 = mWasListen[i];
var_r23 = mWasRepeat[i];
}
#endif
if (var_r22) {
if (field_0x2e8[i] == 18.0f IF_DUSK(&& dusk::interp::get_ui_tick_pending()))
{
if (field_0x2e8[i] == 18.0f) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON_BLINK, NULL, 0, 0);
}
@@ -419,7 +460,7 @@ void dMeterButton_c::draw() {
g_drawHIO.mEmpButton.mPikariRepeatHitFrontInner,
g_drawHIO.mEmpButton.mPikariRepeatHitBackOuter,
g_drawHIO.mEmpButton.mPikariRepeatHitBackInner,
g_drawHIO.mEmpButton.mPikariRepeatHitAnimSpeed, 0);
g_drawHIO.mEmpButton.mPikariRepeatHitAnimSpeed, 0 IF_DUSK_ARG(repeatFrames));
} else if (isFastSet(i)) {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->drawPikari(
vtx.x, vtx.y, &field_0x2e8[i], g_drawHIO.mEmpButton.mPikariFastScale,
@@ -441,7 +482,7 @@ void dMeterButton_c::draw() {
}
}
dMeter2Info_resetBlinkButton();
IF_NOT_DUSK(dMeter2Info_resetBlinkButton());
}
int dMeterButton_c::_delete() {
@@ -2075,7 +2116,7 @@ void dMeterButton_c::setAlphaButtonAAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonA, 5);
}
if (mpButtonA->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_A_e]) {
if (DUSK_IF_ELSE(true, mpButtonA->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_A_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_A_e] = true;
}
@@ -2111,7 +2152,7 @@ void dMeterButton_c::setAlphaButtonBAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonB, 5);
}
if (mpButtonB->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_B_e]) {
if (DUSK_IF_ELSE(true, mpButtonB->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_B_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_B_e] = true;
}
@@ -2147,7 +2188,7 @@ void dMeterButton_c::setAlphaButtonRAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonR, 5);
}
if (mpButtonR->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_R_e]) {
if (DUSK_IF_ELSE(true, mpButtonR->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_R_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_R_e] = true;
}
@@ -2166,7 +2207,7 @@ void dMeterButton_c::setAlphaButtonZAnimeMin() {
mpButtonZ->setAlphaRate(0.0f);
mpButtonZ->alphaAnimeStart(0);
if (mpButtonZ->getAlphaRate() == 0.0f) {
if (DUSK_IF_ELSE(true, mpButtonZ->getAlphaRate() == 0.0f)) {
hide_button(BUTTON_Z_e);
mPlayedButtonSound[BUTTON_Z_e] = false;
}
@@ -2178,12 +2219,14 @@ void dMeterButton_c::setAlphaButtonZAnimeMax() {
if (dComIfGp_isZSetFlag(1)) {
mpButtonZ->setAlphaRate(1.0f);
mpButtonZ->alphaAnimeStart(5);
#if !TARGET_PC
} else {
mpButtonZ->setAlphaRate(1.0f);
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonZ, 5);
#endif
}
if (mpButtonZ->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_Z_e]) {
if (DUSK_IF_ELSE(true, mpButtonZ->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_Z_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_Z_e] = true;
}
@@ -2220,7 +2263,7 @@ void dMeterButton_c::setAlphaButton3DAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButton3D, 5);
}
if (mpButton3D->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_3D_e]) {
if (DUSK_IF_ELSE(true, mpButton3D->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_3D_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_3D_e] = true;
}
@@ -2264,7 +2307,7 @@ void dMeterButton_c::setAlphaButtonCAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonC, 5);
}
if (mpButtonC->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_C_e]) {
if (DUSK_IF_ELSE(true, mpButtonC->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_C_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_C_e] = true;
}
@@ -2329,7 +2372,7 @@ void dMeterButton_c::setAlphaButtonSAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonS, 5);
}
if (mpButtonS->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_S_e]) {
if (DUSK_IF_ELSE(true, mpButtonS->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_S_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_S_e] = true;
}
@@ -2365,7 +2408,7 @@ void dMeterButton_c::setAlphaButtonXAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonX, 5);
}
if (mpButtonX->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_X_e]) {
if (DUSK_IF_ELSE(true, mpButtonX->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_X_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_X_e] = true;
}
@@ -2401,7 +2444,7 @@ void dMeterButton_c::setAlphaButtonYAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonY, 5);
}
if (mpButtonY->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_Y_e]) {
if (DUSK_IF_ELSE(true, mpButtonY->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_Y_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_Y_e] = true;
}
@@ -2440,7 +2483,7 @@ void dMeterButton_c::setAlphaButtonNunAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonNun, 5);
}
if (mpButtonNun->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_NUN_e]) {
if (DUSK_IF_ELSE(true, mpButtonNun->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_NUN_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_NUN_e] = true;
}
@@ -2480,7 +2523,7 @@ void dMeterButton_c::setAlphaButtonRemoAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonRemo, 5);
}
if (mpButtonRemo->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_REMO_e]) {
if (DUSK_IF_ELSE(true, mpButtonRemo->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_REMO_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_REMO_e] = true;
}
@@ -2520,7 +2563,7 @@ void dMeterButton_c::setAlphaButtonRemo2AnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonRemo2, 5);
}
if (mpButtonRemo2->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_REMO2_e]) {
if (DUSK_IF_ELSE(true, mpButtonRemo2->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_REMO2_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_REMO2_e] = true;
}
@@ -2562,7 +2605,7 @@ void dMeterButton_c::setAlphaButtonARAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonAR, 5);
}
if (mpButtonAR->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_AR_e]) {
if (DUSK_IF_ELSE(true, mpButtonAR->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_AR_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_AR_e] = true;
}
@@ -2604,7 +2647,7 @@ void dMeterButton_c::setAlphaButton3DBAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButton3DB, 5);
}
if (mpButton3DB->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_3DB_e]) {
if (DUSK_IF_ELSE(true, mpButton3DB->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_3DB_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_3DB_e] = true;
}
@@ -2646,7 +2689,7 @@ void dMeterButton_c::setAlphaButtonNUREAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonNURE, 5);
}
if (mpButtonNURE->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_NURE_e]) {
if (DUSK_IF_ELSE(true, mpButtonNURE->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_NURE_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_NURE_e] = true;
}
@@ -2688,7 +2731,7 @@ void dMeterButton_c::setAlphaButtonReelAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonReel, 5);
}
if (mpButtonReel->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_REEL_e]) {
if (DUSK_IF_ELSE(true, mpButtonReel->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_REEL_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_REEL_e] = true;
}
@@ -2720,7 +2763,7 @@ void dMeterButton_c::setAlphaButtonReel2AnimeMax() {
mpButtonReel2->setAlphaRate(1.0f);
mpButtonReel2->alphaAnimeStart(5);
if (mpButtonReel2->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_REEL2_e]) {
if (DUSK_IF_ELSE(true, mpButtonReel2->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_REEL2_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_REEL2_e] = true;
}
@@ -2752,7 +2795,7 @@ void dMeterButton_c::setAlphaButtonABAnimeMax() {
mpButtonAB->setAlphaRate(1.0f);
mpButtonAB->alphaAnimeStart(5);
if (mpButtonAB->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_AB_e]) {
if (DUSK_IF_ELSE(true, mpButtonAB->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_AB_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_AB_e] = true;
}
@@ -2784,7 +2827,7 @@ void dMeterButton_c::setAlphaButtonTateAnimeMax() {
mpButtonTate->setAlphaRate(1.0f);
mpButtonTate->alphaAnimeStart(5);
if (mpButtonTate->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_TATE_e]) {
if (DUSK_IF_ELSE(true, mpButtonTate->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_TATE_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_TATE_e] = true;
}
@@ -2826,7 +2869,7 @@ void dMeterButton_c::setAlphaButtonNunZAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonNunZ, 5);
}
if (mpButtonNunZ->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_NUNZ_e]) {
if (DUSK_IF_ELSE(true, mpButtonNunZ->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_NUNZ_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_NUNZ_e] = true;
}
@@ -2868,7 +2911,7 @@ void dMeterButton_c::setAlphaButtonNunCAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonNunC, 5);
}
if (mpButtonNunC->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_NUNC_e]) {
if (DUSK_IF_ELSE(true, mpButtonNunC->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_NUNC_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_NUNC_e] = true;
}
@@ -2910,7 +2953,7 @@ void dMeterButton_c::setAlphaButtonBinAnimeMax() {
dMeter2Info_getMeterClass()->getMeterDrawPtr()->setAlphaAnimeMax(mpButtonBin, 5);
}
if (mpButtonBin->getAlphaRate() == 1.0f && !mPlayedButtonSound[BUTTON_BIN_e]) {
if (DUSK_IF_ELSE(true, mpButtonBin->getAlphaRate() == 1.0f) && !mPlayedButtonSound[BUTTON_BIN_e]) {
mDoAud_seStart(Z2SE_SY_HINT_BUTTON, NULL, 0, 0);
mPlayedButtonSound[BUTTON_BIN_e] = true;
}
+39 -12
View File
@@ -13,7 +13,7 @@
#include "d/d_pane_class.h"
#if TARGET_PC
#include "dusk/interp/frame_interpolation.h"
#include "dusk/interp/user_interface.h"
#endif
dMeterHaihai_c::dMeterHaihai_c(u8 i_type) {
@@ -59,12 +59,13 @@ int dMeterHaihai_c::_create() {
int dMeterHaihai_c::_execute(u32 i_flags) {
mFlags = i_flags;
updateHaihai();
DUSK_IF_ELSE(setScale(1.0f), updateHaihai());
alphaAnimeHaihai(i_flags);
return 1;
}
void dMeterHaihai_c::draw() {
IF_DUSK(updateHaihai());
if ((mFlags & 8) || (mFlags & 0x10) || (mFlags & 0x1000000) || (mFlags & 0x800000) ||
(mFlags & 0x20) || (mFlags & 0x4000000))
{
@@ -132,6 +133,7 @@ void dMeterHaihai_c::draw() {
}
void dMeterHaihai_c::drawHaihai(u8 i_direction) {
IF_DUSK(updateHaihai());
f32 center_x = FB_WIDTH_BASE / 2;
f32 center_y = FB_HEIGHT_BASE / 2;
@@ -187,6 +189,7 @@ void dMeterHaihai_c::drawHaihai(u8 i_direction) {
}
void dMeterHaihai_c::drawHaihai(u8 i_direction, f32 i_posX, f32 i_posY, f32 param_3, f32 param_4) {
IF_DUSK(updateHaihai());
if (mType == 1) {
i_posX += (3.0f + g_drawHIO.mScrollArrowCenterPosX);
i_posY += (g_drawHIO.mScrollArrowCenterPosY - 5.0f);
@@ -284,13 +287,21 @@ void dMeterHaihai_c::updateHaihai() {
playBtkAnime(mpCursorBtk);
playBpkAnime(mpCursorBpk);
mpHaihaiScreen->animation();
setScale(1.0f);
IF_NOT_DUSK(setScale(1.0f));
}
void dMeterHaihai_c::playBckAnime(J2DAnmTransformKey* i_bck) {
if (checkPlayAnime(1)) {
if (i_bck != NULL) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
#if TARGET_PC
f32 speed;
if (mType == 4) {
speed = g_drawHIO.mWiiLockArrowBCKAnimSpeed;
} else {
speed = g_drawHIO.mScrollArrowBCKAnimSpeed;
}
dusk::vdt::present_looping(mBckFrame, i_bck, speed);
#else
if (mType == 4) {
mBckFrame += g_drawHIO.mWiiLockArrowBCKAnimSpeed;
} else {
@@ -300,12 +311,12 @@ void dMeterHaihai_c::playBckAnime(J2DAnmTransformKey* i_bck) {
if (mBckFrame >= i_bck->getFrameMax()) {
mBckFrame -= i_bck->getFrameMax();
}
IF_DUSK_BLOCK_END
#endif
} else {
mBtkFrame = 1.0f;
}
i_bck->setFrame(mBckFrame);
IF_NOT_DUSK(i_bck->setFrame(mBckFrame));
mpHaihaiScreen->search(MULTI_CHAR('n_anim'))->setAnimation(i_bck);
mpHaihaiScreen->search(MULTI_CHAR('n_anim'))->animationTransform();
mpHaihaiScreen->search(MULTI_CHAR('n_anim'))->setAnimation((J2DAnmTransform*)NULL);
@@ -315,7 +326,15 @@ void dMeterHaihai_c::playBckAnime(J2DAnmTransformKey* i_bck) {
void dMeterHaihai_c::playBtkAnime(J2DAnmTextureSRTKey* i_btk) {
if (checkPlayAnime(2)) {
if (i_btk != NULL) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
#if TARGET_PC
f32 speed;
if (mType == 4) {
speed = g_drawHIO.mWiiLockArrowBTKAnimSpeed;
} else {
speed = g_drawHIO.mScrollArrowBTKAnimSpeed;
}
dusk::vdt::present_looping(mBtkFrame, i_btk, speed);
#else
if (mType == 4) {
mBtkFrame += g_drawHIO.mWiiLockArrowBTKAnimSpeed;
} else {
@@ -325,12 +344,12 @@ void dMeterHaihai_c::playBtkAnime(J2DAnmTextureSRTKey* i_btk) {
if (mBtkFrame >= i_btk->getFrameMax()) {
mBtkFrame -= i_btk->getFrameMax();
}
IF_DUSK_BLOCK_END
#endif
} else {
mBtkFrame = 1.0f;
}
i_btk->setFrame(mBtkFrame);
IF_NOT_DUSK(i_btk->setFrame(mBtkFrame));
mpHaihaiScreen->search(MULTI_CHAR('yaji00'))->setAnimation(i_btk);
mpHaihaiScreen->search(MULTI_CHAR('yaji01'))->setAnimation(i_btk);
}
@@ -339,7 +358,15 @@ void dMeterHaihai_c::playBtkAnime(J2DAnmTextureSRTKey* i_btk) {
void dMeterHaihai_c::playBpkAnime(J2DAnmColor* i_bpk) {
if (checkPlayAnime(0)) {
if (i_bpk != NULL) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
#if TARGET_PC
f32 speed;
if (mType == 4) {
speed = g_drawHIO.mWiiLockArrowBPKAnimSpeed;
} else {
speed = g_drawHIO.mScrollArrowBPKAnimSpeed;
}
dusk::vdt::present_looping(mBpkFrame, i_bpk, speed);
#else
if (mType == 4) {
mBpkFrame += g_drawHIO.mWiiLockArrowBPKAnimSpeed;
} else {
@@ -349,12 +376,12 @@ void dMeterHaihai_c::playBpkAnime(J2DAnmColor* i_bpk) {
if (mBpkFrame >= i_bpk->getFrameMax()) {
mBpkFrame -= i_bpk->getFrameMax();
}
IF_DUSK_BLOCK_END
#endif
} else {
mBpkFrame = 1.0f;
}
i_bpk->setFrame(mBpkFrame);
IF_NOT_DUSK(i_bpk->setFrame(mBpkFrame));
mpHaihaiScreen->search(MULTI_CHAR('npc_l1'))->setAnimation(i_bpk);
mpHaihaiScreen->search(MULTI_CHAR('yaji_l'))->setAnimation(i_bpk);
}
+20
View File
@@ -15,6 +15,10 @@
#include "d/d_pane_class.h"
#include <cstring>
#if TARGET_PC
#include "dusk/interp/user_interface.h"
#endif
dMeterHakusha_c::dMeterHakusha_c(void* i_screen) {
field_0x004 = (J2DScreen*)i_screen;
_create();
@@ -115,6 +119,20 @@ void dMeterHakusha_c::draw() {
mpButtonScreen->draw(0.0f, 0.0f, graf_ctx);
for (int i = 0; i < getHakushaNum(); i++) {
#if TARGET_PC
if (mHakushaAnimFrame[i] > 0.0f) {
if (mHakushaStatus[i] == 0) {
dusk::vdt::advance_toward_frame(mHakushaAnimFrame[i], 28.0f, g_drawHIO.mSpurIconPikariAnimSpeed);
} else {
dusk::vdt::advance_toward_frame(mHakushaAnimFrame[i], 28.0f, g_drawHIO.mSpurIconRevivePikariAnimSpeed);
}
if (mHakushaAnimFrame[i] >= 28.0f) {
mHakushaAnimFrame[i] = 0.0f;
}
}
#endif
if (mHakushaData[i].flags & 1) {
mpHakushaOn->show();
} else {
@@ -226,6 +244,7 @@ void dMeterHakusha_c::updateHakusha() {
}
for (int i = 0; i < getHakushaNum(); i++) {
#if !TARGET_PC
if (mHakushaAnimFrame[i] > 0.0f) {
if (mHakushaStatus[i] == 0) {
mHakushaAnimFrame[i] += g_drawHIO.mSpurIconPikariAnimSpeed;
@@ -237,6 +256,7 @@ void dMeterHakusha_c::updateHakusha() {
mHakushaAnimFrame[i] = 0.0f;
}
}
#endif
mHakushaData[i].pos_x = abtn_x_offset;
mHakushaData[i].pos_y = abtn_y_offset;
+22 -6
View File
@@ -16,15 +16,16 @@
#include "f_op/f_op_overlap_mng.h"
#include "m_Do/m_Do_controller_pad.h"
#include "d/d_camera.h"
#if TARGET_PC
#include "JSystem/JUtility/JUTPalette.h"
#include "dusk/settings.h"
#include <algorithm>
#endif
#include <cstring>
#if TARGET_PC
#include "dusk/action_bindings.h"
#include "dusk/interp/user_interface.h"
#include "dusk/settings.h"
#include "JSystem/JUtility/JUTPalette.h"
#include <algorithm>
namespace {
@@ -490,15 +491,18 @@ void dMeterMap_c::_create(J2DScreen* unused) {
if (mMapIsInside != 0) {
mMapIsInside = 1;
mSlidePositionOffset = getDispPosInside_OffsetX();
IF_DUSK(mSlidePositionOffsetTarget = mSlidePositionOffset);
dMeter2Info_setMapStatus(1);
} else {
mMapIsInside = 0;
mSlidePositionOffset = getDispPosOutSide_OffsetX();
IF_DUSK(mSlidePositionOffsetTarget = mSlidePositionOffset);
dMeter2Info_setMapStatus(0);
}
field_0x2e = 0;
mSlidePositionOffset = 0;
IF_DUSK(mSlidePositionOffsetTarget = 0);
field_0x30 = 0;
/* dSv_event_flag_c::M_085 - Twilight Hyrule Field - Midna dialogue right before Boss Bug's Tear of Light appears */
field_0x2b = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[118]);
@@ -507,11 +511,13 @@ void dMeterMap_c::_create(J2DScreen* unused) {
void dMeterMap_c::setDispPosOutSide() {
mMapIsInside = 0;
mSlidePositionOffset = getDispPosOutSide_OffsetX();
IF_DUSK(mSlidePositionOffsetTarget = mSlidePositionOffset);
}
void dMeterMap_c::setDispPosInSide() {
mMapIsInside = 1;
mSlidePositionOffset = getDispPosInside_OffsetX();
IF_DUSK(mSlidePositionOffsetTarget = mSlidePositionOffset);
}
void dMeterMap_c::_delete() {
@@ -573,6 +579,8 @@ void dMeterMap_c::_move(u32 param_0) {
}
if (mMapIsInside != 0) {
IF_DUSK(mSlidePositionOffsetTarget = getDispPosInside_OffsetX());
#if !TARGET_PC
if (mSlidePositionOffset != getDispPosInside_OffsetX()) {
if (!cLib_addCalcAngleS(&mSlidePositionOffset, getDispPosInside_OffsetX(), 2, 60, 10)) {
#if DEBUG
@@ -580,8 +588,10 @@ void dMeterMap_c::_move(u32 param_0) {
#endif
}
}
#endif
} else {
cLib_addCalcAngleS(&mSlidePositionOffset, getDispPosOutSide_OffsetX(), 2, 60, 10);
IF_DUSK(mSlidePositionOffsetTarget = getDispPosOutSide_OffsetX());
IF_NOT_DUSK(cLib_addCalcAngleS(&mSlidePositionOffset, getDispPosOutSide_OffsetX(), 2, 60, 10));
}
Vec map_pos = dMapInfo_n::getMapPlayerPos();
@@ -636,6 +646,12 @@ void dMeterMap_c::draw() {
f32 drawPosX = mDrawPosX;
f32 drawPosY = mDrawPosY;
#if TARGET_PC
dusk::vdt::present_addCalc(&mSlidePositionOffset, mSlidePositionOffsetTarget, 0.5f, 60.0f, 10.0f);
mDrawPosX = mSlidePositionOffset + getMapDispEdgeLeftX_Layout();
drawPosX = mDrawPosX;
#endif
u8 alpha = mMapAlpha;
#if DEBUG
if (g_meter_mapHIO.mMapAlphaTest) {
+8 -12
View File
@@ -19,7 +19,7 @@
#include <cstring>
#if TARGET_PC
#include "dusk/interp/frame_interpolation.h"
#include "dusk/interp/user_interface.h"
#endif
dMeterString_c::dMeterString_c(int i_stringID) {
@@ -109,22 +109,20 @@ void dMeterString_c::draw() {
f32 var_f30 = 1.0f;
if (mAnimFrame < 60.0f) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
#if TARGET_PC
dusk::vdt::advance_toward_frame(mAnimFrame, 60.0f, g_drawHIO.mMiniGame.mReadyFightTextAnimSpeed);
#else
mAnimFrame += g_drawHIO.mMiniGame.mReadyFightTextAnimSpeed;
if (mAnimFrame > 60.0f) {
mAnimFrame = 60.0f;
}
IF_DUSK_BLOCK_END
#endif
playBckAnimation(mAnimFrame);
} else if (mAnimFrame < (f32)g_drawHIO.mMiniGame.mReadyFightTextWaitFrames + 60.0f) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
mAnimFrame += var_f30;
IF_DUSK_BLOCK_END
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(mAnimFrame, (f32)g_drawHIO.mMiniGame.mReadyFightTextWaitFrames + 60.0f, 1.0f), mAnimFrame += var_f30);
} else if (mAnimFrame < var_f31) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
mAnimFrame += var_f30;
IF_DUSK_BLOCK_END
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(mAnimFrame, var_f31, 1.0f), mAnimFrame += var_f30);
var_f30 = acc(g_drawHIO.mMiniGame.field_0x172, var_f31 - mAnimFrame, 0);
}
@@ -137,17 +135,15 @@ void dMeterString_c::draw() {
if (mPikariAnimFrame > 0.0f) {
drawPikari();
} else if (mPikariAnimFrame == -1.0f IF_DUSK(&& dusk::interp::get_ui_tick_pending()) &&
} else if (mPikariAnimFrame == -1.0f &&
mAnimFrame > g_drawHIO.mMiniGame.mReadyFightPikariAppearFrames)
{
mPikariAnimFrame = 18.0f - g_drawHIO.mMiniGame.mReadyFightPikariAnimSpeed;
}
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
if (mAnimFrame >= var_f31) {
dMeter2Info_resetMeterString();
}
IF_DUSK_BLOCK_END
}
}
}
+83 -15
View File
@@ -24,7 +24,7 @@
#include <cstring>
#if TARGET_PC
#include "dusk/interp/frame_interpolation.h"
#include "dusk/interp/user_interface.h"
#include "dusk/version.hpp"
#endif
@@ -215,6 +215,9 @@ int dTimer_c::_execute() {
}
if (m_timer_mode == 3 || m_timer_mode == 4 || m_timer_mode == 6 || m_timer_mode == 5) {
#if TARGET_PC
mp_tm_scrn->mPresentTimerSlide = true;
#else
f32 pos_y = mp_tm_scrn->getTimerTransY();
if (pos_y < 145.0f) {
pos_y += 25.0f;
@@ -224,6 +227,7 @@ int dTimer_c::_execute() {
mp_tm_scrn->setTimerTrans(0.0f, pos_y);
}
#endif
}
break;
default:
@@ -883,6 +887,7 @@ void dDlst_TimerScrnDraw_c::setTimer(int i_time) {
}
}
#if !TARGET_PC
if (mpTimeParent != NULL) {
if ((dComIfGp_event_getMode() == 1 && field_0x3DF != 0) || !isVisible()) {
s16 alpha_time = mpTimeParent->getAlphaTimer();
@@ -902,6 +907,7 @@ void dDlst_TimerScrnDraw_c::setTimer(int i_time) {
}
}
}
#endif
}
void dDlst_TimerScrnDraw_c::setCounter(u8 i_count, u8 i_max) {
@@ -1006,6 +1012,7 @@ void dDlst_TimerScrnDraw_c::setCounter(u8 i_count, u8 i_max) {
}
}
#if !TARGET_PC
if ((dComIfGp_event_getMode() == 1 && field_0x3E0 != 0) || !isVisible()) {
if (mpCowParent != NULL) {
s16 alpha_time = mpCowParent->getAlphaTimer();
@@ -1055,6 +1062,7 @@ void dDlst_TimerScrnDraw_c::setCounter(u8 i_count, u8 i_max) {
}
}
}
#endif
}
void dDlst_TimerScrnDraw_c::setParentPos(f32 i_posX, f32 i_posY) {
@@ -1112,17 +1120,24 @@ void dDlst_TimerScrnDraw_c::setShowType(u8 i_type) {
}
void dDlst_TimerScrnDraw_c::anime() {
#if TARGET_PC
if (!mPresentStep) {
mPresentOpening = true;
return;
}
const f32 previousFrame = field_0x3D8;
#endif
static const s16 animeFrame[] = {7, 15, 22};
if (field_0x3DE == 0) {
if (field_0x3D8 <= animeFrame[2]) {
field_0x3D8++;
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(field_0x3D8, 23.0f, 1.0f), field_0x3D8++);
} else {
field_0x3DE = 1;
}
if (field_0x3D8 <= animeFrame[1]) {
f32 temp_f31 = acc(animeFrame[1], field_0x3D8, 0);
if (DUSK_IF_ELSE(previousFrame, field_0x3D8) <= animeFrame[1]) {
f32 temp_f31 = acc(animeFrame[1], DUSK_IF_ELSE(std::min(field_0x3D8, (f32)animeFrame[1]), field_0x3D8), 0);
f32 temp_f1 = (1.0f - temp_f31) * -50.0f;
if (mpTimeParent != NULL) {
@@ -1146,13 +1161,13 @@ void dDlst_TimerScrnDraw_c::anime() {
}
}
if (field_0x3D8 == animeFrame[1]) {
if (field_0x3D8 DUSK_IF_ELSE(>=, ==) animeFrame[1]) {
field_0x3DF = 1;
}
}
if (field_0x3D8 > animeFrame[0] && field_0x3D8 <= animeFrame[2]) {
f32 temp_f31 = acc(animeFrame[1], field_0x3D8 - animeFrame[0], 0);
if (field_0x3D8 > animeFrame[0] && DUSK_IF_ELSE(previousFrame, field_0x3D8) <= animeFrame[2]) {
f32 temp_f31 = acc(animeFrame[1], DUSK_IF_ELSE(std::min(field_0x3D8, (f32)animeFrame[2]), field_0x3D8) - animeFrame[0], 0);
f32 temp_f1 = (1.0f - temp_f31) * -50.0f;
if (mpCowParent != NULL) {
@@ -1173,7 +1188,7 @@ void dDlst_TimerScrnDraw_c::anime() {
g_drawHIO.mMiniGame.mIconSizeY[mHIOType]);
}
if (field_0x3D8 == animeFrame[2]) {
if (field_0x3D8 DUSK_IF_ELSE(>=, ==) animeFrame[2]) {
field_0x3E0 = 1;
}
}
@@ -1181,8 +1196,14 @@ void dDlst_TimerScrnDraw_c::anime() {
}
BOOL dDlst_TimerScrnDraw_c::closeAnime() {
#if TARGET_PC
if (!mPresentStep) {
mPresentClosing = true;
return field_0x3D8 >= 7.0f;
}
#endif
BOOL var_r31 = false;
field_0x3D8++;
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(field_0x3D8, 7.0f, 1.0f), field_0x3D8++);
if (field_0x3D8 <= 7) {
f32 temp_f31 = acc(7, field_0x3D8, 0);
@@ -1332,7 +1353,54 @@ s32 dDlst_TimerScrnDraw_c::createStart(u16 i_messageID) {
return 0;
}
#if TARGET_PC
void dDlst_TimerScrnDraw_c::presentAnims() {
mPresentStep = true;
if (mPresentTimerSlide) {
dusk::vdt::advance_toward_frame(mTimerTransY, 145.0f, 25.0f);
if (field_0x3e2 != 0 && mHIOType == 0) {
setTimerPos(g_drawHIO.mMiniGame.mTimerPosX_4x3,
g_drawHIO.mMiniGame.mTimerPosY_4x3);
} else {
setTimerPos(g_drawHIO.mMiniGame.mTimerPosX[mHIOType],
g_drawHIO.mMiniGame.mTimerPosY[mHIOType]);
}
}
if (mPresentClosing) {
closeAnime();
} else {
if (mPresentOpening) {
anime();
}
const bool event = dComIfGp_event_getMode() == 1;
auto fade = [&](CPaneMgr* pane, bool hidden, bool ready, f32 alpha, bool timer) {
if (pane == NULL) {
return;
}
f32 frame = pane->getAlphaTimer();
const f32 previous = frame;
dusk::vdt::advance_toward_frame(frame, hidden ? 5.0f : 0.0f, 1.0f);
if (ready || frame != previous) {
const f32 rate = timer ? acc(5.0f, 5.0f - frame, 0.0f) :
1.0f - acc(5.0f, frame, 0.0f);
pane->setAlphaRate(mParentAlpha * alpha * rate);
}
pane->alphaAnimeStart(frame);
};
fade(mpTimeParent, (event && field_0x3DF != 0) || !isVisible(), field_0x3DF != 0,
g_drawHIO.mMiniGame.mTimerAlpha[mHIOType], true);
const bool hideCounter = (event && field_0x3E0 != 0) || !isVisible();
fade(mpCowParent, hideCounter, field_0x3E0 != 0,
g_drawHIO.mMiniGame.mCounterAlpha[mHIOType], false);
fade(mpImageParent, hideCounter, field_0x3E0 != 0,
g_drawHIO.mMiniGame.mIconAlpha[mHIOType], false);
}
mPresentStep = false;
}
#endif
void dDlst_TimerScrnDraw_c::draw() {
IF_DUSK(presentAnims());
J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort();
graf_ctx->setup2D();
@@ -1342,20 +1410,22 @@ void dDlst_TimerScrnDraw_c::draw() {
((f32)g_drawHIO.mMiniGame.mGetInTextWaitFrames + 60.0f);
for (int i = 0; i < 51; i++) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
if (m_getin_info[i].bck_frame > 0.0f && m_getin_info[i].bck_frame < temp) {
if (m_getin_info[i].bck_frame < 60.0f) {
#if TARGET_PC
dusk::vdt::advance_toward_frame(m_getin_info[i].bck_frame, 60.0f, g_drawHIO.mMiniGame.mGetInTextAnimSpeed);
#else
m_getin_info[i].bck_frame += g_drawHIO.mMiniGame.mGetInTextAnimSpeed;
if (m_getin_info[i].bck_frame > 60.0f) {
m_getin_info[i].bck_frame = 60.0f;
}
#endif
} else if (m_getin_info[i].bck_frame < g_drawHIO.mMiniGame.mGetInTextWaitFrames + 60.0f) {
m_getin_info[i].bck_frame++;
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(m_getin_info[i].bck_frame, (f32)g_drawHIO.mMiniGame.mGetInTextWaitFrames + 60.0f, 1.0f), m_getin_info[i].bck_frame++);
} else if (m_getin_info[i].bck_frame < temp) {
m_getin_info[i].bck_frame++;
DUSK_IF_ELSE(dusk::vdt::advance_toward_frame(m_getin_info[i].bck_frame, temp, 1.0f), m_getin_info[i].bck_frame++);
}
}
IF_DUSK_BLOCK_END
if (m_getin_info[i].bck_frame > 0.0f && m_getin_info[i].bck_frame < temp) {
f32 var_f29 = 1.0f;
@@ -1395,7 +1465,6 @@ void dDlst_TimerScrnDraw_c::draw() {
if (m_getin_info[i].pikari_frame > 0.0f) {
drawPikari(i);
} else if (m_getin_info[i].pikari_frame == -1.0f) {
IF_DUSK_BLOCK(dusk::interp::get_ui_tick_pending())
if (m_getin_info[i].field_0xc == 0) {
if (m_getin_info[i].bck_frame > g_drawHIO.mMiniGame.mGetInPikariAppearFrames) {
m_getin_info[i].pikari_frame =
@@ -1405,7 +1474,6 @@ void dDlst_TimerScrnDraw_c::draw() {
m_getin_info[i].pikari_frame =
18.0f - g_drawHIO.mMiniGame.mStartPikariAnimSpeed;
}
IF_DUSK_BLOCK_END
}
}
}
+40
View File
@@ -2,6 +2,9 @@
#include "dusk/game_clock.h"
#include "JSystem/J2DGraph/J2DAnimation.h"
#include "SSystem/SComponent/c_lib.h"
#include <dolphin/types.h>
#include <algorithm>
@@ -51,4 +54,41 @@ void present_animation(Animation& animation, f32& frame, Pane& pane, Apply apply
}
}
inline void present_looping(f32& frame, J2DAnmBase* anm, f32 speed) {
if (anm == nullptr) {
return;
}
advance_looping_frame(frame, speed, anm->getFrameMax());
anm->setFrame(frame);
}
inline void present_addCalc(f32* value, f32 target, f32 scale, f32 maxStep, f32 minStep) {
const f32 frames = game_clock::original_frames();
if (*value == target || frames <= 0.0f) {
return;
}
const f32 timedScale = frames == 1.0f ? scale : 1.0f - std::pow(1.0f - scale, frames);
cLib_addCalc(value, target, timedScale, maxStep * frames, minStep * frames);
}
inline void present_addCalc2(f32* value, f32 target, f32 scale, f32 maxStep, f32 snap) {
const f32 frames = game_clock::original_frames();
if (*value == target || frames <= 0.0f) {
return;
}
const f32 timedScale = frames == 1.0f ? scale : 1.0f - std::pow(1.0f - scale, frames);
cLib_addCalc2(value, target, timedScale, maxStep * frames);
if (fabsf(*value - target) < snap) {
*value = target;
}
}
inline bool present_chase(f32* value, f32 target, f32 scale, f32 maxStep, f32 snap) {
if (*value == target) {
return false;
}
present_addCalc2(value, target, scale, maxStep, snap);
return true;
}
} // namespace dusk::vdt