]> icculus.org git repositories - btb/d2x.git/blob - main/dumpmine.c
This commit was generated by cvs2svn to compensate for changes in r2,
[btb/d2x.git] / main / dumpmine.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14
15 #ifdef RCS
16 static char rcsid[] = "$Id: dumpmine.c,v 1.1.1.1 2001-01-19 03:30:00 bradleyb Exp $";
17 #endif
18
19 #include <conf.h>
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdarg.h>
23 #include <errno.h>
24
25 #include "pstypes.h"
26 #include "mono.h"
27 #include "key.h"
28 #include "gr.h"
29 #include "palette.h"
30
31 #include "inferno.h"
32 #ifdef EDITOR
33 #include "editor\editor.h"
34 #endif
35 #include "error.h"
36 #include "object.h"
37 #include "wall.h"
38 #include "gamemine.h"
39 #include "robot.h"
40 #include "player.h"
41 #include "newmenu.h"
42 #include "textures.h"
43
44 #include "bm.h"
45 #include "menu.h"
46 #include "switch.h"
47 #include "fuelcen.h"
48 #include "powerup.h"
49 #include "gameseq.h"
50 #include "polyobj.h"
51 #include "gamesave.h"
52
53
54 #ifdef EDITOR
55
56 extern ubyte bogus_data[64*64];
57 extern grs_bitmap bogus_bitmap;
58
59 //      --------------------------------------------------------------------------------
60 char    *object_types(int objnum)
61 {
62         int     type = Objects[objnum].type;
63
64         Assert((type >= 0) && (type < MAX_OBJECT_TYPES));
65         return  &Object_type_names[type];
66 }
67
68 //      --------------------------------------------------------------------------------
69 char    *object_ids(int objnum)
70 {
71         int     type = Objects[objnum].type;
72         int     id = Objects[objnum].id;
73
74         switch (type) {
75                 case OBJ_ROBOT:
76                         return &Robot_names[id];
77                         break;
78                 case OBJ_POWERUP:
79                         return &Powerup_names[id];
80                         break;
81         }
82
83         return  NULL;
84 }
85
86 void err_printf(FILE *my_file, char * format, ... )
87 {
88         va_list args;
89         char            message[256];
90
91         va_start(args, format );
92         vsprintf(message,format,args);
93         va_end(args);
94
95         mprintf((1, "%s", message));
96         fprintf(my_file, "%s", message);
97         Errors_in_mine++;
98 }
99
100 void warning_printf(FILE *my_file, char * format, ... )
101 {
102         va_list args;
103         char            message[256];
104
105         va_start(args, format );
106         vsprintf(message,format,args);
107         va_end(args);
108
109         mprintf((0, "%s", message));
110         fprintf(my_file, "%s", message);
111 }
112
113 //      -----------------------------------------------------------------------------------------------------------
114 void write_exit_text(FILE *my_file)
115 {
116         int     i, j, count;
117
118         fprintf(my_file, "-----------------------------------------------------------------------------\n");
119         fprintf(my_file, "Exit stuff\n");
120
121         //      ---------- Find exit triggers ----------
122         count=0;
123         for (i=0; i<Num_triggers; i++)
124                 if (Triggers[i].type == TT_EXIT) {
125                         int     count2;
126
127                         fprintf(my_file, "Trigger %2i, is an exit trigger with %i links.\n", i, Triggers[i].num_links);
128                         count++;
129                         if (Triggers[i].num_links != 0)
130                                 err_printf(my_file, "Error: Exit triggers must have 0 links, this one has %i links.\n", Triggers[i].num_links);
131
132                         //      Find wall pointing to this trigger.
133                         count2 = 0;
134                         for (j=0; j<Num_walls; j++)
135                                 if (Walls[j].trigger == i) {
136                                         count2++;
137                                         fprintf(my_file, "Exit trigger %i is in segment %i, on side %i, bound to wall %i\n", i, Walls[j].segnum, Walls[j].sidenum, j);
138                                 }
139                         if (count2 == 0)
140                                 err_printf(my_file, "Error: Trigger %i is not bound to any wall.\n", i);
141                         else if (count2 > 1)
142                                 err_printf(my_file, "Error: Trigger %i is bound to %i walls.\n", i, count2);
143
144                 }
145
146         if (count == 0)
147                 err_printf(my_file, "Error: No exit trigger in this mine.\n");
148         else if (count != 1)
149                 err_printf(my_file, "Error: More than one exit trigger in this mine.\n");
150         else
151                 fprintf(my_file, "\n");
152
153         //      ---------- Find exit doors ----------
154         count = 0;
155         for (i=0; i<=Highest_segment_index; i++)
156                 for (j=0; j<MAX_SIDES_PER_SEGMENT; j++)
157                         if (Segments[i].children[j] == -2) {
158                                 fprintf(my_file, "Segment %3i, side %i is an exit door.\n", i, j);
159                                 count++;
160                         }
161
162         if (count == 0)
163                 err_printf(my_file, "Error: No external wall in this mine.\n");
164         else if (count != 1) {
165                 // -- warning_printf(my_file, "Warning: %i external walls in this mine.\n", count);
166                 // -- warning_printf(my_file, "(If %i are secret exits, then no problem.)\n", count-1); 
167         } else
168                 fprintf(my_file, "\n");
169 }
170
171 //      -----------------------------------------------------------------------------------------------------------
172 void write_key_text(FILE *my_file)
173 {
174         int     i;
175         int     red_count, blue_count, gold_count;
176         int     red_count2, blue_count2, gold_count2;
177         int     blue_segnum=-1, blue_sidenum=-1, red_segnum=-1, red_sidenum=-1, gold_segnum=-1, gold_sidenum=-1;
178         int     connect_side;
179
180         fprintf(my_file, "-----------------------------------------------------------------------------\n");
181         fprintf(my_file, "Key stuff:\n");
182
183         red_count = 0;
184         blue_count = 0;
185         gold_count = 0;
186
187         for (i=0; i<Num_walls; i++) {
188                 if (Walls[i].keys & KEY_BLUE) {
189                         fprintf(my_file, "Wall %i (seg=%i, side=%i) is keyed to the blue key.\n", i, Walls[i].segnum, Walls[i].sidenum);
190                         if (blue_segnum == -1) {
191                                 blue_segnum = Walls[i].segnum;
192                                 blue_sidenum = Walls[i].sidenum;
193                                 blue_count++;
194                         } else {
195                                 connect_side = find_connect_side(&Segments[Walls[i].segnum], &Segments[blue_segnum]);
196                                 if (connect_side != blue_sidenum) {
197                                         warning_printf(my_file, "Warning: This blue door at seg %i, is different than the one at seg %i, side %i\n", Walls[i].segnum, blue_segnum, blue_sidenum);
198                                         blue_count++;
199                                 }
200                         }
201                 }
202                 if (Walls[i].keys & KEY_RED) {
203                         fprintf(my_file, "Wall %i (seg=%i, side=%i) is keyed to the red key.\n", i, Walls[i].segnum, Walls[i].sidenum);
204                         if (red_segnum == -1) {
205                                 red_segnum = Walls[i].segnum;
206                                 red_sidenum = Walls[i].sidenum;
207                                 red_count++;
208                         } else {
209                                 connect_side = find_connect_side(&Segments[Walls[i].segnum], &Segments[red_segnum]);
210                                 if (connect_side != red_sidenum) {
211                                         warning_printf(my_file, "Warning: This red door at seg %i, is different than the one at seg %i, side %i\n", Walls[i].segnum, red_segnum, red_sidenum);
212                                         red_count++;
213                                 }
214                         }
215                 }
216                 if (Walls[i].keys & KEY_GOLD) {
217                         fprintf(my_file, "Wall %i (seg=%i, side=%i) is keyed to the gold key.\n", i, Walls[i].segnum, Walls[i].sidenum);
218                         if (gold_segnum == -1) {
219                                 gold_segnum = Walls[i].segnum;
220                                 gold_sidenum = Walls[i].sidenum;
221                                 gold_count++;
222                         } else {
223                                 connect_side = find_connect_side(&Segments[Walls[i].segnum], &Segments[gold_segnum]);
224                                 if (connect_side != gold_sidenum) {
225                                         warning_printf(my_file, "Warning: This gold door at seg %i, is different than the one at seg %i, side %i\n", Walls[i].segnum, gold_segnum, gold_sidenum);
226                                         gold_count++;
227                                 }
228                         }
229                 }
230         }
231
232         if (blue_count > 1)
233                 warning_printf(my_file, "Warning: %i doors are keyed to the blue key.\n", blue_count);
234
235         if (red_count > 1)
236                 warning_printf(my_file, "Warning: %i doors are keyed to the red key.\n", red_count);
237
238         if (gold_count > 1)
239                 warning_printf(my_file, "Warning: %i doors are keyed to the gold key.\n", gold_count);
240
241         red_count2 = 0;
242         blue_count2 = 0;
243         gold_count2 = 0;
244
245         for (i=0; i<=Highest_object_index; i++) {
246                 if (Objects[i].type == OBJ_POWERUP)
247                         if (Objects[i].id == POW_KEY_BLUE) {
248                                 fprintf(my_file, "The BLUE key is object %i in segment %i\n", i, Objects[i].segnum);
249                                 blue_count2++;
250                         }
251                 if (Objects[i].type == OBJ_POWERUP)
252                         if (Objects[i].id == POW_KEY_RED) {
253                                 fprintf(my_file, "The RED key is object %i in segment %i\n", i, Objects[i].segnum);
254                                 red_count2++;
255                         }
256                 if (Objects[i].type == OBJ_POWERUP)
257                         if (Objects[i].id == POW_KEY_GOLD) {
258                                 fprintf(my_file, "The GOLD key is object %i in segment %i\n", i, Objects[i].segnum);
259                                 gold_count2++;
260                         }
261
262                 if (Objects[i].contains_count) {
263                         if (Objects[i].contains_type == OBJ_POWERUP) {
264                                 switch (Objects[i].contains_id) {
265                                         case POW_KEY_BLUE:
266                                                 fprintf(my_file, "The BLUE key is contained in object %i (a %s %s) in segment %i\n", i, Object_type_names[Objects[i].type], Robot_names[Objects[i].id], Objects[i].segnum);
267                                                 blue_count2 += Objects[i].contains_count;
268                                                 break;
269                                         case POW_KEY_GOLD:
270                                                 fprintf(my_file, "The GOLD key is contained in object %i (a %s %s) in segment %i\n", i, Object_type_names[Objects[i].type], Robot_names[Objects[i].id], Objects[i].segnum);
271                                                 gold_count2 += Objects[i].contains_count;
272                                                 break;
273                                         case POW_KEY_RED:
274                                                 fprintf(my_file, "The RED key is contained in object %i (a %s %s) in segment %i\n", i, Object_type_names[Objects[i].type], Robot_names[Objects[i].id], Objects[i].segnum);
275                                                 red_count2 += Objects[i].contains_count;
276                                                 break;
277                                         default:
278                                                 break;
279                                 }
280                         }
281                 }
282         }
283
284         if (blue_count)
285                 if (blue_count2 == 0)
286                         err_printf(my_file, "Error: There is a door keyed to the blue key, but no blue key!\n");
287
288         if (red_count)
289                 if (red_count2 == 0)
290                         err_printf(my_file, "Error: There is a door keyed to the red key, but no red key!\n");
291
292         if (gold_count)
293                 if (gold_count2 == 0)
294                         err_printf(my_file, "Error: There is a door keyed to the gold key, but no gold key!\n");
295
296         if (blue_count2 > 1)
297                 err_printf(my_file, "Error: There are %i blue keys!\n", blue_count2);
298
299         if (red_count2 > 1)
300                 err_printf(my_file, "Error: There are %i red keys!\n", red_count2);
301
302         if (gold_count2 > 1)
303                 err_printf(my_file, "Error: There are %i gold keys!\n", gold_count2);
304 }
305
306 //      ------------------------------------------------------------------------------------------
307 void write_control_center_text(FILE *my_file)
308 {
309         int     i, count, objnum, count2;
310
311         fprintf(my_file, "-----------------------------------------------------------------------------\n");
312         fprintf(my_file, "Control Center stuff:\n");
313
314         count = 0;
315         for (i=0; i<=Highest_segment_index; i++)
316                 if (Segment2s[i].special == SEGMENT_IS_CONTROLCEN) {
317                         count++;
318                         fprintf(my_file, "Segment %3i is a control center.\n", i);
319                         objnum = Segments[i].objects;
320                         count2 = 0;
321                         while (objnum != -1) {
322                                 if (Objects[objnum].type == OBJ_CNTRLCEN)
323                                         count2++;
324                                 objnum = Objects[objnum].next;
325                         }
326                         if (count2 == 0)
327                                 fprintf(my_file, "No control center object in control center segment.\n");
328                         else if (count2 != 1)
329                                 fprintf(my_file, "%i control center objects in control center segment.\n", count2);
330                 }
331
332         if (count == 0)
333                 err_printf(my_file, "Error: No control center in this mine.\n");
334         else if (count != 1)
335                 err_printf(my_file, "Error: More than one control center in this mine.\n");
336 }
337
338 //      ------------------------------------------------------------------------------------------
339 void write_fuelcen_text(FILE *my_file)
340 {
341         int     i;
342
343         fprintf(my_file, "-----------------------------------------------------------------------------\n");
344         fprintf(my_file, "Fuel Center stuff: (Note: This means fuel, repair, materialize, control centers!)\n");
345
346         for (i=0; i<Num_fuelcenters; i++) {
347                 fprintf(my_file, "Fuelcenter %i: Type=%i (%s), segment = %3i\n", i, Station[i].Type, Special_names[Station[i].Type], Station[i].segnum);
348                 if (Segment2s[Station[i].segnum].special != Station[i].Type)
349                         err_printf(my_file, "Error: Conflicting data: Segment %i has special type %i (%s), expected to be %i\n", Station[i].segnum, Segment2s[Station[i].segnum].special, Special_names[Segment2s[Station[i].segnum].special], Station[i].Type);
350         }
351 }
352
353 //      ------------------------------------------------------------------------------------------
354 void write_segment_text(FILE *my_file)
355 {
356         int     i, objnum;
357
358         fprintf(my_file, "-----------------------------------------------------------------------------\n");
359         fprintf(my_file, "Segment stuff:\n");
360
361         for (i=0; i<=Highest_segment_index; i++) {
362
363                 fprintf(my_file, "Segment %4i: ", i);
364                 if (Segment2s[i].special != 0)
365                         fprintf(my_file, "special = %3i (%s), value = %3i ", Segment2s[i].special, Special_names[Segment2s[i].special], Segment2s[i].value);
366
367                 if (Segment2s[i].matcen_num != -1)
368                         fprintf(my_file, "matcen = %3i, ", Segment2s[i].matcen_num);
369                 
370                 fprintf(my_file, "\n");
371         }
372
373         for (i=0; i<=Highest_segment_index; i++) {
374                 int     depth;
375
376                 objnum = Segments[i].objects;
377                 fprintf(my_file, "Segment %4i: ", i);
378                 depth=0;
379                 if (objnum != -1) {
380                         fprintf(my_file, "Objects: ");
381                         while (objnum != -1) {
382                                 fprintf(my_file, "[%8s %8s %3i] ", object_types(objnum), object_ids(objnum), objnum);
383                                 objnum = Objects[objnum].next;
384                                 if (depth++ > 30) {
385                                         fprintf(my_file, "\nAborted after %i links\n", depth);
386                                         break;
387                                 }
388                         }
389                 }
390                 fprintf(my_file, "\n");
391         }
392 }
393
394 //      ------------------------------------------------------------------------------------------
395 //      This routine is bogus.  It assumes that all centers are matcens, which is not true.  The setting of segnum is bogus.
396 void write_matcen_text(FILE *my_file)
397 {
398         int     i, j, k;
399
400         fprintf(my_file, "-----------------------------------------------------------------------------\n");
401         fprintf(my_file, "Materialization centers:\n");
402         for (i=0; i<Num_robot_centers; i++) {
403                 int     trigger_count=0, segnum, fuelcen_num;
404
405                 fprintf(my_file, "FuelCenter[%02i].Segment = %04i  ", i, Station[i].segnum);
406                 fprintf(my_file, "Segment2[%04i].matcen_num = %02i  ", Station[i].segnum, Segment2s[Station[i].segnum].matcen_num);
407
408                 fuelcen_num = RobotCenters[i].fuelcen_num;
409                 if (Station[fuelcen_num].Type != SEGMENT_IS_ROBOTMAKER)
410                         err_printf(my_file, "Error: Matcen %i corresponds to Station %i, which has type %i (%s).\n", i, fuelcen_num, Station[fuelcen_num].Type, Special_names[Station[fuelcen_num].Type]);
411
412                 segnum = Station[fuelcen_num].segnum;
413
414                 //      Find trigger for this materialization center.
415                 for (j=0; j<Num_triggers; j++) {
416                         if (Triggers[j].type == TT_MATCEN) {
417                                 for (k=0; k<Triggers[j].num_links; k++)
418                                         if (Triggers[j].seg[k] == segnum) {
419                                                 fprintf(my_file, "Trigger = %2i  ", j );
420                                                 trigger_count++;
421                                         }
422                         }
423                 }
424                 fprintf(my_file, "\n");
425
426                 if (trigger_count == 0)
427                         err_printf(my_file, "Error: Matcen %i in segment %i has no trigger!\n", i, segnum);
428
429         }
430 }
431
432 //      ------------------------------------------------------------------------------------------
433 void write_wall_text(FILE *my_file)
434 {
435         int     i, j;
436         byte    wall_flags[MAX_WALLS];
437
438         fprintf(my_file, "-----------------------------------------------------------------------------\n");
439         fprintf(my_file, "Walls:\n");
440         for (i=0; i<Num_walls; i++) {
441                 int     segnum, sidenum;
442
443                 fprintf(my_file, "Wall %03i: seg=%3i, side=%2i, linked_wall=%3i, type=%s, flags=%4x, hps=%3i, trigger=%2i, clip_num=%2i, keys=%2i, state=%i\n", i,
444                         Walls[i].segnum, Walls[i].sidenum, Walls[i].linked_wall, Wall_names[Walls[i].type], Walls[i].flags, Walls[i].hps >> 16, Walls[i].trigger, Walls[i].clip_num, Walls[i].keys, Walls[i].state);
445
446                 if (Walls[i].trigger >= Num_triggers)
447                         fprintf(my_file, "Wall %03d points to invalid trigger %d\n",i,Walls[i].trigger);
448
449                 segnum = Walls[i].segnum;
450                 sidenum = Walls[i].sidenum;
451
452                 if (Segments[segnum].sides[sidenum].wall_num != i)
453                         err_printf(my_file, "Error: Wall %i points at segment %i, side %i, but that segment doesn't point back (it's wall_num = %i)\n", i, segnum, sidenum, Segments[segnum].sides[sidenum].wall_num);
454         }
455
456         for (i=0; i<MAX_WALLS; i++)
457                 wall_flags[i] = 0;
458
459         for (i=0; i<=Highest_segment_index; i++) {
460                 segment *segp = &Segments[i];
461                 for (j=0; j<MAX_SIDES_PER_SEGMENT; j++) {
462                         side    *sidep = &segp->sides[j];
463                         if (sidep->wall_num != -1)
464                                 if (wall_flags[sidep->wall_num])
465                                         err_printf(my_file, "Error: Wall %i appears in two or more segments, including segment %i, side %i.\n", sidep->wall_num, i, j);
466                                 else
467                                         wall_flags[sidep->wall_num] = 1;
468                 }
469         }
470
471 }
472
473 //typedef struct trigger {
474 //      byte            type;
475 //      short           flags;
476 //      fix             value;
477 //      fix             time;
478 //      byte            link_num;
479 //      short   num_links;
480 //      short   seg[MAX_WALLS_PER_LINK];
481 //      short           side[MAX_WALLS_PER_LINK];
482 //      } trigger;
483
484 //      ------------------------------------------------------------------------------------------
485 void write_player_text(FILE *my_file)
486 {
487         int     i, num_players=0;
488
489         fprintf(my_file, "-----------------------------------------------------------------------------\n");
490         fprintf(my_file, "Players:\n");
491         for (i=0; i<=Highest_object_index; i++) {
492                 if (Objects[i].type == OBJ_PLAYER) {
493                         num_players++;
494                         fprintf(my_file, "Player %2i is object #%3i in segment #%3i.\n", Objects[i].id, i, Objects[i].segnum);
495                 }
496         }
497
498         if (num_players != MAX_PLAYERS)
499                 err_printf(my_file, "Error: %i player objects.  %i are required.\n", num_players, MAX_PLAYERS);
500         if (num_players > MAX_MULTI_PLAYERS)
501                 err_printf(my_file, "Error: %i player objects.  %i are required.\n", num_players, MAX_PLAYERS);
502 }
503
504 //      ------------------------------------------------------------------------------------------
505 void write_trigger_text(FILE *my_file)
506 {
507         int     i, j, w;
508
509         fprintf(my_file, "-----------------------------------------------------------------------------\n");
510         fprintf(my_file, "Triggers:\n");
511         for (i=0; i<Num_triggers; i++) {
512                 fprintf(my_file, "Trigger %03i: type=%02x flags=%04x, value=%08x, time=%8x, num_links=%i ", i, 
513                         Triggers[i].type, Triggers[i].flags, Triggers[i].value, Triggers[i].time, Triggers[i].num_links);
514
515                 for (j=0; j<Triggers[i].num_links; j++)
516                         fprintf(my_file, "[%03i:%i] ", Triggers[i].seg[j], Triggers[i].side[j]);
517
518                 //      Find which wall this trigger is connected to.
519                 for (w=0; w<Num_walls; w++)
520                         if (Walls[w].trigger == i)
521                                 break;
522
523                 if (w == Num_walls)
524                         err_printf(my_file, "\nError: Trigger %i is not connected to any wall, so it can never be triggered.\n", i);
525                 else
526                         fprintf(my_file, "Attached to seg:side = %i:%i, wall %i\n", Walls[w].segnum, Walls[w].sidenum, Segments[Walls[w].segnum].sides[Walls[w].sidenum].wall_num);
527
528         }
529
530 }
531
532 //      ------------------------------------------------------------------------------------------
533 void write_game_text_file(char *filename)
534 {
535         char    my_filename[128];
536         int     namelen;
537         FILE    * my_file;
538
539         Errors_in_mine = 0;
540
541         // mprintf((0, "Writing text file for mine [%s]\n", filename));
542
543         namelen = strlen(filename);
544
545         Assert (namelen > 4);
546
547         Assert (filename[namelen-4] == '.');
548
549         strcpy(my_filename, filename);
550         strcpy( &my_filename[namelen-4], ".txm");
551
552         // mprintf((0, "Writing text file [%s]\n", my_filename));
553
554         my_file = fopen( my_filename, "wt" );
555         // -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
556
557         if (!my_file)   {
558                 char  ErrorMessage[200];
559
560                 sprintf( ErrorMessage, "ERROR: Unable to open %s\nErrno = %i", my_file, errno );
561                 stop_time();
562                 gr_palette_load(gr_palette);
563                 nm_messagebox( NULL, 1, "Ok", ErrorMessage );
564                 start_time();
565
566                 return;
567         }
568
569         dump_used_textures_level(my_file, 0);
570         say_totals(my_file, Gamesave_current_filename);
571
572         fprintf(my_file, "\nNumber of segments:   %4i\n", Highest_segment_index+1);
573         fprintf(my_file, "Number of objects:    %4i\n", Highest_object_index+1);
574         fprintf(my_file, "Number of walls:      %4i\n", Num_walls);
575         fprintf(my_file, "Number of open doors: %4i\n", Num_open_doors);
576         fprintf(my_file, "Number of triggers:   %4i\n", Num_triggers);
577         fprintf(my_file, "Number of matcens:    %4i\n", Num_robot_centers);
578         fprintf(my_file, "\n");
579
580         write_segment_text(my_file);
581
582         write_fuelcen_text(my_file);
583
584         write_matcen_text(my_file);
585
586         write_player_text(my_file);
587
588         write_wall_text(my_file);
589
590         write_trigger_text(my_file);
591
592         write_exit_text(my_file);
593
594         //      ---------- Find control center segment ----------
595         write_control_center_text(my_file);
596
597         //      ---------- Show keyed walls ----------
598         write_key_text(my_file);
599
600 { int r;
601         r = fclose(my_file);
602         mprintf((1, "Close value = %i\n", r));
603         if (r)
604                 Int3();
605 }
606 }
607
608 // -- //        ---------------
609 // -- //        Note: This only works for a loaded level because the objects array must be valid.
610 // -- void determine_used_textures_robots(int *tmap_buf)
611 // -- {
612 // --   int     i, objnum;
613 // --   polymodel       *po;
614 // -- 
615 // --   Assert(N_polygon_models);
616 // -- 
617 // --   for (objnum=0; objnum <= Highest_object_index; objnum++) {
618 // --           int     model_num;
619 // -- 
620 // --           if (Objects[objnum].render_type == RT_POLYOBJ) {
621 // --                   model_num = Objects[objnum].rtype.pobj_info.model_num;
622 // -- 
623 // --                   po=&Polygon_models[model_num];
624 // -- 
625 // --                   for (i=0;i<po->n_textures;i++)  {
626 // --                           int     tli;
627 // -- 
628 // --                           tli = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]];
629 // --                           Assert((tli>=0) && (tli<= Num_tmaps));
630 // --                           tmap_buf[tli]++;
631 // --                   }
632 // --           }
633 // --   }
634 // -- 
635 // -- }
636
637 // --05/17/95--//       -----------------------------------------------------------------------------
638 // --05/17/95--void determine_used_textures_level(int load_level_flag, int shareware_flag, int level_num, int *tmap_buf, int *wall_buf, byte *level_tmap_buf, int max_tmap)
639 // --05/17/95--{
640 // --05/17/95-- int     segnum, sidenum;
641 // --05/17/95-- int     i, j;
642 // --05/17/95--
643 // --05/17/95-- for (i=0; i<max_tmap; i++)
644 // --05/17/95--         tmap_buf[i] = 0;
645 // --05/17/95--
646 // --05/17/95-- if (load_level_flag) {
647 // --05/17/95--         if (shareware_flag)
648 // --05/17/95--                 load_level(Shareware_level_names[level_num]);
649 // --05/17/95--         else
650 // --05/17/95--                 load_level(Registered_level_names[level_num]);
651 // --05/17/95-- }
652 // --05/17/95--
653 // --05/17/95-- for (segnum=0; segnum<=Highest_segment_index; segnum++) {
654 // --05/17/95--         segment *segp = &Segments[segnum];
655 // --05/17/95--
656 // --05/17/95--         for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
657 // --05/17/95--                 side    *sidep = &segp->sides[sidenum];
658 // --05/17/95--
659 // --05/17/95--                 if (sidep->wall_num != -1) {
660 // --05/17/95--                         int clip_num = Walls[sidep->wall_num].clip_num;
661 // --05/17/95--                         if (clip_num != -1) {
662 // --05/17/95--
663 // --05/17/95--                                 int num_frames = WallAnims[clip_num].num_frames;
664 // --05/17/95--
665 // --05/17/95--                                 wall_buf[clip_num] = 1;
666 // --05/17/95--
667 // --05/17/95--                                 for (j=0; j<num_frames; j++) {
668 // --05/17/95--                                         int     tmap_num;
669 // --05/17/95--
670 // --05/17/95--                                         tmap_num = WallAnims[clip_num].frames[j];
671 // --05/17/95--                                         tmap_buf[tmap_num]++;
672 // --05/17/95--                                         if (level_tmap_buf[tmap_num] == -1)
673 // --05/17/95--                                                 level_tmap_buf[tmap_num] = level_num + (!shareware_flag) * NUM_SHAREWARE_LEVELS;
674 // --05/17/95--                                 }
675 // --05/17/95--                         }
676 // --05/17/95--                 }
677 // --05/17/95--
678 // --05/17/95--                 if (sidep->tmap_num >= 0)
679 // --05/17/95--                         if (sidep->tmap_num < max_tmap) {
680 // --05/17/95--                                 tmap_buf[sidep->tmap_num]++;
681 // --05/17/95--                                 if (level_tmap_buf[sidep->tmap_num] == -1)
682 // --05/17/95--                                         level_tmap_buf[sidep->tmap_num] = level_num + (!shareware_flag) * NUM_SHAREWARE_LEVELS;
683 // --05/17/95--                         } else
684 // --05/17/95--                                 Int3(); //      Error, bogus texture map.  Should not be greater than max_tmap.
685 // --05/17/95--
686 // --05/17/95--                 if ((sidep->tmap_num2 & 0x3fff) != 0)
687 // --05/17/95--                         if ((sidep->tmap_num2 & 0x3fff) < max_tmap) {
688 // --05/17/95--                                 tmap_buf[sidep->tmap_num2 & 0x3fff]++;
689 // --05/17/95--                                 if (level_tmap_buf[sidep->tmap_num2 & 0x3fff] == -1)
690 // --05/17/95--                                         level_tmap_buf[sidep->tmap_num2 & 0x3fff] = level_num + (!shareware_flag) * NUM_SHAREWARE_LEVELS;
691 // --05/17/95--                         } else
692 // --05/17/95--                                 Int3(); //      Error, bogus texture map.  Should not be greater than max_tmap.
693 // --05/17/95--         }
694 // --05/17/95-- }
695 // --05/17/95--}
696
697 //      Adam: Change NUM_ADAM_LEVELS to the number of levels.
698 #define NUM_ADAM_LEVELS 30
699
700 //      Adam: Stick the names here.
701 char *Adam_level_names[NUM_ADAM_LEVELS] = {
702         "D2LEVA-1.LVL",
703         "D2LEVA-2.LVL",
704         "D2LEVA-3.LVL",
705         "D2LEVA-4.LVL",
706         "D2LEVA-S.LVL",
707
708         "D2LEVB-1.LVL",
709         "D2LEVB-2.LVL",
710         "D2LEVB-3.LVL",
711         "D2LEVB-4.LVL",
712         "D2LEVB-S.LVL",
713
714         "D2LEVC-1.LVL",
715         "D2LEVC-2.LVL",
716         "D2LEVC-3.LVL",
717         "D2LEVC-4.LVL",
718         "D2LEVC-S.LVL",
719
720         "D2LEVD-1.LVL",
721         "D2LEVD-2.LVL",
722         "D2LEVD-3.LVL",
723         "D2LEVD-4.LVL",
724         "D2LEVD-S.LVL",
725
726         "D2LEVE-1.LVL",
727         "D2LEVE-2.LVL",
728         "D2LEVE-3.LVL",
729         "D2LEVE-4.LVL",
730         "D2LEVE-S.LVL",
731
732         "D2LEVF-1.LVL",
733         "D2LEVF-2.LVL",
734         "D2LEVF-3.LVL",
735         "D2LEVF-4.LVL",
736         "D2LEVF-S.LVL",
737 };
738
739 typedef struct BitmapFile       {
740         char                    name[15];
741 } BitmapFile;
742
743 extern BitmapFile AllBitmaps[ MAX_BITMAP_FILES ];
744
745 int     Ignore_tmap_num2_error;
746
747 //      -----------------------------------------------------------------------------
748 void determine_used_textures_level(int load_level_flag, int shareware_flag, int level_num, int *tmap_buf, int *wall_buf, byte *level_tmap_buf, int max_tmap)
749 {
750         int     segnum, sidenum, objnum=max_tmap;
751         int     i, j;
752
753         Assert(shareware_flag != -17);
754
755         for (i=0; i<MAX_BITMAP_FILES; i++)
756                 tmap_buf[i] = 0;
757
758         if (load_level_flag) {
759                 load_level(Adam_level_names[level_num]);
760         }
761
762
763         //      Process robots.
764         for (objnum=0; objnum<=Highest_object_index; objnum++) {
765                 object *objp = &Objects[objnum];
766
767                 if (objp->render_type == RT_POLYOBJ) {
768                         polymodel *po = &Polygon_models[objp->rtype.pobj_info.model_num];
769
770                         for (i=0; i<po->n_textures; i++) {
771
772                                 int     tli = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index;
773                                 // -- mprintf((0, "%s  ", AllBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index].name));
774
775                                 if ((tli < MAX_BITMAP_FILES) && (tli >= 0)) {
776                                         tmap_buf[tli]++;
777                                         if (level_tmap_buf[tli] == -1)
778                                                 level_tmap_buf[tli] = level_num;
779                                 } else
780                                         Int3(); //      Hmm, It seems this texture is bogus!
781                         }
782
783                 }
784         }
785
786
787         Ignore_tmap_num2_error = 0;
788
789         //      Process walls and segment sides.
790         for (segnum=0; segnum<=Highest_segment_index; segnum++) {
791                 segment *segp = &Segments[segnum];
792
793                 for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
794                         side    *sidep = &segp->sides[sidenum];
795
796                         if (sidep->wall_num != -1) {
797                                 int clip_num = Walls[sidep->wall_num].clip_num;
798                                 if (clip_num != -1) {
799
800                                         // -- int num_frames = WallAnims[clip_num].num_frames;
801
802                                         wall_buf[clip_num] = 1;
803
804                                         for (j=0; j<1; j++) {   //      Used to do through num_frames, but don't really want all the door01#3 stuff.
805                                                 int     tmap_num;
806
807                                                 tmap_num = Textures[WallAnims[clip_num].frames[j]].index;
808                                                 Assert((tmap_num >= 0) && (tmap_num < MAX_BITMAP_FILES));
809                                                 tmap_buf[tmap_num]++;
810                                                 if (level_tmap_buf[tmap_num] == -1)
811                                                         level_tmap_buf[tmap_num] = level_num;
812                                         }
813                                 }
814                         } else if (segp->children[sidenum] == -1) {
815
816                                 if (sidep->tmap_num >= 0)
817                                         if (sidep->tmap_num < MAX_BITMAP_FILES) {
818                                                 Assert(Textures[sidep->tmap_num].index < MAX_BITMAP_FILES);
819                                                 tmap_buf[Textures[sidep->tmap_num].index]++;
820                                                 if (level_tmap_buf[Textures[sidep->tmap_num].index] == -1)
821                                                         level_tmap_buf[Textures[sidep->tmap_num].index] = level_num;
822                                         } else
823                                                 Int3(); //      Error, bogus texture map.  Should not be greater than max_tmap.
824
825                                 if ((sidep->tmap_num2 & 0x3fff) != 0)
826                                         if ((sidep->tmap_num2 & 0x3fff) < MAX_BITMAP_FILES) {
827                                                 Assert(Textures[sidep->tmap_num2 & 0x3fff].index < MAX_BITMAP_FILES);
828                                                 tmap_buf[Textures[sidep->tmap_num2 & 0x3fff].index]++;
829                                                 if (level_tmap_buf[Textures[sidep->tmap_num2 & 0x3fff].index] == -1)
830                                                         level_tmap_buf[Textures[sidep->tmap_num2 & 0x3fff].index] = level_num;
831                                         } else {
832                                                 if (!Ignore_tmap_num2_error)
833                                                         Int3(); //      Error, bogus texture map.  Should not be greater than max_tmap.
834                                                 Ignore_tmap_num2_error = 1;
835                                                 sidep->tmap_num2 = 0;
836                                         }
837                         }
838                 }
839         }
840 }
841
842 //      -----------------------------------------------------------------------------
843 void merge_buffers(int *dest, int *src, int num)
844 {
845         int     i;
846
847         for (i=0; i<num; i++)
848                 if (src[i])
849                         dest[i] += src[i];
850 }
851
852 //      -----------------------------------------------------------------------------
853 void say_used_tmaps(FILE *my_file, int *tb)
854 {
855         int     i;
856 // -- mk, 08/14/95 --   int     count = 0;
857
858         for (i=0; i<MAX_BITMAP_FILES; i++)
859                 if (tb[i]) {
860                         fprintf(my_file, "[%3i %8s (%4i)]\n", i, AllBitmaps[i].name, tb[i]);
861 // -- mk, 08/14/95 --                   if (count++ >= 4) {
862 // -- mk, 08/14/95 --                           fprintf(my_file, "\n");
863 // -- mk, 08/14/95 --                           count = 0;
864 // -- mk, 08/14/95 --                   }
865                 }
866 }
867
868 // --05/17/95--//       -----------------------------------------------------------------------------
869 // --05/17/95--void say_used_once_tmaps(FILE *my_file, int *tb, byte *tb_lnum)
870 // --05/17/95--{
871 // --05/17/95-- int     i;
872 // --05/17/95-- char    *level_name;
873 // --05/17/95--
874 // --05/17/95-- for (i=0; i<Num_tmaps; i++)
875 // --05/17/95--         if (tb[i] == 1) {
876 // --05/17/95--                 int     level_num = tb_lnum[i];
877 // --05/17/95--                 if (level_num >= NUM_SHAREWARE_LEVELS) {
878 // --05/17/95--                         Assert((level_num - NUM_SHAREWARE_LEVELS >= 0) && (level_num - NUM_SHAREWARE_LEVELS < NUM_REGISTERED_LEVELS));
879 // --05/17/95--                         level_name = Registered_level_names[level_num - NUM_SHAREWARE_LEVELS];
880 // --05/17/95--                 } else {
881 // --05/17/95--                         Assert((level_num >= 0) && (level_num < NUM_SHAREWARE_LEVELS));
882 // --05/17/95--                         level_name = Shareware_level_names[level_num];
883 // --05/17/95--                 }
884 // --05/17/95--
885 // --05/17/95--                 fprintf(my_file, "Texture %3i %8s used only once on level %s\n", i, TmapInfo[i].filename, level_name);
886 // --05/17/95--         }
887 // --05/17/95--}
888
889 //      -----------------------------------------------------------------------------
890 void say_used_once_tmaps(FILE *my_file, int *tb, byte *tb_lnum)
891 {
892         int     i;
893         char    *level_name;
894
895         for (i=0; i<MAX_BITMAP_FILES; i++)
896                 if (tb[i] == 1) {
897                         int     level_num = tb_lnum[i];
898                         level_name = Adam_level_names[level_num];
899
900                         fprintf(my_file, "Texture %3i %8s used only once on level %s\n", i, AllBitmaps[i].name, level_name);
901                 }
902 }
903
904 //      -----------------------------------------------------------------------------
905 void say_unused_tmaps(FILE *my_file, int *tb)
906 {
907         int     i;
908         int     count = 0;
909
910         for (i=0; i<MAX_BITMAP_FILES; i++)
911                 if (!tb[i]) {
912                         if (GameBitmaps[Textures[i].index].bm_data == &bogus_data)
913                                 fprintf(my_file, "U");
914                         else
915                                 fprintf(my_file, " ");
916
917                         fprintf(my_file, "[%3i %8s] ", i, AllBitmaps[i].name);
918                         if (count++ >= 4) {
919                                 fprintf(my_file, "\n");
920                                 count = 0;
921                         }
922                 }
923 }
924
925 //      -----------------------------------------------------------------------------
926 void say_unused_walls(FILE *my_file, int *tb)
927 {
928         int     i;
929
930         for (i=0; i<Num_wall_anims; i++)
931                 if (!tb[i])
932                         fprintf(my_file, "Wall %3i is unused.\n", i);
933 }
934
935 //      -------------------------------------------------------------------------------------------------
936 say_totals(FILE *my_file, char *level_name)
937 {
938         int     i;              //, objnum;
939         int     total_robots = 0;
940         int     objects_processed = 0;
941
942         int     used_objects[MAX_OBJECTS];
943
944         fprintf(my_file, "\nLevel %s\n", level_name);
945
946         for (i=0; i<MAX_OBJECTS; i++)
947                 used_objects[i] = 0;
948
949         while (objects_processed < Highest_object_index+1) {
950                 int     j, objtype, objid, objcount, cur_obj_val, min_obj_val, min_objnum;
951
952                 //      Find new min objnum.
953                 min_obj_val = 0x7fff0000;
954                 min_objnum = -1;
955
956                 for (j=0; j<=Highest_object_index; j++) {
957                         if (!used_objects[j] && Objects[j].type!=OBJ_NONE) {
958                                 cur_obj_val = Objects[j].type * 1000 + Objects[j].id;
959                                 if (cur_obj_val < min_obj_val) {
960                                         min_objnum = j;
961                                         min_obj_val = cur_obj_val;
962                                 }
963                         }
964                 }
965                 if ((min_objnum == -1) || (Objects[min_objnum].type == 255))
966                         break;
967
968                 objcount = 0;
969
970                 objtype = Objects[min_objnum].type;
971                 objid = Objects[min_objnum].id;
972
973                 for (i=0; i<=Highest_object_index; i++) {
974                         if (!used_objects[i]) {
975
976                                 if (((Objects[i].type == objtype) && (Objects[i].id == objid)) ||
977                                                 ((Objects[i].type == objtype) && (objtype == OBJ_PLAYER)) ||
978                                                 ((Objects[i].type == objtype) && (objtype == OBJ_COOP)) ||
979                                                 ((Objects[i].type == objtype) && (objtype == OBJ_HOSTAGE))) {
980                                         if (Objects[i].type == OBJ_ROBOT)
981                                                 total_robots++;
982                                         used_objects[i] = 1;
983                                         objcount++;
984                                         objects_processed++;
985                                 }
986                         }
987                 }
988
989                 if (objcount) {
990                         fprintf(my_file, "Object: ");
991                         fprintf(my_file, "%8s %8s %3i\n", object_types(min_objnum), object_ids(min_objnum), objcount);
992                 }
993         }
994
995         fprintf(my_file, "Total robots = %3i\n", total_robots);
996 }
997
998 int     First_dump_level = 0;
999 int     Last_dump_level = NUM_ADAM_LEVELS-1;
1000
1001 //      -----------------------------------------------------------------------------
1002 void say_totals_all(void)
1003 {
1004         int     i;
1005         FILE    *my_file;
1006
1007         my_file = fopen( "levels.all", "wt" );
1008         // -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
1009
1010         if (!my_file)   {
1011                 char  ErrorMessage[200];
1012
1013                 sprintf( ErrorMessage, "ERROR: Unable to open levels.all\nErrno=%i", errno );
1014                 stop_time();
1015                 gr_palette_load(gr_palette);
1016                 nm_messagebox( NULL, 1, "Ok", ErrorMessage );
1017                 start_time();
1018
1019                 return;
1020         }
1021
1022         for (i=First_dump_level; i<=Last_dump_level; i++) {
1023                 mprintf((0, "Level %i\n", i+1));
1024                 load_level(Adam_level_names[i]);
1025                 say_totals(my_file, Adam_level_names[i]);
1026         }
1027
1028 //--05/17/95--  for (i=0; i<NUM_SHAREWARE_LEVELS; i++) {
1029 //--05/17/95--          mprintf((0, "Level %i\n", i+1));
1030 //--05/17/95--          load_level(Shareware_level_names[i]);
1031 //--05/17/95--          say_totals(my_file, Shareware_level_names[i]);
1032 //--05/17/95--  }
1033 //--05/17/95--
1034 //--05/17/95--  for (i=0; i<NUM_REGISTERED_LEVELS; i++) {
1035 //--05/17/95--          mprintf((0, "Level %i\n", i+1+NUM_SHAREWARE_LEVELS));
1036 //--05/17/95--          load_level(Registered_level_names[i]);
1037 //--05/17/95--          say_totals(my_file, Registered_level_names[i]);
1038 //--05/17/95--  }
1039
1040         fclose(my_file);
1041
1042 }
1043
1044 void dump_used_textures_level(FILE *my_file, int level_num)
1045 {
1046         int     i;
1047         int     temp_tmap_buf[MAX_BITMAP_FILES];
1048         int     perm_tmap_buf[MAX_BITMAP_FILES];
1049         byte    level_tmap_buf[MAX_BITMAP_FILES];
1050         int     temp_wall_buf[MAX_BITMAP_FILES];
1051         int     perm_wall_buf[MAX_BITMAP_FILES];
1052
1053         for (i=0; i<MAX_BITMAP_FILES; i++) {
1054                 perm_tmap_buf[i] = 0;
1055                 level_tmap_buf[i] = -1;
1056         }
1057
1058         for (i=0; i<MAX_BITMAP_FILES; i++) {
1059                 perm_wall_buf[i] = 0;
1060         }
1061
1062         determine_used_textures_level(0, 1, level_num, temp_tmap_buf, temp_wall_buf, level_tmap_buf, MAX_BITMAP_FILES);
1063 // --   determine_used_textures_robots(temp_tmap_buf);
1064         fprintf(my_file, "\nTextures used in [%s]\n", Gamesave_current_filename);
1065         say_used_tmaps(my_file, temp_tmap_buf);
1066 }
1067
1068 FILE    *my_file;
1069
1070 //      -----------------------------------------------------------------------------
1071 void dump_used_textures_all(void)
1072 {
1073         int     i;
1074         int     temp_tmap_buf[MAX_BITMAP_FILES];
1075         int     perm_tmap_buf[MAX_BITMAP_FILES];
1076         byte    level_tmap_buf[MAX_BITMAP_FILES];
1077         int     temp_wall_buf[MAX_BITMAP_FILES];
1078         int     perm_wall_buf[MAX_BITMAP_FILES];
1079
1080 say_totals_all();
1081
1082         my_file = fopen( "textures.dmp", "wt" );
1083         // -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
1084
1085         if (!my_file)   {
1086                 char  ErrorMessage[200];
1087
1088                 sprintf( ErrorMessage, "ERROR: Can't open textures.dmp\nErrno=%i", errno);
1089                 stop_time();
1090                 gr_palette_load(gr_palette);
1091                 nm_messagebox( NULL, 1, "Ok", ErrorMessage );
1092                 start_time();
1093
1094                 return;
1095         }
1096
1097         for (i=0; i<MAX_BITMAP_FILES; i++) {
1098                 perm_tmap_buf[i] = 0;
1099                 level_tmap_buf[i] = -1;
1100         }
1101
1102         for (i=0; i<MAX_BITMAP_FILES; i++) {
1103                 perm_wall_buf[i] = 0;
1104         }
1105
1106 // --05/17/95-- for (i=0; i<NUM_SHAREWARE_LEVELS; i++) {
1107 // --05/17/95--         determine_used_textures_level(1, 1, i, temp_tmap_buf, temp_wall_buf, level_tmap_buf, MAX_BITMAP_FILES);
1108 // --05/17/95--         fprintf(my_file, "\nTextures used in [%s]\n", Shareware_level_names[i]);
1109 // --05/17/95--         say_used_tmaps(my_file, temp_tmap_buf);
1110 // --05/17/95--         merge_buffers(perm_tmap_buf, temp_tmap_buf, MAX_BITMAP_FILES);
1111 // --05/17/95--         merge_buffers(perm_wall_buf, temp_wall_buf, MAX_BITMAP_FILES);
1112 // --05/17/95-- }
1113 // --05/17/95--
1114 // --05/17/95-- fprintf(my_file, "\n\nUsed textures in all shareware mines:\n");
1115 // --05/17/95-- say_used_tmaps(my_file, perm_tmap_buf);
1116 // --05/17/95--
1117 // --05/17/95-- fprintf(my_file, "\nUnused textures in all shareware mines:\n");
1118 // --05/17/95-- say_unused_tmaps(my_file, perm_tmap_buf);
1119 // --05/17/95--
1120 // --05/17/95-- fprintf(my_file, "\nTextures used exactly once in all shareware mines:\n");
1121 // --05/17/95-- say_used_once_tmaps(my_file, perm_tmap_buf, level_tmap_buf);
1122 // --05/17/95--
1123 // --05/17/95-- fprintf(my_file, "\nWall anims (eg, doors) unused in all shareware mines:\n");
1124 // --05/17/95-- say_unused_walls(my_file, perm_wall_buf);
1125
1126 // --05/17/95-- for (i=0; i<NUM_REGISTERED_LEVELS; i++) {
1127 // --05/17/95--         determine_used_textures_level(1, 0, i, temp_tmap_buf, temp_wall_buf, level_tmap_buf, MAX_BITMAP_FILES);
1128 // --05/17/95--         fprintf(my_file, "\nTextures used in [%s]\n", Registered_level_names[i]);
1129 // --05/17/95--         say_used_tmaps(my_file, temp_tmap_buf);
1130 // --05/17/95--         merge_buffers(perm_tmap_buf, temp_tmap_buf, MAX_BITMAP_FILES);
1131 // --05/17/95-- }
1132 // --05/17/95--
1133 // --05/17/95-- fprintf(my_file, "\n\nUsed textures in all (including registered) mines:\n");
1134 // --05/17/95-- say_used_tmaps(my_file, perm_tmap_buf);
1135 // --05/17/95--
1136 // --05/17/95-- fprintf(my_file, "\nUnused textures in all (including registered) mines:\n");
1137 // --05/17/95-- say_unused_tmaps(my_file, perm_tmap_buf);
1138
1139         for (i=First_dump_level; i<=Last_dump_level; i++) {
1140                 determine_used_textures_level(1, 0, i, temp_tmap_buf, temp_wall_buf, level_tmap_buf, MAX_BITMAP_FILES);
1141                 fprintf(my_file, "\nTextures used in [%s]\n", Adam_level_names[i]);
1142                 say_used_tmaps(my_file, temp_tmap_buf);
1143                 merge_buffers(perm_tmap_buf, temp_tmap_buf, MAX_BITMAP_FILES);
1144         }
1145
1146         fprintf(my_file, "\n\nUsed textures in all (including registered) mines:\n");
1147         say_used_tmaps(my_file, perm_tmap_buf);
1148
1149         fprintf(my_file, "\nUnused textures in all (including registered) mines:\n");
1150         say_unused_tmaps(my_file, perm_tmap_buf);
1151
1152         fclose(my_file);
1153 }
1154
1155 #endif