NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_audio.hpp
Go to the documentation of this file.
1#pragma once
3#include <lib/nw4r/math/vec.hpp>
4#include <game/mLib/m_vec.hpp>
5
6/// @file
7
8/// @ingroup bases
9
10template<int T>
11class NMSndObject { // : NMSndObjectBase
12public:
13 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
14};
15
16class SndObjctCmnEmy : public NMSndObject<4> {
17public:
18 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
19};
20
21class SndObjctCmnMap : public NMSndObject<4> {
22public:
23 virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
24};
25
26namespace dAudio {
27 void requestStartScene(ProfileName sceneProf); ///< Sets up game audio for the given scene.
28 void prepareSceneSnd(); ///< @unofficial
29 void destroySceneSnd(); ///< @unofficial
30 void setNextScene(ProfileName prof, unsigned long bgmIndex);
31 void pauseOffGameWithReset(); ///< @unofficial
32
33 int getRemotePlayer(int);
34 nw4r::math::VEC2 cvtSndObjctPos(const mVec3_c &);
35
37 public:
38 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
39 SndObjctCmnEmy::startSound(soundID, pos, remPlayer);
40 }
41 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
42 SndObjctCmnEmy::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
43 }
44 };
45
47 public:
48 void startSound(unsigned long soundID, const nw4r::math::VEC2 &pos, int remPlayer) {
49 SndObjctCmnMap::startSound(soundID, pos, remPlayer);
50 }
51 void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
52 SndObjctCmnMap::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
53 }
54 };
55
56 extern SndObjctCmnEmy_c *g_pSndObjEmy;
57 extern SndObjctCmnMap_c *g_pSndObjMap;
58
59 /// @unofficial
60 class SoundEffectID_t {
61 public:
62 SoundEffectID_t(u32 soundID) : id(soundID) {}
63
64 operator u32() const {
65 return id;
66 }
67
68 template<class T>
69 void playObjSound(T *obj, const mVec3_c &pos, int playerNo) const {
70 obj->startSound(id, dAudio::cvtSndObjctPos(pos), playerNo);
71 }
72
73 void playEmySound(const mVec3_c &pos, int playerNo) const {
74 playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
75 }
76
77 void playMapSound(const mVec3_c &pos, int playerNo) const {
78 playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
79 }
80
81 private:
82 u32 id;
83 };
84};
A three-dimensional floating point vector.
Definition m_vec.hpp:101
void requestStartScene(ProfileName sceneProf)
Sets up game audio for the given scene.
void destroySceneSnd()
void prepareSceneSnd()
void pauseOffGameWithReset()
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32