Debian Codegraph @

manage/powerpage.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 POWERPAGE_H
20 #define POWERPAGE_H
21
22 #include "manage.h"
23 #include "cfile.h"
24 #include "pstypes.h"
25 #include "powerup.h"
26
27 struct mngs_power_page {
28 powerup powerup_struct;
29 char image_name[PAGENAME_LEN];
30 char sound_name[MAX_POWERUP_SOUNDS][PAGENAME_LEN];
31 };
32
33 // Powerup page functions
34 //---------------------------------------------------------------
35
36 // Given an open file pointer and a power_page struct, writes that power page out
37 void mng_WritePowerPage(CFILE *outfile, mngs_power_page *powpage);
38
39 // Reads a powerup page from an open file. Returns 0 on error.
40 int mng_ReadPowerPage(CFILE *infile, mngs_power_page *powpage);
41
42 // Given a power handle, searches the table file and replaces the powerup with the same name
43 // If local=1, then does it to the users local copy
44 // Returns 0 on error, else 1 if all is good
45 int mng_ReplacePowPage(char *name, int handle, int local);
46
47 // Given a powerup name, finds it in the table file and deletes it
48 // If local is 1, deletes from the local table file
49 int mng_DeletePowPage(char *name, int local);
50
51 // Reads in the powpage named "name" into powpage struct
52 // Returns 0 on error or couldn't find, else 1 if all is good
53 int mng_FindSpecificPowPage(char *name, mngs_power_page *powpage, int offset = 0);
54
55 // Given a power page, allocs a powerup and calls AssignPowPageToPowerup to actually
56 // load bitmaps and values. Rturns powerup handle on success, -1 if fail
57 int mng_SetAndLoadPowerup(mngs_power_page *powpage);
58
59 // Given a powpage and a powerup handle, attempts to make powerup n correspond to
60 // to the powpage.
61 // Returns 1 on success, 0 otherwise
62 int mng_AssignPowPageToPowerup(mngs_power_page *powpage, int n);
63
64 // Copies values from a powerup into a power_page
65 void mng_AssignPowerupToPowPage(int n, mngs_power_page *powpage);
66
67 // Reads in a power page from the local table file, superseding any powerup
68 // already in RAM with that same name
69 void mng_LoadLocalPowerupPage(CFILE *);
70
71 // Reads in a page off the net
72 void mng_LoadNetPowerupPage(CFILE *);
73
74 // First searches through the powerup index to see if the powerup is already
75 // loaded. If not, searches in the table file and loads it.
76 // Returns index of powerup if found, -1 if not
77 int mng_GetGuaranteedPowerupPage(char *name, CFILE *infile = NULL);
78
79 #endif