1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
vcmi/client/CCreatureAnimation.h
Michał W. Urbańczyk 89cb5cb81b * added calls for battle action start/end
* added interface for casting spells
* artifact info in backpack
* artifacts we pick up on the map go to the appropriate slot (if free)
2008-09-28 21:01:49 +00:00

48 lines
1.7 KiB
C++

#pragma once
#include "../global.h"
#include "../CPlayerInterface.h"
#include "../hch/CDefHandler.h"
class CCreatureAnimation : public CIntObject
{
private:
int totalEntries, DEFType, totalBlocks;
bool allowRepaint;
int length;
BMPPalette palette[256];
unsigned int * RWEntries;
int * RLEntries;
struct SEntry
{
std::string name;
int offset;
int group;
} ;
std::vector<SEntry> SEntries ;
char id[2];
std::string defName, curDir;
int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
void putPixel(SDL_Surface * dest, const int & ftcp, const BMPPalette & color, const unsigned char & palc, const bool & yellowBorder) const;
////////////
unsigned char * FDef; //animation raw data
unsigned int curFrame; //number of currently displayed frame
unsigned int frames; //number of frames
public:
int type; //type of animation being displayed (-1 - whole animation, >0 - specified part [default: -1])
int fullWidth, fullHeight; //read-only, please!
CCreatureAnimation(std::string name); //c-tor
~CCreatureAnimation(); //d-tor
void setType(int type); //sets type of animation and cleares framecount
int getType() const; //returns type of animation
int nextFrame(SDL_Surface * dest, int x, int y, bool attacker, bool incrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
int nextFrameMiddle(SDL_Surface * dest, int x, int y, bool attacker, bool IncrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
void incrementFrame();
int getFrame() const;
int framesInGroup(int group) const; //retirns number of fromes in given group
};