| 1 | #ifndef GAME_CLIENT_COMPONENTS_MAPSOUNDS_H |
| 2 | #define GAME_CLIENT_COMPONENTS_MAPSOUNDS_H |
| 3 | |
| 4 | #include <engine/sound.h> |
| 5 | |
| 6 | #include <game/client/component.h> |
| 7 | #include <game/mapitems.h> |
| 8 | |
| 9 | #include <vector> |
| 10 | |
| 11 | class CMapSounds : public CComponent |
| 12 | { |
| 13 | int m_aSounds[MAX_MAPSOUNDS]; |
| 14 | int m_Count; |
| 15 | |
| 16 | class CSourceQueueEntry |
| 17 | { |
| 18 | public: |
| 19 | int m_Sound; |
| 20 | bool m_HighDetail; |
| 21 | ISound::CVoiceHandle m_Voice; |
| 22 | const CMapItemGroup *m_pGroup; |
| 23 | const CSoundSource *m_pSource; |
| 24 | }; |
| 25 | std::vector<CSourceQueueEntry> m_vSourceQueue; |
| 26 | void Clear(); |
| 27 | |
| 28 | public: |
| 29 | CMapSounds(); |
| 30 | int Sizeof() const override { return sizeof(*this); } |
| 31 | |
| 32 | void Play(int Channel, int SoundId); |
| 33 | void PlayAt(int Channel, int SoundId, vec2 Position); |
| 34 | |
| 35 | void OnMapLoad() override; |
| 36 | void OnRender() override; |
| 37 | void OnStateChange(int NewState, int OldState) override; |
| 38 | }; |
| 39 | |
| 40 | #endif // GAME_CLIENT_COMPONENTS_MAPSOUNDS_H |
| 41 | |