107
111
TextFormatParser tfp ( &s );
110
// auto_ptr<TextPropertyGroup> atpg ( tpg );
114
auto_ptr<TextPropertyGroup> atpg ( tpg );
112
116
PropertyReadingContainer pc ( "sounds", tpg );
114
118
pc.openBracket("shoot");
120
readLine( pc, "MACHINEGUN", SoundList::shooting, 6 );
115
122
readLine( pc, "CRUISEMISSILE", SoundList::shooting, 0 );
116
124
readLine( pc, "MINE", SoundList::shooting, 1 );
117
126
readLine( pc, "BOMB", SoundList::shooting, 2 );
118
readLine( pc, "AIRMISSILE", SoundList::shooting, 3 );
119
readLine( pc, "GROUNDMISSILE", SoundList::shooting, 4 );
128
readLine( pc, "LARGEMISSILE", SoundList::shooting, 3 );
130
readLine( pc, "SMALLMISSILE", SoundList::shooting, 4 );
120
132
readLine( pc, "TORPEDO", SoundList::shooting, 5 );
121
readLine( pc, "MACHINEGUN", SoundList::shooting, 6 );
122
134
readLine( pc, "CANNON", SoundList::shooting, 7 );
123
136
readLine( pc, "LASER", SoundList::shooting, 10);
124
137
pc.closeBracket();
126
140
pc.openBracket("move");
127
141
readLine( pc, "default", SoundList::moving, 0 );
128
143
readLine( pc, "LIGHT_TRACKED_VEHICLE", SoundList::moving, 1 );
129
145
readLine( pc, "MEDIUM_TRACKED_VEHICLE", SoundList::moving, 2 );
130
147
readLine( pc, "HEAVY_TRACKED_VEHICLE", SoundList::moving, 3 );
131
149
readLine( pc, "LIGHT_WHEELED_VEHICLE", SoundList::moving, 4 );
132
151
readLine( pc, "MEDIUM_WHEELED_VEHICLE", SoundList::moving, 5 );
133
153
readLine( pc, "HEAVY_WHEELED_VEHICLE", SoundList::moving, 6 );
134
155
readLine( pc, "TROOPER", SoundList::moving, 7 );
135
157
readLine( pc, "RAIL_VEHICLE", SoundList::moving, 8 );
136
159
readLine( pc, "MEDIUM_AIRCRAFT", SoundList::moving, 9 );
137
161
readLine( pc, "MEDIUM_SHIP", SoundList::moving, 10 );
138
163
readLine( pc, "TURRET", SoundList::moving, 11 );
139
165
readLine( pc, "LIGHT_AIRCRAFT", SoundList::moving, 12 );
140
167
readLine( pc, "HEAVY_AIRCRAFT", SoundList::moving, 13 );
141
169
readLine( pc, "LIGHT_SHIP", SoundList::moving, 14 );
142
171
readLine( pc, "HEAVY_SHIP", SoundList::moving, 15 );
143
173
readLine( pc, "HELICOPTER", SoundList::moving, 16 );
144
175
pc.closeBracket();
146
177
pc.openBracket("UserInterface");
147
178
readLine( pc, "ACKNOWLEDGE", SoundList::menu_ack );
148
179
pc.closeBracket();
149
181
readLine( pc, "CONQUER_BUILDING", SoundList::conquer_building );
150
183
readLine( pc, "UNIT_EXPLODES", SoundList::unitExplodes );
151
185
readLine( pc, "BUILDING_COLLAPSES", SoundList::buildingCollapses );
152
187
readLine( pc, "REFUEL", SoundList::refuel );
153
189
readLine( pc, "REPAIR", SoundList::repair );
191
readLine( pc, "JUMPDRIVE", SoundList::jumpdrive );
159
Sound* SoundList::getSound( const ASCString& filename, int fadeIn )
195
Sound* SoundList::getSound( const ASCString& filename )
197
if ( SoundSystem::getInstance()->isOff() )
161
200
displayLogMessage ( 5, " SoundList::getSound(1) : trying to acquire handle for sound %s \n", filename.c_str() );
163
202
if ( soundFiles.find ( filename ) == soundFiles.end() ) {
164
203
displayLogMessage ( 5, " Sound has not been loaded ...\n" );
165
Sound* s = new Sound ( filename, fadeIn );
206
if( filename.find(':') != ASCString::npos ) {
207
ASCString primary = filename.substr( 0, filename.find(':'));
208
ASCString secondary = filename.substr( filename.find(':')+1 );
209
displayLogMessage ( 8, " this is a multipart sound\n" );
210
s = new Sound( primary, secondary );
212
s = new Sound ( filename );
166
218
soundFiles[filename] = s;
168
220
displayLogMessage ( 5, " loading sound completed\n" );
178
Sound* SoundList::getSound( Sample snd, int subType, const ASCString& label )
230
Sound* SoundList::getSound( Sample snd, int subType, const ASCString& label, int height )
180
232
if ( SoundSystem::getInstance()->isOff() )
183
235
if ( label.find ( "." ) != ASCString::npos ) {
184
return getSound ( label, 0 );
236
return getSound ( label );
187
238
ASCString newlabel = copytoLower(label);
188
240
for ( vector<SoundAssignment>::iterator i = soundAssignments.begin(); i != soundAssignments.end(); i++ )
189
if ( snd == i->sample && subType == i->subType )
241
if ( snd == i->sample && subType == i->subType ) {
242
if ( height >= 0 && height <= 7 )
243
if ( i->snd.find( heightTags[height] ) != i->snd.end() ) {
244
displayLogMessage ( 10, ASCString(" SoundList::getSound(2) : heightlabel ") + heightTags[height] + " found, returning matching sound \n" );
245
return i->snd[heightTags[height]];
190
248
if ( newlabel.empty() || i->snd.find( newlabel ) == i->snd.end() ) {
191
249
displayLogMessage ( 10, " SoundList::getSound(2) : label " + label + " not found, returning default sound \n" );
192
250
if ( !i->defaultSound )