@@ -164,7 +164,61 @@ namespace RTE {
164
164
165
165
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
166
166
167
- int SoundContainer::Save (Writer &writer) const { return 0 ; }
167
+ int SoundContainer::Save (Writer &writer) const {
168
+ Entity::Save (writer);
169
+
170
+ for (const std::vector<SoundData> &soundSet : m_SoundSets) {
171
+ writer.NewProperty (" AddSoundSet" );
172
+ writer.ObjectStart (" SoundSet" );
173
+
174
+ for (const SoundData &soundData : soundSet) {
175
+ writer.NewProperty (" AddSound" );
176
+ writer.ObjectStart (" ContentFile" );
177
+
178
+ writer.NewProperty (" FilePath" );
179
+ writer << soundData.SoundFile .GetDataPath ();
180
+ writer.NewProperty (" Offset" );
181
+ writer << soundData.Offset ;
182
+ writer.NewProperty (" MinimumAudibleDistance" );
183
+ writer << soundData.MinimumAudibleDistance ;
184
+ writer.NewProperty (" AttenuationStartDistance" );
185
+ writer << soundData.AttenuationStartDistance ;
186
+
187
+ writer.ObjectEnd ();
188
+ }
189
+ writer.ObjectEnd ();
190
+ }
191
+
192
+ writer.NewProperty (" CycleMode" );
193
+ bool t = m_SoundSelectionCycleMode == SoundCycleMode::MODE_FORWARDS;
194
+ std::list<std::pair<const std::string, SoundContainer::SoundCycleMode>>::const_iterator cycleModeMapEntry = std::find_if (c_CycleModeMap.begin (), c_CycleModeMap.end (), [&soundSelectionCycleMode = m_SoundSelectionCycleMode](auto element) { return element.second == soundSelectionCycleMode; });
195
+ if (cycleModeMapEntry != c_CycleModeMap.end ()) {
196
+ writer << cycleModeMapEntry->first ;
197
+ } else {
198
+ writer << m_SoundSelectionCycleMode;
199
+ }
200
+
201
+ writer.NewProperty (" Immobile" );
202
+ writer << m_Immobile;
203
+ writer.NewProperty (" AttenuationStartDistance" );
204
+ writer << m_AttenuationStartDistance;
205
+ writer.NewProperty (" LoopSetting" );
206
+ writer << m_Loops;
207
+
208
+ writer.NewProperty (" Priority" );
209
+ writer << m_Priority;
210
+ writer.NewProperty (" AffectedByGlobalPitch" );
211
+ writer << m_AffectedByGlobalPitch;
212
+
213
+ writer.NewProperty (" Pos" );
214
+ writer << m_Pos;
215
+ writer.NewProperty (" Volume" );
216
+ writer << m_Volume;
217
+ writer.NewProperty (" Pitch" );
218
+ writer << m_Pitch;
219
+
220
+ return 0 ;
221
+ }
168
222
169
223
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
170
224
0 commit comments