MCPcopy Create free account
hub / github.com/NetHack/NetHack / main

Function main

sys/msdos/tile2bin.c:82–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80int paletteflag;
81
82int
83main(int argc, char *argv[])
84{
85 int i;
86 struct tm *newtime;
87 time_t aclock;
88 char *paletteptr;
89 unsigned num_monsters = 0;
90
91 if (argc != 1) {
92 Fprintf(stderr, "usage: tile2bin (from the util directory)\n");
93 exit(EXIT_FAILURE);
94 }
95
96#ifdef PLANAR_FILE
97#ifndef OVERVIEW_FILE
98 tibfile1 = fopen(NETHACK_PLANAR_TILEFILE, WRBMODE);
99#else
100 tibfile1 = fopen(NETHACK_OVERVIEW_TILEFILE, WRBMODE);
101#endif
102 if (tibfile1 == (FILE *) 0) {
103 Fprintf(stderr, "Unable to open output file %s\n",
104#ifndef OVERVIEW_FILE
105 NETHACK_PLANAR_TILEFILE);
106#else
107 NETHACK_OVERVIEW_TILEFILE);
108#endif
109 exit(EXIT_FAILURE);
110 }
111#endif
112
113#ifdef PACKED_FILE
114 tibfile2 = fopen(NETHACK_PACKED_TILEFILE, WRBMODE);
115 if (tibfile2 == (FILE *) 0) {
116 Fprintf(stderr, "Unable to open output file %s\n",
117 NETHACK_PACKED_TILEFILE);
118 exit(EXIT_FAILURE);
119 }
120#endif
121 time(&aclock);
122 newtime = localtime(&aclock);
123
124 tilecount = 0;
125 paletteflag = 0;
126 filenum = 0;
127 while (filenum < 3) {
128 if (!fopen_text_file(tilefiles[filenum], RDTMODE)) {
129 Fprintf(stderr,
130 "usage: tile2bin (from the util or src directory)\n");
131 exit(EXIT_FAILURE);
132 }
133 num_colors = colorsinmap;
134 if (num_colors > 62) {
135 Fprintf(stderr, "too many colors (%d)\n", num_colors);
136 exit(EXIT_FAILURE);
137 }
138
139 if (!paletteflag) {

Callers

nothing calls this directly

Calls 10

timeFunction · 0.85
localtimeFunction · 0.85
fopen_text_fileFunction · 0.85
remap_colorsFunction · 0.85
read_text_tileFunction · 0.85
build_tibtileFunction · 0.85
write_tibtileFunction · 0.85
fclose_text_fileFunction · 0.85
write_tibheaderFunction · 0.85
fcloseFunction · 0.85

Tested by

no test coverage detected