aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/soundscape_system.h
blob: 8cdc356d9b29c3f8f58e37e1e372b4b04bc0a6f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#ifndef SOUNDSCAPE_SYSTEM_H
#define SOUNDSCAPE_SYSTEM_H
#ifdef _WIN32
#pragma once
#endif


#include "stringregistry.h"
#include "tier1/utlstring.h"
class CEnvSoundscape;

struct clusterSoundscapeList_t
{
	unsigned short	soundscapeCount;
	unsigned short	firstSoundscape;
};



class CSoundscapeSystem : public CAutoGameSystemPerFrame
{
public:
	CSoundscapeSystem( char const *name ) : CAutoGameSystemPerFrame( name )
	{
	}

	// game system
	virtual bool Init( void );
	virtual void Shutdown( void );
	virtual void FrameUpdatePostEntityThink( void );
	virtual void LevelInitPreEntity( void );
	virtual void LevelInitPostEntity();

	virtual void AddSoundscapeFile( const char *filename );
	int	GetSoundscapeIndex( const char *pName );
	bool IsValidIndex( int index );

	void FlushSoundscapes( void );
	void AddSoundscapeEntity( CEnvSoundscape *pSoundscape );
	void RemoveSoundscapeEntity( CEnvSoundscape *pSoundscape );
	void PrintDebugInfo( void );

	void AddSoundscapeSounds( KeyValues *pSoundscape, int soundscapeIndex );
	void PrecacheSounds( int soundscapeIndex );

private:
	CStringRegistry							m_soundscapes;
	int										m_soundscapeCount;
	CUtlVector< CEnvSoundscape * >			m_soundscapeEntities;
	CUtlVector<clusterSoundscapeList_t>		m_soundscapesInCluster;
	CUtlVector<unsigned short>				m_soundscapeIndexList;
	int										m_activeIndex;
	CUtlVector< CUtlVector< CUtlString > >	m_soundscapeSounds;
};

extern CSoundscapeSystem g_SoundscapeSystem;


#endif // SOUNDSCAPE_SYSTEM_H