1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_anim_c = |
3 | * static char *rcsid_anim_c = |
4 | * "$Id: anim.C,v 1.8 2006/09/11 20:28:37 root Exp $"; |
4 | * "$Id: anim.C,v 1.9 2006/09/12 19:20:05 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
188 | int |
188 | int |
189 | base_state; /* starting index # to draw from */ |
189 | base_state; /* starting index # to draw from */ |
190 | |
190 | |
191 | if (!op->animation_id || !NUM_ANIMATIONS (op)) |
191 | if (!op->animation_id || !NUM_ANIMATIONS (op)) |
192 | { |
192 | { |
193 | LOG (llevError, "Object lacks animation.\n"); |
193 | LOG (llevError, "Object %s lacks animation.\n", op->debug_desc ()); |
194 | dump_object (op); |
|
|
195 | return; |
194 | return; |
196 | } |
195 | } |
|
|
196 | |
197 | if (op->head) |
197 | if (op->head) |
198 | { |
198 | { |
199 | dir = op->head->direction; |
199 | dir = op->head->direction; |
200 | |
200 | |
201 | if (NUM_ANIMATIONS (op) == NUM_ANIMATIONS (op->head)) |
201 | if (NUM_ANIMATIONS (op) == NUM_ANIMATIONS (op->head)) |
202 | op->state = op->head->state; |
202 | op->state = op->head->state; |
203 | else |
203 | else |
204 | ++op->state; |
204 | ++op->state; |
205 | } |
205 | } |
206 | else |
206 | else |
207 | { |
|
|
208 | ++op->state; /* increase draw state */ |
207 | ++op->state; /* increase draw state */ |
209 | } |
|
|
210 | |
208 | |
211 | /* If object is turning, then max animation state is half through the |
209 | /* If object is turning, then max animation state is half through the |
212 | * animations. Otherwise, we can use all the animations. |
210 | * animations. Otherwise, we can use all the animations. |
213 | */ |
211 | */ |
214 | max_state = NUM_ANIMATIONS (op) / NUM_FACINGS (op); |
212 | max_state = NUM_ANIMATIONS (op) / NUM_FACINGS (op); |
… | |
… | |
217 | * of the animations were left facing, the second half right facing. |
215 | * of the animations were left facing, the second half right facing. |
218 | * Note in old the is_turning, it was set so that the animation for a monster |
216 | * Note in old the is_turning, it was set so that the animation for a monster |
219 | * was always towards the enemy - now it is whatever direction the monster |
217 | * was always towards the enemy - now it is whatever direction the monster |
220 | * is facing. |
218 | * is facing. |
221 | */ |
219 | */ |
|
|
220 | |
222 | if (NUM_FACINGS (op) == 2) |
221 | if (NUM_FACINGS (op) == 2) |
223 | { |
222 | { |
224 | if (dir < 5) |
223 | if (dir < 5) |
225 | base_state = 0; |
224 | base_state = 0; |
226 | else |
225 | else |