1 #ifndef __GNUC__
2 #pragma once
3 #endif
4 #ifndef __XR_SCENE_SOUND_SRCS_H__
5 #define __XR_SCENE_SOUND_SRCS_H__
6 
7 #include "xr_vector2.h"
8 #include "xr_vector3.h"
9 #include "xr_scene_objects.h"
10 
11 namespace xray_re {
12 
13 // ESoundSource
14 const uint16_t SOUNDSRC_VERSION = 0x14;
15 
16 enum {
17 	SOUNDSRC_TYPE_0	= 0,
18 };
19 
20 enum {
21 	SOUNDSRC_CHUNK_VERSION		= 0x1001,
22 	SOUNDSRC_CHUNK_TYPE		= 0x1002,
23 	SOUNDSRC_CHUNK_SOURCE_NAME	= 0x1003,
24 	SOUNDSRC_CHUNK_PARAMS_0		= 0x1004,
25 	SOUNDSRC_CHUNK_FLAGS		= 0x1005,	// really?
26 	SOUNDSRC_CHUNK_PARAMS_1		= 0x1006,
27 	SOUNDSRC_CHUNK_PARAMS_2		= 0x1007,
28 	SOUNDSRC_CHUNK_TIME		= 0x1008,
29 };
30 
31 class xr_sound_src_object: public xr_custom_object {
32 public:
33 			xr_sound_src_object(xr_scene& scene);
34 	virtual		~xr_sound_src_object();
35 	virtual void	load(xr_reader& r);
36 	virtual void	save(xr_writer& w) const;
37 
38 	virtual void		save_v12(xr_ini_writer* w) const;
39 
40 	uint32_t&	flags();
41 	uint8_t&	type();
42 	std::string&	source_name();
43 	fvector3&	sound_pos();
44 	float&		volume();
45 	float&		frequency();
46 	fvector2&	pause_time();
47 	fvector2&	active_time();
48 	fvector2&	play_time();
49 
50 private:
51 	uint32_t	m_flags;
52 	uint8_t		m_type;
53 
54 	std::string	m_source_name;
55 
56 	fvector3	m_sound_pos;	// not sure. it might duplicate the xr_custom_object::m_co_position.
57 	float		m_volume;
58 	float		m_frequency;
59 	float		m_min_dist;
60 	float		m_max_dist;
61 	float		m_max_ai_dist;
62 
63 	fvector2	m_pause_time;
64 	fvector2	m_active_time;
65 	fvector2	m_play_time;
66 };
67 
flags()68 inline uint32_t& xr_sound_src_object::flags() { return m_flags; }
type()69 inline uint8_t& xr_sound_src_object::type() { return m_type; }
source_name()70 inline std::string& xr_sound_src_object::source_name() { return m_source_name; }
sound_pos()71 inline fvector3& xr_sound_src_object::sound_pos() { return m_sound_pos; }
volume()72 inline float& xr_sound_src_object::volume() { return m_volume; }
frequency()73 inline float& xr_sound_src_object::frequency() { return m_frequency; }
pause_time()74 inline fvector2& xr_sound_src_object::pause_time() { return m_pause_time; }
active_time()75 inline fvector2& xr_sound_src_object::active_time() { return m_active_time; }
play_time()76 inline fvector2& xr_sound_src_object::play_time() { return m_play_time; }
77 
78 
79 // ESceneSoundSrcTools
80 class xr_scene_sound_srcs: public xr_scene_objects {
81 public:
82 			xr_scene_sound_srcs(xr_scene& scene);
83 	virtual		~xr_scene_sound_srcs();
84 	virtual void	load(xr_reader& r);
85 	virtual void	save(xr_writer& w) const;
86 
87 	virtual void		save_v12(xr_ini_writer* w) const;
88 };
89 
90 } // end of namespace xray_re
91 
92 #endif
93