GameDirectorSB 29-03-23 [v1.24] World Editor Export and Preview World Functions
@@ -281,217 +281,6 @@ | ||
281 | 281 | } |
282 | 282 | |
283 | 283 | // ************************************************************************* |
284 | -// * Level_ExportTo_RFW * | |
285 | -// ************************************************************************* | |
286 | -bool AB_Export_RFW::Level_ExportTo_RFW(Level2 *pLevel, const char *Filename, BrushList *BList,int ExpSelected, geBoolean ExpLights, int GroupID) | |
287 | -{ | |
288 | - | |
289 | - FILE *f; | |
290 | - geBoolean WriteRslt; | |
291 | - int size, i; | |
292 | - geBoolean *WrittenTex; | |
293 | - | |
294 | - if(!pLevel) return GE_FALSE; | |
295 | - if(!Filename) return GE_FALSE; | |
296 | - | |
297 | - // error checking required! | |
298 | - f = fopen(Filename, "wb"); | |
299 | - | |
300 | - if (!f) return GE_FALSE; | |
301 | - | |
302 | - WriteRslt = GE_FALSE; | |
303 | - | |
304 | - // get the number of textures | |
305 | - WrittenTex=(geBoolean *)calloc(sizeof(geBoolean), pLevel->WadFile->mBitmapCount); | |
306 | - // which textures are used? | |
307 | - BrushList_GetUsedTextures(BList, WrittenTex, pLevel->WadFile); | |
308 | - | |
309 | - const int FileLength = 11; | |
310 | - | |
311 | - fseek(f, 32L, SEEK_SET); | |
312 | - | |
313 | - // write all used materials to the file | |
314 | - for(i=0;i<pLevel->WadFile->mBitmapCount;i++) | |
315 | - { | |
316 | - if(WrittenTex[i]) | |
317 | - { | |
318 | - // 3ds only allows DOS 8.3 file names, so cut the name if necessary | |
319 | - char matname[FileLength]; | |
320 | - int j,k; | |
321 | - strncpy (matname, pLevel->WadFile->mBitmaps[i].Name, FileLength-1); | |
322 | - matname[FileLength-1] = '\0'; | |
323 | - for(j=0;matname[j]!='\0';j++); | |
324 | - | |
325 | - TypeIO_WriteUshort(f, CHUNK_MATBLOCK); | |
326 | - TypeIO_WriteInt(f, 6+6+j+1 +(3*15) + 102 +6 +8 +6+j+5 +8); | |
327 | - | |
328 | - // write material name | |
329 | - TypeIO_WriteUshort(f, CHUNK_MATNAME); | |
330 | - TypeIO_WriteInt(f,(6+j+1)); | |
331 | - for(k=0;k<=j;k++) | |
332 | - TypeIO_WriteUChar(f, matname[k]); | |
333 | - | |
334 | - // ambient color | |
335 | - TypeIO_WriteUshort(f, CHUNK_MATAMB); //0xA010 Ambient color | |
336 | - TypeIO_WriteInt(f,6+6+3); | |
337 | - | |
338 | - TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
339 | - TypeIO_WriteInt(f,6+3); | |
340 | - TypeIO_WriteUChar(f, (char)120); | |
341 | - TypeIO_WriteUChar(f, (char)120); | |
342 | - TypeIO_WriteUChar(f, (char)120); | |
343 | - | |
344 | - // diffuse color | |
345 | - TypeIO_WriteUshort(f, CHUNK_MATDIFF); //0xA020 Diffuse color | |
346 | - TypeIO_WriteInt(f,6+6+3); | |
347 | - | |
348 | - TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
349 | - TypeIO_WriteInt(f,6+3); | |
350 | - TypeIO_WriteUChar(f, (char)120); | |
351 | - TypeIO_WriteUChar(f, (char)120); | |
352 | - TypeIO_WriteUChar(f, (char)120); | |
353 | - | |
354 | - // specular color | |
355 | - TypeIO_WriteUshort(f, CHUNK_MATSPEC); //0xA030 Specular color | |
356 | - TypeIO_WriteInt(f,6+6+3); | |
357 | - | |
358 | - TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
359 | - TypeIO_WriteInt(f,6+3); | |
360 | - TypeIO_WriteUChar(f, (char)120); | |
361 | - TypeIO_WriteUChar(f, (char)120); | |
362 | - TypeIO_WriteUChar(f, (char)120); | |
363 | - | |
364 | - TypeIO_WriteUshort(f, CHUNK_MATSHININESS); | |
365 | - TypeIO_WriteInt(f,14); | |
366 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
367 | - TypeIO_WriteInt(f,8); | |
368 | - TypeIO_WriteUshort(f, 0); | |
369 | - | |
370 | - TypeIO_WriteUshort(f, CHUNK_MATSHIN2PCT); | |
371 | - TypeIO_WriteInt(f,14); | |
372 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
373 | - TypeIO_WriteInt(f,8); | |
374 | - TypeIO_WriteUshort(f, 0); | |
375 | - | |
376 | - TypeIO_WriteUshort(f, CHUNK_MATTRANS); | |
377 | - TypeIO_WriteInt(f,14); | |
378 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
379 | - TypeIO_WriteInt(f,8); | |
380 | - TypeIO_WriteUshort(f, 0); | |
381 | - | |
382 | - TypeIO_WriteUshort(f, CHUNK_MATXPFALL); | |
383 | - TypeIO_WriteInt(f,14); | |
384 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
385 | - TypeIO_WriteInt(f,8); | |
386 | - TypeIO_WriteUshort(f, 0); | |
387 | - | |
388 | - TypeIO_WriteUshort(f, CHUNK_MATREFBLUR); | |
389 | - TypeIO_WriteInt(f,14); | |
390 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
391 | - TypeIO_WriteInt(f,8); | |
392 | - TypeIO_WriteUshort(f, 0); | |
393 | - | |
394 | - TypeIO_WriteUshort(f, CHUNK_MATSHADING); | |
395 | - TypeIO_WriteInt(f,8); | |
396 | - TypeIO_WriteUshort(f, 3); | |
397 | - | |
398 | - TypeIO_WriteUshort(f, CHUNK_MATDECAL); | |
399 | - TypeIO_WriteInt(f,14); | |
400 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
401 | - TypeIO_WriteInt(f,8); | |
402 | - TypeIO_WriteUshort(f, 0); | |
403 | - | |
404 | - TypeIO_WriteUshort(f, CHUNK_MATWIRESIZE); | |
405 | - TypeIO_WriteInt(f,10); | |
406 | - TypeIO_WriteFloat(f, 1.0f); | |
407 | - | |
408 | - // texture map | |
409 | - TypeIO_WriteUshort(f, CHUNK_MAP); | |
410 | - TypeIO_WriteInt(f,6+8+6+j+5+8); | |
411 | - | |
412 | - TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
413 | - TypeIO_WriteInt(f,8); | |
414 | - TypeIO_WriteUshort(f, 100); | |
415 | - | |
416 | - // write map name | |
417 | - TypeIO_WriteUshort(f, CHUNK_MAPNAME); | |
418 | - TypeIO_WriteInt(f, 6+j+5); | |
419 | - for(k=0;k<j;k++) | |
420 | - TypeIO_WriteUChar(f, matname[k]); | |
421 | - TypeIO_WriteUChar(f, '.'); | |
422 | - if(geBitmap_HasAlpha(pLevel->WadFile->mBitmaps[i].bmp)) | |
423 | - { | |
424 | - TypeIO_WriteUChar(f, 't'); | |
425 | - TypeIO_WriteUChar(f, 'g'); | |
426 | - TypeIO_WriteUChar(f, 'a'); | |
427 | - } | |
428 | - else | |
429 | - { | |
430 | - TypeIO_WriteUChar(f, 'b'); | |
431 | - TypeIO_WriteUChar(f, 'm'); | |
432 | - TypeIO_WriteUChar(f, 'p'); | |
433 | - } | |
434 | - | |
435 | - TypeIO_WriteUChar(f, '\0'); | |
436 | - | |
437 | - TypeIO_WriteUshort(f, CHUNK_MAPTILING); | |
438 | - TypeIO_WriteInt(f,8); | |
439 | - TypeIO_WriteUshort(f, 0); | |
440 | - } | |
441 | - } | |
442 | - | |
443 | - // write out the master scale | |
444 | - TypeIO_WriteUshort(f, MASTER_SCALE); | |
445 | - TypeIO_WriteInt(f, 10); | |
446 | - TypeIO_WriteFloat(f, 1.0f); | |
447 | - | |
448 | - // export the brushes | |
449 | - if (BrushList_ExportTo3ds (BList, f, GE_FALSE) == GE_FALSE) goto WriteDone; | |
450 | - | |
451 | -// changed QD 12/03 | |
452 | - int size_kf; | |
453 | - size_kf=0; | |
454 | - | |
455 | - size = ftell(f); | |
456 | - | |
457 | - // move back to the bginning of the file | |
458 | - fseek(f, 0L, SEEK_SET ); | |
459 | - | |
460 | - TypeIO_WriteUshort(f,CHUNK_MAIN3DS); | |
461 | - TypeIO_WriteInt(f, size); | |
462 | - | |
463 | - TypeIO_WriteUshort(f, CHUNK_VERSION); | |
464 | - TypeIO_WriteInt(f, 10); | |
465 | - TypeIO_WriteInt(f, 3); | |
466 | - | |
467 | - TypeIO_WriteUshort(f,CHUNK_EDIT3DS); | |
468 | -// changed QD 12/03 | |
469 | - TypeIO_WriteInt(f, size-16-size_kf); | |
470 | -// end change | |
471 | - TypeIO_WriteUshort(f,CHUNK_MESH_VERSION); | |
472 | - TypeIO_WriteInt(f, 10); | |
473 | - TypeIO_WriteInt(f, 3); | |
474 | - | |
475 | - WriteRslt = GE_TRUE; | |
476 | - | |
477 | -WriteDone: | |
478 | - | |
479 | - free(WrittenTex); | |
480 | - | |
481 | - if (fclose(f) != 0) return GE_FALSE; | |
482 | - | |
483 | -// changed QD 12/03 | |
484 | - if((size-size_kf)<=42) | |
485 | - _unlink(Filename); | |
486 | -// end change | |
487 | - | |
488 | - | |
489 | - Write_Project_File("GDSB.Wepf",Filename); | |
490 | - | |
491 | - return WriteRslt; | |
492 | -} | |
493 | - | |
494 | -// ************************************************************************* | |
495 | 284 | // * Write_Project_File Terry Flanigan * |
496 | 285 | // ************************************************************************* |
497 | 286 | bool AB_Export_RFW::Write_Project_File(char* Path_And_File,const char* Filename) |
@@ -29,7 +29,7 @@ | ||
29 | 29 | virtual ~AB_Export_RFW(); |
30 | 30 | |
31 | 31 | void ExportTo_RFW(const char *FileName, int ExpSelected, geBoolean ExpLights, geBoolean ExpFiles); |
32 | - bool Level_ExportTo_RFW(Level2 *pLevel, const char *Filename, BrushList *BList,int ExpSelected, geBoolean ExpLights, int GroupID); | |
32 | + | |
33 | 33 | |
34 | 34 | bool Write_Project_File(char* Path_And_File,const char* Filename); |
35 | 35 |
@@ -25,9 +25,71 @@ | ||
25 | 25 | #include "AB_App.h" |
26 | 26 | #include "A_Export_World.h" |
27 | 27 | |
28 | +#include "FUSIONDoc.h" | |
29 | +#include "level.h" | |
30 | +#include "Parse3dt.h" | |
31 | +#include "EntTypeName.h" | |
32 | +#include <assert.h> | |
33 | +#include "ram.h" | |
34 | +#include "units.h" | |
35 | +#include "util.h" | |
36 | +#include "FilePath.h" | |
37 | +// changed QD 12/03 | |
38 | +#include <malloc.h> | |
39 | +#include "typeio.h" | |
40 | + | |
41 | +#define NUM_VIEWS (4) | |
42 | + | |
43 | +struct tag_Level3 | |
44 | +{ | |
45 | + BrushList *Brushes; | |
46 | + CEntityArray *Entities; | |
47 | + char *WadPath; | |
48 | + char *HeadersDir; | |
49 | + // changed QD Actors | |
50 | + char *ActorsDir; | |
51 | + geBoolean ShowActors; | |
52 | + char *PawnIniPath; | |
53 | + // end change | |
54 | + EntTypeNameList *EntTypeNames; | |
55 | + GroupListType *Groups; | |
56 | + SizeInfo *WadSizeInfos; | |
57 | + CWadFile *WadFile; | |
58 | + EntityTable *pEntityDefs; | |
59 | + | |
60 | + ModelInfo_Type ModelInfo; | |
61 | + | |
62 | + SkyFaceTexture SkyFaces[6]; | |
63 | + geVec3d SkyRotationAxis; | |
64 | + geFloat SkyRotationSpeed; | |
65 | + geFloat SkyTextureScale; | |
66 | + | |
67 | + // level edit settings | |
68 | + CompileParamsType CompileParams; | |
69 | + int GroupVisSetting; | |
70 | + EntityViewList *pEntityView; | |
71 | + | |
72 | + GridInfo GridSettings; | |
73 | + geBoolean BspRebuildFlag; | |
74 | + ViewStateInfo ViewInfo[NUM_VIEWS]; | |
75 | + | |
76 | + BrushTemplate_Arch ArchTemplate; | |
77 | + BrushTemplate_Box BoxTemplate; | |
78 | + BrushTemplate_Cone ConeTemplate; | |
79 | + BrushTemplate_Cylinder CylinderTemplate; | |
80 | + BrushTemplate_Spheroid SpheroidTemplate; | |
81 | + BrushTemplate_Staircase StaircaseTemplate; | |
82 | + | |
83 | + geVec3d TemplatePos; | |
84 | + | |
85 | + float DrawScale; // default draw scale | |
86 | + float LightmapScale; // default lightmap scale | |
87 | +}; | |
88 | + | |
28 | 89 | A_Export_World::A_Export_World(void) |
29 | 90 | { |
30 | - | |
91 | + m_pDoc = NULL; | |
92 | + WriteScene = NULL; | |
31 | 93 | } |
32 | 94 | |
33 | 95 | A_Export_World::~A_Export_World(void) |
@@ -35,6 +97,51 @@ | ||
35 | 97 | |
36 | 98 | } |
37 | 99 | |
100 | + | |
101 | +// changed QD 12/03 | |
102 | +#define CHUNK_MAIN3DS 0x4d4d | |
103 | +#define CHUNK_VERSION 0x0002 | |
104 | +#define CHUNK_EDIT3DS 0x3d3d | |
105 | +#define CHUNK_MESH_VERSION 0x3d3e | |
106 | +// global chunks | |
107 | +#define CHUNK_COLORRGB 0x0011 | |
108 | +#define CHUNK_PERCENT 0x0030 | |
109 | +// Object chunks | |
110 | +/* | |
111 | +#define CHUNK_OBJBLOCK 0x4000 | |
112 | +#define CHUNK_TRIMESH 0x4100 | |
113 | +#define CHUNK_VERTLIST 0x4110 | |
114 | +#define CHUNK_FACELIST 0x4120 | |
115 | +#define CHUNK_MAPLIST 0x4140 | |
116 | +#define CHUNK_SMOOTHLIST 0x4150 | |
117 | +*/ | |
118 | +// Material chunks | |
119 | +#define CHUNK_MATBLOCK 0xAFFF | |
120 | +#define CHUNK_MATNAME 0xA000 | |
121 | +#define CHUNK_MATAMB 0xA010 // Ambient color | |
122 | +#define CHUNK_MATDIFF 0xA020 // Diffuse color | |
123 | +#define CHUNK_MATSPEC 0xA030 // Specular color | |
124 | +#define CHUNK_MATSHININESS 0xA040 | |
125 | +#define CHUNK_MATSHIN2PCT 0xA041 | |
126 | +#define CHUNK_MATTRANS 0xA050 | |
127 | +#define CHUNK_MATXPFALL 0xA052 | |
128 | +#define CHUNK_MATREFBLUR 0xA053 | |
129 | +#define CHUNK_MATSHADING 0xA100 | |
130 | +#define CHUNK_MATDECAL 0xA084 | |
131 | +#define CHUNK_MATWIRESIZE 0xA087 | |
132 | +#define CHUNK_MAP 0xA200 | |
133 | +#define CHUNK_MAPNAME 0xA300 // name of bitmap | |
134 | +#define CHUNK_MAPTILING 0xA351 | |
135 | + | |
136 | +// Keyframe chunks | |
137 | +#define CHUNK_KEYFRAME 0xB000 | |
138 | +#define CHUNK_KF_HDR 0xB00a | |
139 | +#define CHUNK_KF_SEG 0xB008 // start, end | |
140 | +#define CHUNK_KF_CURTIME 0xB009 | |
141 | + | |
142 | +#define MASTER_SCALE 0x0100 | |
143 | + | |
144 | + | |
38 | 145 | // ************************************************************************* |
39 | 146 | // * Export_World_GD3D:- Terry and Hazel Flanigan 2023 * |
40 | 147 | // ************************************************************************* |
@@ -51,8 +158,260 @@ | ||
51 | 158 | strcat(App->CL_FileIO->FileName, ".G3ds"); |
52 | 159 | } |
53 | 160 | |
54 | - App->pCFusionDoc = (CFusionDoc*)App->m_pMainFrame->GetCurrentDoc(); | |
161 | + m_pDoc = (CFusionDoc*)App->m_pMainFrame->GetCurrentDoc(); | |
55 | 162 | |
56 | - App->pCFusionDoc->ExportTo_RFW(App->CL_FileIO->PathFileName, 1, 0, 0); | |
163 | + m_pDoc->ExportTo_RFW(App->CL_FileIO->PathFileName, 1, 0, 0); | |
57 | 164 | } |
58 | 165 | } |
166 | + | |
167 | +// ************************************************************************* | |
168 | +// * Level_Build_G3ds:- Terry and Hazel Flanigan 2023 * | |
169 | +// ************************************************************************* | |
170 | +bool A_Export_World::Level_Build_G3ds(Level3 *pLevel, const char *Filename, BrushList *BList,int ExpSelected, geBoolean ExpLights, int GroupID) | |
171 | +{ | |
172 | + FILE *f; | |
173 | + geBoolean WriteRslt; | |
174 | + int size, i; | |
175 | + geBoolean *WrittenTex; | |
176 | + | |
177 | + if(!pLevel) return GE_FALSE; | |
178 | + if(!Filename) return GE_FALSE; | |
179 | + | |
180 | + // error checking required! | |
181 | + f = fopen(Filename, "wb"); | |
182 | + | |
183 | + if (!f) return GE_FALSE; | |
184 | + | |
185 | + WriteRslt = GE_FALSE; | |
186 | + | |
187 | + // get the number of textures | |
188 | + WrittenTex=(geBoolean *)calloc(sizeof(geBoolean), pLevel->WadFile->mBitmapCount); | |
189 | + // which textures are used? | |
190 | + BrushList_GetUsedTextures(BList, WrittenTex, pLevel->WadFile); | |
191 | + | |
192 | + const int FileLength = 11; | |
193 | + | |
194 | + fseek(f, 32L, SEEK_SET); | |
195 | + | |
196 | + // write all used materials to the file | |
197 | + for(i=0;i<pLevel->WadFile->mBitmapCount;i++) | |
198 | + { | |
199 | + if(WrittenTex[i]) | |
200 | + { | |
201 | + // 3ds only allows DOS 8.3 file names, so cut the name if necessary | |
202 | + char matname[FileLength]; | |
203 | + int j,k; | |
204 | + strncpy (matname, pLevel->WadFile->mBitmaps[i].Name, FileLength-1); | |
205 | + matname[FileLength-1] = '\0'; | |
206 | + for(j=0;matname[j]!='\0';j++); | |
207 | + | |
208 | + TypeIO_WriteUshort(f, CHUNK_MATBLOCK); | |
209 | + TypeIO_WriteInt(f, 6+6+j+1 +(3*15) + 102 +6 +8 +6+j+5 +8); | |
210 | + | |
211 | + // write material name | |
212 | + TypeIO_WriteUshort(f, CHUNK_MATNAME); | |
213 | + TypeIO_WriteInt(f,(6+j+1)); | |
214 | + for(k=0;k<=j;k++) | |
215 | + TypeIO_WriteUChar(f, matname[k]); | |
216 | + | |
217 | + // ambient color | |
218 | + TypeIO_WriteUshort(f, CHUNK_MATAMB); //0xA010 Ambient color | |
219 | + TypeIO_WriteInt(f,6+6+3); | |
220 | + | |
221 | + TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
222 | + TypeIO_WriteInt(f,6+3); | |
223 | + TypeIO_WriteUChar(f, (char)120); | |
224 | + TypeIO_WriteUChar(f, (char)120); | |
225 | + TypeIO_WriteUChar(f, (char)120); | |
226 | + | |
227 | + // diffuse color | |
228 | + TypeIO_WriteUshort(f, CHUNK_MATDIFF); //0xA020 Diffuse color | |
229 | + TypeIO_WriteInt(f,6+6+3); | |
230 | + | |
231 | + TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
232 | + TypeIO_WriteInt(f,6+3); | |
233 | + TypeIO_WriteUChar(f, (char)120); | |
234 | + TypeIO_WriteUChar(f, (char)120); | |
235 | + TypeIO_WriteUChar(f, (char)120); | |
236 | + | |
237 | + // specular color | |
238 | + TypeIO_WriteUshort(f, CHUNK_MATSPEC); //0xA030 Specular color | |
239 | + TypeIO_WriteInt(f,6+6+3); | |
240 | + | |
241 | + TypeIO_WriteUshort(f, CHUNK_COLORRGB); | |
242 | + TypeIO_WriteInt(f,6+3); | |
243 | + TypeIO_WriteUChar(f, (char)120); | |
244 | + TypeIO_WriteUChar(f, (char)120); | |
245 | + TypeIO_WriteUChar(f, (char)120); | |
246 | + | |
247 | + TypeIO_WriteUshort(f, CHUNK_MATSHININESS); | |
248 | + TypeIO_WriteInt(f,14); | |
249 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
250 | + TypeIO_WriteInt(f,8); | |
251 | + TypeIO_WriteUshort(f, 0); | |
252 | + | |
253 | + TypeIO_WriteUshort(f, CHUNK_MATSHIN2PCT); | |
254 | + TypeIO_WriteInt(f,14); | |
255 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
256 | + TypeIO_WriteInt(f,8); | |
257 | + TypeIO_WriteUshort(f, 0); | |
258 | + | |
259 | + TypeIO_WriteUshort(f, CHUNK_MATTRANS); | |
260 | + TypeIO_WriteInt(f,14); | |
261 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
262 | + TypeIO_WriteInt(f,8); | |
263 | + TypeIO_WriteUshort(f, 0); | |
264 | + | |
265 | + TypeIO_WriteUshort(f, CHUNK_MATXPFALL); | |
266 | + TypeIO_WriteInt(f,14); | |
267 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
268 | + TypeIO_WriteInt(f,8); | |
269 | + TypeIO_WriteUshort(f, 0); | |
270 | + | |
271 | + TypeIO_WriteUshort(f, CHUNK_MATREFBLUR); | |
272 | + TypeIO_WriteInt(f,14); | |
273 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
274 | + TypeIO_WriteInt(f,8); | |
275 | + TypeIO_WriteUshort(f, 0); | |
276 | + | |
277 | + TypeIO_WriteUshort(f, CHUNK_MATSHADING); | |
278 | + TypeIO_WriteInt(f,8); | |
279 | + TypeIO_WriteUshort(f, 3); | |
280 | + | |
281 | + TypeIO_WriteUshort(f, CHUNK_MATDECAL); | |
282 | + TypeIO_WriteInt(f,14); | |
283 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
284 | + TypeIO_WriteInt(f,8); | |
285 | + TypeIO_WriteUshort(f, 0); | |
286 | + | |
287 | + TypeIO_WriteUshort(f, CHUNK_MATWIRESIZE); | |
288 | + TypeIO_WriteInt(f,10); | |
289 | + TypeIO_WriteFloat(f, 1.0f); | |
290 | + | |
291 | + // texture map | |
292 | + TypeIO_WriteUshort(f, CHUNK_MAP); | |
293 | + TypeIO_WriteInt(f,6+8+6+j+5+8); | |
294 | + | |
295 | + TypeIO_WriteUshort(f, CHUNK_PERCENT); | |
296 | + TypeIO_WriteInt(f,8); | |
297 | + TypeIO_WriteUshort(f, 100); | |
298 | + | |
299 | + // write map name | |
300 | + TypeIO_WriteUshort(f, CHUNK_MAPNAME); | |
301 | + TypeIO_WriteInt(f, 6+j+5); | |
302 | + for(k=0;k<j;k++) | |
303 | + TypeIO_WriteUChar(f, matname[k]); | |
304 | + TypeIO_WriteUChar(f, '.'); | |
305 | + if(geBitmap_HasAlpha(pLevel->WadFile->mBitmaps[i].bmp)) | |
306 | + { | |
307 | + TypeIO_WriteUChar(f, 't'); | |
308 | + TypeIO_WriteUChar(f, 'g'); | |
309 | + TypeIO_WriteUChar(f, 'a'); | |
310 | + } | |
311 | + else | |
312 | + { | |
313 | + TypeIO_WriteUChar(f, 'b'); | |
314 | + TypeIO_WriteUChar(f, 'm'); | |
315 | + TypeIO_WriteUChar(f, 'p'); | |
316 | + } | |
317 | + | |
318 | + TypeIO_WriteUChar(f, '\0'); | |
319 | + | |
320 | + TypeIO_WriteUshort(f, CHUNK_MAPTILING); | |
321 | + TypeIO_WriteInt(f,8); | |
322 | + TypeIO_WriteUshort(f, 0); | |
323 | + } | |
324 | + } | |
325 | + | |
326 | + // write out the master scale | |
327 | + TypeIO_WriteUshort(f, MASTER_SCALE); | |
328 | + TypeIO_WriteInt(f, 10); | |
329 | + TypeIO_WriteFloat(f, 1.0f); | |
330 | + | |
331 | + // export the brushes | |
332 | + if (BrushList_ExportTo3ds (BList, f, GE_FALSE) == GE_FALSE) goto WriteDone; | |
333 | + | |
334 | +// changed QD 12/03 | |
335 | + int size_kf; | |
336 | + size_kf=0; | |
337 | + | |
338 | + size = ftell(f); | |
339 | + | |
340 | + // move back to the bginning of the file | |
341 | + fseek(f, 0L, SEEK_SET ); | |
342 | + | |
343 | + TypeIO_WriteUshort(f,CHUNK_MAIN3DS); | |
344 | + TypeIO_WriteInt(f, size); | |
345 | + | |
346 | + TypeIO_WriteUshort(f, CHUNK_VERSION); | |
347 | + TypeIO_WriteInt(f, 10); | |
348 | + TypeIO_WriteInt(f, 3); | |
349 | + | |
350 | + TypeIO_WriteUshort(f,CHUNK_EDIT3DS); | |
351 | +// changed QD 12/03 | |
352 | + TypeIO_WriteInt(f, size-16-size_kf); | |
353 | +// end change | |
354 | + TypeIO_WriteUshort(f,CHUNK_MESH_VERSION); | |
355 | + TypeIO_WriteInt(f, 10); | |
356 | + TypeIO_WriteInt(f, 3); | |
357 | + | |
358 | + WriteRslt = GE_TRUE; | |
359 | + | |
360 | +WriteDone: | |
361 | + | |
362 | + free(WrittenTex); | |
363 | + | |
364 | + if (fclose(f) != 0) return GE_FALSE; | |
365 | + | |
366 | +// changed QD 12/03 | |
367 | + if((size-size_kf)<=42) | |
368 | + _unlink(Filename); | |
369 | +// end change | |
370 | + | |
371 | + | |
372 | + Write_Project_File("GDSB.Wepf",Filename); | |
373 | + | |
374 | + return WriteRslt; | |
375 | +} | |
376 | + | |
377 | +// ************************************************************************* | |
378 | +// * Write_Project_File Terry Flanigan * | |
379 | +// ************************************************************************* | |
380 | +bool A_Export_World::Write_Project_File(char* Path_And_File,const char* Filename) | |
381 | +{ | |
382 | + char NewFile[MAX_PATH]; | |
383 | + | |
384 | + if (stricmp(Filename + strlen(Filename) - 5, ".G3ds") == 0) | |
385 | + { | |
386 | + strcpy(NewFile, Filename); | |
387 | + int Len = strlen(NewFile); | |
388 | + NewFile[Len - 5] = 0; | |
389 | + | |
390 | + strcat(NewFile,".Wepf"); | |
391 | + } | |
392 | + | |
393 | + WriteScene = NULL; | |
394 | + | |
395 | + WriteScene = fopen(NewFile, "wt"); | |
396 | + if (!WriteScene) | |
397 | + { | |
398 | + App->Say("Cant Create Save File"); | |
399 | + return 0; | |
400 | + } | |
401 | + | |
402 | + fprintf(WriteScene, "%s\n", "[World_Data]"); | |
403 | + | |
404 | + fprintf(WriteScene, "%s%s\n", "3dt_Path_FileName=",App->CL_World->mCurrent_3DT_PathAndFile); | |
405 | + | |
406 | + | |
407 | + fprintf(WriteScene, "%s%s\n", "G3ds_Path_FileName=",Filename); | |
408 | + | |
409 | + | |
410 | + fprintf(WriteScene, "%s%s\n", "Txl_Path_FileName=", App->CL_World->mCurrent_TXL_FilePath); | |
411 | + | |
412 | + | |
413 | + fprintf(WriteScene, "%s\n", " "); | |
414 | + fclose(WriteScene); | |
415 | + | |
416 | + return 1; | |
417 | +} |
@@ -23,6 +23,19 @@ | ||
23 | 23 | distribution. |
24 | 24 | */ |
25 | 25 | |
26 | +#include "level.h" | |
27 | +#include "entity.h" | |
28 | +#include "brush.h" | |
29 | +#include "model.h" | |
30 | +#include "group.h" | |
31 | +#include "wadfile.h" | |
32 | +#include "compiler.h" | |
33 | +#include "EntView.h" | |
34 | +#include "BrushTemplate.h" | |
35 | +#include "EntityTable.h" | |
36 | + | |
37 | +typedef struct tag_Level3 Level3; | |
38 | + | |
26 | 39 | class A_Export_World |
27 | 40 | { |
28 | 41 | public: |
@@ -31,4 +44,12 @@ | ||
31 | 44 | |
32 | 45 | void Export_World_GD3D(); |
33 | 46 | |
47 | + CFusionDoc *m_pDoc; | |
48 | + | |
49 | + bool Level_Build_G3ds(Level3 *pLevel, const char *Filename, BrushList *BList,int ExpSelected, geBoolean ExpLights, int GroupID); | |
50 | + bool Write_Project_File(char* Path_And_File,const char* Filename); | |
51 | + | |
52 | +private: | |
53 | + | |
54 | + FILE* WriteScene; | |
34 | 55 | }; |
@@ -8586,7 +8586,7 @@ | ||
8586 | 8586 | |
8587 | 8587 | BList = Level_GetBrushes (pLevel); |
8588 | 8588 | if(!ExpSelected&&!ExpFiles) |
8589 | - fResult = App->ABC_Export_RFW->Level_ExportTo_RFW(reinterpret_cast<tag_Level2 *> (pLevel), FileName, BList, ExpSelected, ExpLights, -1); | |
8589 | + fResult = App->CL_Export_World->Level_Build_G3ds(reinterpret_cast<tag_Level3 *> (pLevel), FileName, BList, ExpSelected, ExpLights, -1); | |
8590 | 8590 | |
8591 | 8591 | else |
8592 | 8592 | { |
@@ -8671,7 +8671,7 @@ | ||
8671 | 8671 | ::FilePath_ChangeName(FileName, Name, NewFileName); |
8672 | 8672 | } |
8673 | 8673 | |
8674 | - fResult =App->ABC_Export_RFW->Level_ExportTo_RFW(reinterpret_cast<tag_Level2 *> (pLevel), NewFileName, SBList, ExpSelected, ExpLights, GroupID); | |
8674 | + fResult = App->CL_Export_World->Level_Build_G3ds(reinterpret_cast<tag_Level3 *> (pLevel), NewFileName, SBList, ExpSelected, ExpLights, GroupID); | |
8675 | 8675 | if(!fResult) |
8676 | 8676 | App->Say("Error exporting group"); |
8677 | 8677 | BrushList_Destroy(&SBList); |