| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/ambient.h $ |
| 21 | * $Revision: 4 $ |
| 22 | * $Date: 2/12/99 5:33p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Header for ambient sound system |
| 26 | * |
| 27 | * $Log: /DescentIII/main/ambient.h $ |
| 28 | * |
| 29 | * 4 2/12/99 5:33p Kevin |
| 30 | * Added table file flag thingy |
| 31 | * |
| 32 | * 3 2/10/99 2:31p Matt |
| 33 | * Deleted some unused code and fixed a slightly stupid thing. |
| 34 | * |
| 35 | * 2 8/20/98 12:35p Matt |
| 36 | * Added nice editing for ambient sound patterns |
| 37 | * |
| 38 | * 1 8/17/98 7:00p Matt |
| 39 | * Added ambient sound system |
| 40 | * |
| 41 | */ |
| 42 | |
| 43 | #ifndef _AMBIENT_H |
| 44 | #define _AMBIENT_H |
| 45 | |
| 46 | #include "manage.h" |
| 47 | |
| 48 | // An Ambient Sound Element, one part of an Ambient Sound Pattern (ASP) |
| 49 | struct ase { |
| 50 | int handle; // the sample's handle |
| 51 | float min_volume, max_volume; // minimum and maximum volume |
| 52 | int probability; // between 0 and 100 |
| 53 | }; |
| 54 | |
| 55 | // An Ambient Sound Element, one part of an Ambient Sound Pattern (ASP) |
| 56 | struct asp { |
| 57 | char name[PAGENAME_LEN]; // the name of this pattern |
| 58 | float min_delay, max_delay; // delay time between sounds |
| 59 | int num_sounds; // how many sounds in this pattern |
| 60 | ase *sounds; // array of sounds |
| 61 | float delay; // how long until the next sound |
| 62 | }; |
| 63 | |
| 64 | extern int Num_ambient_sound_patterns; |
| 65 | extern asp Ambient_sound_patterns[]; |
| 66 | |
| 67 | #define AMBIENT_FILE_NAME "ambient.dat" |
| 68 | /* |
| 69 | $$TABLE_GENERIC "ambient.dat" |
| 70 | */ |
| 71 | |
| 72 | // Initialize the ambient sound system |
| 73 | void InitAmbientSoundSystem(); |
| 74 | |
| 75 | // Does the ambient sound processing for one frame, maybe playing a sound or two |
| 76 | void DoAmbientSounds(); |
| 77 | |
| 78 | // Initializes the ambient sounds for the current level |
| 79 | void InitAmbientSounds(); |
| 80 | |
| 81 | // Return the index of a named ambient sound pattern |
| 82 | // Returns number, or -1 if can't find |
| 83 | int FindAmbientSoundPattern(char *aspname); |
| 84 | |
| 85 | // Returns a pointer to the name of the specified ambient sound pattern |
| 86 | char *AmbientSoundPatternName(int n); |
| 87 | |
| 88 | // Reads data from the ambient sound data file |
| 89 | void ReadAmbientData(); |
| 90 | |
| 91 | // Writes data from the ambient sound data file |
| 92 | void WriteAmbientData(); |
| 93 | |
| 94 | #endif |