Просмотр исходного кода

Mainly more improvements in CPreGame

Michał W. Urbańczyk 18 лет назад
Родитель
Сommit
ab3a06bf69
7 измененных файлов с 80 добавлено и 6 удалено
  1. 43 1
      CAdvmapInterface.cpp
  2. 18 0
      CAdvmapInterface.h
  3. 8 0
      CGameInterface.cpp
  4. 3 1
      CGameInterface.h
  5. 2 1
      CMT.cpp
  6. BIN
      CPreGame.cpp
  7. 6 3
      CPreGame.h

+ 43 - 1
CAdvmapInterface.cpp

@@ -5,7 +5,10 @@ extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
 
 using namespace boost::logic;
 using namespace CSDL_Ext;
-
+CDefHandler * CHeroList::arrdo = NULL;
+CDefHandler * CHeroList::arrup = NULL;
+CDefHandler * CTownList::arrdo = NULL;
+CDefHandler * CTownList::arrup = NULL;
 CAdvMapInt::~CAdvMapInt()
 {
 	SDL_FreeSurface(bg);
@@ -125,6 +128,45 @@ void CList::deactivate()
 void CList::clickLeft(tribool down)
 {
 };
+CHeroList::CHeroList()
+{
+	pos = genRect(192,64,609,196);
+}
+void CHeroList::select(int which)
+{
+}
+void CHeroList::clickLeft(tribool down)
+{
+}
+void CHeroList::clickRight(tribool down)
+{
+}
+void CHeroList::hover (bool on)
+{
+}
+void CHeroList::keyPressed (SDL_KeyboardEvent & key)
+{
+}
+CTownList::CTownList()
+{
+	pos = genRect(192,48,747,196);
+	arrdo = NULL;
+}
+void CTownList::select(int which)
+{
+}
+void CTownList::clickLeft(tribool down)
+{
+}
+void CTownList::clickRight(tribool down)
+{
+}
+void CTownList::hover (bool on)
+{
+}
+void CTownList::keyPressed (SDL_KeyboardEvent & key)
+{
+}
 CStatusBar::CStatusBar(int x, int y)
 {
 	bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");

+ 18 - 0
CAdvmapInterface.h

@@ -34,6 +34,7 @@ public:
 class CList 
 	: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject
 {
+public:
 	SDL_Surface * bg;
 	//arrow up, arrow down
 	int posw, posh; //position width/height
@@ -46,14 +47,28 @@ class CList
 class CHeroList 
 	: public CList
 {
+public:
+	static CDefHandler *arrup, *arrdo;
+
+	CHeroList();
 	void select(int which);
+	void clickLeft(tribool down);
 	void clickRight(tribool down);
+	void hover (bool on);
+	void keyPressed (SDL_KeyboardEvent & key);
 };
 class CTownList 
 	: public CList
 {
+public:
+	static CDefHandler *arrup, *arrdo;
+
+	CTownList();
 	void select(int which);
+	void clickLeft(tribool down);
 	void clickRight(tribool down);
+	void hover (bool on);
+	void keyPressed (SDL_KeyboardEvent & key);
 };
 class CResourceBar
 	:public ClickableR, public CIntObject
@@ -161,6 +176,9 @@ public:
 
 	CStatusBar statusbar;
 	
+	CHeroList heroList;
+	CTownList townList;
+
 	//fuctions binded to buttons
 	void fshowOverview();
 	void fswitchLevel(); 

+ 8 - 0
CGameInterface.cpp

@@ -28,6 +28,10 @@ void CButtonBase::show()
 		
 	}
 }
+ClickableL::ClickableL()
+{
+	pressedL=false;
+}
 void ClickableL::clickLeft(tribool down)
 {
 	if (down)
@@ -44,6 +48,10 @@ void ClickableL::deactivate()
 	LOCPLINT->lclickable.erase
 		(std::find(LOCPLINT->lclickable.begin(),LOCPLINT->lclickable.end(),this));
 }
+ClickableR::ClickableR()
+{
+	pressedR=false;
+}
 void ClickableR::activate()
 {
 	LOCPLINT->rclickable.push_back(this);

+ 3 - 1
CGameInterface.h

@@ -34,6 +34,7 @@ class ClickableL : public virtual CIntObject  //for left-clicks
 {
 public:
 	bool pressedL;
+	ClickableL();
 	virtual void clickLeft (tribool down)=0;
 	virtual void activate()=0;
 	virtual void deactivate()=0;
@@ -42,6 +43,7 @@ class ClickableR : public virtual CIntObject //for right-clicks
 {
 public:
 	bool pressedR;
+	ClickableR();
 	virtual void clickRight (tribool down)=0;
 	virtual void activate()=0;
 	virtual void deactivate()=0;
@@ -70,7 +72,7 @@ public:
 
 	virtual void yourTurn()=0{};
 };
-class CGlobalAI : public CGameInterface // callback for AI
+class CGlobalAI : public CGameInterface // AI class (to derivate)
 {
 public:
 	virtual void yourTurn(){};

+ 2 - 1
CMT.cpp

@@ -59,7 +59,7 @@ const char * NAME = "VCMI 0.3";
    version of the library linked do not match, or Z_ERRNO if there is
    an error reading or writing the files. */
 SDL_Surface * ekran, * screen, * screen2;
-TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX;
+TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
 
 int _tmain(int argc, _TCHAR* argv[])
 { 
@@ -86,6 +86,7 @@ int _tmain(int argc, _TCHAR* argv[])
 		//TNR = TTF_OpenFont("Fonts\\tnr.ttf",10);
 		GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13);
 		GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22);
+		GEORM = TTF_OpenFont("Fonts\\georgia.ttf",10);
 
 		//initializing audio
 		CMusicHandler * mush = new CMusicHandler;


+ 6 - 3
CPreGame.h

@@ -177,12 +177,13 @@ class MapSel : public PreGameTab
 public:
 	ESortBy sortBy;
 	SDL_Surface * bg;
-	int selected;
+	int selected; //selected map
 	CDefHandler * Dtypes, * Dvic; 
-	CDefHandler *Dsizes, * Dloss;
+	CDefHandler *Dsizes, * Dloss,
+		* sFlags;
 	std::vector<Mapa*> scenList;
 	std::vector<SDL_Surface*> scenImgs;
-	int current;
+	//int current;
 	std::vector<CMapInfo> ourMaps;
 	IntBut<> small, medium, large, xlarge, all;
 	SetrButton<> nrplayer, mapsize, type, name, viccon, loscon;
@@ -198,6 +199,7 @@ public:
 	void select(int which, bool updateMapsList=true);
 	void moveByOne(bool up);
 	void printSelectedInfo();
+	void printFlags();
 	MapSel();
 	~MapSel();
 };
@@ -224,6 +226,7 @@ class CPreGame
 {
 public:	
 	std::string playerName;
+	int playerColor;
 	HighButton * highlighted;
 	PreGameTab* currentTab;
 	StartInfo ret;