mirror of
https://github.com/zeldaret/ss
synced 2026-07-08 22:04:41 -04:00
d_snd_anim_sound OK
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef D_SND_ANIM_SOUND_H
|
||||
#define D_SND_ANIM_SOUND_H
|
||||
|
||||
#include "d/snd/d_snd_types.h"
|
||||
#include "nw4r/snd/snd_AnimSound.h"
|
||||
|
||||
// Could also inherit from AnimSound
|
||||
class dSndAnimSound_c {
|
||||
public:
|
||||
dSndAnimSound_c(dSoundSource_c *source);
|
||||
void setData(const void *data);
|
||||
void setFrame(f32 frame);
|
||||
void resetFrame(f32 frame);
|
||||
void setRate(f32 rate);
|
||||
|
||||
void setCallback(dSoundSource_c *source);
|
||||
void setCallback(nw4r::snd::AnimSound::Callback cb, void *userData);
|
||||
|
||||
private:
|
||||
static void animCallback(int, s32, const char *, UNKWORD, void *userData);
|
||||
|
||||
/* 0x00 */ nw4r::snd::AnimSound mSound;
|
||||
/* 0x90 */ const void *mpData;
|
||||
/* 0x94 */ f32 field_0x94;
|
||||
/* 0x98 */ f32 field_0x98;
|
||||
/* 0x9C */ bool mNeedFrameReset;
|
||||
/* 0xA0 */ nw4r::snd::AnimSound::PlayDirection mDirection;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -29,7 +29,14 @@ public:
|
||||
|
||||
dSndSmallEffectMgr_c();
|
||||
|
||||
void initialize();
|
||||
void calc();
|
||||
void calcTimer();
|
||||
|
||||
void stopAllSound(s32 fadeFrames);
|
||||
void stopAllSoundDemoRelated(s32 fadeFrames); // TODO: better name
|
||||
void stopAllSoundExceptEvent(s32 fadeFrames);
|
||||
void stopAllSoundExceptEffectOrLink(s32 fadeFrames);
|
||||
|
||||
bool playSound(u32 soundId);
|
||||
// used for clawshots cursor, pan depends on where on the screen
|
||||
@@ -47,7 +54,17 @@ public:
|
||||
|
||||
bool playDowsingPingSound(f32 volume, f32 pitch);
|
||||
bool holdDowsingNearestSound();
|
||||
|
||||
|
||||
bool playSirenCountdownSound(s32 timer);
|
||||
bool playMinigameCountdownSound();
|
||||
bool playMinigameTimeUpSound(s32 timer);
|
||||
bool playMinigameStartSound();
|
||||
bool playMinigameFinishSound();
|
||||
bool playMinigameFinishWhistleSound();
|
||||
bool playMinigameScoreUpSound(s32 param);
|
||||
bool playMinigameScoreDownSound();
|
||||
bool playMinigameMusasabiSound(s32 count);
|
||||
|
||||
bool playSkbSound(u32 soundId);
|
||||
|
||||
bool playButtonPressSoundWhenAdvancingTextBoxes(f32);
|
||||
|
||||
@@ -63,7 +63,9 @@ public:
|
||||
virtual void d_s_vt_0x1D4();
|
||||
virtual void d_s_vt_0x1D8();
|
||||
virtual void d_s_vt_0x1DC();
|
||||
virtual void d_s_vt_0x1E0();
|
||||
virtual void onAnimSoundEvent(UNKWORD arg) {
|
||||
field_0x154 = arg;
|
||||
}
|
||||
virtual void d_s_vt_0x1E4();
|
||||
virtual u32 d_s_vt_0x1E8(u32 soundId);
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ public:
|
||||
return GetInstance()->mpBoomerangSource;
|
||||
}
|
||||
|
||||
void stopAllSound();
|
||||
void stopAllNonPlayerSound();
|
||||
|
||||
private:
|
||||
static bool isCertainEnemyType(dSoundSource_c *source);
|
||||
void removeSourceFromList(dSoundSource_c *source, nw4r::ut::List *list);
|
||||
|
||||
@@ -36,6 +36,10 @@ public:
|
||||
|
||||
static bool isInStage(const char *stageName);
|
||||
|
||||
s32 getStageId_0x044() const {
|
||||
return field_0x044;
|
||||
}
|
||||
|
||||
u32 getField_0x11C() const {
|
||||
return field_0x11C;
|
||||
}
|
||||
@@ -62,6 +66,11 @@ public:
|
||||
|
||||
void setFlowEvent(u32 eventId);
|
||||
|
||||
const char *getCurrentStageMusicDemoName() const;
|
||||
bool isInDemo() const {
|
||||
return getCurrentStageMusicDemoName() != nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
u32 getStageTypeFlags(const char *stageName) const;
|
||||
// ET, FS, or corresponding Sky Keep rooms
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
bool Setup(const void *data);
|
||||
void Shutdown();
|
||||
void ResetFrame(f32, int);
|
||||
void ResetFrame(f32, int cycle);
|
||||
void UpdateFrame(f32 frame, PlayDirection dir);
|
||||
void UpdateForward(f32 frame);
|
||||
void UpdateBackward(f32 frame);
|
||||
@@ -103,27 +103,78 @@ public:
|
||||
void StartEvent(const AnimEvent *, bool);
|
||||
void HoldEvent(const AnimEvent *, bool);
|
||||
void StopEvent(const AnimEvent *);
|
||||
bool IsPlayableLoopCount(const nw4r::snd::detail::AnimEventFrameInfo&);
|
||||
bool IsPlayableLoopCount(const nw4r::snd::detail::AnimEventFrameInfo &);
|
||||
|
||||
typedef void (*Callback)(int, s32, const char *, UNKWORD, void *userData);
|
||||
|
||||
typedef void (*Callback)(int, s32, const char *, UNKWORD, UNKWORD);
|
||||
void SetCallback(Callback cb, void *userData) {
|
||||
mCallback = cb;
|
||||
mUserData = userData;
|
||||
}
|
||||
|
||||
u32 GetAnimDuration() const {
|
||||
return mReader.GetAnimDuration();
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ SoundStartable &mStartable;
|
||||
/* 0x04 */ AnimSoundFileReader mReader;
|
||||
/* 0x0C */ f32 field_0x0C;
|
||||
/* 0x0C */ f32 mCurrentFrame;
|
||||
/* 0x10 */ AnimEventPlayer *mpSounds;
|
||||
/* 0x14 */ int mNumSounds;
|
||||
/* 0x18 */ bool mIsActive;
|
||||
/* 0x19 */ u8 field_0x19;
|
||||
/* 0x1A */ u8 field_0x1A;
|
||||
/* 0x1C */ UNKWORD field_0x1C;
|
||||
/* 0x19 */ bool mNeedFrameReset;
|
||||
/* 0x1A */ bool mNeedTriggerEventsAtCurrentFrame;
|
||||
/* 0x1C */ int mCycleCounter;
|
||||
/* 0x20 */ Callback mCallback;
|
||||
/* 0x24 */ UNKWORD field_0x24;
|
||||
/* 0x24 */ void *mUserData;
|
||||
/* 0x28 */ f32 field_0x28;
|
||||
/* 0x2C */ f32 mVariableValue;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Not sure about this one but it appears game code isn't meant to access the "detail"
|
||||
// namespace so I guess some way for game code to use the above things need to exist
|
||||
class AnimSound {
|
||||
public:
|
||||
AnimSound(SoundStartable &startable) : mImpl(startable, mPlayers, 8) {}
|
||||
|
||||
enum PlayDirection {
|
||||
FORWARD,
|
||||
BACKWARD,
|
||||
};
|
||||
|
||||
typedef void (*Callback)(int, s32, const char *, UNKWORD, void *userData);
|
||||
|
||||
bool Setup(const void *data) {
|
||||
return mImpl.Setup(data);
|
||||
}
|
||||
|
||||
void UpdateFrame(f32 frame, PlayDirection dir) {
|
||||
mImpl.UpdateFrame(frame, (detail::AnimSoundImpl::PlayDirection)dir);
|
||||
}
|
||||
|
||||
void ResetFrame(f32 frame, int cycle) {
|
||||
mImpl.ResetFrame(frame, cycle);
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
mImpl.Shutdown();
|
||||
}
|
||||
|
||||
void SetCallback(Callback cb, void *userData) {
|
||||
mImpl.SetCallback(cb, userData);
|
||||
}
|
||||
|
||||
u32 GetAnimDuration() const {
|
||||
return mImpl.GetAnimDuration();
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ detail::AnimSoundImpl mImpl;
|
||||
/* 0x30 */ detail::AnimEventPlayer mPlayers[8];
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
Reference in New Issue
Block a user