ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/anim.C
(Generate patch)

Comparing deliantra/server/common/anim.C (file contents):
Revision 1.8 by root, Mon Sep 11 20:28:37 2006 UTC vs.
Revision 1.10 by root, Thu Sep 14 22:33:58 2006 UTC

1
2/*
3 * static char *rcsid_anim_c =
4 * "$Id: anim.C,v 1.8 2006/09/11 20:28:37 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002-2003 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002-2003 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* This file contains animation related code. */ 24/* This file contains animation related code. */
31 25
32#include <global.h> 26#include <global.h>
33#include <stdio.h> 27#include <stdio.h>
34 28
35std::vector < Animations > animations; 29std::vector<Animations> animations;
36 30
37void 31void
38free_all_anim (void) 32free_all_anim (void)
39{ 33{
40 for (int i = 0; i <= num_animations; i++) 34 for (int i = 0; i <= num_animations; i++)
188 int 182 int
189 base_state; /* starting index # to draw from */ 183 base_state; /* starting index # to draw from */
190 184
191 if (!op->animation_id || !NUM_ANIMATIONS (op)) 185 if (!op->animation_id || !NUM_ANIMATIONS (op))
192 { 186 {
193 LOG (llevError, "Object lacks animation.\n"); 187 LOG (llevError, "Object %s lacks animation.\n", op->debug_desc ());
194 dump_object (op);
195 return; 188 return;
196 } 189 }
190
197 if (op->head) 191 if (op->head)
198 { 192 {
199 dir = op->head->direction; 193 dir = op->head->direction;
200 194
201 if (NUM_ANIMATIONS (op) == NUM_ANIMATIONS (op->head)) 195 if (NUM_ANIMATIONS (op) == NUM_ANIMATIONS (op->head))
202 op->state = op->head->state; 196 op->state = op->head->state;
203 else 197 else
204 ++op->state; 198 ++op->state;
205 } 199 }
206 else 200 else
207 {
208 ++op->state; /* increase draw state */ 201 ++op->state; /* increase draw state */
209 }
210 202
211 /* If object is turning, then max animation state is half through the 203 /* If object is turning, then max animation state is half through the
212 * animations. Otherwise, we can use all the animations. 204 * animations. Otherwise, we can use all the animations.
213 */ 205 */
214 max_state = NUM_ANIMATIONS (op) / NUM_FACINGS (op); 206 max_state = NUM_ANIMATIONS (op) / NUM_FACINGS (op);
217 * of the animations were left facing, the second half right facing. 209 * 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 210 * 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 211 * was always towards the enemy - now it is whatever direction the monster
220 * is facing. 212 * is facing.
221 */ 213 */
214
222 if (NUM_FACINGS (op) == 2) 215 if (NUM_FACINGS (op) == 2)
223 { 216 {
224 if (dir < 5) 217 if (dir < 5)
225 base_state = 0; 218 base_state = 0;
226 else 219 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines