Debian Codegraph @

manage/weaponpage.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
20 #ifndef WEAPONPAGE_H
21 #define WEAPONPAGE_H
22
23 #include "manage.h"
24 #include "weapon.h"
25 #include "cfile.h"
26 #include "pstypes.h"
27
28 struct mngs_weapon_page {
29 weapon weapon_struct;
30 char hud_image_name[PAGENAME_LEN];
31 char fire_image_name[PAGENAME_LEN];
32 char explode_image_name[PAGENAME_LEN];
33 char smoke_image_name[PAGENAME_LEN];
34 char scorch_image_name[PAGENAME_LEN];
35 char icon_name[PAGENAME_LEN];
36 char spawn_name[PAGENAME_LEN];
37 char alternate_spawn_name[PAGENAME_LEN];
38 char particle_name[PAGENAME_LEN];
39 char robot_spawn_name[PAGENAME_LEN];
40 char sound_name[MAX_WEAPON_SOUNDS][PAGENAME_LEN];
41 };
42
43 // Weapon page functions
44 //---------------------------------------------------------------
45
46 // Given an open file pointer and a weapon_page struct, writes that weaponpage out
47 void mng_WriteWeaponPage(CFILE *outfile, mngs_weapon_page *weaponpage);
48
49 // Reads a weapon page from an open file. Returns 0 on error.
50 int mng_ReadWeaponPage(CFILE *infile, mngs_weapon_page *weaponpage);
51
52 // Given an open file pointer and a weapon_page struct, writes that weaponpage out
53 void mng_WriteNewWeaponPage(CFILE *outfile, mngs_weapon_page *weaponpage);
54
55 // Reads a weapon page from an open file. Returns 0 on error.
56 int mng_ReadNewWeaponPage(CFILE *infile, mngs_weapon_page *weaponpage);
57
58 // Reads in the weaponpage named "name" into weaponpage struct
59 // Returns 0 on error or couldn't find, else 1 if all is good
60 int mng_FindSpecificWeaponPage(char *name, mngs_weapon_page *weaponpage, int offset = 0);
61 int mng_FindSpecificWeaponPage(char *name, mngs_weapon_page *weaponpage);
62
63 // Given a weapon page, allocs a weapon and calls AssignWeaponPageToWeapon to actually
64 // load model and values. Rturns weapon handle on success, -1 if fail
65 int mng_SetAndLoadWeapon(mngs_weapon_page *weaponpage, CFILE *infile);
66
67 // Given a weaponpage and a weapon handle, attempts to make weapon n correspond to
68 // to the weaponpage.
69 // Returns 1 on success, 0 otherwise
70 int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *infile = NULL);
71
72 // Copies values from a Weapon into a weapon_page
73 void mng_AssignWeaponToWeaponPage(int n, mngs_weapon_page *weaponpage);
74
75 // Reads in a weapon page from the local table file, superseding any weapon
76 // already in RAM with that same name
77 void mng_LoadLocalWeaponPage(CFILE *);
78
79 // Reads in a page off the net
80 void mng_LoadNetWeaponPage(CFILE *, bool overlay = false);
81
82 int mng_GetGuaranteedWeaponPage(char *name, CFILE *infile = NULL);
83
84 #endif