1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
11 | * (at your option) any later version. |
12 | |
12 | * |
13 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | |
17 | * |
18 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | The maintainer of this code can be reached at <crossfire@schmorp.de> |
22 | * The maintainer of this code can be reached at <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | |
25 | |
26 | #include <global.h> |
26 | #include <global.h> |
27 | #include <stdio.h> |
27 | #include <stdio.h> |
28 | |
28 | |
29 | New_Face *new_faces; |
29 | facetile *new_faces; |
30 | |
30 | |
31 | /* bmappair and xbm are used when looking for the image id numbers |
31 | /* bmappair and xbm are used when looking for the image id numbers |
32 | * of a face by name. xbm is sorted alphabetically so that bsearch |
32 | * of a face by name. xbm is sorted alphabetically so that bsearch |
33 | * can be used to quickly find the entry for a name. the number is |
33 | * can be used to quickly find the entry for a name. the number is |
34 | * then an index into the new_faces array. |
34 | * then an index into the new_faces array. |
… | |
… | |
51 | static struct bmappair *xbm = NULL; |
51 | static struct bmappair *xbm = NULL; |
52 | |
52 | |
53 | /* Following can just as easily be pointers, but |
53 | /* Following can just as easily be pointers, but |
54 | * it is easier to keep them like this. |
54 | * it is easier to keep them like this. |
55 | */ |
55 | */ |
56 | New_Face *blank_face, *dark_faces[3], *empty_face, *smooth_face; |
56 | facetile *blank_face, *dark_faces[3], *empty_face, *smooth_face; |
57 | |
57 | |
58 | |
58 | |
59 | /* nroffiles is the actual number of bitmaps defined. |
59 | /* nroffiles is the actual number of bitmaps defined. |
60 | * nrofpixmaps is the number of bitmaps loaded. With |
60 | * nrofpixmaps is the number of bitmaps loaded. With |
61 | * the automatic generation of the bmaps file, this is now equal |
61 | * the automatic generation of the bmaps file, this is now equal |
… | |
… | |
147 | */ |
147 | */ |
148 | static void |
148 | static void |
149 | ReadFaceData (void) |
149 | ReadFaceData (void) |
150 | { |
150 | { |
151 | char buf[MAX_BUF], *cp; |
151 | char buf[MAX_BUF], *cp; |
152 | New_Face *on_face = NULL; |
152 | facetile *on_face = NULL; |
153 | FILE *fp; |
153 | FILE *fp; |
154 | |
154 | |
155 | sprintf (buf, "%s/faces", settings.datadir); |
155 | sprintf (buf, "%s/faces", settings.datadir); |
156 | LOG (llevDebug, "Reading faces from %s...\n", buf); |
156 | LOG (llevDebug, "Reading faces from %s...\n", buf); |
157 | if ((fp = fopen (buf, "r")) == NULL) |
157 | if ((fp = fopen (buf, "r")) == NULL) |
… | |
… | |
295 | } |
295 | } |
296 | fclose (fp); |
296 | fclose (fp); |
297 | |
297 | |
298 | LOG (llevDebug, "done (got %d/%d/%d)\n", nrofpixmaps, nrofbmaps, nroffiles); |
298 | LOG (llevDebug, "done (got %d/%d/%d)\n", nrofpixmaps, nrofbmaps, nroffiles); |
299 | |
299 | |
300 | new_faces = new New_Face[nrofpixmaps]; |
300 | new_faces = new facetile[nrofpixmaps]; |
301 | |
301 | |
302 | for (i = 0; i < nrofpixmaps; i++) |
302 | for (i = 0; i < nrofpixmaps; i++) |
303 | { |
303 | { |
304 | new_faces[i].name = ""; |
304 | new_faces[i].name = ""; |
305 | new_faces[i].number = i; |
305 | new_faces[i].number = i; |