… | |
… | |
40 | } |
40 | } |
41 | |
41 | |
42 | void |
42 | void |
43 | init_anim (void) |
43 | init_anim (void) |
44 | { |
44 | { |
45 | char |
|
|
46 | buf[MAX_BUF]; |
45 | char buf[MAX_BUF]; |
47 | FILE * |
46 | FILE * fp; |
48 | fp; |
|
|
49 | static int |
|
|
50 | anim_init = 0; |
47 | static int anim_init = 0; |
51 | int |
|
|
52 | num_frames = 0, faces[MAX_ANIMATIONS], i; |
48 | int num_frames = 0, faces[MAX_ANIMATIONS], i; |
53 | |
49 | |
54 | if (anim_init) |
50 | if (anim_init) |
55 | return; |
51 | return; |
56 | |
52 | |
57 | num_animations = 0; |
53 | num_animations = 0; |
… | |
… | |
115 | for (i = 0; i < num_frames; i++) |
111 | for (i = 0; i < num_frames; i++) |
116 | animations[num_animations].faces[i] = faces[i]; |
112 | animations[num_animations].faces[i] = faces[i]; |
117 | |
113 | |
118 | animations[num_animations].num_animations = num_frames; |
114 | animations[num_animations].num_animations = num_frames; |
119 | if (num_frames % animations[num_animations].facings) |
115 | if (num_frames % animations[num_animations].facings) |
120 | { |
|
|
121 | LOG (llevDebug, "Animation %s frame numbers (%d) is not a multiple of facings (%d)\n", |
116 | LOG (llevDebug, "Animation %s frame numbers (%d) is not a multiple of facings (%d)\n", |
122 | &animations[num_animations].name, num_frames, animations[num_animations].facings); |
117 | &animations[num_animations].name, num_frames, animations[num_animations].facings); |
123 | } |
118 | |
124 | num_frames = 0; |
119 | num_frames = 0; |
125 | } |
120 | } |
126 | else if (!strncmp (buf, "facings", 7)) |
121 | else if (!strncmp (buf, "facings ", 8)) |
127 | { |
122 | { |
128 | if (!(animations[num_animations].facings = atoi (buf + 7))) |
123 | if (!(animations[num_animations].facings = atoi (buf + 8))) |
129 | { |
124 | { |
130 | LOG (llevDebug, "Animation %s has 0 facings, line=%s\n", &animations[num_animations].name, buf); |
125 | LOG (llevDebug, "Animation %s has 0 facings, line=%s\n", &animations[num_animations].name, buf); |
131 | animations[num_animations].facings = 1; |
126 | animations[num_animations].facings = 1; |
132 | } |
127 | } |
133 | |
128 | |
134 | } |
129 | } |
135 | else |
130 | else |
136 | { |
131 | { |
137 | if (!(faces[num_frames++] = FindFace (buf, 0))) |
132 | if (!(faces[num_frames++] = face_find (buf))) |
138 | LOG (llevDebug, "Could not find face %s for animation %s\n", buf, &animations[num_animations].name); |
133 | LOG (llevDebug, "Could not find face %s for animation %s\n", buf, &animations[num_animations].name); |
139 | } |
134 | } |
140 | } |
135 | } |
141 | |
136 | |
142 | fclose (fp); |
137 | fclose (fp); |
… | |
… | |
245 | |
240 | |
246 | SET_ANIMATION (op, op->state + base_state); |
241 | SET_ANIMATION (op, op->state + base_state); |
247 | |
242 | |
248 | if (op->face == blank_face) |
243 | if (op->face == blank_face) |
249 | op->invisible = 1; |
244 | op->invisible = 1; |
|
|
245 | |
250 | /* This block covers monsters (eg, pixies) which are supposed to |
246 | /* This block covers monsters (eg, pixies) which are supposed to |
251 | * cycle from visible to invisible and back to being visible. |
247 | * cycle from visible to invisible and back to being visible. |
252 | * as such, disable it for players, as then players would become |
248 | * as such, disable it for players, as then players would become |
253 | * visible. |
249 | * visible. |
254 | */ |
250 | */ |
255 | else if (op->type != PLAYER && op->arch->clone.flag [FLAG_ALIVE]) |
251 | else if (op->type != PLAYER && op->arch->clone.flag [FLAG_ALIVE]) |
256 | { |
252 | { |
257 | if (op->face->number == 0) |
253 | if (op->face == 0) |
258 | { |
254 | { |
259 | op->invisible = 1; |
255 | op->invisible = 1; |
260 | CLEAR_FLAG (op, FLAG_ALIVE); |
256 | CLEAR_FLAG (op, FLAG_ALIVE); |
261 | } |
257 | } |
262 | else |
258 | else |