Debian Codegraph @

engine/include/animation.h

raw
1 // ____ _ __
2 // / __ )____ _____ | | / /___ ___________
3 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
4 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
5 // /_____/\____/____/ |__/|__/\__,_/_/ /____/
6 //
7 // A futuristic real-time strategy game.
8 // This file is part of Bos Wars.
9 //
10 /**@name animation.h - The animations headerfile. */
11 //
12 // (c) Copyright 2005-2008 by Jimmy Salmon
13 //
14 // This program is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; only version 2 of the License.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 // 02111-1307, USA.
27
28 #ifndef __ANIMATIONS_H__
29 #define __ANIMATIONS_H__
30
31 //@{
32
33 #include <string>
34 #include <map>
35
36 /*----------------------------------------------------------------------------
37 -- Declarations
38 ----------------------------------------------------------------------------*/
39
40 enum AnimationType {
41 AnimationNone,
42 AnimationFrame,
43 AnimationExactFrame,
44 AnimationRandomFrame,
45 AnimationWait,
46 AnimationRandomWait,
47 AnimationSound,
48 AnimationRandomSound,
49 AnimationAttack,
50 AnimationRotate,
51 AnimationRandomRotate,
52 AnimationMove,
53 AnimationUnbreakable,
54 AnimationLabel,
55 AnimationGoto,
56 AnimationRandomGoto,
57 };
58
59 class CAnimation {
60 public:
61 CAnimation() : Type(AnimationNone), Next(NULL) {}
62
63 AnimationType Type;
64 union {
65 struct {
66 int Frame;
67 } Frame;
68 struct {
69 int MinFrame;
70 int MaxFrame;
71 } RandomFrame;
72 struct {
73 int Wait;
74 } Wait;
75 struct {
76 int MinWait;
77 int MaxWait;
78 } RandomWait;
79 struct {
80 char *Name;
81 CSound *Sound;
82 } Sound;
83 struct {
84 char **Name;
85 CSound **Sound;
86 int NumSounds;
87 } RandomSound;
88 struct {
89 int Rotate;
90 } Rotate;
91 struct {
92 int Move;
93 } Move;
94 struct {
95 int Begin;
96 } Unbreakable;
97 struct {
98 CAnimation *Goto;
99 } Goto;
100 struct {
101 int Random;
102 CAnimation *Goto;
103 } RandomGoto;
104 } D;
105 CAnimation *Next;
106 };
107
108 class CAnimations {
109 public:
110 CAnimations() : Start(NULL), Still(NULL), Death(NULL), Attack(NULL),
111 Move(NULL), Repair(NULL), Train(NULL), Harvest(NULL)
112 {
113 }
114
115 CAnimation *Start;
116 CAnimation *Still;
117 CAnimation *Death;
118 CAnimation *Attack;
119 CAnimation *Move;
120 CAnimation *Repair;
121 CAnimation *Train;
122 CAnimation *Harvest;
123 };
124
125
126 #define ANIMATIONS_MAXANIM 1024
127
128 extern CAnimation *AnimationsArray[ANIMATIONS_MAXANIM];
129 extern int NumAnimations;
130
131 /// Hash table of all the animations
132 extern std::map<std::string, CAnimations *> AnimationMap;
133
134
135 /*----------------------------------------------------------------------------
136 -- Functions
137 ----------------------------------------------------------------------------*/
138
139 /// Get the animations structure by ident
140 extern CAnimations *AnimationsByIdent(const std::string &ident);
141
142
143 //@}
144
145 #endif // !__ANIMATIONS_H__