Z2AudioLib work (#2339)

* Z2LinkMgr work, Z2AudioArcLoader matching

* Z2SeMgr matching

* Z2SpeechMgr2 almost done, Z2SoundHandles matching
This commit is contained in:
Caroline Madsen
2025-03-22 02:03:43 -04:00
committed by GitHub
parent 42b75737d5
commit 23f56e4c20
43 changed files with 1832 additions and 1194 deletions
-117
View File
@@ -1,7 +1,6 @@
#ifndef Z2CREATURE_H
#define Z2CREATURE_H
#include "SSystem/SComponent/c_xyz.h"
#include "Z2AudioLib/Z2SoundObject.h"
#include "Z2AudioLib/Z2SoundStarter.h"
@@ -35,122 +34,6 @@ public:
/* 0x70 */ Z2SoundObjSimple mSoundObjSimple2;
}; // Size: 0x90
struct Z2LinkSoundStarter : public Z2SoundStarter {
Z2LinkSoundStarter();
inline virtual ~Z2LinkSoundStarter();
virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, f32,
f32, f32, f32, f32, u32);
};
class Z2CreatureLink : public Z2Creature, public Z2LinkSoundStarter {
public:
Z2CreatureLink();
~Z2CreatureLink();
void setLinkState(u8);
void setLinkGroupInfo(u8);
void setLinkHp(s32, s32);
void setLinkSwordType(s32, s32);
void setLinkShieldType(s32, s32);
void setLinkBootsType(s32);
virtual void deleteObject();
void init(Vec*, Vec*, Vec*);
void initKantera(Vec*);
void deleteKantera(void);
void setKanteraState(u8);
virtual void framework(u32, s8);
void setSinkDepth(s8);
void setRiding(bool);
void setMagnetized(bool);
void setWolfEyeOpen(bool);
Z2SoundHandlePool* startLinkSound(JAISoundID, u32, s8);
JAISoundHandle* startLinkSoundLevel(JAISoundID, u32, s8);
void startLinkVoice(JAISoundID, s8);
void startLinkVoiceLevel(JAISoundID, s8);
void startLinkSwordSound(JAISoundID, u32, s8);
virtual Z2SoundHandlePool* startCollisionSE(u32, u32);
int startHitItemSE(u32, u32, Z2SoundObjBase*, float);
void setResumeAttack(bool);
void setInWater(bool status) { mInWater = status; }
bool isInWater() { return mInWater; }
u8 getLinkState() const { return mLinkState; }
u8 getMoveSpeed() const { return mMoveSpeed; }
bool isRiding() const { return mRiding; }
void i_setLinkState(u8 i_state) { mLinkState = i_state; }
Z2SoundObjSimple& getKantera() { return mKantera; }
u8 getLinkHp() const { return mLinkHp; }
u8 getMovingTime() { return mMovingTime; }
u8 isWolfSmellOpen() const { return mWolfEyeOpen; }
void setUsingIronBall(bool i_using) { mUsingIronBall = i_using; }
void setMarkState(u8 i_state) { mMarkState = i_state; }
static Z2CreatureLink* mLinkPtr;
private:
/* 0x90 Z2LinkSoundStarter */
/* 0x94 */ Z2SoundObjSimple mKantera;
/* 0xB4 */ cXyz field_0xb4;
/* 0xC0 */ u8 mLinkState;
/* 0xC1 */ u8 field_0xc1;
/* 0xC2 */ u8 mMarkState;
/* 0xC3 */ u8 mLinkHp;
/* 0xC4 */ u8 mLinkBootsType;
/* 0xC5 */ u8 mKanteraState;
/* 0xC6 */ u8 mLinkSwordType;
/* 0xC7 */ u8 mLinkShieldType;
/* 0xC8 */ u8 mMoveSpeed;
/* 0xC9 */ u8 mMovingTime;
/* 0xCA */ s8 mSinkDepth;
/* 0xCB */ bool mWolfEyeOpen : 1;
/* 0xCB */ bool mInWater : 1;
/* 0xCB */ bool mResumeAttack : 1;
/* 0xCB */ bool mFlag3 : 1;
/* 0xCB */ bool mFlag4 : 1;
/* 0xCB */ bool mFlag5 : 1;
/* 0xCB */ bool mRiding : 1;
/* 0xCB */ bool mMagnetized : 1;
/* 0xCC */ bool mFlag8 : 1;
/* 0xCC */ bool mUsingIronBall : 1;
/* 0xCC */ bool mFlag10 : 1;
/* 0xCC */ bool mFlag11 : 1;
/* 0xCC */ bool mFlag12 : 1;
/* 0xCC */ bool mFlag13 : 1;
/* 0xCC */ bool mFlag14 : 1;
/* 0xCC */ bool mFlag15 : 1;
}; // Size: 0xD0
inline Z2CreatureLink* Z2GetLink() {
return Z2CreatureLink::mLinkPtr;
}
class Z2CreatureRide;
struct Z2RideSoundStarter : public Z2SoundStarter {
/* 802C5234 */ Z2RideSoundStarter(Z2CreatureRide*);
/* 802C5078 */ inline virtual ~Z2RideSoundStarter();
/* 802C5284 */ virtual bool startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*, u32, f32, f32, f32, f32,
f32, u32);
/* 0x4 */ Z2CreatureRide* mRide;
};
class Z2CreatureRide : public Z2Creature, public Z2RideSoundStarter {
public:
Z2CreatureRide();
~Z2CreatureRide();
void init(Vec*, Vec*, u8, u8);
void setLinkRiding(bool);
virtual void deleteObject();
private:
/* 0x90 */ // Z2RideSoundStarter mSoundStarter;
/* 0x98 */ bool mLinkRiding;
}; // Size: 0x9C
class Z2CreatureEnemy : public Z2Creature, public JSULink<Z2CreatureEnemy> {
public:
/* 802C0F64 */ Z2CreatureEnemy();
+136
View File
@@ -1,5 +1,141 @@
#ifndef Z2LINKMGR_H
#define Z2LINKMGR_H
#include "SSystem/SComponent/c_xyz.h"
#include "Z2AudioLib/Z2Creature.h"
class Z2LinkSoundStarter : public Z2SoundStarter {
public:
Z2LinkSoundStarter();
inline virtual ~Z2LinkSoundStarter();
virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, f32,
f32, f32, f32, f32, u32);
};
class Z2CreatureLink : public Z2Creature, public Z2LinkSoundStarter {
public:
Z2CreatureLink();
~Z2CreatureLink();
void setLinkState(u8);
void setLinkGroupInfo(u8);
void setLinkHp(s32, s32);
void setLinkSwordType(s32, s32);
void setLinkShieldType(s32, s32);
void setLinkBootsType(s32);
virtual void deleteObject();
void init(Vec*, Vec*, Vec*);
void initKantera(Vec*);
void deleteKantera(void);
void setKanteraState(u8);
virtual void framework(u32, s8);
void setSinkDepth(s8);
void setRiding(bool);
void setMagnetized(bool);
void setWolfEyeOpen(bool);
Z2SoundHandlePool* startLinkSound(JAISoundID, u32, s8);
JAISoundHandle* startLinkSoundLevel(JAISoundID, u32, s8);
Z2SoundHandlePool* startLinkVoice(JAISoundID, s8);
Z2SoundHandlePool* startLinkVoiceLevel(JAISoundID, s8);
void startLinkSwordSound(JAISoundID, u32, s8);
virtual Z2SoundHandlePool* startCollisionSE(u32, u32);
Z2SoundHandlePool* startHitItemSE(u32, u32, Z2SoundObjBase*, float);
void setResumeAttack(bool);
void setInWater(bool status) { mInWater = status; }
bool isInWater() { return mInWater; }
u8 getLinkState() const { return mLinkState; }
u8 getMoveSpeed() const { return mMoveSpeed; }
bool isRiding() const { return mRiding; }
void i_setLinkState(u8 i_state) { mLinkState = i_state; }
Z2SoundObjSimple& getKantera() { return mKantera; }
u8 getLinkHp() const { return mLinkHp; }
u8 getMovingTime() { return mMovingTime; }
u8 isWolfSmellOpen() const { return mWolfEyeOpen; }
void setUsingIronBall(bool i_using) { mUsingIronBall = i_using; }
void setMarkState(u8 i_state) { mMarkState = i_state; }
static Z2CreatureLink* mLinkPtr;
friend class Z2LinkSoundStarter;
friend class Z2RideSoundStarter;
private:
/* 0x90 Z2LinkSoundStarter */
/* 0x94 */ Z2SoundObjSimple mKantera;
/* 0xB4 */ cXyz field_0xb4;
/* 0xC0 */ u8 mLinkState;
/* 0xC1 */ u8 field_0xc1;
/* 0xC2 */ u8 mMarkState;
/* 0xC3 */ u8 mLinkHp;
/* 0xC4 */ u8 mLinkBootsType;
/* 0xC5 */ u8 mKanteraState;
/* 0xC6 */ u8 mLinkSwordType;
/* 0xC7 */ u8 mLinkShieldType;
/* 0xC8 */ u8 mMoveSpeed;
/* 0xC9 */ u8 mMovingTime;
/* 0xCA */ s8 mSinkDepth;
/* 0xCB */ bool mWolfEyeOpen : 1;
/* 0xCB */ bool mInWater : 1;
/* 0xCB */ bool mResumeAttack : 1;
/* 0xCB */ bool mFlag3 : 1;
/* 0xCB */ bool mFlag4 : 1;
/* 0xCB */ bool mFlag5 : 1;
/* 0xCB */ bool mRiding : 1;
/* 0xCB */ bool mMagnetized : 1;
/* 0xCC */ bool mFlag8 : 1;
/* 0xCC */ bool mUsingIronBall : 1;
/* 0xCC */ bool mFlag10 : 1;
/* 0xCC */ bool mFlag11 : 1;
/* 0xCC */ bool mFlag12 : 1;
/* 0xCC */ bool mFlag13 : 1;
/* 0xCC */ bool mFlag14 : 1;
/* 0xCC */ bool mFlag15 : 1;
}; // Size: 0xD0
inline Z2CreatureLink* Z2GetLink() {
return Z2CreatureLink::mLinkPtr;
}
class Z2CreatureRide;
struct Z2RideSoundStarter : public Z2SoundStarter {
/* 802C5234 */ Z2RideSoundStarter(Z2CreatureRide*);
/* 802C5078 */ virtual ~Z2RideSoundStarter() {}
/* 802C5284 */ virtual bool startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*, u32, f32, f32, f32, f32,
f32, u32);
/* 0x4 */ Z2CreatureRide* mRide;
};
class Z2CreatureRide : public Z2Creature, public Z2RideSoundStarter {
public:
Z2CreatureRide();
~Z2CreatureRide();
void init(Vec*, Vec*, u8, u8);
void setLinkRiding(bool);
bool isLinkRiding() { return mLinkRiding; }
virtual void deleteObject();
private:
/* 0x90 */ // Z2RideSoundStarter mSoundStarter;
/* 0x98 */ bool mLinkRiding;
}; // Size: 0x9C
class Z2SoundObjCoach : public Z2SoundObjBase {
public:
/* 802C54B8 */ Z2SoundObjCoach();
/* 802C54FC */ void init(Vec*, u8);
/* 802C551C */ Z2SoundHandlePool* startWheelSound(f32);
/* 802C56C0 */ Z2SoundHandlePool* startFireSound(u16);
/* 802C57C0 */ Z2SoundHandlePool* startSound(JAISoundID, u32, s8);
private:
/* 0x20 */ f32 field_0x20;
};
#endif /* Z2LINKMGR_H */
+1
View File
@@ -40,6 +40,7 @@ public:
bool isMovieDemo() { return sceneNum == 2 || sceneNum == 8 || sceneNum == 9; }
s32 getSeLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 0); }
s32 getBgmLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 1); }
u8 getDemoSeWaveNum() { return loadedDemoWave; }
private:
/* 0x00 */ JAISoundID BGM_ID;
+1 -5
View File
@@ -4,13 +4,9 @@
#include "JSystem/JAudio2/JAISoundHandles.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
// This should inherit JASPoolAllocObject (without which some functions in Z2SoundHandles.cpp badly mismatch)
// but this inheritance causes the memPool_ to be generated in the first file that includes this header.
// Perhaps this class definition should belong to a different header.
class Z2SoundHandlePool : public JAISoundHandle, public JSULink<Z2SoundHandlePool> { // , public JASPoolAllocObject<Z2SoundHandlePool> {
class Z2SoundHandlePool : public JAISoundHandle, public JSULink<Z2SoundHandlePool>, public JASPoolAllocObject<Z2SoundHandlePool> {
public:
Z2SoundHandlePool() : JAISoundHandle(), JSULink<Z2SoundHandlePool>(this) {}
~Z2SoundHandlePool() {}
};
class Z2SoundHandles : protected JSUList<Z2SoundHandlePool> {
+1
View File
@@ -93,6 +93,7 @@ public:
bool removeEnemy(JSULink<Z2CreatureEnemy>*);
u8 isTwilightBattle();
u8 getEnemyNumNear() { return mEnemyNumNear; }
u8 getEnemyNumVeryFar() { return mEnemyNumVeryFar; }
bool isForceBattle() { return mForceBattle; }
JSUList<Z2CreatureEnemy>* getEnemyList() { return this; }
+5 -5
View File
@@ -35,11 +35,11 @@ struct Z2SpeechMgr2 : public JASGlobalInstance<Z2SpeechMgr2> {
/* 0x004 */ JAISoundHandle field_0x4;
/* 0x008 */ JMath::TRandom_fast_ random;
/* 0x00C */ Z2SpeechStarter mSpeech;
/* 0x010 */ u16 field_0x10[500];
/* 0x3F8 */ s16 field_0x3f8;
/* 0x3FA */ s16 field_0x3fa;
/* 0x3FC */ u16 field_0x3fc;
/* 0x3FE */ u8 field_0x3fe;
/* 0x010 */ u16 mText[500];
/* 0x3F8 */ s16 mTextNum;
/* 0x3FA */ s16 mTextCount;
/* 0x3FC */ u16 mMood;
/* 0x3FE */ u8 mVoice;
/* 0x3FF */ u8 field_0x3ff;
/* 0x400 */ u8 field_0x400;
/* 0x401 */ u8 field_0x401;