Debian Codegraph @

manage/texpage.cpp

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/manage/texpage.cpp $
21 * $Revision: 61 $
22 * $Date: 10/08/01 4:20p $
23 * $Author: Matt $
24 *
25 * For loading/saving of texture types
26 *
27 * $Log: /DescentIII/Main/manage/texpage.cpp $
28 *
29 * 61 10/08/01 4:20p Matt
30 * Added system to check for errors when reading in add-on data.
31 *
32 * 59 9/06/01 10:32a Matt
33 * Added code to fix problem poping add-on pages when the original pages
34 * were in the extra.gam file.
35 *
36 * 58 3/20/00 12:28p Matt
37 * Merge of Duane's post-1.3 changes.
38 * Added malloc for temp struct instead of delcaring on the stack.
39 *
40 * 57 10/26/99 3:31p Jeff
41 * handle extra.gam addon tablefile
42 *
43 * 56 9/18/99 8:49p Jeff
44 * fixed bug with addon pages that have dependencies on other pages in the
45 * addon tablefile
46 *
47 * 55 8/11/99 5:32p Jeff
48 * changes to fix addon tablefile support so it works correctly
49 *
50 * 54 5/21/99 6:39a Matt
51 * Fixed massive evil caused by recent changes for Mac, which resulted in
52 * two functions using the same static data at the same time.
53 *
54 * 53 5/14/99 12:07p Jeff
55 * error handling (Jason)
56 *
57 * 52 5/13/99 8:36p Matt
58 * Made some local variables global to get around the 32K local variable
59 * limit on the Mac.
60 *
61 * 51 4/14/99 1:34a Jeff
62 * fixed case mismatched #includes
63 *
64 * 50 4/12/99 3:05p Jason
65 * changes for 256 textures
66 *
67 * 49 4/09/99 7:04p Jason
68 * changed some texture defines
69 *
70 * 48 4/09/99 12:51p Jason
71 * corrected buggy sound resolving code
72 *
73 * 47 3/30/99 6:01p Jason
74 * added new procedural effect
75 *
76 * 46 2/20/99 2:17p Matt
77 * Added texture sounds
78 *
79 * 45 2/16/99 11:17a Jason
80 * took out mprintf
81 *
82 * 44 2/01/99 11:47a Jason
83 * fixed bumpmap errors
84 *
85 * 43 1/22/99 3:59p Jason
86 * added 256x256 textures to help with terrain skies
87 *
88 * 42 1/13/99 7:05a Jeff
89 * put #ifdef around #include <windows.h>
90 *
91 * 41 12/29/98 4:30p Jason
92 * added add-on data functionality
93 *
94 * 40 12/17/98 12:02p Jason
95 * fixed dumb procedural thing
96 *
97 * 39 11/06/98 12:35p Jason
98 * more speedups for manage system
99 *
100 * 38 11/05/98 7:55p Jason
101 * changes for new manage system
102 *
103 * 37 11/02/98 6:02p Jason
104 * made yes network updates much faster
105 *
106 * 36 10/09/98 2:27p Jason
107 * reorganized table file system
108 *
109 * 35 10/08/98 10:03p Jason
110 * more filtered table file stuff
111 *
112 * 34 10/07/98 5:03p Jason
113 * more options for textures
114 *
115 * 33 10/01/98 2:47p Jason
116 * added timed procedurals
117 *
118 * 32 8/24/98 2:37p Jason
119 * made table file more efficient with regards to invalid names
120 *
121 * 31 8/15/98 3:46p Matt
122 * Got rid of compile warning
123 *
124 * 30 8/13/98 1:03p Jason
125 * added some more procedural workers
126 *
127 * 29 8/12/98 4:24p Luke
128 * temporary fix for dumb local table file conundrum
129 *
130 * 28 7/14/98 6:50p Jason
131 * made procedurals save out to the table file
132 *
133 * 27 6/12/98 1:06p Jason
134 * added smart loading from local table file
135 *
136 * 26 6/11/98 12:54p Mark
137 * temp fix
138 *
139 * 25 6/10/98 12:21p Matt
140 * Revamped system that controls what textures are displayed on the
141 * texture tab. Should work correctly now, and will now save the settings
142 * to the registry. Also, textures now default to no type set, not all
143 * types set.
144 *
145 * 24 6/03/98 3:46p Jason
146 * made megacell system more robust
147 *
148 * 23 5/20/98 1:08p Jason
149 * more stuff for adding bumpmaps
150 *
151 * 22 5/04/98 6:08p Jason
152 * sped up predictive pagefile loading
153 *
154 * 21 4/06/98 4:42p Jason
155 * added texture alpha change
156 *
157 * 20 3/17/98 4:33p Jason
158 * Added size changing to bitmaps/textures
159 *
160 * 19 2/23/98 1:22p Jason
161 * made FindSpecific* read from the local drive, not the net drive - when
162 * starting the editor
163 *
164 * 18 2/16/98 11:42a Jason
165 * added better error checking for checking out files
166 *
167 * 17 2/12/98 1:32p Jason
168 * got mipmapping working
169 *
170 * 16 1/14/98 7:55p Jason
171 * make textures pageable depending on whether or not you're using the
172 * network
173 *
174 * 15 12/19/97 2:46p Jason
175 * implemented bitmap paging routines
176 *
177 * 14 12/10/97 5:29p Jason
178 * warn if reusing a net texture
179 *
180 * 13 11/21/97 2:02p Jason
181 * made light textures on model render that model face fully bright
182 *
183 * 12 10/20/97 5:05p Mark
184 * FROM JASON: Changed error bitmap from -1 to 0
185 *
186 * 11 10/15/97 5:20p Jason
187 * did a HUGE overhaul of the bitmap system
188 *
189 * 10 9/25/97 4:30p Jason
190 * got destroyable textures working
191 *
192 * 9 8/19/97 1:21p Jason
193 * set reflectivity to .5 by default
194 *
195 * 8 8/19/97 1:57a Jason
196 * made rgb lighting take floats
197 *
198 * 7 8/12/97 1:10a Jason
199 * added code to support radiosity lighting
200 *
201 * 6 8/08/97 12:59p Jason
202 * got texture sliding and pingponging working
203 *
204 * 5 8/06/97 2:57p Jason
205 * fixed alpha problem with reorder net pages
206 *
207 * 4 8/04/97 5:05p Jason
208 * fixed dumb off-by-one error
209 *
210 * 3 8/04/97 3:28p Jason
211 * added alpha blending per texture
212 *
213 * 31 6/24/97 12:42p Jason
214 * checked in for safety
215 *
216 * 30 6/06/97 3:57p Jason
217 * implemented changes for small textures and automatic tmap2 recognition
218 *
219 * 29 6/05/97 2:52p Jason
220 * added megacell functions
221 *
222 * 28 5/30/97 5:46p Jason
223 * added colored light functionality on a vertex level
224 *
225 * 27 5/23/97 7:07p Matt
226 * Added code, data, & dialogs to keep track of what a texture is used for
227 * (mine, terrain, object) so we can display in the texture dialog only
228 * the ones we're interested in.
229 *
230 * 26 5/12/97 1:19p Jason
231 * sped up texture loading a little bit
232 *
233 * 25 5/12/97 11:41a Jason
234 * made game work (default) to 16bit no mip maps mode
235 * Saves us alot of memory
236 *
237 * 24 5/08/97 12:41p Jason
238 * made manage system work with device dependant path names
239 *
240 * 23 4/25/97 6:16p Jason
241 * added switcheroo function
242 *
243 * 22 4/08/97 2:25a Chris
244 * Fixed a problem with uninitialized data. In addition it
245 * fixed a problem with the .used flag that would happen
246 * 1 out of 2^(sizeof(used_flag)) times (it would be zero
247 * when it was supposed to be non-zero)
248 *
249 * 21 3/12/97 6:15 PM Jeremy
250 * in mng_WriteTexturePage moved the declaration of int i outside of the
251 * first for loop to the top of the function so that it will compile on
252 * mac and PC at the same time. :)
253 *
254 * 20 3/03/97 6:21p Matt
255 * Changed cfile functions to use D3 naming convention
256 *
257 * $NoKeywords: $
258 */
259
260 #include <cstring>
261 #include <filesystem>
262
263 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
264 #include "manage.h"cxx . . $ `<file>/lib/manage.h`/
265 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
266 #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/
267 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
268 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
269 #include "texpage.h"cxx . . $ `<file>/manage/texpage.h`/
270 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
271 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
272 #include "args.h"cxx . . $ `<file>/Descent3/args.h`/
273 #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/
274 #include "soundpage.h"cxx . . $ `<file>/manage/soundpage.h`/
275 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
276
277 // Texpage commands that are read/written
278 // A command is followed by a byte count describing how many bytes
279 // are in the data for the command
280 #define TEXPAGE_COMMAND_NAMEcxx . . $ `manage/texpage.cpp:280:9`! 1
281 #define TEXPAGE_COMMAND_FLAGScxx . . $ `manage/texpage.cpp:281:9`! 2
282 #define TEXPAGE_COMMAND_ENDcxx . . $ `manage/texpage.cpp:282:9`! 3
283 #define TEXPAGE_COMMAND_BITMAP_NAMEcxx . . $ `manage/texpage.cpp:283:9`! 4
284 #define TEXPAGE_COMMAND_DESTROY_NAMEcxx . . $ `manage/texpage.cpp:284:9`! 5
285 #define TEXPAGE_COMMAND_VERSIONcxx . . $ `manage/texpage.cpp:285:9`! 6
286 #define TEXPAGE_COMMAND_REFLECTcxx . . $ `manage/texpage.cpp:286:9`! 7
287 #define TEXPAGE_COMMAND_DAMAGEcxx . . $ `manage/texpage.cpp:287:9`! 8
288 #define TEXPAGE_COMMAND_LIGHTINGcxx . . $ `manage/texpage.cpp:288:9`! 9
289 #define TEXPAGE_COMMAND_SLIDEcxx . . $ `manage/texpage.cpp:289:9`! 10
290 #define TEXPAGE_COMMAND_NULL_NAMEcxx . . $ `manage/texpage.cpp:290:9`! 11 // null terminated name string
291 #define TEXPAGE_COMMAND_BITMAP_NULL_NAMEcxx . . $ `manage/texpage.cpp:291:9`! 12
292 #define TEXPAGE_COMMAND_DESTROY_NULL_NAMEcxx . . $ `manage/texpage.cpp:292:9`! 13
293 #define TEXPAGE_COMMAND_COLORED_LIGHTINGcxx . . $ `manage/texpage.cpp:293:9`! 14
294 #define TEXPAGE_COMMAND_ALPHAcxx . . $ `manage/texpage.cpp:294:9`! 15
295 #define TEXPAGE_COMMAND_SLIDE_FLOATcxx . . $ `manage/texpage.cpp:295:9`! 16
296 #define TEXPAGE_COMMAND_LIGHTING_FLOATcxx . . $ `manage/texpage.cpp:296:9`! 17
297 #define TEXPAGE_COMMAND_SPEEDcxx . . $ `manage/texpage.cpp:297:9`! 18
298 #define TEXPAGE_COMMAND_FIRST_PROC_PALcxx . . $ `manage/texpage.cpp:298:9`! 19
299 #define TEXPAGE_COMMAND_SECOND_PROC_PALcxx . . $ `manage/texpage.cpp:299:9`! 20
300 #define TEXPAGE_COMMAND_PROCEDURALcxx . . $ `manage/texpage.cpp:300:9`! 21
301 #define TEXPAGE_COMMAND_EXTRA_PROCEDURALcxx . . $ `manage/texpage.cpp:301:9`! 22
302 #define TEXPAGE_COMMAND_EXTRA_PROCEDURAL2cxx . . $ `manage/texpage.cpp:302:9`! 23
303 #define TEXPAGE_COMMAND_CORONAcxx . . $ `manage/texpage.cpp:303:9`! 24
304
305 // Declare this here because it's too big to put on the stack on the Mac
306 static mngs_texture_pagecxx . . $ mngs_texture_page# texpage1cxx . . $ texpage1.;
307
308 extern char *TablefileNameOverridecxx . . $ TablefileNameOverride.;
309
310 #define TEXPAGE_VERSIONcxx . . $ `manage/texpage.cpp:310:9`! 7
311 // Given an open file pointer and a texture handle, writes that texture page out
312 void mng_WriteTexturePagecxx . . $ mng_WriteTexturePage(ba0e418ed632d802).(CFILEcxx . . $ CFILE# *outfile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
313 int i = 0;
314
315 ASSERTcxx . . $ `misc/pserror.h:246:9`!(outfile != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
316 ASSERTcxx . . $ `misc/pserror.h:246:9`!(texpage != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
317
318 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!);
319
320 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_VERSIONcxx . . $ `manage/texpage.cpp:285:9`!);
321 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 1);
322 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_VERSIONcxx . . $ `manage/texpage.cpp:310:9`!);
323
324 // Write out texture name
325 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_NULL_NAMEcxx . . $ `manage/texpage.cpp:290:9`!);
326 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, strlen(texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.) + 1);
327 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.);
328
329 // Write out its bitmaps name
330 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_BITMAP_NULL_NAMEcxx . . $ `manage/texpage.cpp:291:9`!); // get ready to write out name
331 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, strlen(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.) + 1);
332 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.);
333
334 // Write out its bitmaps name
335 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_DESTROY_NULL_NAMEcxx . . $ `manage/texpage.cpp:292:9`!); // get ready to write out name
336 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, strlen(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name.) + 1);
337 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name.);
338
339 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_LIGHTING_FLOATcxx . . $ `manage/texpage.cpp:296:9`!);
340 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4 * 3);
341 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..rcxx . . $ texture#r.);
342 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..gcxx . . $ texture#g.);
343 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..bcxx . . $ texture#b.);
344
345 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_ALPHAcxx . . $ `manage/texpage.cpp:294:9`!);
346 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
347 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha.);
348
349 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_SPEEDcxx . . $ `manage/texpage.cpp:297:9`!);
350 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
351 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..speedcxx . . $ texture#speed.);
352
353 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_SLIDE_FLOATcxx . . $ `manage/texpage.cpp:295:9`!);
354 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 8);
355 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_ucxx . . $ texture#slide_u.);
356 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_vcxx . . $ texture#slide_v.);
357
358 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_REFLECTcxx . . $ `manage/texpage.cpp:286:9`!);
359 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
360 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..reflectivitycxx . . $ texture#reflectivity.);
361
362 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_CORONAcxx . . $ `manage/texpage.cpp:303:9`!);
363 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 1);
364 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..corona_typecxx . . $ texture#corona_type.);
365
366 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_DAMAGEcxx . . $ `manage/texpage.cpp:287:9`!);
367 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
368 cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..damagecxx . . $ texture#damage.);
369
370 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_FLAGScxx . . $ `manage/texpage.cpp:281:9`!); // write out flags field
371 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
372 cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags.);
373
374 // Write out the procedural
375 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
376 // Write out the palette in two halves
377 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_FIRST_PROC_PALcxx . . $ `manage/texpage.cpp:298:9`!);
378 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, (uint8_tcxx . . $ uint8_t#)255);
379 for (i = 0; i < 255; i++) {
380 uint16_tcxx . . $ uint16_t# val = texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i];
381 val >>= 8;
382
383 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, val);
384 }
385
386 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_SECOND_PROC_PALcxx . . $ `manage/texpage.cpp:299:9`!);
387 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, (uint8_tcxx . . $ uint8_t#)255);
388 for (i = 0; i < 255; i++) {
389 uint16_tcxx . . $ uint16_t# val = texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i];
390 val &= 0xFF;
391
392 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, val);
393 }
394
395 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_EXTRA_PROCEDURALcxx . . $ `manage/texpage.cpp:301:9`!);
396 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 3);
397 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat.);
398 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_lightcxx . . $ mngs_texture_page#proc_light.);
399 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness.);
400
401 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_EXTRA_PROCEDURAL2cxx . . $ `manage/texpage.cpp:302:9`!);
402 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 4);
403 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time.);
404
405 // Write out static procedural
406 for (i = 0; i < texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.; i++) {
407 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_PROCEDURALcxx . . $ `manage/texpage.cpp:300:9`!);
408
409 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 8);
410
411 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[i]);
412 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[i]);
413 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[i]);
414 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[i]);
415
416 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[i]);
417 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[i]);
418
419 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[i]);
420 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[i]);
421 }
422 }
423
424 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, TEXPAGE_COMMAND_ENDcxx . . $ `manage/texpage.cpp:282:9`!); // we're all done
425 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, 0);
426 }
427
428 // Given an open file pointer and a texture handle, writes that texture page out
429 void mng_WriteNewTexturePagecxx . . $ mng_WriteNewTexturePage(ba0e418ed632d802).(CFILEcxx . . $ CFILE# *outfile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
430 int i = 0;
431
432 ASSERTcxx . . $ `misc/pserror.h:246:9`!(outfile != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
433 ASSERTcxx . . $ `misc/pserror.h:246:9`!(texpage != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
434
435 int offset = StartManagePagecxx . . $ StartManagePage(d1801a78c3072b68).(outfile, PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!);
436
437 cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(outfile, TEXPAGE_VERSIONcxx . . $ `manage/texpage.cpp:310:9`!);
438 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.);
439
440 // Write out its bitmaps name
441 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.);
442
443 // Write out destroy bitmap name
444 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name.);
445
446 // Write out rgb lighting and alpha
447 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..rcxx . . $ texture#r.);
448 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..gcxx . . $ texture#g.);
449 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..bcxx . . $ texture#b.);
450 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha.);
451
452 // Write out animation speed
453 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..speedcxx . . $ texture#speed.);
454
455 // Write out sliding values
456 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_ucxx . . $ texture#slide_u.);
457 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_vcxx . . $ texture#slide_v.);
458
459 // Write reflectivity
460 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..reflectivitycxx . . $ texture#reflectivity.);
461
462 // Write corona type
463 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..corona_typecxx . . $ texture#corona_type.);
464
465 // Write damage
466 cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..damagecxx . . $ texture#damage.);
467
468 // Write flags
469 cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags.);
470
471 // Write out the procedural
472 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
473 // Write procedural palette
474 for (i = 0; i < 255; i++) {
475 uint16_tcxx . . $ uint16_t# val = texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i];
476 cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(outfile, val);
477 }
478
479 // Write procedural globals
480 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat.);
481 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_lightcxx . . $ mngs_texture_page#proc_light.);
482 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness.);
483 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time.);
484
485 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->osc_timecxx . . $ mngs_texture_page#osc_time.);
486 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->osc_valuecxx . . $ mngs_texture_page#osc_value.);
487
488 // Write out static procedurals
489 cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(outfile, texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.);
490 for (i = 0; i < texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.; i++) {
491 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[i]);
492 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[i]);
493 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[i]);
494 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[i]);
495 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[i]);
496 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[i]);
497 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[i]);
498 cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(outfile, texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[i]);
499 }
500 }
501
502 cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(outfile, texpage->sound_namecxx . . $ mngs_texture_page#sound_name.);
503 cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(outfile, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..sound_volumecxx . . $ texture#sound_volume.);
504
505 EndManagePagecxx . . $ EndManagePage(966989f25543eb13).(outfile, offset);
506 }
507
508 void mng_InitTexturePagecxx . . $ mng_InitTexturePage(d5a4c4c9147c0c99).(mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
509 memset(texpage, 0, sizeof(mngs_texture_pagecxx . . $ mngs_texture_page#));
510 texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness. = 4;
511 texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat. = 200;
512 texpage->proc_lightcxx . . $ mngs_texture_page#proc_light. = 1;
513 texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. = 0;
514 texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time. = 0;
515 texpage->osc_timecxx . . $ mngs_texture_page#osc_time. = 0;
516 texpage->osc_valuecxx . . $ mngs_texture_page#osc_value. = 8;
517
518 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha. = 1.0;
519 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..speedcxx . . $ texture#speed. = 1.0;
520 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..reflectivitycxx . . $ texture#reflectivity. = .5;
521 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..corona_typecxx . . $ texture#corona_type. = 0;
522 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_vcxx . . $ texture#slide_v. = 0;
523 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_ucxx . . $ texture#slide_u. = 0;
524 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..bumpmapcxx . . $ texture#bumpmap. = -1;
525 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound. = -1;
526 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..sound_volumecxx . . $ texture#sound_volume. = 1.0;
527
528 strcpy(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., "");
529 strcpy(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., "");
530 strcpy(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., "");
531 }
532
533 // Reads a texture page from an open file. Returns 0 on error.
534 int mng_ReadTexturePagecxx . . $ mng_ReadTexturePage(3fd8847e45b480a6).(CFILEcxx . . $ CFILE# *infile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
535 int done = 0;
536 char command;
537 uint8_tcxx . . $ uint8_t# len;
538 int i;
539 int proc_index = 0;
540
541 if (!Old_table_methodcxx . . $ Old_table_method.)
542 return mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(infile, texpage);
543
544 ASSERTcxx . . $ `misc/pserror.h:246:9`!(infile != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
545 mng_InitTexturePagecxx . . $ mng_InitTexturePage(d5a4c4c9147c0c99).(texpage);
546
547 while (!done) {
548 command = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
549 len = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
550
551 switch (command) {
552 case TEXPAGE_COMMAND_ENDcxx . . $ `manage/texpage.cpp:282:9`!:
553 done = 1;
554 break;
555 case TEXPAGE_COMMAND_FLAGScxx . . $ `manage/texpage.cpp:281:9`!:
556 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
557 break;
558 case TEXPAGE_COMMAND_LIGHTINGcxx . . $ `manage/texpage.cpp:288:9`!:
559 cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile); // Ignored
560 break;
561 case TEXPAGE_COMMAND_LIGHTING_FLOATcxx . . $ `manage/texpage.cpp:296:9`!:
562 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..rcxx . . $ texture#r. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
563 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..gcxx . . $ texture#g. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
564 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..bcxx . . $ texture#b. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
565 break;
566 case TEXPAGE_COMMAND_DAMAGEcxx . . $ `manage/texpage.cpp:287:9`!:
567 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..damagecxx . . $ texture#damage. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
568 break;
569 case TEXPAGE_COMMAND_REFLECTcxx . . $ `manage/texpage.cpp:286:9`!:
570 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..reflectivitycxx . . $ texture#reflectivity. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
571 break;
572 case TEXPAGE_COMMAND_CORONAcxx . . $ `manage/texpage.cpp:303:9`!:
573 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..corona_typecxx . . $ texture#corona_type. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
574 break;
575 case TEXPAGE_COMMAND_ALPHAcxx . . $ `manage/texpage.cpp:294:9`!:
576 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
577 break;
578 case TEXPAGE_COMMAND_SPEEDcxx . . $ `manage/texpage.cpp:297:9`!:
579 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..speedcxx . . $ texture#speed. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
580 break;
581 case TEXPAGE_COMMAND_SLIDE_FLOATcxx . . $ `manage/texpage.cpp:295:9`!:
582 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_ucxx . . $ texture#slide_u. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
583 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_vcxx . . $ texture#slide_v. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
584 break;
585 case TEXPAGE_COMMAND_BITMAP_NAMEcxx . . $ `manage/texpage.cpp:283:9`!: // the name of the texture's bitmap
586 for (i = 0; i < BITMAP_NAME_LENcxx . . $ `lib/bitmap.h:41:9`!; i++)
587 texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
588 break;
589 case TEXPAGE_COMMAND_DESTROY_NAMEcxx . . $ `manage/texpage.cpp:284:9`!: // the name of the texture's bitmap
590 for (i = 0; i < BITMAP_NAME_LENcxx . . $ `lib/bitmap.h:41:9`!; i++)
591 texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
592 break;
593 case TEXPAGE_COMMAND_NAMEcxx . . $ `manage/texpage.cpp:280:9`!:
594 for (i = 0; i < PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!; i++)
595 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
596 break;
597 case TEXPAGE_COMMAND_NULL_NAMEcxx . . $ `manage/texpage.cpp:290:9`!:
598 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
599 break;
600 case TEXPAGE_COMMAND_BITMAP_NULL_NAMEcxx . . $ `manage/texpage.cpp:291:9`!: // the name of the texture's bitmap
601 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
602 break;
603 case TEXPAGE_COMMAND_DESTROY_NULL_NAMEcxx . . $ `manage/texpage.cpp:292:9`!: // the name of the texture's bitmap
604 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
605 break;
606 case TEXPAGE_COMMAND_FIRST_PROC_PALcxx . . $ `manage/texpage.cpp:298:9`!:
607 for (i = 0; i < 255; i++) {
608 uint16_tcxx . . $ uint16_t# val = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
609 val <<= 8;
610 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i] &= 0xFF;
611 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i] |= val;
612 }
613 break;
614 case TEXPAGE_COMMAND_SECOND_PROC_PALcxx . . $ `manage/texpage.cpp:299:9`!:
615 for (i = 0; i < 255; i++) {
616 uint8_tcxx . . $ uint8_t# val = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
617 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i] &= 0xFF00;
618 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i] |= val;
619 }
620 break;
621 case TEXPAGE_COMMAND_EXTRA_PROCEDURALcxx . . $ `manage/texpage.cpp:301:9`!:
622 texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
623 texpage->proc_lightcxx . . $ mngs_texture_page#proc_light. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
624 texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
625 break;
626 case TEXPAGE_COMMAND_EXTRA_PROCEDURAL2cxx . . $ `manage/texpage.cpp:302:9`!:
627 texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
628 break;
629 case TEXPAGE_COMMAND_PROCEDURALcxx . . $ `manage/texpage.cpp:300:9`!:
630 texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
631 texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
632 texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
633 texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
634 texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
635 texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
636
637 texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
638 texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[proc_index] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
639
640 proc_index++;
641 break;
642 default:
643 for (i = 0; i < len; i++)
644 cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
645 break;
646 }
647 }
648
649 // Jason hack
650 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha. < .9999)
651 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. |= TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`!;
652 else
653 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. &= ~TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`!;
654
655 texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. = proc_index;
656
657 if (texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. == 0)
658 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. &= ~TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!;
659
660 if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(texpage->destroy_name, "INVALID", 7))
661 strcpy(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., "");
662
663 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..usedcxx . . $ texture#used. = 1;
664
665 return 1; // successfully read
666 }
667
668 // Reads a texture page from an open file. Returns 0 on error.
669 int mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(CFILEcxx . . $ CFILE# *infile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
670 int i;
671
672 ASSERTcxx . . $ `misc/pserror.h:246:9`!(infile != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
673 mng_InitTexturePagecxx . . $ mng_InitTexturePage(d5a4c4c9147c0c99).(texpage);
674
675 int version = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(infile);
676
677 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
678 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
679 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
680
681 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..rcxx . . $ texture#r. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
682 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..gcxx . . $ texture#g. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
683 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..bcxx . . $ texture#b. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
684 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..alphacxx . . $ texture#alpha. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
685
686 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..speedcxx . . $ texture#speed. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
687
688 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_ucxx . . $ texture#slide_u. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
689 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..slide_vcxx . . $ texture#slide_v. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
690 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..reflectivitycxx . . $ texture#reflectivity. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
691
692 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..corona_typecxx . . $ texture#corona_type. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
693 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..damagecxx . . $ texture#damage. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
694 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
695
696 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
697 for (i = 0; i < 255; i++) {
698 uint16_tcxx . . $ uint16_t# val = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(infile);
699 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[i] = val;
700 }
701
702 texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
703 texpage->proc_lightcxx . . $ mngs_texture_page#proc_light. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
704 texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
705 texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
706
707 if (version >= 6) {
708 texpage->osc_timecxx . . $ mngs_texture_page#osc_time. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
709 texpage->osc_valuecxx . . $ mngs_texture_page#osc_value. = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
710 }
711
712 texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(infile);
713
714 if (texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. > MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!) {
715 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Warning! Too many procedural elements!\n");
716 Int3cxx . . $ `misc/pserror.h:247:9`!();
717 }
718
719 for (i = 0; i < texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.; i++) {
720 texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
721 texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
722 texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
723 texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
724 texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
725 texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
726
727 texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
728 texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[i] = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
729 }
730 }
731
732 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
733 if (texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. == 0)
734 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..flagscxx . . $ texture#flags. &= ~TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!;
735 }
736
737 if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(texpage->destroy_name, "INVALID", 7))
738 strcpy(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., "");
739
740 if (version >= 5) {
741
742 if (version < 7) {
743 // Kill buggy version of sound resolving code
744 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
745 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound. = -1;
746 strcpy(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., "");
747 } else
748 cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, infile);
749
750 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..sound_volumecxx . . $ texture#sound_volume. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(infile);
751 } else {
752 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound. = -1;
753 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..sound_volumecxx . . $ texture#sound_volume. = 1.0;
754 }
755
756 texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..usedcxx . . $ texture#used. = 1;
757
758 return 1; // successfully read
759 }
760
761 // Given some texture names, finds them in the table file and deletes them
762 // If local is 1, deletes from the local table file
763 int mng_DeleteTexPageSeriescxx . . $ mng_DeleteTexPageSeries(6f6099c1eba6c17c).(char *names[], int num_textures, int local) {
764 CFILEcxx . . $ CFILE# *infile, *outfile;
765 uint8_tcxx . . $ uint8_t# pagetype, replaced = 0;
766 int done = 0;
767 int deleted = 0;
768 memset(&texpage1cxx . . $ texpage1., 0, sizeof(mngs_texture_pagecxx . . $ mngs_texture_page#));
769
770 if (local)
771 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(LocalTableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
772 else
773 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(TableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
774
775 if (!infile) {
776 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't open table file to delete texture!\n");
777 Int3cxx . . $ `misc/pserror.h:247:9`!();
778 return 0;
779 }
780
781 if (local)
782 outfile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(LocalTempTableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb");
783 else
784 outfile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(TempTableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb");
785
786 if (!outfile) {
787 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't open temp table file to delete texture!\n");
788 cfclosecxx . . $ cfclose(3639e799710acb68).(infile);
789 Int3cxx . . $ `misc/pserror.h:247:9`!();
790 return 0;
791 }
792
793 while (!done) {
794 if (cfeofcxx . . $ cfeof(413716a422df0036).(infile)) {
795 done = 1;
796 continue;
797 }
798 pagetype = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
799 int len = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
800
801 // If not a texture page, just read it in and write it right back out
802 if (pagetype != PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!) {
803 mng_ReadWriteDummyPagecxx . . $ mng_ReadWriteDummyPage(3a9ef30e80ec550).(infile, outfile, pagetype);
804 continue;
805 }
806
807 mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(infile, &texpage1cxx . . $ texpage1.);
808
809 int found = -1;
810 for (int i = 0; i < num_textures && found == -1; i++) {
811 if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(names[i], texpage1.tex_struct.name)) {
812 found = i;
813 }
814 }
815
816 if (found == -1) // Not found
817 {
818 mng_WriteNewTexturePagecxx . . $ mng_WriteNewTexturePage(ba0e418ed632d802).(outfile, &texpage1cxx . . $ texpage1.);
819 } else
820 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Deleting %s (%s).\n", names[found], local ? "locally" : "on network");
821 }
822
823 cfclosecxx . . $ cfclose(3639e799710acb68).(infile);
824 cfclosecxx . . $ cfclose(3639e799710acb68).(outfile);
825
826 // Now, remove our table file and rename the temp file to be the table file
827
828 if (local) {
829 if (!SwitcherooFilescxx . . $ SwitcherooFiles(2f051e3560ff300f).(LocalTableFilenamecxx . . $ LocalTableFilename., LocalTempTableFilenamecxx . . $ LocalTempTableFilename.))
830 return 0;
831 } else {
832 if (!SwitcherooFilescxx . . $ SwitcherooFiles(2f051e3560ff300f).(TableFilenamecxx . . $ TableFilename., TempTableFilenamecxx . . $ TempTableFilename.))
833 return 0;
834 }
835
836 return 1; // successful!
837 }
838
839 // Reads in the texpage named "name" into texpage struct
840 // Returns 0 on error or couldn't find, else 1 if all is good
841 int mng_FindSpecificTexPagecxx . . $ mng_FindSpecificTexPage(c515c31a8f24d4fa).(char *name, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage, int offset) {
842 CFILEcxx . . $ CFILE# *infile;
843 uint8_tcxx . . $ uint8_t# pagetype;
844 int done = 0, found = 0;
845 int first_try = 1;
846 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# tablenamecxx . . $ std/filesystem/__cxx11/path#path(ced63f7c635d850d).;
847
848 if (Loading_localscxx . . $ Loading_locals.) {
849 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(LocalTableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
850 } else if (Loading_addon_tablecxx . . $ Loading_addon_table. != -1) {
851 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(AddOnDataTablescxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).[Loading_addon_tablecxx . . $ Loading_addon_table.].AddOnTableFilenamecxx . . $ AddOnTablefile#AddOnTableFilename., "rb");
852 } else {
853 if (Network_upcxx . . $ Network_up. && Starting_editorcxx . . $ Starting_editor.) {
854 int farg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-filter");
855
856 if (farg)
857 tablename =cxx . . $ std/filesystem/__cxx11/path#`operator=`(d30197541d75bb9a). GameArgscxx . . $ GameArgs.[farg + 1];
858 else
859 tablename =cxx . . $ std/filesystem/__cxx11/path#`operator=`(9c9aa2f17f237d0f). LocalTableDircxx . . $ LocalTableDir. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). NET_TABLEcxx . . $ `lib/manage.h:36:9`!;
860
861 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(tablename, "rb");
862 } else {
863 infile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
864 if (TablefileNameOverridecxx . . $ TablefileNameOverride.) {
865 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(TablefileNameOverridecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
866 }
867
868 if (!infile)
869 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(TableFilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
870 }
871 }
872
873 if (!infile) {
874 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't open table file to find texture!\n");
875 Int3cxx . . $ `misc/pserror.h:247:9`!();
876 return 0;
877 }
878
879 try_again:;
880 if (offset)
881 cfseekcxx . . $ cfseek(f9992d249f032805).(infile, offset, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
882
883 while (!done) {
884 if (cfeofcxx . . $ cfeof(413716a422df0036).(infile)) {
885 done = 1;
886 continue;
887 }
888 pagetype = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(infile);
889 int len = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(infile);
890
891 // If not a texture page, just read it in and ignore it
892 if (pagetype != PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!) {
893 cfseekcxx . . $ cfseek(f9992d249f032805).(infile, len - 4, SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!);
894 continue;
895 }
896
897 mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(infile, texpage);
898
899 if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(name, texpage->tex_struct.name)) {
900 // This is the page we want
901 found = 1;
902 done = 1;
903 }
904 }
905
906 cfclosecxx . . $ cfclose(3639e799710acb68).(infile);
907
908 if (!found && first_try) {
909 done = first_try = 0;
910 infile = cfopencxx . . $ cfopen(7c7b94e455f1ae56).("extra.gam"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
911 if (infile)
912 goto try_again;
913 }
914
915 return found; // successful!
916 }
917
918 // Given a texture page, allocs a texture and calls AssignTexPageToTexture to actually
919 // load bitmaps and values. Rturns texture handle on success, -1 if fail
920 int mng_SetAndLoadTexturecxx . . $ mng_SetAndLoadTexture(37ba96e75fb14565).(mngs_texture_pagecxx . . $ mngs_texture_page# *texpage, CFILEcxx . . $ CFILE# *infile) {
921 int n;
922
923 n = AllocTexturecxx . . $ AllocTexture(b126dc7c1de90089).();
924 if (n < 0)
925 return -1;
926 if (!mng_AssignTexPageToTexturecxx . . $ mng_AssignTexPageToTexture(728768d0b263a36e).(texpage, n, infile))
927 return -1;
928
929 return n;
930 }
931
932 // extern char Texture256Names[][80];
933 // extern int Num_256s;
934 // Given a texpage and a texture handle, attempts to make texture n correspond to
935 // to the texpage.
936 // Returns 1 on success, 0 otherwise
937 int mng_AssignTexPageToTexturecxx . . $ mng_AssignTexPageToTexture(728768d0b263a36e).(mngs_texture_pagecxx . . $ mngs_texture_page# *texpage, int n, CFILEcxx . . $ CFILE# *infile) {
938 texturecxx . . $ texture# *tex = &GameTexturescxx . . $ GameTextures.[n];
939 int bm_handle;
940
941 // copy our values
942 memcpy(tex, &texpage->tex_structcxx . . $ mngs_texture_page#tex_struct., sizeof(texturecxx . . $ texture#));
943
944 // Check to see if this image differs from the one on the net
945 // If so, make a local copy
946 // If this is a release, don't do any of this stuff
947 #ifndef RELEASE
948 if (Network_upcxx . . $ Network_up.) {
949 UpdatePrimitivecxx . . $ UpdatePrimitive(563e7f6fc320b4cb).(LocalManageGraphicsDircxx . . $ LocalManageGraphicsDir. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). texpagecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., ManageGraphicsDircxx . . $ ManageGraphicsDir. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). texpagecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.,
950 texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, tex->namecxx . . $ texture#name.);
951 }
952 #endif
953
954 // Try and load our textures bitmaps from the disk
955 uint8_tcxx . . $ uint8_t# pageable;
956 uint8_tcxx . . $ uint8_t# mipped = 1;
957
958 if (Network_upcxx . . $ Network_up.)
959 pageable = 0;
960 else
961 pageable = 1;
962
963 pageable = 1;
964
965 /*int done=0;
966 for (int i=0;i<Num_256s && !done;i++)
967 {
968 if (!stricmp (Texture256Names[i],tex->name))
969 {
970 tex->flags&=~(TF_TEXTURE_64|TF_TEXTURE_32);
971 tex->flags|=TF_TEXTURE_256;
972 mprintf(0,"Found 256...%s\n",tex->name);
973 int len=strlen (texpage->bitmap_name);
974 texpage->bitmap_name[len-3]='t';
975 texpage->bitmap_name[len-2]='g';
976 texpage->bitmap_name[len-1]='a';
977
978 done=1;
979 }
980 }*/
981
982 if (tex->flagscxx . . $ texture#flags. & TF_TEXTURE_64cxx . . $ `Descent3/gametexture.h:214:9`!) {
983 bm_handle = LoadTextureImagecxx . . $ LoadTextureImage(f997a6335c8241fb).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, SMALL_TEXTUREcxx . . $ `Descent3/gametexture.h:240:9`!, mipped, pageable);
984 } else if (tex->flagscxx . . $ texture#flags. & TF_TEXTURE_32cxx . . $ `Descent3/gametexture.h:216:9`!) {
985 bm_handle = LoadTextureImagecxx . . $ LoadTextureImage(f997a6335c8241fb).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, TINY_TEXTUREcxx . . $ `Descent3/gametexture.h:241:9`!, mipped, pageable);
986 } else if (tex->flagscxx . . $ texture#flags. & TF_TEXTURE_256cxx . . $ `Descent3/gametexture.h:229:9`!) {
987 mipped = 0;
988 bm_handle = LoadTextureImagecxx . . $ LoadTextureImage(f997a6335c8241fb).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, HUGE_TEXTUREcxx . . $ `Descent3/gametexture.h:242:9`!, mipped, pageable);
989 } else
990 bm_handle = LoadTextureImagecxx . . $ LoadTextureImage(f997a6335c8241fb).(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NORMAL_TEXTUREcxx . . $ `Descent3/gametexture.h:239:9`!, mipped, pageable);
991
992 if (bm_handle < 0) {
993 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't load bitmap '%s' in AssignTexPage...\n", texpage->bitmap_name);
994 tex->bm_handlecxx . . $ texture#bm_handle. = 0;
995 return 0;
996 } else
997 tex->bm_handlecxx . . $ texture#bm_handle. = bm_handle;
998
999 // Load the destroyed texture
1000 if (tex->flagscxx . . $ texture#flags. & TF_DESTROYABLEcxx . . $ `Descent3/gametexture.h:208:9`!) {
1001 // Are destroyed and non-destroyed the same?
1002 if (!(stricmpcxx . . $ `linux/linux_fix.h:43:9`!(texpage->destroy_name, tex->name))) {
1003 tex->flagscxx . . $ texture#flags. &= ~TF_DESTROYABLEcxx . . $ `Descent3/gametexture.h:208:9`!;
1004 tex->destroy_handlecxx . . $ texture#destroy_handle. = -1;
1005 } else {
1006
1007 int destroy_handle = mng_GetGuaranteedTexturePagecxx . . $ mng_GetGuaranteedTexturePage(a1d8d01c9983cd45).(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., infile);
1008 if (destroy_handle < 0)
1009 tex->destroy_handlecxx . . $ texture#destroy_handle. = 0;
1010 else
1011 tex->destroy_handlecxx . . $ texture#destroy_handle. = destroy_handle;
1012 }
1013 }
1014
1015 // Get sound if needed
1016 if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("", texpage->sound_name))
1017 tex->soundcxx . . $ texture#sound. = mng_GetGuaranteedSoundPagecxx . . $ mng_GetGuaranteedSoundPage(a1d8d01c9983cd45).(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., infile);
1018 else
1019 tex->soundcxx . . $ texture#sound. = -1;
1020
1021 // Set lighting flag
1022 if (tex->rcxx . . $ texture#r. > 0 || tex->gcxx . . $ texture#g. > 0 || tex->bcxx . . $ texture#b. > 0)
1023 tex->flagscxx . . $ texture#flags. |= TF_LIGHTcxx . . $ `Descent3/gametexture.h:220:9`!;
1024 else
1025 tex->flagscxx . . $ texture#flags. &= ~TF_LIGHTcxx . . $ `Descent3/gametexture.h:220:9`!;
1026
1027 // Set procedural if there is one
1028 if (tex->flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
1029 if (tex->proceduralcxx . . $ texture#procedural. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1030 FreeProceduralForTexturecxx . . $ FreeProceduralForTexture(d4f767463ce0a6b3).(n);
1031
1032 if (texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. == 0) {
1033 tex->flagscxx . . $ texture#flags. &= ~TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!;
1034
1035 } else {
1036 AllocateProceduralForTexturecxx . . $ AllocateProceduralForTexture(7864480464b09eea).(n);
1037 AllocateStaticProceduralsForTexturecxx . . $ AllocateStaticProceduralsForTexture(3e454b8ccf442868).(n, texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.);
1038 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->num_static_elementscxx . . $ proc_struct#num_static_elements. = texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.;
1039 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->heatcxx . . $ proc_struct#heat. = texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat.;
1040 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->lightcxx . . $ proc_struct#light. = texpage->proc_lightcxx . . $ mngs_texture_page#proc_light.;
1041 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->thicknesscxx . . $ proc_struct#thickness. = texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness.;
1042 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->evaluation_timecxx . . $ proc_struct#evaluation_time. = texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time.;
1043 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->osc_timecxx . . $ proc_struct#osc_time. = texpage->osc_timecxx . . $ mngs_texture_page#osc_time.;
1044 GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->osc_valuecxx . . $ proc_struct#osc_value. = texpage->osc_valuecxx . . $ mngs_texture_page#osc_value.;
1045
1046 // Last 2 colors are the same
1047 texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[255] = texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette.[254];
1048
1049 memcpy(GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->palettecxx . . $ proc_struct#palette., texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette., 256 * 2);
1050
1051 for (int i = 0; i < texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.; i++) {
1052 static_proc_elementcxx . . $ static_proc_element# *proc = &GameTexturescxx . . $ GameTextures.[n].proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i];
1053 proc->typecxx . . $ static_proc_element#type. = texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[i];
1054 proc->frequencycxx . . $ static_proc_element#frequency. = texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[i];
1055 proc->speedcxx . . $ static_proc_element#speed. = texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[i];
1056 proc->sizecxx . . $ static_proc_element#size. = texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[i];
1057 proc->x1cxx . . $ static_proc_element#x1. = texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[i];
1058 proc->y1cxx . . $ static_proc_element#y1. = texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[i];
1059 proc->x2cxx . . $ static_proc_element#x2. = texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[i];
1060 proc->y2cxx . . $ static_proc_element#y2. = texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[i];
1061 }
1062 }
1063 }
1064 return 1;
1065 }
1066
1067 // Copies values from a texture into a texture_page
1068 void mng_AssignTextureToTexPagecxx . . $ mng_AssignTextureToTexPage(a870206c076b2873).(int n, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage) {
1069 texturecxx . . $ texture# *tex = &GameTexturescxx . . $ GameTextures.[n];
1070
1071 memcpy(&texpage->tex_structcxx . . $ mngs_texture_page#tex_struct., tex, sizeof(texturecxx . . $ texture#));
1072
1073 if (tex->bm_handlecxx . . $ texture#bm_handle. != -1) {
1074 if (tex->flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!)
1075 strcpy(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., GameVClipscxx . . $ GameVClips.[tex->bm_handlecxx . . $ texture#bm_handle.].namecxx . . $ vclip#name.);
1076 else
1077 strcpy(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., GameBitmapscxx . . $ GameBitmaps.[tex->bm_handlecxx . . $ texture#bm_handle.].namecxx . . $ bms_bitmap#name.);
1078 } else
1079 strcpy(texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name., "");
1080
1081 if (tex->destroy_handlecxx . . $ texture#destroy_handle. != -1)
1082 strcpy(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., GameTexturescxx . . $ GameTextures.[tex->destroy_handlecxx . . $ texture#destroy_handle.].namecxx . . $ texture#name.);
1083 else
1084 strcpy(texpage->destroy_namecxx . . $ mngs_texture_page#destroy_name., "");
1085
1086 if (texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound. != -1)
1087 strcpy(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., Soundscxx . . $ Sounds.[texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..soundcxx . . $ texture#sound.].namecxx . . $ sound_info#name.);
1088 else
1089 strcpy(texpage->sound_namecxx . . $ mngs_texture_page#sound_name., "");
1090
1091 // assign procedural if there is one
1092 if (tex->flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) {
1093 memcpy(texpage->proc_palettecxx . . $ mngs_texture_page#proc_palette., tex->proceduralcxx . . $ texture#procedural.->palettecxx . . $ proc_struct#palette., 256 * 2);
1094 texpage->num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements. = tex->proceduralcxx . . $ texture#procedural.->num_static_elementscxx . . $ proc_struct#num_static_elements.;
1095 texpage->proc_heatcxx . . $ mngs_texture_page#proc_heat. = tex->proceduralcxx . . $ texture#procedural.->heatcxx . . $ proc_struct#heat.;
1096 texpage->proc_lightcxx . . $ mngs_texture_page#proc_light. = tex->proceduralcxx . . $ texture#procedural.->lightcxx . . $ proc_struct#light.;
1097 texpage->proc_thicknesscxx . . $ mngs_texture_page#proc_thickness. = tex->proceduralcxx . . $ texture#procedural.->thicknesscxx . . $ proc_struct#thickness.;
1098 texpage->proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time. = tex->proceduralcxx . . $ texture#procedural.->evaluation_timecxx . . $ proc_struct#evaluation_time.;
1099 texpage->osc_timecxx . . $ mngs_texture_page#osc_time. = tex->proceduralcxx . . $ texture#procedural.->osc_timecxx . . $ proc_struct#osc_time.;
1100 texpage->osc_valuecxx . . $ mngs_texture_page#osc_value. = tex->proceduralcxx . . $ texture#procedural.->osc_valuecxx . . $ proc_struct#osc_value.;
1101
1102 for (int i = 0; i < tex->proceduralcxx . . $ texture#procedural.->num_static_elementscxx . . $ proc_struct#num_static_elements.; i++) {
1103 texpage->proc_typecxx . . $ mngs_texture_page#proc_type.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].typecxx . . $ static_proc_element#type.;
1104 texpage->proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].frequencycxx . . $ static_proc_element#frequency.;
1105 texpage->proc_speedcxx . . $ mngs_texture_page#proc_speed.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].speedcxx . . $ static_proc_element#speed.;
1106 texpage->proc_sizecxx . . $ mngs_texture_page#proc_size.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].sizecxx . . $ static_proc_element#size.;
1107
1108 texpage->proc_x1cxx . . $ mngs_texture_page#proc_x1.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].x1cxx . . $ static_proc_element#x1.;
1109 texpage->proc_y1cxx . . $ mngs_texture_page#proc_y1.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].y1cxx . . $ static_proc_element#y1.;
1110 texpage->proc_x2cxx . . $ mngs_texture_page#proc_x2.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].x2cxx . . $ static_proc_element#x2.;
1111 texpage->proc_y2cxx . . $ mngs_texture_page#proc_y2.[i] = tex->proceduralcxx . . $ texture#procedural.->static_proc_elementscxx . . $ proc_struct#static_proc_elements.[i].y2cxx . . $ static_proc_element#y2.;
1112 }
1113 }
1114 }
1115
1116 // Loads in a texture page
1117 void mng_LoadNetTexturePagecxx . . $ mng_LoadNetTexturePage(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *infile, bool overlay) {
1118 memset(&texpage1cxx . . $ texpage1., 0, sizeof(mngs_texture_pagecxx . . $ mngs_texture_page#));
1119
1120 if (mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(infile, &texpage1cxx . . $ texpage1.)) {
1121 int n;
1122 n = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.);
1123 if (n != -1) {
1124 if (overlay) {
1125 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "OVERLAYING TEXTURE %s\n", texpage1.tex_struct.name);
1126 mng_FreePagetypePrimitivescxx . . $ mng_FreePagetypePrimitives(99469d7ff9a1485a).(PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., 0);
1127 mng_AssignTexPageToTexturecxx . . $ mng_AssignTexPageToTexture(728768d0b263a36e).(&texpage1cxx . . $ texpage1., n);
1128 }
1129 return;
1130 }
1131
1132 int ret = mng_SetAndLoadTexturecxx . . $ mng_SetAndLoadTexture(37ba96e75fb14565).(&texpage1cxx . . $ texpage1., infile);
1133 ASSERTcxx . . $ `misc/pserror.h:246:9`!(ret >= 0);
1134 } else
1135 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Could not load texpage named %s!\n", texpage1.tex_struct.name);
1136 }
1137
1138 // Loads in a texture page from a file, superseding any texture with that name
1139 // already in memory
1140 void mng_LoadLocalTexturePagecxx . . $ mng_LoadLocalTexturePage(3639e799710acb68).(CFILEcxx . . $ CFILE# *infile) {
1141 int ok = 0;
1142 memset(&texpage1cxx . . $ texpage1., 0, sizeof(mngs_texture_pagecxx . . $ mngs_texture_page#));
1143
1144 if (mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(infile, &texpage1cxx . . $ texpage1.)) {
1145 int i = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.);
1146 if (i != -1) {
1147 // Make sure we really have this page checked out
1148 mngs_Pagelockcxx . . $ mngs_Pagelock# pl;
1149 // int locked;
1150
1151 strcpy(pl.namecxx . . $ mngs_Pagelock#name., texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name.);
1152 pl.pagetypecxx . . $ mngs_Pagelock#pagetype. = PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!;
1153
1154 /*if (Network_up)
1155 {
1156 locked=mng_CheckIfPageOwned(&pl,TableUser);
1157 if (locked!=1)
1158 Int3(); // Your local vs net copies of the lock file do not match
1159 }*/
1160
1161 ok = 1;
1162 bool need_to_load_page = true;
1163
1164 if (Loading_addon_tablecxx . . $ Loading_addon_table. != -1) {
1165 AddOnTablefilecxx . . $ AddOnTablefile# *addon;
1166 int tidx;
1167
1168 // see if we really need to load this page
1169 // check to see if we already have loaded this page (because it was
1170 // a dependancy of another)
1171 addon = &AddOnDataTablescxx . . $ AddOnDataTables.[Loading_addon_tablecxx . . $ Loading_addon_table.];
1172 for (tidx = 0; tidx < addon->Num_addon_tracklockscxx . . $ AddOnTablefile#Num_addon_tracklocks.; tidx++) {
1173 if (addon->Addon_tracklockscxx . . $ AddOnTablefile#Addon_tracklocks.[tidx].pagetypecxx . . $ mngs_track_lock#pagetype. == PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`! &&
1174 !stricmpcxx . . $ `linux/linux_fix.h:43:9`!(addon->Addon_tracklocks[tidx].name, texpage1.tex_struct.name)) {
1175 // found it!!
1176 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TexturePage: %s previously loaded\n", texpage1.tex_struct.name);
1177 need_to_load_page = false;
1178 break;
1179 }
1180 }
1181 }
1182
1183 if (need_to_load_page) {
1184 mng_FreePagetypePrimitivescxx . . $ mng_FreePagetypePrimitives(99469d7ff9a1485a).(PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., 0);
1185 mng_AssignTexPageToTexturecxx . . $ mng_AssignTexPageToTexture(728768d0b263a36e).(&texpage1cxx . . $ texpage1., i);
1186
1187 // For addon data
1188 if (Loading_addon_tablecxx . . $ Loading_addon_table. != -1) {
1189 // this is an overlay of some sort..see which we are overlaying
1190 int overlay = 1;
1191 int addidx, tidx;
1192 bool found = false;
1193 for (addidx = Num_addon_tablescxx . . $ Num_addon_tables. - 1; addidx >= 0; addidx--) {
1194 if (addidx == Loading_addon_tablecxx . . $ Loading_addon_table.)
1195 continue;
1196 AddOnTablefilecxx . . $ AddOnTablefile# *addon = &AddOnDataTablescxx . . $ AddOnDataTables.[addidx];
1197
1198 // look for the page in this table file
1199 for (tidx = 0; tidx < addon->Num_addon_tracklockscxx . . $ AddOnTablefile#Num_addon_tracklocks.; tidx++) {
1200 if (addon->Addon_tracklockscxx . . $ AddOnTablefile#Addon_tracklocks.[tidx].pagetypecxx . . $ mngs_track_lock#pagetype. == PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`! &&
1201 !stricmpcxx . . $ `linux/linux_fix.h:43:9`!(addon->Addon_tracklocks[tidx].name, texpage1.tex_struct.name)) {
1202 // found it!!
1203 found = true;
1204 overlay = addidx + 2;
1205 break;
1206 }
1207 }
1208
1209 if (found)
1210 break;
1211 }
1212
1213 mng_PushAddonPagecxx . . $ mng_PushAddonPage(99469d7ff9a1485a).(PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., overlay);
1214 }
1215 }
1216 } else {
1217 // This is a local texture that has never been checked in
1218 if ((i = mng_SetAndLoadTexturecxx . . $ mng_SetAndLoadTexture(37ba96e75fb14565).(&texpage1cxx . . $ texpage1., infile)) < 0)
1219 ok = 0;
1220 else
1221 ok = 1;
1222
1223 // For addon data
1224 if (ok && Loading_addon_tablecxx . . $ Loading_addon_table. != -1)
1225 mng_PushAddonPagecxx . . $ mng_PushAddonPage(99469d7ff9a1485a).(PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., 0);
1226 }
1227
1228 // ASSERT (ok==1); // There was problem loading a page!
1229 if (ok != 1)
1230 DataErrorcxx . . $ DataError(326aeb464d16410c).("Cannot load texture <%s>, bitmap name <%s>\n", texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., texpage1cxx . . $ texpage1..bitmap_namecxx . . $ mngs_texture_page#bitmap_name.);
1231
1232 if (Loading_addon_tablecxx . . $ Loading_addon_table. == -1)
1233 mng_AllocTrackLockcxx . . $ mng_AllocTrackLock(6abd07ddb1a912f0).(texpage1cxx . . $ texpage1..tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!);
1234
1235 } else
1236 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Could not load texpage named %s!\n", texpage1.tex_struct.name);
1237 }
1238
1239 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
1240
1241 // First searches through the texture index to see if the texture is already
1242 // loaded. If not, searches in the table file and loads it.
1243 // Returns index of texture found, -1 if not
1244 int mng_GetGuaranteedTexturePagecxx . . $ mng_GetGuaranteedTexturePage(a1d8d01c9983cd45).(char *name, CFILEcxx . . $ CFILE# *infile) {
1245 int i;
1246
1247 // See if its in memory
1248 i = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(name);
1249 if (i != -1)
1250 return i;
1251
1252 mngs_texture_pagecxx . . $ mngs_texture_page# *texpage = (mngs_texture_pagecxx . . $ mngs_texture_page# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(*texpage));
1253
1254 // Not in memory. Load it from the table file. Start searching from the
1255 // current spot in the open table file
1256 int ret = mng_FindSpecificTexPagecxx . . $ mng_FindSpecificTexPage(c515c31a8f24d4fa).(name, texpage, infile ? infile->positioncxx . . $ CFILE#position. : 0);
1257 if (!ret)
1258 return -1;
1259
1260 // We've found it in the table file, now load it.
1261 ret = mng_SetAndLoadTexturecxx . . $ mng_SetAndLoadTexture(37ba96e75fb14565).(texpage, infile);
1262 // ASSERT (ret>=0);
1263 if (ret < 0)
1264 DataErrorcxx . . $ DataError(326aeb464d16410c).("Cannot load texture <%s>, bitmap name <%s>\n", texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., texpage->bitmap_namecxx . . $ mngs_texture_page#bitmap_name.);
1265
1266 if (Loading_addon_tablecxx . . $ Loading_addon_table. != -1) {
1267 // we're loading addon table pages, this will not overlay anything
1268 mng_PushAddonPagecxx . . $ mng_PushAddonPage(99469d7ff9a1485a).(PAGETYPE_TEXTUREcxx . . $ `lib/manage.h:49:9`!, texpage->tex_structcxx . . $ mngs_texture_page#tex_struct..namecxx . . $ texture#name., 0);
1269 }
1270 mem_freecxx . . $ `mem/mem.h:80:9`!(texpage);
1271
1272 return ret;
1273 }