1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
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 | |
… | |
… | |
112 | static int |
112 | static int |
113 | compar (const struct bmappair *a, const struct bmappair *b) |
113 | compar (const struct bmappair *a, const struct bmappair *b) |
114 | { |
114 | { |
115 | return strcmp (a->name, b->name); |
115 | return strcmp (a->name, b->name); |
116 | } |
116 | } |
|
|
117 | |
117 | static int |
118 | static int |
118 | compar_smooth (const struct smoothing *a, const struct smoothing *b) |
119 | compar_smooth (const struct smoothing *a, const struct smoothing *b) |
119 | { |
120 | { |
120 | if (a->id < b->id) |
121 | if (a->id < b->id) |
121 | return -1; |
122 | return -1; |
122 | if (b->id < a->id) |
123 | if (b->id < a->id) |
123 | return 1; |
124 | return 1; |
124 | return 0; |
125 | return 0; |
125 | } |
126 | } |
126 | |
127 | |
127 | |
|
|
128 | /* |
128 | /* |
129 | * Returns the matching color in the coloralias if found, |
129 | * Returns the matching color in the coloralias if found, |
130 | * 0 otherwise. Note that 0 will actually be black, so there is no |
130 | * 0 otherwise. Note that 0 will actually be black, so there is no |
131 | * way the calling function can tell if an error occurred or not |
131 | * way the calling function can tell if an error occurred or not |
132 | */ |
132 | */ |
133 | |
|
|
134 | static uint8 |
133 | static uint8 |
135 | find_color (const char *name) |
134 | find_color (const char *name) |
136 | { |
135 | { |
137 | uint8 i; |
136 | uint8 i; |
138 | |
137 | |
… | |
… | |
144 | } |
143 | } |
145 | |
144 | |
146 | /* This reads the lib/faces file, getting color and visibility information. |
145 | /* This reads the lib/faces file, getting color and visibility information. |
147 | * it is called by ReadBmapNames. |
146 | * it is called by ReadBmapNames. |
148 | */ |
147 | */ |
149 | |
|
|
150 | static void |
148 | static void |
151 | ReadFaceData (void) |
149 | ReadFaceData (void) |
152 | { |
150 | { |
153 | char buf[MAX_BUF], *cp; |
151 | char buf[MAX_BUF], *cp; |
154 | New_Face *on_face = NULL; |
152 | New_Face *on_face = NULL; |
… | |
… | |
217 | on_face->magicmap |= FACE_FLOOR; |
215 | on_face->magicmap |= FACE_FLOOR; |
218 | } |
216 | } |
219 | else |
217 | else |
220 | LOG (llevDebug, "Got unknown line in faces file: %s\n", buf); |
218 | LOG (llevDebug, "Got unknown line in faces file: %s\n", buf); |
221 | } |
219 | } |
|
|
220 | |
222 | LOG (llevDebug, "done\n"); |
221 | LOG (llevDebug, "done\n"); |
223 | fclose (fp); |
222 | fclose (fp); |
224 | } |
223 | } |
225 | |
224 | |
226 | /* This reads the bmaps file to get all the bitmap names and |
225 | /* This reads the bmaps file to get all the bitmap names and |
227 | * stuff. It only needs to be done once, because it is player |
226 | * stuff. It only needs to be done once, because it is player |
228 | * independent (ie, what display the person is on will not make a |
227 | * independent (ie, what display the person is on will not make a |
229 | * difference.) |
228 | * difference.) |
230 | */ |
229 | */ |
231 | |
|
|
232 | void |
230 | void |
233 | ReadBmapNames (void) |
231 | ReadBmapNames (void) |
234 | { |
232 | { |
235 | char buf[MAX_BUF], *p, *q; |
233 | char buf[MAX_BUF], *p, *q; |
236 | FILE *fp; |
234 | FILE *fp; |