Z2SeqMgr mostly done (#2053)

This commit is contained in:
Caroline Madsen
2024-01-29 18:50:13 -05:00
committed by GitHub
parent 36a29bc4fe
commit 16259ec265
27 changed files with 2275 additions and 525 deletions
+9 -6
View File
@@ -51,7 +51,7 @@ struct JAISoundStatus_ {
bool isDead() { return state.unk == 6;}
inline bool isPlaying() { return state.unk == 5; }
bool isPrepared() { return state.unk >= 3; }
inline bool isMute() { return field_0x0.flags.mute; }
inline bool isPaused() { return field_0x0.flags.paused; }
void pauseWhenOut() {
@@ -97,7 +97,7 @@ struct JAISoundStatus_ {
} flags;
} state;
/* 0x4 */ u32 user_data;
}; // Size: 0x6
}; // Size: 0x8
struct JAISoundFader {
void forceIn() {
@@ -236,10 +236,14 @@ public:
bool isHandleAttached() const { return handle_ != NULL; }
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
void removeLifeTime_() { status_.field_0x1.flags.flag1 = false; }
bool isPrepared() { return status_.isPrepared(); }
void unlockIfLocked() { status_.unlockIfLocked(); }
void lockWhenPrepared() { status_.lockWhenPrepared(); }
void stop_JAISound_() {
status_.state.flags.flag5 = 0;
status_.state.flags.flag1 = 1;
}
bool isStopping() {
bool isStopping = false;
if (status_.state.flags.flag1) {
@@ -278,10 +282,9 @@ public:
return audible_ != NULL;
}
void fadeIn(u32 param_1) {
fader.fadeInFromOut(param_1);
return;
}
JAISoundFader& getFader() { return fader; }
void fadeIn(u32 i_count) { fader.fadeInFromOut(i_count); }
void fadeOut(u32 i_count) { fader.fadeOut(i_count); }
JAISoundParamsProperty& getProperty() { return params.mProperty; }
+8 -8
View File
@@ -18,32 +18,32 @@ struct JAISoundParamsProperty {
struct JAISoundParamsTransition {
struct TTransition {
void zero() {
field_0x0 = 0.0f;
mStep = 0.0f;
mCount = 0;
field_0x4 = 0.0f;
mDest = 0.0f;
}
void set(f32 newValue, f32 intensity, u32 fadeCount) {
mCount = fadeCount;
field_0x0 = (newValue - intensity) / mCount;
field_0x4 = newValue;
mStep = (newValue - intensity) / mCount;
mDest = newValue;
}
f32 apply(f32 param_0) {
if (mCount > 1) {
mCount--;
param_0 += field_0x0;
param_0 += mStep;
} else {
if (mCount == 1) {
mCount = 0;
param_0 = field_0x4;
param_0 = mDest;
}
}
return param_0;
}
/* 0x0 */ f32 field_0x0;
/* 0x4 */ f32 field_0x4;
/* 0x0 */ f32 mStep;
/* 0x4 */ f32 mDest;
/* 0x8 */ u32 mCount;
}; // Size: 0xC
+1
View File
@@ -81,6 +81,7 @@ public:
void i_setLinkState(u8 i_state) { mLinkState = i_state; }
Z2SoundObjSimple& getKantera() { return mKantera; }
u8 getLinkHp() const { return mLinkHp; }
u8 getMovingTime() { return mMovingTime; }
static Z2CreatureLink* mLinkPtr;
+1
View File
@@ -54,5 +54,6 @@ extern u8 struct_80450868;
extern u8 struct_80450869;
extern u8 struct_8045086A;
extern u8 struct_8045086B;
extern u8 data_8045086C;
#endif /* Z2PARAM_H */
+2
View File
@@ -32,7 +32,9 @@ public:
bool isSceneExist() const { return sceneExist; }
int getCurrentSceneNum() const { return sceneNum; }
s8 getCurrentRoomNum() { return roomNum; }
bool isInGame() const { return inGame; }
void setInGame(bool i_inGame) { inGame = i_inGame; }
bool isInDarkness() const { return inDarkness; }
s8 getRoomReverb() const { return dComIfGp_getReverb(roomNum); }
+97 -28
View File
@@ -4,13 +4,6 @@
#include "JSystem/JAudio2/JAISoundHandles.h"
#include "JSystem/JAudio2/JASGadget.h"
// move TTransition / Z2SoundFader ?
struct TTransition {
/* 0x0 */ float field_0x0;
/* 0x4 */ float field_0x4;
/* 0x8 */ u32 mCount;
}; // Size = 0xC
struct Z2SoundFader {
void move(f32 vol, u32 count) {
if (count != 0) {
@@ -21,6 +14,61 @@ struct Z2SoundFader {
}
}
void forceIn() {
mIntensity = 1.0f;
mTransition.zero();
}
void forceOut() {
mIntensity = 0.0f;
mTransition.zero();
}
void fadeIn(u32 count) {
if (count != 0) {
mTransition.set(1.0f, mIntensity, count);
} else {
forceIn();
}
}
void fadeOut(u32 count) {
if (count != 0) {
mTransition.set(0.0f, mIntensity, count);
} else {
forceOut();
}
}
void fadeInFromOut(u32 count) {
mIntensity = 0.0f;
fadeIn(count);
}
u32 getCount() {
return mTransition.mCount;
}
f32 getIntensity() {
return mIntensity;
}
f32 getDest() {
if (getCount() != 0) {
return mTransition.mDest;
} else {
return mIntensity;
}
}
void calc() {
mIntensity = mTransition.apply(mIntensity);
}
f32 get() {
return getIntensity();
}
/* 0x0 */ float mIntensity;
/* 0x4 */ JAISoundParamsTransition::TTransition mTransition;
}; // Size = 0x10
@@ -35,7 +83,7 @@ public:
void subBgmStop();
void subBgmStopInner();
void bgmStreamPrepare(u32);
int bgmStreamCheckReady();
bool bgmStreamCheckReady();
void bgmStreamPlay();
void bgmStreamStop(u32);
void changeBgmStatus(s32);
@@ -52,7 +100,7 @@ public:
void setTimeProcVolMod(bool, u32);
void processBgmFramework();
bool checkBgmIDPlaying(u32);
void getChildTrackVolume(JAISoundHandle*, int);
f32 getChildTrackVolume(JAISoundHandle*, int);
void setChildTrackVolume(JAISoundHandle*, int, float, u32, float, float);
void resetBattleBgmParams();
void setBattleBgmOff(bool);
@@ -90,20 +138,24 @@ public:
void i_bgmAllUnMute(u32 count) { mAllBgmMaster.move(1.0f, count); }
void i_muteSceneBgm(u32 count, f32 vol) {
field_0x44.move(vol, count);
mSceneBgm.move(vol, count);
}
void i_unMuteSceneBgm(u32 count) {
mBgmPause.move(1.0f, 0);
field_0x44.move(1.0f, count);
mSceneBgm.move(1.0f, count);
}
void bgmAllMute(u32 count, f32 val) {
mAllBgmMaster.mTransition.set(val, mAllBgmMaster.mIntensity, count);
}
void bgmAllUnMute(u32 count) {
mAllBgmMaster.move(1.0f, count);
}
bool isItemGetDemo() {
return field_0x08.isSoundAttached() || field_0xba != 0;
return mFanfareHandle.isSoundAttached() || mFanfareCount != 0;
}
u32 getMainBgmID() {
@@ -122,39 +174,56 @@ public:
return -1;
}
u32 getStreamBgmID() {
if (mStreamBgmHandle) {
return mStreamBgmHandle->getID();
}
return -1;
}
JAISoundHandle* getMainBgmHandle() { return &mMainBgmHandle; }
/* 0x00 */ JAISoundHandle mMainBgmHandle;
/* 0x04 */ JAISoundHandle mSubBgmHandle;
/* 0x08 */ JAISoundHandle field_0x08;
/* 0x0C */ JAISoundHandle field_0x0c;
/* 0x10 */ JAISoundID field_0x10;
/* 0x08 */ JAISoundHandle mFanfareHandle;
/* 0x0C */ JAISoundHandle mStreamBgmHandle;
/* 0x10 */ JAISoundID mFanfareID;
/* 0x14 */ Z2SoundFader mMainBgmMaster;
/* 0x24 */ Z2SoundFader mSubBgmMaster;
/* 0x34 */ Z2SoundFader mBgmPause;
/* 0x44 */ Z2SoundFader field_0x44;
/* 0x44 */ Z2SoundFader mSceneBgm;
/* 0x54 */ Z2SoundFader mFanfareMute;
/* 0x64 */ Z2SoundFader field_0x64;
/* 0x64 */ Z2SoundFader mStreamBgmMaster;
/* 0x74 */ Z2SoundFader mAllBgmMaster;
/* 0x84 */ Z2SoundFader field_0x84;
/* 0x94 */ Z2SoundFader mWindStone;
/* 0xA4 */ Z2SoundFader field_0xa4;
/* 0xB4 */ f32 mTwilightGateVol;
/* 0xB8 */ u16 field_0xb8;
/* 0xBA */ u8 field_0xba;
/* 0xBB */ u8 field_0xbb;
/* 0xBC */ u8 field_0xbc;
/* 0xBD */ u8 field_0xbd;
/* 0xBE */ u8 field_0xbe;
/* 0xBF */ u8 field_0xbf;
/* 0xC0 */ u8 field_0xc0;
/* 0xB8 */ s16 field_0xb8;
/* 0xBA */ u8 mFanfareCount;
/* 0xBB */ u8 mDekuToadCount;
/* 0xBC */ u8 mBgmStatus;
/* 0xBD */ u8 mSubBgmStatus;
/* 0xBE */ u8 mBattleDistState;
/* 0xBF */ u8 mBattleSeqState;
/* 0xC0 */ u8 mBattleSeqCount;
/* 0xC1 */ u8 field_0xc1;
/* 0xC2 */ u8 field_0xc2;
/* 0xC3 */ u8 field_0xc3;
/* 0xC2 */ u8 mBattleLastHit;
/* 0xC3 */ u8 mRideCount;
/* 0xC4 */ u8 field_0xc4;
/* 0xC8 */ f32 field_0xc8;
/* 0xCC */ f32 field_0xcc;
/* 0xD0 */ u8 mFlags;
/* 0xD0 */ struct {
bool mBattleDistIgnore : 1;
bool flag1 : 1;
bool mBattleSearched : 1;
bool mBattleBgmOff : 1;
bool mRiding : 1;
bool flag5 : 1;
bool flag6 : 1;
bool flag7 : 1;
} mFlags;
}; // Size = 0xD4
inline Z2SeqMgr* Z2GetSeqMgr() {
+1 -1
View File
@@ -25,7 +25,7 @@ public:
/* 802AA9E8 */ void multiVolumeSoundID(JAISoundID, f32);
/* 802AAAC4 */ void isPlayingSoundID(JAISoundID);
/* 802A9EE8 */ virtual int startSound(JAISoundID, JAISoundHandle*,
/* 802A9EE8 */ virtual bool startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*);
JAISeMgr* getSeMgr() { return &mSeMgr; }
+1
View File
@@ -30,6 +30,7 @@ public:
bool removeEnemy(JSULink<Z2CreatureEnemy>*);
u8 isTwilightBattle();
u8 getEnemyNumVeryFar() { return mEnemyNumVeryFar; }
bool isForceBattle() { return mForceBattle; }
JSUList<Z2CreatureEnemy>* getEnemyList() { return this; }
+4
View File
@@ -15,4 +15,8 @@ struct Z2SoundStarter : public JAISoundStarter, public JASGlobalInstance<Z2Sound
float, float, float, float, u32);
};
inline Z2SoundStarter* Z2GetSoundStarter() {
return JASGlobalInstance<Z2SoundStarter>::getInstance();
}
#endif /* Z2SOUNDSTARTER_H */
+3
View File
@@ -25,7 +25,10 @@ struct Z2StatusMgr : public JASGlobalInstance<Z2StatusMgr> {
void setHour(s32 hour) { mHour = hour; }
void setMinute(s32 min) { mMinute = min; }
void setWeekday(s32 day) { mWeekday = day; }
f32 getCameraInWaterDepth() { return mUnderwaterDepth; }
f32 getCameraInWaterDepthRatio() const { return mCameraInWaterDepthRatio; }
u8 getHour() { return mHour; }
bool isPaused() { return mIsMenuIn; }
/* 0x00 */ u8 mHour;
/* 0x01 */ u8 mMinute;
-4
View File
@@ -303,8 +303,4 @@ public:
static const u8* m_branchData;
};
inline Z2SoundStarter* Z2GetSoundStarter() {
return JASGlobalInstance<Z2SoundStarter>::getInstance();
}
#endif /* D_D_DEMO_H */