AnimAction.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2006 The Pentagram team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef ANIMACTION_H
00020 #define ANIMACTION_H
00021 
00022 #include <vector>
00023 class Actor;
00024 
00025 struct AnimFrame
00026 {
00027         int frame;
00028         int deltaz;
00029         int deltadir;
00030         int sfx;
00031         uint32 flags;
00032 
00033         enum AnimFrameFlags {
00034                 AFF_UNK1     = 0x0001,
00035                 AFF_ONGROUND = 0x0002,
00036                 AFF_FLIPPED  = 0x0020,
00037                 AFF_SPECIAL  = 0x0800
00038         };
00039 
00040         inline bool is_flipped() { return (flags & AFF_FLIPPED) != 0; }
00041         inline int attack_range() { return ((flags >> 2) & 0x07); }
00042 };
00043 
00044 struct AnimAction {
00045         uint32 shapenum;
00046         uint32 action;
00047 
00048         std::vector<AnimFrame> frames[16]; // 8 or 16 directions
00049         unsigned int size;
00050         int framerepeat;
00051         uint32 flags;
00052 
00053         unsigned int dircount;
00054 
00060         void getAnimRange(Actor* actor, int dir,
00061                                           unsigned int& startframe, unsigned int& endframe) const;
00062 
00070         void getAnimRange(unsigned int lastanim, int lastdir,
00071                                           bool firststep, int dir,
00072                                           unsigned int& startframe, unsigned int& endframe) const;
00073 
00074         unsigned int getDirCount() const;
00075 
00076         enum AnimActionFlags {
00077                 AAF_TWOSTEP      = 0x0001,
00078                 AAF_ATTACK       = 0x0002,
00079                 AAF_LOOPING      = 0x0004,
00080                 AAF_UNSTOPPABLE  = 0x0008,
00081                 AAF_LOOPING2     = 0x0010, // CHECKME: guessing at this flag
00082                 AAF_HANGING      = 0x0080,
00083                 AAF_CRUS_16DIRS  = 0x4000, // Crusader
00084                 AAF_DESTROYACTOR = 0x8000  // destroy actor after animation finishes
00085         };
00086 };
00087 
00088 
00089 #endif

Generated on Fri Jul 27 22:27:09 2007 for pentagram by  doxygen 1.4.7