Debian Codegraph @

manage/shippage.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 SHIPPAGE_H
20 #define SHIPPAGE_H
21
22 #include "manage.h"
23 #include "ship.h"
24 #include "cfile.h"
25 #include "pstypes.h"
26
27 struct mngs_ship_page {
28 ship ship_struct;
29 char image_name[PAGENAME_LEN];
30 char dying_image_name[PAGENAME_LEN];
31 char weapon_name[MAX_PLAYER_WEAPONS][MAX_WB_GUNPOINTS][PAGENAME_LEN];
32 char fire_sound_name[MAX_PLAYER_WEAPONS][MAX_WB_FIRING_MASKS][PAGENAME_LEN];
33 char med_image_name[PAGENAME_LEN];
34 char lo_image_name[PAGENAME_LEN];
35 char firing_sound_name[MAX_PLAYER_WEAPONS][PAGENAME_LEN];
36 char release_sound_name[MAX_PLAYER_WEAPONS][PAGENAME_LEN];
37 char spew_powerup_name[MAX_PLAYER_WEAPONS][PAGENAME_LEN];
38 };
39
40 // Ship page functions
41 //---------------------------------------------------------------
42
43 // Given an open file pointer and a ship_page struct, writes that shippage out
44 void mng_WriteShipPage(CFILE *outfile, mngs_ship_page *shippage);
45
46 // Reads a ship page from an open file. Returns 0 on error.
47 int mng_ReadShipPage(CFILE *infile, mngs_ship_page *shippage);
48
49 // Given an open file pointer and a ship_page struct, writes that shippage out
50 void mng_WriteNewShipPage(CFILE *outfile, mngs_ship_page *shippage);
51
52 // Reads a ship page from an open file. Returns 0 on error.
53 int mng_ReadNewShipPage(CFILE *infile, mngs_ship_page *shippage);
54
55 // Reads in the shippage named "name" into shippage struct
56 // Returns 0 on error or couldn't find, else 1 if all is good
57 int mng_FindSpecificShipPage(char *name, mngs_ship_page *shippage, int offset = 0);
58
59 // Given a ship page, allocs a ship and calls AssignShipPageToShip to actually
60 // load model and values. Rturns ship handle on success, -1 if fail
61 int mng_SetAndLoadShip(mngs_ship_page *shippage, CFILE *infile);
62
63 // Given a shippage and a ship handle, attempts to make ship n correspond to
64 // to the shippage.
65 // Returns 1 on success, 0 otherwise
66 int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile = NULL);
67
68 // Copies values from a Ship into a ship_page
69 void mng_AssignShipToShipPage(int n, mngs_ship_page *shippage);
70
71 // Reads in a ship page from the local table file, superseding any ship
72 // already in RAM with that same name
73 void mng_LoadLocalShipPage(CFILE *);
74
75 // Reads in a page off the net
76 void mng_LoadNetShipPage(CFILE *, bool overlay = false);
77
78 #endif