1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

another piece of battles

Yifeng, your blitting optimizations are good enough for now (and work for me ;]). If you want to do something simple and developing, you could write sound handling - especially a function to play sounds directly from lod files (atm it requires unpacking to a file and opening it). It may require a small patch to SDL_mixer, but will significantly contribute to this project.
This commit is contained in:
mateuszb
2008-03-04 17:25:58 +00:00
parent 4f3ca5613e
commit ffd3742e3d
2 changed files with 95 additions and 34 deletions

View File

@@ -5,18 +5,34 @@
class CCreatureSet;
class CGHeroInstance;
class CDefHandler;
class CStack;
template <typename T> class AdventureMapButton;
class CBattleHero : public IShowable, public CIntObject
{
public:
CDefHandler * dh;
int phase;
int image;
void show(SDL_Surface * to);
bool flip; //false if it's attacking hero, true otherwise
CDefHandler * dh, *flag; //animation and flag
int phase; //stage of animation
int image; //frame of animation
unsigned char flagAnim, flagAnimCount; //for flag animation
void show(SDL_Surface * to); //prints next frame of animation to to
CBattleHero(std::string defName, int phaseG, int imageG, bool filpG, unsigned char player); //c-tor
~CBattleHero(); //d-tor
};
class CBattleHex
{
unsigned int myNumber;
bool accesible;
CStack * ourStack;
};
class CBattleObstacle
{
std::vector<int> lockedHexes;
};
class CBattleInterface : public IActivable, public IShowable
{
private:
@@ -24,12 +40,15 @@ private:
AdventureMapButton<CBattleInterface> * bOptions, * bSurrender, * bFlee, * bAutofight, * bSpell,
* bWait, * bDefence, * bConsoleUp, * bConsoleDown;
CBattleHero * attackingHero, * defendingHero;
SDL_Surface * cellBorder, * cellShade;
public:
CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2);
~CBattleInterface();
CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2); //c-tor
~CBattleInterface(); //d-tor
//std::vector<TimeInterested*> timeinterested; //animation handling
bool printCellBorders; //if true, cell borders will be printed
CBattleHex bfield[187]; //11 lines, 17 hexes on each
std::vector< CBattleObstacle * > obstacles; //vector of obstacles on the battlefield
//button handle funcs:
void bOptionsf();
@@ -46,4 +65,4 @@ public:
void activate();
void deactivate();
void show(SDL_Surface * to);
};
};