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
11class 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 bool SoundEnabled();
28
29public:
30 CMapSounds();
31 int Sizeof() const override { return sizeof(*this); }
32
33 void Play(int Channel, int SoundId);
34 void PlayAt(int Channel, int SoundId, vec2 Position);
35 void StopAll();
36
37 void OnMapLoad() override;
38 void OnRender() override;
39 void OnStateChange(int NewState, int OldState) override;
40};
41
42#endif // GAME_CLIENT_COMPONENTS_MAPSOUNDS_H
43