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