Skip to content

Commit

Permalink
procTactWait
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jun 6, 2024
1 parent 02b4fad commit eec24f6
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 18 deletions.
7 changes: 3 additions & 4 deletions include/JAZelAudio/JAIZelInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class JAIZelInst {
void setBeat(s32);
void setVolume(f32);
void metronomePlay(s32, s32);
void judge(s32, s32);
s32 judge(s32, s32);
void ambientPlay();
void armSoundPlay(s32);
f32 getMelodyPattern(s32, s32, s32*);
Expand All @@ -24,9 +24,8 @@ class JAIZelInst {
void melodyPlay(s32);
void melodyStop();

// one of these inlines returns field_0x30, not sure which
void getBeat() {}
void getBeatFrames() {}
u8 getBeat() { return mMelodyNum; }
f32 getBeatFrames() { return field_0x30; }

public:
/* 0x00 */ int field_0x0;
Expand Down
5 changes: 2 additions & 3 deletions include/d/actor/d_a_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class daPy_py_c : public fopAc_ac_c {
daPyRFlg0_UNK80000 = 0x00080000,
daPyRFlg0_POISON_CURSE = 0x00100000,
daPyRFlg0_GRAB_PUT_START = 0x00400000,
daPyRFlg0_TACT_USE = 0x01000000,
daPyRFlg0_TACT_INPUT = 0x01000000,
daPyRFlg0_FAIRY_USE = 0x02000000,
daPyRFlg0_UNK8000000 = 0x08000000,
daPyRFlg0_UNK10000000 = 0x10000000,
Expand Down Expand Up @@ -445,7 +445,7 @@ class daPy_py_c : public fopAc_ac_c {
void onPoisonCurse() { onResetFlg0(daPyRFlg0_POISON_CURSE); }
bool getGrabPutStart() const { return checkResetFlg0(daPyRFlg0_GRAB_PUT_START); }
bool checkFairyUse() const { return checkResetFlg0(daPyRFlg0_FAIRY_USE); }
bool checkTactUse() const { return checkResetFlg0(daPyRFlg0_TACT_USE); }
bool checkTactInput() const { return checkResetFlg0(daPyRFlg0_TACT_INPUT); }
bool checkArrowShoot() const { return checkResetFlg0(daPyRFlg0_ARROW_SHOOT); }

bool checkGrabWear() const { return field_0x2b0 < 0.0f; }
Expand All @@ -465,7 +465,6 @@ class daPy_py_c : public fopAc_ac_c {
void checkSwordMiniGame() const {}
void checkSoupPowerUp() const {}
void checkSubjectAccept() const {}
void checkTactInput() const {}
void checkUseArrowEffect() const {}
void getRopeJumpLand() const {}
void checkRopeForceEnd() const {}
Expand Down
5 changes: 4 additions & 1 deletion include/d/actor/d_a_player_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class daPy_fanSwingEcallBack_c : public dPa_levelEcallBack {
}

void onAlphaOutFlg() { mAlphaOutFlg = TRUE; }
JPABaseEmitter* getEmitter() { return mpEmitter; }

void deleteCallBack() {}

/* 0x4 */ BOOL mAlphaOutFlg;
/* 0x8 */ JPABaseEmitter* mpEmitter;
Expand Down Expand Up @@ -2098,7 +2101,7 @@ class daPy_lk_c : public daPy_py_c {
/* 0x3618 */ u32 mModeFlg;
/* 0x361C */ u32 mMtrlSndId;
/* 0x3620 */ u32 m3620;
/* 0x3624 */ int m3624;
/* 0x3624 */ u32 m3624;
/* 0x3628 */ int m3628;
/* 0x362C */ uint mTactZevPartnerPID;
/* 0x3630 */ u32 m3630;
Expand Down
2 changes: 1 addition & 1 deletion include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ inline bool dComIfGp_2dShowCheck() {
return g_dComIfG_gameInfo.play.show2dCheck();
}

inline u8 dComIfGp_setMelodyNum() {
inline u8 dComIfGp_getMelodyNum() {
return g_dComIfG_gameInfo.play.getMelodyNum();
}

Expand Down
20 changes: 15 additions & 5 deletions include/m_Do/m_Do_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void mDoAud_setSceneName(const char*, s32, s32);
void mDoAud_Execute();
BOOL mDoAud_isUsedHeapForStreamBuffer();
int mDoAud_load1stDynamicWave();
int mDoAud_getTactDirection(int stick, int ret);

extern JKRSolidHeap* g_mDoAud_audioHeap;

Expand Down Expand Up @@ -214,15 +215,15 @@ inline void mDoAud_tact_reset() {
mDoAud_zelAudio_c::getTact().reset();
}

inline void mDoAud_tact_getBeat() {
inline u8 mDoAud_tact_getBeat() {
return mDoAud_zelAudio_c::getTact().getBeat();
}

inline void mDoAud_tact_setBeat(s32 beat) {
mDoAud_zelAudio_c::getTact().setBeat(beat);
}

inline void mDoAud_tact_getBeatFrames() {
inline f32 mDoAud_tact_getBeatFrames() {
return mDoAud_zelAudio_c::getTact().getBeatFrames();
}

Expand Down Expand Up @@ -250,11 +251,20 @@ inline void mDoAud_tact_stopArmSwing() {
mDoAud_zelAudio_c::getTact().stopArmSwing();
}

inline void mDoAud_tact_armSoundPlay(s32) {}
inline void mDoAud_tact_judge(s32, s32) {}
inline s32 mDoAud_tact_judge(s32 param_1, s32 param_2) {
return mDoAud_zelAudio_c::getTact().judge(param_1, param_2);
}

inline void mDoAud_tact_armSoundPlay(s32 param_1) {
return mDoAud_zelAudio_c::getTact().armSoundPlay(param_1);
}

inline void mDoAud_tact_metronomePlay(s32 param_1, s32 param_2) {
return mDoAud_zelAudio_c::getTact().metronomePlay(param_1, param_2);
}

inline void mDoAud_tact_melodyPlay(s32) {}
inline void mDoAud_tact_melodyStop() {}
inline void mDoAud_tact_metronomePlay(s32, s32) {}

inline BOOL mDoAud_checkCbPracticePlay() {
return mDoAud_zelAudio_c::getInterface()->checkCbPracticePlay();
Expand Down
2 changes: 1 addition & 1 deletion src/JAZelAudio/JAIZelInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void JAIZelInst::metronomePlay(s32, s32) {
}

/* 802AE864-802AEB5C .text judge__10JAIZelInstFll */
void JAIZelInst::judge(s32, s32) {
s32 JAIZelInst::judge(s32, s32) {
/* Nonmatching */
}

Expand Down
203 changes: 201 additions & 2 deletions src/d/actor/d_a_player_tact.inc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ BOOL daPy_lk_c::checkEndTactMusic() const {
/* 8014D9A4-8014D9D0 .text getTactMetronomeRate__9daPy_lk_cFv */
f32 daPy_lk_c::getTactMetronomeRate() {
if (mCurProc == daPyProc_TACT_WAIT_e) {
return m35A0 / mDoAud_zelAudio_c::getTact().field_0x30;
return m35A0 / mDoAud_tact_getBeatFrames();
} else {
return -1.0f;
}
Expand Down Expand Up @@ -303,7 +303,206 @@ BOOL daPy_lk_c::procTactWait_init(int r30) {

/* 8014E100-8014E9A4 .text procTactWait__9daPy_lk_cFv */
BOOL daPy_lk_c::procTactWait() {
/* Nonmatching */
setShipRidePosUseItem();
mDoAud_tact_ambientPlay();
if (m3570 == -4) {
dComIfGp_evmng_cutEnd(mStaffIdx);
return TRUE;
}

if (m34D2 > 0) {
m34D2--;
if (m3570 == -5) {
m35A0 += 1.0f;
}
if (m34D2 == 0) {
if (m3570 == -5 || m3570 == 6 || m3570 == 7) {
dComIfGp_evmng_cutEnd(mStaffIdx);
g_dComIfG_gameInfo.play.field_0x4947 = 0;
} else if (m3570 == -1 || m3570 == -3 || m3570 >= 0) {
procTactPlay_init(m3574, m3570 == -1, m3570 >= 0);
}
}
return TRUE;
}

if (m3570 == 5 || m3570 == 1 || m3570 == 6 || m3570 == 7) {
if (m35AC >= 0.0f) {
m35AC -= 1.0f;
}
if (m3570 == 5) {
dComIfGp_setAStatus(7);
}
} else if (m3570 != -5) {
dComIfGp_setAStatus(7);
}

if (m34D2 == 0 || ((mPressedButtons & 2) != 0 && dComIfGp_getAStatus() == 7) || m35AC <= 0.0f) {
if (m34D2 != 0) {
resetActAnimeUpper(UPPER_MOVE2_e, -1.0f);
resetActAnimeUpper(UPPER_MOVE1_e, -1.0f);
mDoAud_seStart(JA_SE_TAKT_USE_CANCEL, 0);
}

g_dComIfG_gameInfo.play.field_0x4947 = 0;

if ((mPressedButtons & 2) != 0 && m3570 == 5) {
m35AC = -1000.0f;
}

if (m3570 == -1) {
dComIfGp_event_reset();
dCam_getBody()->EndEventCamera(fopAcM_GetID(this));
endDemoMode();
} else {
dComIfGp_evmng_cutEnd(mStaffIdx);
}
mDoAud_tact_reset();
return TRUE;
}

int r31, r30;
if (m3570 != -5) {
r31 = mDoAud_getTactDirection(1, m34D4);
r30 = mDoAud_getTactDirection(0, m34D6);
mDoAud_tact_setVolume(m35B0 * cM_scos(m34DC));
} else {
r31 = m34D4;
r30 = m34D6;
}

m35A0 += 1.0f;

if (r31 != m34D4) {
if (m35A4 <= 0.0f || r31 != 0) {
setActAnimeUpper(getTactPlayRightArmAnm(r31), UPPER_MOVE1_e, daPy_HIO_tact_c0::m.field_0x8, 0.0f, -1, daPy_HIO_tact_c0::m.field_0xC);

if (r31 == 0 || r31 == 2 || r31 == 4) {
mFrameCtrlUpper[UPPER_MOVE1_e].setRate(daPy_HIO_tact_c0::m.field_0x0);
mFrameCtrlUpper[UPPER_MOVE1_e].setFrame(mFrameCtrlUnder[UNDER_MOVE0_e].getFrame());
}

if (m34D4 == 4 || m34D4 == 2 || r31 == 4 || r31 == 2) {
mDoAud_tact_reset();
mDoAud_tact_setBeat(r31);
m35A0 = 0.0f;
m34DA = 0;
m_old_fdata->initOldFrameMorf(5.0f, 0, 0x2A);
m3624 = 0;
m34D0 = -1;
}
m34D4 = r31;
mAnmRatioUpper[UPPER_MOVE1_e].setRatio(0.0f);

if (m34D4 != 0) {
m35A4 = 2.0f;
}
} else {
m35A4 -= 1.0f;
}
} else if (m34D4 != 0) {
m35A4 = 2.0f;
}

if (r30 != m34D6) {
if (m35A8 <= 0.0f || r30 != 0) {
f32 f31;
if (m34D4 == 4) {
f31 = daPy_HIO_tact_c0::m.field_0x14;
} else if (m34D4 == 2) {
f31 = daPy_HIO_tact_c0::m.field_0x18;
} else {
f31 = daPy_HIO_tact_c0::m.field_0x10;
}
setActAnimeUpper(getTactPlayLeftArmAnm(r30), UPPER_MOVE2_e, f31, 0.0f, -1, daPy_HIO_tact_c0::m.field_0xC);
m34D6 = r30;
mAnmRatioUpper[UPPER_MOVE2_e].setRatio(0.0f);
mDoAud_tact_armSoundPlay(r30);
if (m34D6 != 0) {
m35A8 = 2.0f;
}
} else {
m35A8 -= 1.0f;
}
} else if (m34D6 != 0) {
m35A8 = 2.0f;
}

if (m35A0 >= mDoAud_tact_getBeatFrames()) {
mDoAud_tact_metronomePlay(m34DA, m34D6);
mpEquipItemBrk->setFrame(mpEquipItemBrk->getFrameMax() - 0.001f);
m34D0 = 3;
m35A0 -= mDoAud_tact_getBeatFrames();
m3624++;
if (m3624 == 2) {
m3624 = 0;
}
} else {
mpEquipItemBrk->setFrame(0.0f);
}

if (m34D0 > 0) {
m34D0--;
}

if (m34D0 == 0) {
m3574 = mDoAud_tact_judge(m34DA, m34D6);
m34DA++;

if (m34DA >= mDoAud_tact_getBeat()) {
m34DA = 0;
}

onResetFlg0(daPyRFlg0_TACT_INPUT);
m34D0 = -1;

if ((m3570 >= 0 && m3570 == m3574) ||
(
(m3570 == -1 || m3570 == -3) &&
(m3574 >= 0 && m3574 != 6 && m3574 != 7 && dComIfGs_isTact(m3574))
)
) {
m34D2 = 30;
mDoAud_seStart(JA_SE_WTAKT_MATCH_SIGNAL, 0);
m35A0 = 0.0f;
} else {
m3574 = -1;
if (m3570 == -5) {
m34D8++;
if (m34D8 == 6) {
m34D2 = 15;
}
} else if (m3570 == -2) {
m34D8++;
if (m34D8 == 5) {
m34D2 = 30;
m35A0 = 0.0f;
}
}
}
}

f32 f0;
if (m34D4 == 4) {
f0 = daPy_HIO_tact_c0::m.field_0x14;
} else if (m34D4 == 2) {
f0 = daPy_HIO_tact_c0::m.field_0x18;
} else {
f0 = daPy_HIO_tact_c0::m.field_0x10;
}
mFrameCtrlUpper[UPPER_MOVE2_e].setRate(f0);

if (m34D2 == -1) {
f32 f0 = (m35A0 + m3624 * mDoAud_tact_getBeatFrames()) / (2.0f * mDoAud_tact_getBeatFrames());
mFrameCtrlUnder[UPPER_MOVE0_e].setFrame(f0 * mFrameCtrlUnder[UPPER_MOVE0_e].getEnd());
mFrameCtrlUpper[UPPER_MOVE1_e].setFrame(f0 * mFrameCtrlUpper[UPPER_MOVE1_e].getEnd());
getNowAnmPackUnder(UNDER_MOVE0_e)->setFrame(mFrameCtrlUnder[UNDER_MOVE0_e].getFrame());
if (getNowAnmPackUpper(UPPER_MOVE1_e)) {
getNowAnmPackUpper(UPPER_MOVE1_e)->setFrame(mFrameCtrlUpper[UPPER_MOVE1_e].getFrame());
}
}

return TRUE;
}

/* 8014E9A4-8014EBA0 .text procTactPlay_init__9daPy_lk_cFlii */
Expand Down
2 changes: 1 addition & 1 deletion src/d/d_metronome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void dMetronome_c::melodyGuideShow(s32 note, s16 no) {
/* 80222854-80222C4C .text melodyShow__12dMetronome_cFv */
void dMetronome_c::melodyShow() {
cXyz tactTop, sparklePos;
if (daPy_getPlayerActorClass()->checkTactUse()) {
if (daPy_getPlayerActorClass()->checkTactInput()) {
cXyz pos;
pos.x = 0.0f;
pos.y = 0.0f;
Expand Down

0 comments on commit eec24f6

Please sign in to comment.