Debian Codegraph @

manage/gamefilepage.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 GAMEFILEPAGE_H
20 #define GAMEFILEPAGE_H
21
22 #include "manage.h"
23 #include "cfile.h"
24 #include "pstypes.h"
25 #include "gamefile.h"
26
27 struct mngs_gamefile_page {
28 gamefile gamefile_struct;
29 };
30
31 // Gamefile page functions
32 //---------------------------------------------------------------
33
34 // Given an open file pointer and a gamefile_page struct, writes that gamefile page out
35 void mng_WriteGamefilePage(CFILE *outfile, mngs_gamefile_page *gamefilepage);
36
37 // Reads a gamefile page from an open file. Returns 0 on error.
38 int mng_ReadGamefilePage(CFILE *infile, mngs_gamefile_page *gamefilepage);
39
40 // Given an open file pointer and a gamefile_page struct, writes that gamefile page out
41 void mng_WriteNewGamefilePage(CFILE *outfile, mngs_gamefile_page *gamefilepage);
42
43 // Reads a gamefile page from an open file. Returns 0 on error.
44 int mng_ReadNewGamefilePage(CFILE *infile, mngs_gamefile_page *gamefilepage);
45
46 // Reads in the gamefilepage named "name" into gamefilepage struct
47 // Returns 0 on error or couldn't find, else 1 if all is good
48 int mng_FindSpecificGamefilePage(char *name, mngs_gamefile_page *gamefilepage, int offset = 0);
49
50 // Given a gamefile page, allocs a gamefile and calls AssignGamefilePageToGamefile to actually
51 // load bitmaps and values. Rturns gamefile handle on success, -1 if fail
52 int mng_SetAndLoadGamefile(mngs_gamefile_page *gamefilepage);
53
54 // Given a gamefilepage and a gamefile handle, attempts to make gamefile n correspond to
55 // to the gamefilepage.
56 // Returns 1 on success, 0 otherwise
57 int mng_AssignGamefilePageToGamefile(mngs_gamefile_page *gamefilepage, int n);
58
59 // Copies values from a gamefile into a gamefile_page
60 void mng_AssignGamefileToGamefilePage(int n, mngs_gamefile_page *gamefilepage);
61
62 // Reads in a gamefile page from the local table file, superseding any gamefile
63 // already in RAM with that same name
64 void mng_LoadLocalGamefilePage(CFILE *);
65
66 // Reads in a page off the net
67 void mng_LoadNetGamefilePage(CFILE *, bool overlay = false);
68
69 // First searches through the gamefile index to see if the gamefile is already
70 // loaded. If not, searches in the table file and loads it.
71 // Returns index of gamefile if found, -1 if not
72 int mng_GetGuaranteedGamefilePage(char *name, CFILE *infile = NULL);
73
74 #endif