(argc, argv)
| 50 | FILE *fp; |
| 51 | |
| 52 | int |
| 53 | main(argc, argv) |
| 54 | int argc; |
| 55 | char *argv[]; |
| 56 | { |
| 57 | int i; |
| 58 | |
| 59 | if (argc != 2) { |
| 60 | Fprintf(stderr, "usage: tile2img outfile.img\n"); |
| 61 | exit(EXIT_FAILURE); |
| 62 | } else |
| 63 | strcpy(bmpname, argv[1]); |
| 64 | |
| 65 | #ifdef OBSOLETE |
| 66 | bmpfile2 = fopen(NETHACK_PACKED_TILEFILE, WRBMODE); |
| 67 | if (bmpfile2 == (FILE *) 0) { |
| 68 | Fprintf(stderr, "Unable to open output file %s\n", |
| 69 | NETHACK_PACKED_TILEFILE); |
| 70 | exit(EXIT_FAILURE); |
| 71 | } |
| 72 | #endif |
| 73 | |
| 74 | tilecount = 0; |
| 75 | xoffset = yoffset = 0; |
| 76 | initflag = 0; |
| 77 | filenum = 0; |
| 78 | fp = fopen(bmpname, "wb"); |
| 79 | if (!fp) { |
| 80 | printf("Error creating tile file %s, aborting.\n", bmpname); |
| 81 | exit(1); |
| 82 | } |
| 83 | fclose(fp); |
| 84 | |
| 85 | Bild_daten = (unsigned int **) malloc(MAX_Y * sizeof(unsigned int *)); |
| 86 | for (i = 0; i < MAX_Y; i++) |
| 87 | Bild_daten[i] = (unsigned int *) malloc(MAX_X * sizeof(unsigned int)); |
| 88 | |
| 89 | while (filenum < 3) { |
| 90 | if (!fopen_text_file(tilefiles[filenum], RDTMODE)) { |
| 91 | Fprintf(stderr, "usage: tile2img (from the util directory)\n"); |
| 92 | exit(EXIT_FAILURE); |
| 93 | } |
| 94 | num_colors = colorsinmap; |
| 95 | if (num_colors > 62) { |
| 96 | Fprintf(stderr, "too many colors (%d)\n", num_colors); |
| 97 | exit(EXIT_FAILURE); |
| 98 | } |
| 99 | while (read_text_tile(tilepixels)) { |
| 100 | build_ximgtile(tilepixels); |
| 101 | tilecount++; |
| 102 | xoffset += TILE_X; |
| 103 | if (xoffset >= MAX_X) { |
| 104 | yoffset += TILE_Y; |
| 105 | xoffset = 0; |
| 106 | } |
| 107 | } |
| 108 | (void) fclose_text_file(); |
| 109 | ++filenum; |
nothing calls this directly
no test coverage detected