Allocs a sound file for use, returns -1 if error, else index on success
| 303 | |
| 304 | // Allocs a sound file for use, returns -1 if error, else index on success |
| 305 | int AllocSoundFile() { |
| 306 | for (int i = 0; i < MAX_SOUND_FILES; i++) { |
| 307 | if (SoundFiles[i].used == 0) { |
| 308 | memset(&SoundFiles[i], 0, sizeof(sound_file_info)); |
| 309 | SoundFiles[i].used = 1; |
| 310 | |
| 311 | Num_sound_files++; |
| 312 | return i; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | Int3(); // No sound files free! |
| 317 | return -1; |
| 318 | } |
| 319 | |
| 320 | // Frees sound index n |
| 321 | void FreeSoundFile(int n) { |