2007-08-04 00:47:34 +03:00
|
|
|
#ifndef CADVENTUREMAPINTERFACE_H
|
|
|
|
#define CADVENTUREMAPINTERFACE_H
|
2007-09-14 16:11:10 +03:00
|
|
|
#include <typeinfo>
|
2007-09-18 16:30:26 +03:00
|
|
|
#include "global.h"
|
2007-08-04 00:47:34 +03:00
|
|
|
#include "SDL.h"
|
2007-11-19 00:58:28 +02:00
|
|
|
#include "CPlayerInterface.h"
|
2007-09-18 16:30:26 +03:00
|
|
|
#include <map>
|
2008-03-16 02:09:43 +02:00
|
|
|
#include "AdventureMapButton.h"
|
2007-09-18 16:30:26 +03:00
|
|
|
class CDefHandler;
|
2007-09-14 16:11:10 +03:00
|
|
|
class CCallback;
|
2008-07-16 21:26:15 +03:00
|
|
|
struct CPath;
|
2008-01-09 19:21:31 +02:00
|
|
|
class CAdvMapInt;
|
2007-10-27 22:38:48 +03:00
|
|
|
class CGHeroInstance;
|
|
|
|
class CGTownInstance;
|
2008-01-19 15:19:58 +02:00
|
|
|
class CHeroWindow;
|
2007-08-04 00:47:34 +03:00
|
|
|
/*****************************/
|
|
|
|
class CMinimap
|
2007-08-27 17:15:03 +03:00
|
|
|
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject
|
2007-08-04 00:47:34 +03:00
|
|
|
{
|
2007-08-04 22:01:22 +03:00
|
|
|
public:
|
2008-07-16 21:26:15 +03:00
|
|
|
SDL_Surface * radar;
|
2007-10-21 21:41:58 +03:00
|
|
|
SDL_Surface * temps;
|
2007-08-20 00:12:55 +03:00
|
|
|
std::map<int,SDL_Color> colors;
|
|
|
|
std::map<int,SDL_Color> colorsBlocked;
|
2007-12-06 20:55:58 +02:00
|
|
|
std::vector<SDL_Surface *> map, FoW; //one bitmap for each level (terrain, Fog of War)
|
2007-08-04 00:47:34 +03:00
|
|
|
//TODO flagged buildings
|
2007-10-13 23:31:50 +03:00
|
|
|
std::string statusbarTxt, rcText;
|
2007-08-04 00:47:34 +03:00
|
|
|
|
2008-07-16 21:26:15 +03:00
|
|
|
CMinimap(bool draw=true);
|
2007-08-20 00:12:55 +03:00
|
|
|
void draw();
|
|
|
|
void redraw(int level=-1);// (level==-1) => redraw all levels
|
|
|
|
void updateRadar();
|
2007-08-04 00:47:34 +03:00
|
|
|
|
2007-08-20 00:12:55 +03:00
|
|
|
void clickRight (tribool down);
|
|
|
|
void clickLeft (tribool down);
|
|
|
|
void hover (bool on);
|
2008-09-25 17:09:31 +03:00
|
|
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
2007-08-20 00:12:55 +03:00
|
|
|
void activate(); // makes button active
|
|
|
|
void deactivate(); // makes button inactive (but don't deletes)
|
2008-10-19 02:20:48 +03:00
|
|
|
void hideTile(const int3 &pos); //puts FoW
|
|
|
|
void showTile(const int3 &pos); //removes FoW
|
2007-08-04 22:01:22 +03:00
|
|
|
};
|
|
|
|
class CTerrainRect
|
2008-10-19 16:17:32 +03:00
|
|
|
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested
|
2007-08-04 22:01:22 +03:00
|
|
|
{
|
|
|
|
public:
|
2008-10-17 19:30:56 +03:00
|
|
|
int tilesw, tilesh; //width and height of terrain to blit in tiles
|
2007-10-07 17:51:09 +03:00
|
|
|
int3 curHoveredTile;
|
2008-10-17 19:30:56 +03:00
|
|
|
int moveX, moveY; //shift between actual position of screen and the one we wil blit; ranges from -31 to 31 (in pixels)
|
2007-10-07 17:51:09 +03:00
|
|
|
|
2007-08-17 20:42:21 +03:00
|
|
|
CDefHandler * arrows;
|
|
|
|
CTerrainRect();
|
|
|
|
CPath * currentPath;
|
2008-07-16 21:26:15 +03:00
|
|
|
void activate();
|
2007-08-04 22:01:22 +03:00
|
|
|
void deactivate();
|
|
|
|
void clickLeft(tribool down);
|
|
|
|
void clickRight(tribool down);
|
|
|
|
void hover(bool on);
|
2008-09-25 17:09:31 +03:00
|
|
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
2007-08-04 22:01:22 +03:00
|
|
|
void show();
|
2007-12-22 16:40:27 +02:00
|
|
|
void showPath();
|
2008-09-25 17:09:31 +03:00
|
|
|
int3 whichTileIsIt(const int & x, const int & y); //x,y are cursor position
|
2007-10-07 17:51:09 +03:00
|
|
|
int3 whichTileIsIt(); //uses current cursor pos
|
2007-08-04 00:47:34 +03:00
|
|
|
};
|
2007-09-16 20:21:23 +03:00
|
|
|
class CResDataBar
|
|
|
|
:public ClickableR, public virtual CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SDL_Surface * bg;
|
|
|
|
std::vector<std::pair<int,int> > txtpos;
|
2007-09-18 16:30:26 +03:00
|
|
|
std::string datetext;
|
2007-09-16 20:21:23 +03:00
|
|
|
|
|
|
|
void clickRight (tribool down);
|
2008-07-16 21:26:15 +03:00
|
|
|
void activate();
|
2007-09-16 20:21:23 +03:00
|
|
|
void deactivate();
|
|
|
|
CResDataBar();
|
|
|
|
~CResDataBar();
|
|
|
|
|
|
|
|
void draw();
|
|
|
|
};
|
2007-09-30 19:16:00 +03:00
|
|
|
class CInfoBar
|
2007-12-19 02:06:51 +02:00
|
|
|
:public virtual CIntObject, public TimeInterested
|
2007-09-30 19:16:00 +03:00
|
|
|
{
|
2007-10-17 01:39:11 +03:00
|
|
|
public:
|
2007-12-19 02:06:51 +02:00
|
|
|
CDefHandler *day, *week1, *week2, *week3, *week4;
|
2007-12-22 16:40:27 +02:00
|
|
|
SComponent * current;
|
2007-12-19 02:06:51 +02:00
|
|
|
int mode;
|
|
|
|
int pom;
|
|
|
|
|
2007-09-30 19:16:00 +03:00
|
|
|
CInfoBar();
|
2007-12-19 02:06:51 +02:00
|
|
|
~CInfoBar();
|
|
|
|
void newDay(int Day);
|
|
|
|
void showComp(SComponent * comp, int time=5000);
|
|
|
|
void tick();
|
|
|
|
void draw(const CGObjectInstance * specific=NULL); // if specific==0 function draws info about selected hero/town
|
2007-12-21 01:07:02 +02:00
|
|
|
void blitAnim(int mode);//0 - day, 1 - week
|
|
|
|
CDefHandler * getAnim(int mode);
|
2007-09-30 19:16:00 +03:00
|
|
|
};
|
2007-08-04 00:47:34 +03:00
|
|
|
/*****************************/
|
2008-10-19 16:17:32 +03:00
|
|
|
class CAdvMapInt : public CMainInterface, public KeyInterested //adventure map interface
|
2007-08-04 00:47:34 +03:00
|
|
|
{
|
2007-08-04 22:01:22 +03:00
|
|
|
public:
|
2007-08-04 00:47:34 +03:00
|
|
|
CAdvMapInt(int Player);
|
|
|
|
~CAdvMapInt();
|
|
|
|
|
2007-08-04 22:01:22 +03:00
|
|
|
int3 position; //top left corner of visible map part
|
2007-08-04 00:47:34 +03:00
|
|
|
int player;
|
2007-08-04 22:01:22 +03:00
|
|
|
|
|
|
|
std::vector<CDefHandler *> gems;
|
2008-07-16 21:26:15 +03:00
|
|
|
|
2007-08-04 22:01:22 +03:00
|
|
|
bool scrollingLeft ;
|
|
|
|
bool scrollingRight ;
|
|
|
|
bool scrollingUp ;
|
|
|
|
bool scrollingDown ;
|
2007-10-21 21:41:58 +03:00
|
|
|
bool updateScreen, updateMinimap ;
|
2007-08-04 22:01:22 +03:00
|
|
|
unsigned char anim, animValHitCount; //animation frame
|
2008-01-08 15:31:44 +02:00
|
|
|
unsigned char heroAnim, heroAnimValHitCount; //animation frame
|
2007-08-04 22:01:22 +03:00
|
|
|
|
2007-08-20 00:12:55 +03:00
|
|
|
CMinimap minimap;
|
2007-08-04 22:01:22 +03:00
|
|
|
|
|
|
|
|
2007-08-04 00:47:34 +03:00
|
|
|
SDL_Surface * bg;
|
2008-05-18 20:33:39 +03:00
|
|
|
AdventureMapButton kingOverview,//- kingdom overview
|
2007-08-08 22:28:56 +03:00
|
|
|
underground,//- underground switch
|
2007-08-04 00:47:34 +03:00
|
|
|
questlog,//- questlog
|
|
|
|
sleepWake, //- sleep/wake hero
|
|
|
|
moveHero, //- move hero
|
|
|
|
spellbook,//- spellbook
|
|
|
|
advOptions, //- adventure options
|
2008-07-16 21:26:15 +03:00
|
|
|
sysOptions,//- system options
|
2007-08-04 00:47:34 +03:00
|
|
|
nextHero, //- next hero
|
|
|
|
endTurn;//- end turn
|
|
|
|
//CHeroList herolist;
|
2007-08-04 22:01:22 +03:00
|
|
|
|
2007-08-06 07:03:34 +03:00
|
|
|
CTerrainRect terrain; //visible terrain
|
2007-08-04 00:47:34 +03:00
|
|
|
|
2007-08-06 07:03:34 +03:00
|
|
|
CStatusBar statusbar;
|
2007-09-16 20:21:23 +03:00
|
|
|
CResDataBar resdatabar;
|
2008-07-16 21:26:15 +03:00
|
|
|
|
2007-08-25 07:56:25 +03:00
|
|
|
CHeroList heroList;
|
2008-07-16 21:26:15 +03:00
|
|
|
CTownList townList;
|
2007-10-17 01:39:11 +03:00
|
|
|
CInfoBar infoBar;
|
2008-01-10 21:01:25 +02:00
|
|
|
|
2008-01-11 20:56:39 +02:00
|
|
|
CHeroWindow * heroWindow;
|
2008-07-16 21:26:15 +03:00
|
|
|
|
2008-08-28 20:36:34 +03:00
|
|
|
const CArmedInstance *selection;
|
2007-08-25 07:56:25 +03:00
|
|
|
|
2007-08-06 07:03:34 +03:00
|
|
|
//fuctions binded to buttons
|
|
|
|
void fshowOverview();
|
2008-07-16 21:26:15 +03:00
|
|
|
void fswitchLevel();
|
|
|
|
void fshowQuestlog();
|
2007-08-06 07:03:34 +03:00
|
|
|
void fsleepWake();
|
|
|
|
void fmoveHero();
|
|
|
|
void fshowSpellbok();
|
|
|
|
void fadventureOPtions();
|
|
|
|
void fsystemOptions();
|
|
|
|
void fnextHero();
|
|
|
|
void fendTurn();
|
|
|
|
|
2008-01-20 14:34:39 +02:00
|
|
|
void activate();
|
|
|
|
void deactivate();
|
|
|
|
|
2008-08-25 13:25:16 +03:00
|
|
|
void show(SDL_Surface * to=NULL); //shows and activates adv. map interface
|
2007-10-21 19:45:13 +03:00
|
|
|
void hide(); //deactivates advmap interface
|
2007-08-06 07:03:34 +03:00
|
|
|
void update(); //redraws terrain
|
2007-08-04 22:01:22 +03:00
|
|
|
|
2008-08-28 20:36:34 +03:00
|
|
|
void select(const CArmedInstance *sel);
|
2008-01-31 23:35:30 +02:00
|
|
|
void selectionChanged();
|
2007-09-14 16:11:10 +03:00
|
|
|
void centerOn(int3 on);
|
2007-10-07 17:51:09 +03:00
|
|
|
int3 verifyPos(int3 ver);
|
2007-10-13 23:31:50 +03:00
|
|
|
void handleRightClick(std::string text, tribool down, CIntObject * client);
|
2008-10-19 16:17:32 +03:00
|
|
|
void keyPressed(const SDL_KeyboardEvent & key);
|
2007-09-14 16:11:10 +03:00
|
|
|
|
2007-08-04 00:47:34 +03:00
|
|
|
|
|
|
|
};
|
2008-07-16 21:26:15 +03:00
|
|
|
#endif //CADVENTUREMAPINTERFACE_H
|