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