Debian Codegraph @

lib/polymodel_external.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 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/lib/polymodel_external.h $
21 * $Revision: 7 $
22 * $Date: 10/02/01 8:56a $
23 * $Author: Matt $
24 *
25 * Polymodel defines, flags and structs (anything that could be exported to a DLL)
26 *
27 * $Log: /DescentIII/Main/lib/polymodel_external.h $
28 *
29 * 7 10/02/01 8:56a Matt
30 * Increased MAX_POLY_MODELS from 1000 to 1200
31 *
32 * 6 7/08/99 5:47p Jason
33 * changes for new bumpmapping system in 1.1 update patch
34 *
35 * 5 6/08/99 1:00p Jason
36 * changes for bumpmapping
37 *
38 * 4 4/20/99 1:02p 3dsmax
39 * fixed polymodel loimt
40 *
41 * 3 4/08/99 11:45a Jason
42 * greatly sped up the time it takes to get model anges/positions by
43 * precalculation
44 *
45 * 2 1/21/99 11:15p Jeff
46 * pulled out some structs and defines from header files and moved them
47 * into seperate header files so that multiplayer dlls don't require major
48 * game headers, just those new headers. Side effect is a shorter build
49 * time. Also cleaned up some header file #includes that weren't needed.
50 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
51 * manage.h and multi.h
52 *
53 * $NoKeywords: $
54 */
55
56 #ifndef POLYMODEL_EXTERNAL_H_
57 #define POLYMODEL_EXTERNAL_H_cxx . . $ `lib/polymodel_external.h:57:9`!
58
59 #include <cstdint>
60
61 #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/
62 #include "manage_external.h"cxx . . $ `<file>/lib/manage_external.h`/
63 #include "robotfirestruct.h"cxx . . $ `<file>/lib/robotfirestruct.h`/
64 #include "vecmat_external.h"cxx . . $ `<file>/lib/vecmat_external.h`/
65
66 #define MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`! 1200
67
68 #define MAX_MODEL_TEXTUREScxx . . $ `lib/polymodel_external.h:68:9`! 35
69 #define MAX_POLYGON_VECScxx . . $ `lib/polymodel_external.h:69:9`! 2500
70 #define MAX_DETAIL_LEVELScxx . . $ `lib/polymodel_external.h:70:9`! 3
71 #define MAX_PROP_LENcxx . . $ `lib/polymodel_external.h:71:9`! 256
72 #define MAX_NAME_LENcxx . . $ `lib/polymodel_external.h:72:9`! 32
73
74 #define MAX_GROUND_PLANES_PER_MODELcxx . . $ `lib/polymodel_external.h:74:9`! 10
75 #define MAX_GUNS_PER_MODELcxx . . $ `lib/polymodel_external.h:75:9`! 64
76 #define MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`! 30
77 #define MAX_POINTS_PER_SUBOBJECTcxx . . $ `lib/polymodel_external.h:77:9`! 300
78
79 // Subobject flags
80 #define SOF_ROTATEcxx . . $ `lib/polymodel_external.h:80:9`! 0x01 // This subobject is a rotator
81 #define SOF_TURRETcxx . . $ `lib/polymodel_external.h:81:9`! 0x02 // This subobject is a turret that tracks
82 #define SOF_SHELLcxx . . $ `lib/polymodel_external.h:82:9`! 0x04 // This subobject is a door housing
83 #define SOF_FRONTFACEcxx . . $ `lib/polymodel_external.h:83:9`! 0x08 // This subobject contains the front face for the door
84 #define SOF_MONITOR1cxx . . $ `lib/polymodel_external.h:84:9`! 0x010 // This subobject contains it's first monitor
85 #define SOF_MONITOR2cxx . . $ `lib/polymodel_external.h:85:9`! 0x020 // This subobject contains it's second monitor
86 #define SOF_MONITOR3cxx . . $ `lib/polymodel_external.h:86:9`! 0x040 // This subobject contains it's third monitor
87 #define SOF_MONITOR4cxx . . $ `lib/polymodel_external.h:87:9`! 0x080 // This subobject contains it's fourth monitor
88 #define SOF_MONITOR5cxx . . $ `lib/polymodel_external.h:88:9`! 0x0100
89 #define SOF_MONITOR6cxx . . $ `lib/polymodel_external.h:89:9`! 0x0200
90 #define SOF_MONITOR7cxx . . $ `lib/polymodel_external.h:90:9`! 0x0400
91 #define SOF_MONITOR8cxx . . $ `lib/polymodel_external.h:91:9`! 0x0800
92 #define SOF_FACINGcxx . . $ `lib/polymodel_external.h:92:9`! 0x01000 // This subobject always faces you
93 #define SOF_VIEWERcxx . . $ `lib/polymodel_external.h:93:9`! 0x02000 // This subobject is marked as a 'viewer'.
94 #define SOF_LAYERcxx . . $ `lib/polymodel_external.h:94:9`! 0x04000 // This subobject is marked as part of possible secondary model rendering.
95 #define SOF_WBcxx . . $ `lib/polymodel_external.h:95:9`! 0x08000 // This subobject is part of a weapon battery
96 #define SOF_GLOWcxx . . $ `lib/polymodel_external.h:96:9`! 0x0200000 // This subobject glows
97 #define SOF_CUSTOMcxx . . $ `lib/polymodel_external.h:97:9`! 0x0400000 // This subobject has textures/colors that are customizable
98 #define SOF_THRUSTERcxx . . $ `lib/polymodel_external.h:98:9`! 0x0800000 // This is a thruster subobject
99 #define SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`! 0x01000000 // This object jitters by itself
100 #define SOF_HEADLIGHTcxx . . $ `lib/polymodel_external.h:100:9`! 0x02000000 // This suboject is a headlight
101
102 // gun bank
103 struct w_bankcxx . . $ w_bank# {
104 int parentcxx . . $ w_bank#parent.;
105 vectorcxx . . $ vector# pntcxx . . $ w_bank#pnt.;
106 vectorcxx . . $ vector# normcxx . . $ w_bank#norm.;
107 };
108
109 // attach bank
110 struct a_bankcxx . . $ a_bank# {
111 int parentcxx . . $ a_bank#parent.;
112 vectorcxx . . $ vector# pntcxx . . $ a_bank#pnt.;
113 vectorcxx . . $ vector# normcxx . . $ a_bank#norm.;
114 vectorcxx . . $ vector# uveccxx . . $ a_bank#uvec.;
115 bool f_uveccxx . . $ a_bank#f_uvec.;
116 };
117
118 struct lightmap_object_facecxx . . $ lightmap_object_face# {
119 uint8_tcxx . . $ uint8_t# num_vertscxx . . $ lightmap_object_face#num_verts.;
120 uint16_tcxx . . $ uint16_t# lmi_handlecxx . . $ lightmap_object_face#lmi_handle.;
121 vectorcxx . . $ vector# rveccxx . . $ lightmap_object_face#rvec., uveccxx . . $ lightmap_object_face#uvec.;
122 float *u2cxx . . $ lightmap_object_face#u2., *v2cxx . . $ lightmap_object_face#v2.;
123 };
124
125 struct lightmap_objectcxx . . $ lightmap_object# {
126 uint8_tcxx . . $ uint8_t# num_modelscxx . . $ lightmap_object#num_models.;
127
128 int16_tcxx . . $ int16_t# num_facescxx . . $ lightmap_object#num_faces.[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
129 lightmap_object_facecxx . . $ lightmap_object_face# *lightmap_facescxx . . $ lightmap_object#lightmap_faces.[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
130 uint8_tcxx . . $ uint8_t# usedcxx . . $ lightmap_object#used.;
131
132 };
133
134 struct polyfacecxx . . $ polyface# {
135 int8_tcxx . . $ int8_t# nvertscxx . . $ polyface#nverts.;
136 int16_tcxx . . $ int16_t# *vertnumscxx . . $ polyface#vertnums.;
137 float *ucxx . . $ polyface#u.;
138 float *vcxx . . $ polyface#v.;
139
140 // float *u2,*v2; // For lightmaps only
141
142 ddgr_colorcxx . . $ ddgr_color# colorcxx . . $ polyface#color.;
143 int16_tcxx . . $ int16_t# texnumcxx . . $ polyface#texnum.;
144
145 vectorcxx . . $ vector# normalcxx . . $ polyface#normal.;
146 };
147
148 // glow info
149 struct glowinfocxx . . $ glowinfo# {
150 float glow_rcxx . . $ glowinfo#glow_r., glow_gcxx . . $ glowinfo#glow_g., glow_bcxx . . $ glowinfo#glow_b., glow_sizecxx . . $ glowinfo#glow_size., glow_lengthcxx . . $ glowinfo#glow_length.;
151 vectorcxx . . $ vector# centercxx . . $ glowinfo#center., normalcxx . . $ glowinfo#normal.;
152 };
153
154 // bsp information
155 struct bsp_infocxx . . $ bsp_info# {
156 char namecxx . . $ bsp_info#name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; // name of the subsystem. Probably displayed on HUD
157 int movement_typecxx . . $ bsp_info#movement_type.; //-1 if no movement, otherwise rotational or positional movement -- subobjects only
158 int movement_axiscxx . . $ bsp_info#movement_axis.; // which axis this subobject moves or rotates on.
159 int tree_offsetcxx . . $ bsp_info#tree_offset.; // offset of tree data (children included) into the model_data
160 int data_offsetcxx . . $ bsp_info#data_offset.; // offset of data into the model_data
161 vectorcxx . . $ vector# offsetcxx . . $ bsp_info#offset.; // 3d offset from parent object
162 vectorcxx . . $ vector# normcxx . . $ bsp_info#norm.; // norm for sep plane
163 float dcxx . . $ bsp_info#d.; // norm d for sep plane
164 vectorcxx . . $ vector# pntcxx . . $ bsp_info#pnt.; // point for sep plane
165 vectorcxx . . $ vector# geometric_centercxx . . $ bsp_info#geometric_center.; // geometric center of this subobject. In the same Frame Of
166 // Reference as all other vertices in this submodel. (Relative to pivot point)
167 float radcxx . . $ bsp_info#rad.; // radius for each submodel
168
169 vectorcxx . . $ vector# *vertscxx . . $ bsp_info#verts.; // vertices for the submodel (NEWSTYLE)
170 vectorcxx . . $ vector# *vertnormscxx . . $ bsp_info#vertnorms.;
171 float *alphacxx . . $ bsp_info#alpha.;
172 polyfacecxx . . $ polyface# *facescxx . . $ bsp_info#faces.; // faces for the submodel (NEWSTYLE)
173 vectorcxx . . $ vector# *face_mincxx . . $ bsp_info#face_min.;
174 vectorcxx . . $ vector# *face_maxcxx . . $ bsp_info#face_max.;
175
176 int16_tcxx . . $ int16_t# *vertnum_memorycxx . . $ bsp_info#vertnum_memory.;
177 float *u_memorycxx . . $ bsp_info#u_memory.;
178 float *v_memorycxx . . $ bsp_info#v_memory.;
179
180 int nvertscxx . . $ bsp_info#nverts.;
181 int num_facescxx . . $ bsp_info#num_faces.; // amount of faces (NEWSTYLE);
182
183 int8_tcxx . . $ int8_t# childrencxx . . $ bsp_info#children.[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!]; // children of this submodel
184 int parentcxx . . $ bsp_info#parent.; // what is parent for each submodel
185 uint8_tcxx . . $ uint8_t# num_childrencxx . . $ bsp_info#num_children.;
186
187 vectorcxx . . $ vector# mincxx . . $ bsp_info#min.;
188 vectorcxx . . $ vector# maxcxx . . $ bsp_info#max.;
189 int blown_offcxx . . $ bsp_info#blown_off.; // If set, this subobject is blown off. Stuffed by model_set_instance
190
191 angveccxx . . $ angvec# angscxx . . $ bsp_info#angs.;
192 matrixcxx . . $ matrix# mod_matrixcxx . . $ bsp_info#mod_matrix.; // The angles from parent. Stuffed by model_set_instance
193 vectorcxx . . $ vector# mod_poscxx . . $ bsp_info#mod_pos.; // The modified position of this object. Used for positional interpolation
194
195 vectorcxx . . $ vector# *keyframe_axiscxx . . $ bsp_info#keyframe_axis.; // the axis of rotation for each keyframe
196 int *keyframe_anglescxx . . $ bsp_info#keyframe_angles.; // The destination angles for each key frame
197 vectorcxx . . $ vector# *keyframe_poscxx . . $ bsp_info#keyframe_pos.;
198 matrixcxx . . $ matrix# *keyframe_matrixcxx . . $ bsp_info#keyframe_matrix.; // the combined rotation matrices up to frame n
199 uint16_tcxx . . $ uint16_t# *tick_pos_remapcxx . . $ bsp_info#tick_pos_remap.; // For looking up keyframes fast
200 uint16_tcxx . . $ uint16_t# *tick_ang_remapcxx . . $ bsp_info#tick_ang_remap.; // For looking up keyframes fast
201 int *rot_start_timecxx . . $ bsp_info#rot_start_time.;
202 int *pos_start_timecxx . . $ bsp_info#pos_start_time.;
203
204 int num_key_anglescxx . . $ bsp_info#num_key_angles.;
205 int num_key_poscxx . . $ bsp_info#num_key_pos.;
206
207 int flagscxx . . $ bsp_info#flags.; // see SOF_FLAGS above
208
209 int rot_track_mincxx . . $ bsp_info#rot_track_min., rot_track_maxcxx . . $ bsp_info#rot_track_max.;
210 int pos_track_mincxx . . $ bsp_info#pos_track_min., pos_track_maxcxx . . $ bsp_info#pos_track_max.;
211
212 float rpscxx . . $ bsp_info#rps.; // if SOF_ROTATE or SOF_TURRET is set, this is the rotations per second
213 float fovcxx . . $ bsp_info#fov.; // Half the normalized angle that this turret is allowed to turn (amount in each direction)
214 float think_intervalcxx . . $ bsp_info#think_interval.; // How quickly a turret updates which way it should move
215
216 float normalized_anglecxx . . $ bsp_info#normalized_angle.;
217
218 glowinfocxx . . $ glowinfo# *glow_infocxx . . $ bsp_info#glow_info.;
219 };
220
221 #define PMF_LIGHTMAP_REScxx . . $ `lib/polymodel_external.h:221:9`! 1
222 #define PMF_TIMEDcxx . . $ `lib/polymodel_external.h:222:9`! 2 // Uses new timed animation
223 #define PMF_ALPHAcxx . . $ `lib/polymodel_external.h:223:9`! 4 // Has alpha per vertex qualities
224 #define PMF_FACINGcxx . . $ `lib/polymodel_external.h:224:9`! 8 // Has a submodel that is always facing
225 #define PMF_NOT_RESIDENTcxx . . $ `lib/polymodel_external.h:225:9`! 16 // This polymodel is not in memory
226 #define PMF_SIZE_COMPUTEDcxx . . $ `lib/polymodel_external.h:226:9`! 32 // This polymodel's size is computed
227
228 // used to describe a polygon model
229 struct poly_modelcxx . . $ poly_model# {
230 uint16_tcxx . . $ uint16_t# usedcxx . . $ poly_model#used.;
231
232 int flagscxx . . $ poly_model#flags.; // PMF_flags, see above
233 uint8_tcxx . . $ uint8_t# new_stylecxx . . $ poly_model#new_style.; // if 1, then this polymodel is in the new outrage format (oof)
234 int idcxx . . $ poly_model#id.; // what the polygon model number is. (Index in Poly_models)
235 int versioncxx . . $ poly_model#version.;
236 char namecxx . . $ poly_model#name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!];
237
238 int n_modelscxx . . $ poly_model#n_models.;
239 int model_data_sizecxx . . $ poly_model#model_data_size.;
240 uint8_tcxx . . $ uint8_t# *model_datacxx . . $ poly_model#model_data.;
241
242 vectorcxx . . $ vector# minscxx . . $ poly_model#mins., maxscxx . . $ poly_model#maxs.; // min,max for whole model
243 vectorcxx . . $ vector# view_poscxx . . $ poly_model#view_pos.; // viewing position. Default to {0,0,0}.
244
245 float wall_sizecxx . . $ poly_model#wall_size.;
246 vectorcxx . . $ vector# wall_size_offsetcxx . . $ poly_model#wall_size_offset.;
247
248 float anim_sizecxx . . $ poly_model#anim_size.;
249 vectorcxx . . $ vector# anim_size_offsetcxx . . $ poly_model#anim_size_offset.;
250
251 float radcxx . . $ poly_model#rad.;
252 int n_texturescxx . . $ poly_model#n_textures.;
253 int16_tcxx . . $ int16_t# texturescxx . . $ poly_model#textures.[MAX_MODEL_TEXTUREScxx . . $ `lib/polymodel_external.h:68:9`!]; // a list of bitmap indices
254
255 bsp_infocxx . . $ bsp_info# *submodelcxx . . $ poly_model#submodel.; // an array of size n_models of submodel info.
256 int num_key_anglescxx . . $ poly_model#num_key_angles.;
257 int num_key_poscxx . . $ poly_model#num_key_pos.;
258 int max_keyscxx . . $ poly_model#max_keys.; // the greater number of num_key_pos or num_key_angles
259
260 int frame_mincxx . . $ poly_model#frame_min., frame_maxcxx . . $ poly_model#frame_max.; // For TIMED polymodels, the min/max frames
261
262 int n_gunscxx . . $ poly_model#n_guns.;
263 w_bankcxx . . $ w_bank# *gun_slotscxx . . $ poly_model#gun_slots.; // array of gun banks
264
265 int n_groundcxx . . $ poly_model#n_ground.;
266 w_bankcxx . . $ w_bank# *ground_slotscxx . . $ poly_model#ground_slots.; // array of ground planes
267
268 int n_attachcxx . . $ poly_model#n_attach.;
269 a_bankcxx . . $ a_bank# *attach_slotscxx . . $ poly_model#attach_slots.;
270
271 int num_wbscxx . . $ poly_model#num_wbs.;
272 poly_wb_infocxx . . $ poly_wb_info# *poly_wbcxx . . $ poly_model#poly_wb.; // array of weapon batteries
273
274 int *render_ordercxx . . $ poly_model#render_order.; // internal use
275
276 };
277
278 // Which kind of lighting model for this polymodel
279 enum polymodel_light_typecxx . . $ polymodel_light_type# {
280 POLYMODEL_LIGHTING_STATICcxx . . $ POLYMODEL_LIGHTING_STATIC.,
281 POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.,
282 POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.,
283 };
284
285 // polymodel effects stuff
286 // Effect flags:
287 #define PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`! 1
288 #define PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`! 2
289 #define PEF_COLORcxx . . $ `lib/polymodel_external.h:289:9`! 4
290 #define PEF_MED_REScxx . . $ `lib/polymodel_external.h:290:9`! 8
291 #define PEF_LO_REScxx . . $ `lib/polymodel_external.h:291:9`! 16
292 #define PEF_FOGcxx . . $ `lib/polymodel_external.h:292:9`! 32
293 #define PEF_CUSTOM_COLORcxx . . $ `lib/polymodel_external.h:293:9`! 64
294 #define PEF_CUSTOM_TEXTUREcxx . . $ `lib/polymodel_external.h:294:9`! 128
295 #define PEF_FOGGED_MODELcxx . . $ `lib/polymodel_external.h:295:9`! 256
296 #define PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`! 512
297 #define PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`! 1024
298 #define PEF_GLOW_SCALARcxx . . $ `lib/polymodel_external.h:298:9`! 2048
299 #define PEF_THRUSTER_SCALARcxx . . $ `lib/polymodel_external.h:299:9`! 4096
300 #define PEF_DRAW_HEADLIGHTScxx . . $ `lib/polymodel_external.h:300:9`! 8192
301 #define PEF_NO_GLOWScxx . . $ `lib/polymodel_external.h:301:9`! (8192 << 1)
302 #define PEF_CUSTOM_GLOWcxx . . $ `lib/polymodel_external.h:302:9`! (8192 << 2)
303 #define PEF_BUMPMAPPEDcxx . . $ `lib/polymodel_external.h:303:9`! (8192 << 3)
304
305 struct polymodel_effectcxx . . $ polymodel_effect# {
306 int typecxx . . $ polymodel_effect#type.;
307 float alphacxx . . $ polymodel_effect#alpha.;
308 float deform_rangecxx . . $ polymodel_effect#deform_range.;
309 float rcxx . . $ polymodel_effect#r., gcxx . . $ polymodel_effect#g., bcxx . . $ polymodel_effect#b.;
310 float fog_rcxx . . $ polymodel_effect#fog_r., fog_gcxx . . $ polymodel_effect#fog_g., fog_bcxx . . $ polymodel_effect#fog_b.;
311 int custom_texturecxx . . $ polymodel_effect#custom_texture.;
312 int custom_colorcxx . . $ polymodel_effect#custom_color.;
313
314 float spec_rcxx . . $ polymodel_effect#spec_r., spec_gcxx . . $ polymodel_effect#spec_g., spec_bcxx . . $ polymodel_effect#spec_b.;
315 vectorcxx . . $ vector# spec_light_poscxx . . $ polymodel_effect#spec_light_pos.;
316 float spec_scalarcxx . . $ polymodel_effect#spec_scalar.;
317
318 vectorcxx . . $ vector# bump_light_poscxx . . $ polymodel_effect#bump_light_pos.;
319 float bump_scalarcxx . . $ polymodel_effect#bump_scalar.;
320
321 float fog_depthcxx . . $ polymodel_effect#fog_depth.;
322 float fog_eye_distancecxx . . $ polymodel_effect#fog_eye_distance.;
323 float fog_distancecxx . . $ polymodel_effect#fog_distance.;
324 vectorcxx . . $ vector# fog_planecxx . . $ polymodel_effect#fog_plane., fog_portal_vertcxx . . $ polymodel_effect#fog_portal_vert.;
325 int fog_plane_checkcxx . . $ polymodel_effect#fog_plane_check.;
326
327 float glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar.;
328 float glow_size_scalarcxx . . $ polymodel_effect#glow_size_scalar.;
329
330 float glow_rcxx . . $ polymodel_effect#glow_r., glow_gcxx . . $ polymodel_effect#glow_g., glow_bcxx . . $ polymodel_effect#glow_b.;
331
332 };
333
334 #endif