]> git.jsancho.org Git - lugaru.git/blob - Source/Animation/Animation.h
Moved Skeleton and Animation to their own folder.
[lugaru.git] / Source / Animation / Animation.h
1 /*
2 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
3
4 This file is part of Lugaru.
5
6 Lugaru is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 Lugaru is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef ANIMATION_H
21 #define ANIMATION_H
22
23 #include <vector>
24
25 enum anim_attack_type {
26     neutral, normalattack, reversed, reversal
27 };
28
29 enum anim_height_type {
30     lowheight, middleheight, highheight
31 };
32
33 enum animation_types {
34 #define DECLARE_ANIM(id, ...) id,
35 #include "Animation.def"
36 #undef DECLARE_ANIM
37     animation_count
38 };
39
40 enum animation_bit_offsets {
41 #define DECLARE_ANIM_BIT(bit) o_##bit,
42 #include "Animation.def"
43 #undef DECLARE_ANIM_BIT
44     animation_bit_count
45 };
46
47 enum animation_bits_def {
48 #define DECLARE_ANIM_BIT(bit) bit = 1 << o_##bit,
49 #include "Animation.def"
50 #undef DECLARE_ANIM_BIT
51 };
52
53 static const int animation_bits[animation_count] = {
54 #define DECLARE_ANIM(id, name, height, type, bits) bits,
55 #include "Animation.def"
56 #undef DECLARE_ANIM
57 };
58
59 class Animation
60 {
61 public:
62     static std::vector<Animation> animations;
63     static void loadAll();
64
65     int numframes;
66     int height;
67     int attack;
68     int joints;
69     int weapontargetnum;
70
71     XYZ**  position;
72     float** twist;
73     float** twist2;
74     float* speed;
75     bool** onground;
76     XYZ* forward;
77     int* label;
78     XYZ* weapontarget;
79
80     XYZ offset;
81
82     Animation();
83     Animation(const std::string& fileName, int aheight, int aattack);
84     ~Animation();
85     Animation & operator = (const Animation & ani);
86
87 protected:
88     void deallocate();
89 };
90 #endif