… | |
… | |
44 | { |
44 | { |
45 | char *name; |
45 | char *name; |
46 | unsigned int number; |
46 | unsigned int number; |
47 | }; |
47 | }; |
48 | |
48 | |
49 | void free (bmappair *); // guard to catch free when delete should be used |
|
|
50 | |
|
|
51 | static struct bmappair *xbm = NULL; |
49 | static struct bmappair *xbm = NULL; |
52 | |
50 | |
53 | /* Following can just as easily be pointers, but |
|
|
54 | * it is easier to keep them like this. |
|
|
55 | */ |
|
|
56 | facetile *blank_face, *dark_faces[3], *empty_face, *smooth_face; |
51 | facetile *blank_face, *dark_faces[3], *empty_face, *smooth_face; |
57 | |
|
|
58 | |
52 | |
59 | /* nroffiles is the actual number of bitmaps defined. |
53 | /* nroffiles is the actual number of bitmaps defined. |
60 | * nrofpixmaps is the number of bitmaps loaded. With |
54 | * nrofpixmaps is the number of bitmaps loaded. With |
61 | * the automatic generation of the bmaps file, this is now equal |
55 | * the automatic generation of the bmaps file, this is now equal |
62 | * to nroffiles. |
56 | * to nroffiles. |
… | |
… | |
70 | int nrofpixmaps = 0; |
64 | int nrofpixmaps = 0; |
71 | |
65 | |
72 | /** |
66 | /** |
73 | * id is the face to smooth, smooth is the 16x2 face used to smooth id. |
67 | * id is the face to smooth, smooth is the 16x2 face used to smooth id. |
74 | */ |
68 | */ |
75 | struct smoothing:zero_initialised |
69 | struct smoothing : zero_initialised |
76 | { |
70 | { |
77 | uint16 id; |
71 | uint16 id; |
78 | uint16 smooth; |
72 | uint16 smooth; |
79 | }; |
73 | }; |
80 | |
|
|
81 | void free (smoothing *); // guard to catch free when delete should be used |
|
|
82 | |
74 | |
83 | /** |
75 | /** |
84 | * Contains all defined smoothing entries. smooth is an array of nrofsmooth |
76 | * Contains all defined smoothing entries. smooth is an array of nrofsmooth |
85 | * entries. It is sorted by smooth[].id. |
77 | * entries. It is sorted by smooth[].id. |
86 | */ |
78 | */ |
… | |
… | |
272 | * need to match what sum or other utility may come up with - |
264 | * need to match what sum or other utility may come up with - |
273 | * as long as we get the same results on the same real file |
265 | * as long as we get the same results on the same real file |
274 | * data, it does the job as it lets the client know if |
266 | * data, it does the job as it lets the client know if |
275 | * the file has the same data or not. |
267 | * the file has the same data or not. |
276 | */ |
268 | */ |
277 | ROTATE_RIGHT (bmaps_checksum); |
269 | rotate_right (bmaps_checksum); |
278 | bmaps_checksum += value & 0xff; |
270 | bmaps_checksum += value & 0xff; |
279 | bmaps_checksum &= 0xffffffff; |
271 | bmaps_checksum &= 0xffffffff; |
280 | |
272 | |
281 | ROTATE_RIGHT (bmaps_checksum); |
273 | rotate_right (bmaps_checksum); |
282 | bmaps_checksum += (value >> 8) & 0xff; |
274 | bmaps_checksum += (value >> 8) & 0xff; |
283 | bmaps_checksum &= 0xffffffff; |
275 | bmaps_checksum &= 0xffffffff; |
284 | for (l = 0; l < strlen (q); l++) |
276 | for (l = 0; l < strlen (q); l++) |
285 | { |
277 | { |
286 | ROTATE_RIGHT (bmaps_checksum); |
278 | rotate_right (bmaps_checksum); |
287 | bmaps_checksum += q[l]; |
279 | bmaps_checksum += q[l]; |
288 | bmaps_checksum &= 0xffffffff; |
280 | bmaps_checksum &= 0xffffffff; |
289 | } |
281 | } |
290 | |
282 | |
291 | xbm[nroffiles].number = value; |
283 | xbm[nroffiles].number = value; |
… | |
… | |
304 | new_faces[i].name = ""; |
296 | new_faces[i].name = ""; |
305 | new_faces[i].number = i; |
297 | new_faces[i].number = i; |
306 | new_faces[i].visibility = 0; |
298 | new_faces[i].visibility = 0; |
307 | new_faces[i].magicmap = 255; |
299 | new_faces[i].magicmap = 255; |
308 | } |
300 | } |
|
|
301 | |
309 | for (i = 0; i < nroffiles; i++) |
302 | for (i = 0; i < nroffiles; i++) |
310 | { |
|
|
311 | new_faces[xbm[i].number].name = xbm[i].name; |
303 | new_faces[xbm[i].number].name = xbm[i].name; |
312 | } |
|
|
313 | |
304 | |
314 | // non-pod datatype, likely not allowed |
305 | // non-pod datatype, likely not allowed |
315 | qsort (xbm, nroffiles, sizeof (struct bmappair), (int (*)(const void *, const void *)) compar); |
306 | qsort (xbm, nroffiles, sizeof (struct bmappair), (int (*)(const void *, const void *)) compar); |
316 | |
307 | |
317 | ReadFaceData (); |
308 | ReadFaceData (); |