Debian Codegraph @

manage/genericpage.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 GENERICPAGE_H
20 #define GENERICPAGE_H
21
22 #include "manage.h"
23 #include "cfile.h"
24 #include "pstypes.h"
25 #include "objinfo.h"
26 #include "robotfirestruct.h"
27
28 struct mngs_generic_page {
29 object_info objinfo_struct;
30 anim_elem anim[NUM_MOVEMENT_CLASSES];
31 otype_wb_info static_wb[MAX_WBS_PER_OBJ];
32 t_ai_info ai_info;
33 char image_name[PAGENAME_LEN];
34 char med_image_name[PAGENAME_LEN];
35 char lo_image_name[PAGENAME_LEN];
36 char sound_name[MAX_OBJ_SOUNDS][PAGENAME_LEN];
37 char ai_sound_name[MAX_AI_SOUNDS][PAGENAME_LEN];
38 char weapon_name[MAX_WBS_PER_OBJ][MAX_WB_GUNPOINTS][PAGENAME_LEN];
39 char fire_sound_name[MAX_WBS_PER_OBJ][MAX_WB_FIRING_MASKS][PAGENAME_LEN];
40 char anim_sound_name[NUM_MOVEMENT_CLASSES][NUM_ANIMS_PER_CLASS][PAGENAME_LEN];
41 char dspew_name[MAX_DSPEW_TYPES][PAGENAME_LEN];
42 };
43
44 // Generic page functions
45 //---------------------------------------------------------------
46
47 // Given an open file pointer and a generic_page struct, writes that genericpage out
48 void mng_WriteGenericPage(CFILE *outfile, mngs_generic_page *genericpage);
49
50 // Reads a generic page from an open file. Returns 0 on error.
51 int mng_ReadGenericPage(CFILE *infile, mngs_generic_page *genericpage);
52
53 // Given an open file pointer and a generic_page struct, writes that genericpage out
54 void mng_WriteNewGenericPage(CFILE *outfile, mngs_generic_page *genericpage);
55
56 // Reads a generic page from an open file. Returns 0 on error.
57 int mng_ReadNewGenericPage(CFILE *infile, mngs_generic_page *genericpage);
58
59 // Reads in the genericpage named "name" into genericpage struct
60 // Returns 0 on error or couldn't find, else 1 if all is good
61 int mng_FindSpecificGenericPage(char *name, mngs_generic_page *genericpage, int offset = 0);
62
63 // Given a generic page, allocs a generic and calls AssignGenericPageToGeneric to actually
64 // load model and values. Rturns generic handle on success, -1 if fail
65 int mng_SetAndLoadGeneric(mngs_generic_page *genericpage, CFILE *infile = NULL);
66
67 // Given a genericpage and a generic handle, attempts to make generic n correspond to
68 // to the genericpage.
69 // Returns 1 on success, 0 otherwise
70 int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE *infile = NULL);
71
72 // Copies values from a Generic into a generic_page
73 void mng_AssignObjInfoToGenericPage(int n, mngs_generic_page *genericpage);
74
75 // Reads in a generic page from the local table file, superseding any generic
76 // already in RAM with that same name
77 void mng_LoadLocalGenericPage(CFILE *);
78
79 // Reads in a page off the net
80 void mng_LoadNetGenericPage(CFILE *, bool overlay = false);
81
82 // First searches through the object index to see if the object is already
83 // loaded. If not, searches in the table file and loads it.
84 // Returns index of object found, -1 if not
85 int mng_GetGuaranteedGenericPage(char *name, CFILE *infile);
86
87 #endif