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.27 by root, Sun Jul 1 05:00:17 2007 UTC vs.
Revision 1.31 by root, Thu Sep 17 01:57:31 2009 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software: you can redistribute it and/or modify 8 * Deliantra 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 3 of the License, or 10 * the Free Software Foundation, either version 3 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,
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, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * 20 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24/* This file contains animation related code. */ 24/* This file contains animation related code. */
25 25
26#include <global.h> 26#include <global.h>
30std::vector<animation> animations; 30std::vector<animation> animations;
31 31
32void 32void
33animation::resize (int new_size) 33animation::resize (int new_size)
34{ 34{
35 sfree <faceidx> (faces, num_animations); 35 sfree<faceidx> (faces, num_animations);
36 num_animations = new_size; 36 num_animations = new_size;
37 faces = salloc<faceidx> (num_animations); 37 faces = salloc<faceidx> (num_animations);
38} 38}
39 39
40animation & 40animation &
128 * Note in old the is_turning, it was set so that the animation for a monster 128 * Note in old the is_turning, it was set so that the animation for a monster
129 * was always towards the enemy - now it is whatever direction the monster 129 * was always towards the enemy - now it is whatever direction the monster
130 * is facing. 130 * is facing.
131 */ 131 */
132 132
133 if (dir > 0)
133 if (NUM_FACINGS (op) == 2) 134 switch (NUM_FACINGS (op))
134 { 135 {
135 if (dir < 5) 136 case 2: base_state = ((dir - 1) / (8 / 2)) * (NUM_ANIMATIONS (op) / 2); break;
137 case 4: base_state = ((dir - 1) / (8 / 4)) * (NUM_ANIMATIONS (op) / 4); break;
138 case 8: base_state = ((dir - 1) / (8 / 8)) * (NUM_ANIMATIONS (op) / 8); break;
139 }
140 else
136 base_state = 0; 141 base_state = 0;
137 else
138 base_state = NUM_ANIMATIONS (op) / 2;
139 }
140 else if (NUM_FACINGS (op) == 4)
141 {
142 if (dir == 0)
143 base_state = 0;
144 else
145 base_state = ((dir - 1) / 2) * (NUM_ANIMATIONS (op) / 4);
146 }
147 else if (NUM_FACINGS (op) == 8)
148 {
149 if (dir == 0)
150 base_state = 0;
151 else
152 base_state = (dir - 1) * (NUM_ANIMATIONS (op) / 8);
153 }
154 142
155 /* If beyond drawable states, reset */ 143 /* If beyond drawable states, reset */
156 if (op->state >= max_state) 144 if (op->state >= max_state)
157 op->state = 0; 145 op->state = 0;
158 146

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines