00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __ANIMATIONS_H__
00029 #define __ANIMATIONS_H__
00030
00032
00033 #include <string>
00034 #include <map>
00035
00036
00037
00038
00039
00040 enum AnimationType {
00041 AnimationNone,
00042 AnimationFrame,
00043 AnimationExactFrame,
00044 AnimationRandomFrame,
00045 AnimationWait,
00046 AnimationRandomWait,
00047 AnimationSound,
00048 AnimationRandomSound,
00049 AnimationAttack,
00050 AnimationRotate,
00051 AnimationRandomRotate,
00052 AnimationMove,
00053 AnimationUnbreakable,
00054 AnimationLabel,
00055 AnimationGoto,
00056 AnimationRandomGoto,
00057 };
00058
00059 class CAnimation {
00060 public:
00061 CAnimation() : Type(AnimationNone), Next(NULL) {}
00062
00063 AnimationType Type;
00064 union {
00065 struct {
00066 int Frame;
00067 } Frame;
00068 struct {
00069 int MinFrame;
00070 int MaxFrame;
00071 } RandomFrame;
00072 struct {
00073 int Wait;
00074 } Wait;
00075 struct {
00076 int MinWait;
00077 int MaxWait;
00078 } RandomWait;
00079 struct {
00080 char *Name;
00081 CSound *Sound;
00082 } Sound;
00083 struct {
00084 char **Name;
00085 CSound **Sound;
00086 int NumSounds;
00087 } RandomSound;
00088 struct {
00089 int Rotate;
00090 } Rotate;
00091 struct {
00092 int Move;
00093 } Move;
00094 struct {
00095 int Begin;
00096 } Unbreakable;
00097 struct {
00098 CAnimation *Goto;
00099 } Goto;
00100 struct {
00101 int Random;
00102 CAnimation *Goto;
00103 } RandomGoto;
00104 } D;
00105 CAnimation *Next;
00106 };
00107
00108 class CAnimations {
00109 public:
00110 CAnimations() : Start(NULL), Still(NULL), Death(NULL), Attack(NULL),
00111 Move(NULL), Repair(NULL), Train(NULL), Harvest(NULL)
00112 {
00113 }
00114
00115 CAnimation *Start;
00116 CAnimation *Still;
00117 CAnimation *Death;
00118 CAnimation *Attack;
00119 CAnimation *Move;
00120 CAnimation *Repair;
00121 CAnimation *Train;
00122 CAnimation *Harvest;
00123 };
00124
00125
00126 #define ANIMATIONS_MAXANIM 1024
00127
00128 extern CAnimation *AnimationsArray[ANIMATIONS_MAXANIM];
00129 extern int NumAnimations;
00130
00132 extern std::map<std::string, CAnimations *> AnimationMap;
00133
00134
00135
00136
00137
00138
00140 extern CAnimations *AnimationsByIdent(const std::string &ident);
00141
00142
00144
00145 #endif // !__ANIMATIONS_H__