Debian Codegraph @

manage/soundpage.h

raw symbols SCIP
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
19 #ifndef SOUNDPAGE_H
20 #define SOUNDPAGE_H
21
22 #include "manage.h"
23 #include "soundload.h"
24 #include "cfile.h"
25 #include "pstypes.h"
26
27 struct mngs_sound_page {
28 sound_info sound_struct;
29 char raw_name[PAGENAME_LEN];
30 };
31
32 // Sound page functions
33 //---------------------------------------------------------------
34
35 // Given an open file pointer and a sound_page struct, writes that soundpage out
36 void mng_WriteSoundPage(CFILE *outfile, mngs_sound_page *soundpage);
37
38 // Reads a sound page from an open file. Returns 0 on error.
39 int mng_ReadSoundPage(CFILE *infile, mngs_sound_page *soundpage);
40 // Given an open file pointer and a sound_page struct, writes that soundpage out
41 void mng_WriteNewSoundPage(CFILE *outfile, mngs_sound_page *soundpage);
42
43 // Reads a sound page from an open file. Returns 0 on error.
44 int mng_ReadNewSoundPage(CFILE *infile, mngs_sound_page *soundpage);
45
46 // Reads in the soundpage named "name" into soundpage struct
47 // Returns 0 on error or couldn't find, else 1 if all is good
48 int mng_FindSpecificSoundPage(char *name, mngs_sound_page *soundpage, int offset = 0);
49
50 // Given a sound page, allocs a sound and calls AssignSoundPageToSound to actually
51 // load model and values. Rturns sound handle on success, -1 if fail
52 int mng_SetAndLoadSound(mngs_sound_page *soundpage);
53
54 // Given a soundpage and a sound handle, attempts to make sound n correspond to
55 // to the soundpage.
56 // Returns 1 on success, 0 otherwise
57 int mng_AssignSoundPageToSound(mngs_sound_page *soundpage, int n);
58
59 // Copies values from a Sound into a sound_page
60 void mng_AssignSoundToSoundPage(int n, mngs_sound_page *soundpage);
61
62 // Reads in a sound page from the local table file, superseding any sound
63 // already in RAM with that same name
64 void mng_LoadLocalSoundPage(CFILE *);
65
66 // Reads in a page off the net
67 void mng_LoadNetSoundPage(CFILE *, bool overlay = false);
68
69 // First searches through the sound index to see if the sound is already
70 // loaded. If not, searches in the table file and loads it.
71 // Returns index of sound if found, -1 if not
72 int mng_GetGuaranteedSoundPage(char *name, CFILE *infile = NULL);
73
74 #endif