Debian Codegraph @

Descent3/gametexture.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/gametexture.h $
21 * $Revision: 47 $
22 * $Date: 9/13/01 2:30p $
23 * $Author: Matt $
24 *
25 * Header for gametexture.cpp
26 *
27 * $Log: /DescentIII/Main/gametexture.h $
28 *
29 * 47 9/13/01 2:30p Matt
30 * Increased MAX_TEXTURES from 2800 to 3100.
31 *
32 * 46 3/21/00 1:17p Matt
33 * Increased MAX_TEXTURES to 2800 for PC and Mac, so add-on developers
34 * could add more of their own textures.
35 *
36 * 45 3/20/00 12:09p Matt
37 * Merge of Duane's post-1.3 changes.
38 * Lower MAX_TEXTURES for Mac (Mac only)
39 *
40 * 44 10/17/99 6:06p Chris
41 * We ran out of texture handles...
42 *
43 * 43 5/05/99 5:03a Gwar
44 * renamed ned_GameTextures array to GameTextures in new editor to make
45 * game code happy; 3D texture view still does not display textures
46 *
47 * 42 4/30/99 12:56p Kevin
48 * Lowered values for MAX_SOUNDS, MAX_ROOMS, MAX_TEXTURES and MAX_OBJIDS.
49 * Talk to me before changing any of these again.
50 *
51 * 41 4/20/99 9:26p Matt
52 * Added breakable flag for glass
53 *
54 * 40 4/09/99 7:04p Jason
55 * changed some texture defines
56 *
57 * 39 3/30/99 6:06p Jason
58 * added new procedural effect
59 *
60 * 38 3/10/99 7:12p Jason
61 * added smooth specular shading for curved surfaces
62 *
63 * 37 2/20/99 2:17p Matt
64 * Added texture sounds
65 *
66 * 36 1/29/99 6:29p Jason
67 * first pass at adding bumpmaps
68 *
69 * 35 1/26/99 4:04p Jason
70 * added some more texture flags
71 *
72 * 34 1/22/99 3:59p Jason
73 * added 256x256 textures to help with terrain skies
74 *
75 * 33 12/23/98 4:59p Jason
76 * some new texture features added
77 *
78 * 32 11/30/98 5:50p Jason
79 * added 4444 bitmap support
80 *
81 * 31 10/07/98 5:03p Jason
82 * more options for textures
83 *
84 * 30 10/01/98 2:47p Jason
85 * added timed procedurals
86 *
87 * 29 8/31/98 1:35p Keneta
88 * Made some use count unsigned shorts
89 *
90 * 28 8/13/98 11:57a Jason
91 * added water procedurals
92 *
93 * 27 7/14/98 6:50p Jason
94 * made procedurals save out to the table file
95 *
96 * 26 7/09/98 7:30p Jason
97 * more procedural stuff
98 *
99 * 25 7/07/98 4:12p Jason
100 * checkin for procedurals
101 *
102 * 24 7/06/98 12:55p Jason
103 * added first pass at procedurals
104 *
105 * 23 6/10/98 12:21p Matt
106 * Revamped system that controls what textures are displayed on the
107 * texture tab. Should work correctly now, and will now save the settings
108 * to the registry. Also, textures now default to no type set, not all
109 * types set.
110 *
111 * 22 6/02/98 6:03p Jason
112 * added specular lightmaps
113 *
114 * 21 5/20/98 5:44p Jason
115 * incremental checkin for bumpmapping
116 *
117 * 20 5/20/98 1:08p Jason
118 * more stuff for adding bumpmaps
119 *
120 * 19 5/19/98 3:19p Jason
121 * cleaned up some texture flags
122 *
123 * 18 5/03/98 10:24p Matt
124 * Renamed some unused constants
125 *
126 * 17 4/15/98 12:22p Jason
127 * lots of miscellaneous stuff pertaining to lighting and vis effects
128 *
129 * 16 4/06/98 4:41p Jason
130 * added texture alpha change
131 *
132 * 15 3/17/98 4:33p Jason
133 * Added size changing to bitmaps/textures
134 *
135 * 14 2/13/98 12:40p Jason
136 * added functions to touch all data in a level when the level is loaded
137 *
138 * 13 2/10/98 11:38a Matt
139 * Ripped out the obsolete merge stuff
140 *
141 * 12 2/03/98 3:15p Jason
142 * added the ability to specify saturation textures for models
143 *
144 * 11 1/13/98 3:09p Jason
145 * added glow effect for engines
146 *
147 * 10 1/06/98 2:58p Mark
148 * upped texture limit to 3000.
149 *
150 * 9 12/19/97 2:46p Jason
151 * implemented bitmap paging routines
152 *
153 * 8 11/21/97 2:02p Jason
154 * made light textures on model render that model face fully bright
155 *
156 * 7 10/15/97 5:20p Jason
157 * did a HUGE overhaul of the bitmap system
158 *
159 * 6 8/19/97 1:57a Jason
160 * made rgb lighting take floats
161 *
162 * 5 8/12/97 1:10a Jason
163 * added code to support radiosity lighting
164 *
165 * 4 8/08/97 12:59p Jason
166 * got texture sliding and pingponging working
167 *
168 * 3 8/05/97 4:27p Chris
169 * Added two flags for fly thru and fly by
170 *
171 * 2 8/04/97 3:28p Jason
172 * added alpha blending per texture
173 *
174 * 11 6/24/97 12:45p Jason
175 * checked in for safety
176 *
177 * 9 6/06/97 3:57p Jason
178 * implemented changes for small textures and automatic tmap2 recognition
179 *
180 * 8 5/30/97 5:46p Jason
181 * added colored light functionality on a vertex level
182 *
183 * 7 5/23/97 7:07p Matt
184 * Added code, data, & dialogs to keep track of what a texture is used for
185 * (mine, terrain, object) so we can display in the texture dialog only
186 * the ones we're interested in.
187 *
188 * $NoKeywords: $
189 */
190
191 #ifndef GAMETEXTURE_H
192 #define GAMETEXTURE_Hcxx . . $ `Descent3/gametexture.h:192:9`!
193
194 #ifdef NEWEDITOR /* only include tablefile header (manage stuff for NEWEDITOR) */
195 #include "..\neweditor\ned_TableFile.h"
196 #include "..\neweditor\ned_GameTexture.h"
197 #else
198
199 #include "manage.h"cxx . . $ `<file>/lib/manage.h`/
200
201 #define TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`! 1
202 #define TF_WATERcxx . . $ `Descent3/gametexture.h:202:9`! (1 << 1)
203 #define TF_METALcxx . . $ `Descent3/gametexture.h:203:9`! (1 << 2) // Shines like metal
204 #define TF_MARBLEcxx . . $ `Descent3/gametexture.h:204:9`! (1 << 3) // Shines like marble
205 #define TF_PLASTICcxx . . $ `Descent3/gametexture.h:205:9`! (1 << 4) // Shines like plastic
206 #define TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`! (1 << 5)
207 #define TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`! (1 << 6)
208 #define TF_DESTROYABLEcxx . . $ `Descent3/gametexture.h:208:9`! (1 << 7)
209 #define TF_EFFECTcxx . . $ `Descent3/gametexture.h:209:9`! (1 << 8)
210 #define TF_HUD_COCKPITcxx . . $ `Descent3/gametexture.h:210:9`! (1 << 9)
211 #define TF_MINEcxx . . $ `Descent3/gametexture.h:211:9`! (1 << 10)
212 #define TF_TERRAINcxx . . $ `Descent3/gametexture.h:212:9`! (1 << 11)
213 #define TF_OBJECTcxx . . $ `Descent3/gametexture.h:213:9`! (1 << 12)
214 #define TF_TEXTURE_64cxx . . $ `Descent3/gametexture.h:214:9`! (1 << 13)
215 #define TF_TMAP2cxx . . $ `Descent3/gametexture.h:215:9`! (1 << 14)
216 #define TF_TEXTURE_32cxx . . $ `Descent3/gametexture.h:216:9`! (1 << 15)
217 #define TF_FLY_THRUcxx . . $ `Descent3/gametexture.h:217:9`! (1 << 16)
218 #define TF_PASS_THRUcxx . . $ `Descent3/gametexture.h:218:9`! (1 << 17)
219 #define TF_PING_PONGcxx . . $ `Descent3/gametexture.h:219:9`! (1 << 18)
220 #define TF_LIGHTcxx . . $ `Descent3/gametexture.h:220:9`! (1 << 19)
221 #define TF_BREAKABLEcxx . . $ `Descent3/gametexture.h:221:9`! (1 << 20) // Breakable (as in glass)
222 #define TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`! (1 << 21)
223 #define TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`! (1 << 22)
224 #define TF_DONTUSEcxx . . $ `Descent3/gametexture.h:224:9`! (1 << 23)
225 #define TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`! (1 << 24)
226 #define TF_WATER_PROCEDURALcxx . . $ `Descent3/gametexture.h:226:9`! (1 << 25)
227 #define TF_FORCE_LIGHTMAPcxx . . $ `Descent3/gametexture.h:227:9`! (1 << 26)
228 #define TF_SATURATE_LIGHTMAPcxx . . $ `Descent3/gametexture.h:228:9`! (1 << 27)
229 #define TF_TEXTURE_256cxx . . $ `Descent3/gametexture.h:229:9`! (1 << 28)
230 #define TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`! (1 << 29)
231 #define TF_RUBBLEcxx . . $ `Descent3/gametexture.h:231:9`! (1 << 30)
232 #define TF_SMOOTH_SPECULARcxx . . $ `Descent3/gametexture.h:232:9`! (1 << 31)
233
234 #define TF_TEXTURE_TYPEScxx . . $ `Descent3/gametexture.h:234:9`! (TF_MINE + TF_TERRAIN + TF_OBJECT + TF_EFFECT + TF_HUD_COCKPIT + TF_LIGHT)
235
236 #define TF_SPECULARcxx . . $ `Descent3/gametexture.h:236:9`! (TF_METALcxx . . $ `Descent3/gametexture.h:203:9`! + TF_MARBLEcxx . . $ `Descent3/gametexture.h:204:9`! | TF_PLASTICcxx . . $ `Descent3/gametexture.h:205:9`!)
237
238 #define NOT_TEXTUREcxx . . $ `Descent3/gametexture.h:238:9`! 0
239 #define NORMAL_TEXTUREcxx . . $ `Descent3/gametexture.h:239:9`! 1 // a normal size texture
240 #define SMALL_TEXTUREcxx . . $ `Descent3/gametexture.h:240:9`! 2 // 1/4 of a normal texture
241 #define TINY_TEXTUREcxx . . $ `Descent3/gametexture.h:241:9`! 3 // 1/8 of a normal texture
242 #define HUGE_TEXTUREcxx . . $ `Descent3/gametexture.h:242:9`! 4 // Double the size of a normal texture
243
244 #define MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`! 3100
245
246 #define PROC_MEMORY_TYPE_NONEcxx . . $ `Descent3/gametexture.h:246:9`! 0
247 #define PROC_MEMORY_TYPE_FIREcxx . . $ `Descent3/gametexture.h:247:9`! 1
248 #define PROC_MEMORY_TYPE_WATERcxx . . $ `Descent3/gametexture.h:248:9`! 2
249
250 struct static_proc_elementcxx . . $ static_proc_element# {
251 uint8_tcxx . . $ uint8_t# typecxx . . $ static_proc_element#type.;
252
253 uint8_tcxx . . $ uint8_t# frequencycxx . . $ static_proc_element#frequency.;
254 uint8_tcxx . . $ uint8_t# speedcxx . . $ static_proc_element#speed.;
255 uint8_tcxx . . $ uint8_t# colorcxx . . $ static_proc_element#color.;
256 uint8_tcxx . . $ uint8_t# sizecxx . . $ static_proc_element#size.;
257
258 uint8_tcxx . . $ uint8_t# x1cxx . . $ static_proc_element#x1., y1cxx . . $ static_proc_element#y1., x2cxx . . $ static_proc_element#x2., y2cxx . . $ static_proc_element#y2.;
259
260 };
261
262 struct proc_structcxx . . $ proc_struct# {
263 int16_tcxx . . $ int16_t# dynamic_proc_elementscxx . . $ proc_struct#dynamic_proc_elements.; // list of dynamic procedural texture elements
264 void *proc1cxx . . $ proc_struct#proc1.; // pointer for procedural page
265 void *proc2cxx . . $ proc_struct#proc2.; // back page of procedural
266 int16_tcxx . . $ int16_t# procedural_bitmapcxx . . $ proc_struct#procedural_bitmap.; // handle to the bitmap holding the finished procedural
267
268 uint16_tcxx . . $ uint16_t# *palettecxx . . $ proc_struct#palette.;
269 static_proc_elementcxx . . $ static_proc_element# *static_proc_elementscxx . . $ proc_struct#static_proc_elements.;
270 uint16_tcxx . . $ uint16_t# num_static_elementscxx . . $ proc_struct#num_static_elements.;
271
272 uint8_tcxx . . $ uint8_t# memory_typecxx . . $ proc_struct#memory_type.;
273
274 uint8_tcxx . . $ uint8_t# heatcxx . . $ proc_struct#heat.;
275 uint8_tcxx . . $ uint8_t# thicknesscxx . . $ proc_struct#thickness.;
276 uint8_tcxx . . $ uint8_t# lightcxx . . $ proc_struct#light.;
277
278 float last_evaluation_timecxx . . $ proc_struct#last_evaluation_time.;
279 float evaluation_timecxx . . $ proc_struct#evaluation_time.;
280 float osc_timecxx . . $ proc_struct#osc_time.;
281 uint8_tcxx . . $ uint8_t# osc_valuecxx . . $ proc_struct#osc_value.;
282
283 int last_procedural_framecxx . . $ proc_struct#last_procedural_frame.; // last frame a procedural was calculated for this texture
284 };
285
286 struct texturecxx . . $ texture# {
287 char namecxx . . $ texture#name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; // this textures name
288 int flagscxx . . $ texture#flags.; // values defined above
289 int bm_handlecxx . . $ texture#bm_handle.; // handle which shows what this texture looks like
290 int destroy_handlecxx . . $ texture#destroy_handle.; // handle which denotes the destroyed image
291
292 int damagecxx . . $ texture#damage.;
293 float reflectivitycxx . . $ texture#reflectivity.;
294 float rcxx . . $ texture#r., gcxx . . $ texture#g., bcxx . . $ texture#b.; // colored lighting (0 to 100%)
295
296 float slide_ucxx . . $ texture#slide_u., slide_vcxx . . $ texture#slide_v.; // How many times this texture slides during a second
297 float alphacxx . . $ texture#alpha.; // alpha value (from 0 to 1)
298 float speedcxx . . $ texture#speed.; // how fast this texture animates
299
300 proc_structcxx . . $ proc_struct# *proceduralcxx . . $ texture#procedural.;
301
302 int soundcxx . . $ texture#sound.; // The sound this texture makes
303 float sound_volumecxx . . $ texture#sound_volume.; // The volume for this texture's sound
304
305 int16_tcxx . . $ int16_t# bumpmapcxx . . $ texture#bumpmap.; // The bumpmap for this texture, or -1 if there is none
306 uint8_tcxx . . $ uint8_t# corona_typecxx . . $ texture#corona_type.; // what type of corona this thing uses
307 uint8_tcxx . . $ uint8_t# usedcxx . . $ texture#used.; // is this texture free to be allocated?
308
309 };
310
311 extern texturecxx . . $ texture# GameTexturescxx . . $ GameTextures.[MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!];
312 extern int Num_texturescxx . . $ Num_textures.;
313
314 // Inits the texture system, returning 1 if successful
315 int InitTexturescxx . . $ InitTextures(b126dc7c1de90089).();
316 void ShutdownTexturescxx . . $ ShutdownTextures(49f6e7a06ebc5aa8).();
317
318 // Set aside a texture for use
319 int AllocTexturecxx . . $ AllocTexture(b126dc7c1de90089).(void);
320
321 // Frees a texture for future use
322 void FreeTexturecxx . . $ FreeTexture(d4f767463ce0a6b3).(int);
323
324 // Given current index, gets index of next texture in use
325 int GetNextTexturecxx . . $ GetNextTexture(7864480464b09eea).(int n);
326
327 // Given current index, gets index of prev texture in use
328 int GetPreviousTexturecxx . . $ GetPreviousTexture(7864480464b09eea).(int n);
329
330 // Searches thru all textures for a specific name, returns -1 if not found
331 // or index of texture with name
332 int FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(const char *name);
333
334 // Searches thru all textures for a bitmap of a specific name, returns -1 if not found
335 // or index of texture with name
336 int FindTextureBitmapNamecxx . . $ FindTextureBitmapName(5c4306d8553b3696).(const char *name);
337
338 // Given a texture handle, returns that textures bitmap
339 // If the texture is animated, returns framenum mod num_of_frames in the animation
340 int GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(int handle, int framenum, bool force = false);
341
342 // Given a filename, loads either the bitmap or vclip found in that file. If type
343 // is not NULL, sets it to 1 if file is animation, otherwise sets it to zero
344 int LoadTextureImagecxx . . $ LoadTextureImage(f997a6335c8241fb).(const char *filename, int *type, int texture_size, int mipped, int pageable = 0, int format = 0);
345
346 // Goes through and marks a texture as a tmap2 if its bitmap(s) have transparency
347 bool CheckIfTextureIsTmap2cxx . . $ CheckIfTextureIsTmap2(83c267b20bac841a).(int texnum);
348
349 // Touches a texture, makes sure its in memory
350 void TouchTexturecxx . . $ TouchTexture(d4f767463ce0a6b3).(int n);
351
352 // Builds the bumpmaps for the texture
353 void BuildTextureBumpmapscxx . . $ BuildTextureBumpmaps(d4f767463ce0a6b3).(int texhandle);
354
355 // Allocates the memory needed for static elements for a procedural texture
356 void AllocateStaticProceduralsForTexturecxx . . $ AllocateStaticProceduralsForTexture(3e454b8ccf442868).(int handle, int num_elements);
357
358 // Frees the memory used by static procedural elements
359 void FreeStaticProceduralsForTexturecxx . . $ FreeStaticProceduralsForTexture(d4f767463ce0a6b3).(int handle);
360
361 // Frees all the procedural memory for a texture
362 void FreeProceduralForTexturecxx . . $ FreeProceduralForTexture(d4f767463ce0a6b3).(int n);
363
364 // Allocates memory for a procedural that is attached to a texture
365 int AllocateProceduralForTexturecxx . . $ AllocateProceduralForTexture(7864480464b09eea).(int handle);
366
367 #endif
368
369 #endif