mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	* Adventure Map interface elements configurable (new screen resolutions possible!)
* Data and Sprites subfolders will can be used for adding files not present in .lod archives * version set to 0.65
This commit is contained in:
		| @@ -6,6 +6,7 @@ | ||||
| #include "hch/CPreGameTextHandler.h" | ||||
| #include "hch/CTownHandler.h" | ||||
| #include "CCallback.h" | ||||
| #include "client/CConfigHandler.h" | ||||
| #include "client/Graphics.h" | ||||
| AdventureMapButton::AdventureMapButton () | ||||
| { | ||||
| @@ -32,6 +33,12 @@ AdventureMapButton::AdventureMapButton( const std::map<int,std::string> &Name, c | ||||
| 	init(Callback, Name, HelpBox, playerColoredButton, defName, add, x, y, key); | ||||
| } | ||||
|  | ||||
| AdventureMapButton::AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, config::ButtonInfo *info, int key/*=0*/ ) | ||||
| { | ||||
| 	std::map<int,std::string> pom; | ||||
| 	pom[0] = Name; | ||||
| 	init(Callback, pom, HelpBox, info->playerColoured, info->defName, &info->additionalDefs, info->x, info->y, key); | ||||
| } | ||||
| void AdventureMapButton::clickLeft (tribool down) | ||||
| { | ||||
| 	if(blocked) | ||||
| @@ -122,7 +129,7 @@ void AdventureMapButton::init(const CFunctionList<void()> &Callback, const std:: | ||||
| 			graphics->blueToPlayersAdv(imgs[curimg][i],LOCPLINT->playerID); | ||||
| 	} | ||||
| 	delete temp; | ||||
| 	if (add) | ||||
| 	if (add && add->size()) | ||||
| 	{ | ||||
| 		imgs.resize(imgs.size()+add->size()); | ||||
| 		for (int i=0; i<add->size();i++) | ||||
| @@ -137,7 +144,7 @@ void AdventureMapButton::init(const CFunctionList<void()> &Callback, const std:: | ||||
| 			} | ||||
| 			delete temp; | ||||
| 		} | ||||
| 		delete add; | ||||
| 		//delete add; | ||||
| 	} | ||||
| 	pos.x=x; | ||||
| 	pos.y=y; | ||||
|   | ||||
| @@ -2,6 +2,9 @@ | ||||
| #include "CPlayerInterface.h" | ||||
| #include "client/FunctionList.h" | ||||
| #include <boost/bind.hpp> | ||||
|  | ||||
| namespace config{struct ButtonInfo;} | ||||
|  | ||||
| class AdventureMapButton  | ||||
| 	: public ClickableR, public Hoverable, public KeyShortcut, public CButtonBase | ||||
| { | ||||
| @@ -22,6 +25,7 @@ public: | ||||
| 	AdventureMapButton(); //c-tor | ||||
| 	AdventureMapButton( const std::map<int,std::string> &, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor | ||||
| 	AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor | ||||
| 	AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, config::ButtonInfo *info, int key=0);//c-tor | ||||
| 	//AdventureMapButton( std::string Name, std::string HelpBox, boost::function<void()> Callback, int x, int y, std::string defName, bool activ=false,  std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor | ||||
|  | ||||
| 	void init(const CFunctionList<void()> &Callback, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key ); | ||||
|   | ||||
| @@ -30,7 +30,7 @@ | ||||
| #include <sstream> | ||||
| #pragma warning (disable : 4355)  | ||||
| extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts | ||||
|  | ||||
| #define ADVOPT (conf.go()->ac) | ||||
| using namespace boost::logic; | ||||
| using namespace boost::assign; | ||||
| using namespace CSDL_Ext; | ||||
| @@ -44,15 +44,16 @@ CMinimap::CMinimap(bool draw) | ||||
| 	int3 mapSizes = LOCPLINT->cb->getMapSize(); | ||||
| 	statusbarTxt = CGI->preth->zelp[291].first; | ||||
| 	rcText = CGI->preth->zelp[291].second; | ||||
| 	pos.x=630; | ||||
| 	pos.y=26; | ||||
| 	pos.h=pos.w=144; | ||||
| 	pos.x=ADVOPT.minimapX;//630 | ||||
| 	pos.y=ADVOPT.minimapY;//26 | ||||
| 	pos.h=ADVOPT.minimapW;//144 | ||||
| 	pos.w=ADVOPT.minimapH;//144 | ||||
|  | ||||
| 	int rx = (((float)19)/(mapSizes.x))*((float)pos.w), | ||||
| 		ry = (((float)18)/(mapSizes.y))*((float)pos.h); | ||||
|  | ||||
| 	radar = newSurface(rx,ry); | ||||
| 	temps = newSurface(144,144); | ||||
| 	temps = newSurface(pos.w,pos.h); | ||||
| 	SDL_FillRect(radar,NULL,0x00FFFF); | ||||
| 	for (int i=0; i<radar->w; i++) | ||||
| 	{ | ||||
| @@ -124,7 +125,8 @@ void CMinimap::draw() | ||||
| 		{ | ||||
| 			for (int jj=0; jj<ho; jj++) | ||||
| 			{ | ||||
| 				SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->playerColors[hh[i]->getOwner()].r,graphics->playerColors[hh[i]->getOwner()].g,graphics->playerColors[hh[i]->getOwner()].b); | ||||
| 				SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->playerColors[hh[i]->getOwner()].r, | ||||
| 						graphics->playerColors[hh[i]->getOwner()].g,graphics->playerColors[hh[i]->getOwner()].b); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -145,9 +147,11 @@ void CMinimap::draw() | ||||
| 						for (int jj=0; jj<ho; jj++) | ||||
| 						{ | ||||
| 							if(oo[v]->tempOwner == 255) | ||||
| 								SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->neutralColor->r,graphics->neutralColor->g,graphics->neutralColor->b); | ||||
| 								SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->neutralColor->r, | ||||
| 									graphics->neutralColor->g,graphics->neutralColor->b); | ||||
| 							else | ||||
| 								SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->playerColors[oo[v]->getOwner()].r,graphics->playerColors[oo[v]->getOwner()].g,graphics->playerColors[oo[v]->getOwner()].b); | ||||
| 								SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,graphics->playerColors[oo[v]->getOwner()].r, | ||||
| 									graphics->playerColors[oo[v]->getOwner()].g,graphics->playerColors[oo[v]->getOwner()].b); | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| @@ -765,10 +769,10 @@ void CResDataBar::deactivate() | ||||
| } | ||||
| CResDataBar::CResDataBar() | ||||
| { | ||||
| 	bg = BitmapHandler::loadBitmap("ZRESBAR.bmp"); | ||||
| 	bg = BitmapHandler::loadBitmap(ADVOPT.resdatabarG); | ||||
| 	SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255)); | ||||
| 	graphics->blueToPlayersAdv(bg,LOCPLINT->playerID); | ||||
| 	pos = genRect(bg->h,bg->w,3,575); | ||||
| 	pos = genRect(bg->h,bg->w,ADVOPT.resdatabarX,ADVOPT.resdatabarY); | ||||
|  | ||||
| 	txtpos  +=  (std::pair<int,int>(35,577)),(std::pair<int,int>(120,577)),(std::pair<int,int>(205,577)), | ||||
| 		(std::pair<int,int>(290,577)),(std::pair<int,int>(375,577)),(std::pair<int,int>(460,577)), | ||||
| @@ -974,43 +978,44 @@ void CInfoBar::tick() | ||||
|  | ||||
| CAdvMapInt::CAdvMapInt(int Player) | ||||
| :player(Player), | ||||
| statusbar(7,556), | ||||
| statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG), | ||||
| kingOverview(CGI->preth->zelp[293].first,CGI->preth->zelp[293].second, | ||||
| 			 boost::bind(&CAdvMapInt::fshowOverview,this), 679, 196, "IAM002.DEF", SDLK_k, NULL,true), | ||||
| 			 boost::bind(&CAdvMapInt::fshowOverview,this),&ADVOPT.kingOverview, SDLK_k), | ||||
|  | ||||
| underground(CGI->preth->zelp[294].first,CGI->preth->zelp[294].second, | ||||
| 			boost::bind(&CAdvMapInt::fswitchLevel,this), 711, 196, "IAM010.DEF", SDLK_u, new std::vector<std::string>(1,std::string("IAM003.DEF")),true), | ||||
| 			boost::bind(&CAdvMapInt::fswitchLevel,this),&ADVOPT.underground, SDLK_u), | ||||
|  | ||||
| questlog(CGI->preth->zelp[295].first,CGI->preth->zelp[295].second, | ||||
| 		 boost::bind(&CAdvMapInt::fshowQuestlog,this), 679, 228, "IAM004.DEF", SDLK_q, NULL,true), | ||||
| 		 boost::bind(&CAdvMapInt::fshowQuestlog,this),&ADVOPT.questlog, SDLK_q), | ||||
|  | ||||
| sleepWake(CGI->preth->zelp[296].first,CGI->preth->zelp[296].second, | ||||
| 		  boost::bind(&CAdvMapInt::fsleepWake,this), 711, 228, "IAM005.DEF", SDLK_w, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fsleepWake,this), &ADVOPT.sleepWake, SDLK_w), | ||||
|  | ||||
| moveHero(CGI->preth->zelp[297].first,CGI->preth->zelp[297].second, | ||||
| 		  boost::bind(&CAdvMapInt::fmoveHero,this), 679, 260, "IAM006.DEF", SDLK_m, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fmoveHero,this), &ADVOPT.moveHero, SDLK_m), | ||||
|  | ||||
| spellbook(CGI->preth->zelp[298].first,CGI->preth->zelp[298].second, | ||||
| 		  boost::bind(&CAdvMapInt::fshowSpellbok,this), 711, 260, "IAM007.DEF", SDLK_c, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fshowSpellbok,this), &ADVOPT.spellbook, SDLK_c), | ||||
|  | ||||
| advOptions(CGI->preth->zelp[299].first,CGI->preth->zelp[299].second, | ||||
| 		  boost::bind(&CAdvMapInt::fadventureOPtions,this), 679, 292, "IAM008.DEF", SDLK_a, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fadventureOPtions,this), &ADVOPT.advOptions, SDLK_a), | ||||
|  | ||||
| sysOptions(CGI->preth->zelp[300].first,CGI->preth->zelp[300].second, | ||||
| 		  boost::bind(&CAdvMapInt::fsystemOptions,this), 711, 292, "IAM009.DEF", SDLK_o, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fsystemOptions,this), &ADVOPT.sysOptions, SDLK_o), | ||||
|  | ||||
| nextHero(CGI->preth->zelp[301].first,CGI->preth->zelp[301].second, | ||||
| 		  boost::bind(&CAdvMapInt::fnextHero,this), 679, 324, "IAM000.DEF", SDLK_h, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fnextHero,this), &ADVOPT.nextHero, SDLK_h), | ||||
|  | ||||
| endTurn(CGI->preth->zelp[302].first,CGI->preth->zelp[302].second, | ||||
| 		  boost::bind(&CAdvMapInt::fendTurn,this), 679, 356, "IAM001.DEF", SDLK_e, NULL,true), | ||||
| 		  boost::bind(&CAdvMapInt::fendTurn,this), &ADVOPT.endTurn, SDLK_e), | ||||
|  | ||||
| townList(5,&genRect(192,48,747,196),747,196,747,372) | ||||
| townList(5,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD),//(5,&genRect(192,48,747,196),747,196,747,372), | ||||
| heroList(ADVOPT.hlistSize) | ||||
| { | ||||
| 	selection = NULL; | ||||
| 	townList.fun = boost::bind(&CAdvMapInt::selectionChanged,this); | ||||
| 	LOCPLINT->adventureInt=this; | ||||
| 	bg = BitmapHandler::loadBitmap("ADVMAP.bmp"); | ||||
| 	bg = BitmapHandler::loadBitmap(ADVOPT.mainGraphic); | ||||
| 	graphics->blueToPlayersAdv(bg,player); | ||||
| 	scrollingLeft = false; | ||||
| 	scrollingRight  = false; | ||||
| @@ -1029,10 +1034,10 @@ townList(5,&genRect(192,48,747,196),747,196,747,372) | ||||
|  | ||||
| 	heroWindow = new CHeroWindow(this->player); | ||||
|  | ||||
| 	gems.push_back(CDefHandler::giveDef("agemLL.def")); | ||||
| 	gems.push_back(CDefHandler::giveDef("agemLR.def")); | ||||
| 	gems.push_back(CDefHandler::giveDef("agemUL.def")); | ||||
| 	gems.push_back(CDefHandler::giveDef("agemUR.def")); | ||||
| 	gems.push_back(CDefHandler::giveDef(ADVOPT.gemG[0])); | ||||
| 	gems.push_back(CDefHandler::giveDef(ADVOPT.gemG[1])); | ||||
| 	gems.push_back(CDefHandler::giveDef(ADVOPT.gemG[2])); | ||||
| 	gems.push_back(CDefHandler::giveDef(ADVOPT.gemG[3])); | ||||
| } | ||||
|  | ||||
| void CAdvMapInt::fshowOverview() | ||||
| @@ -1243,10 +1248,8 @@ void CAdvMapInt::update() | ||||
| 	if(updateScreen) | ||||
| 	{	 | ||||
| 		terrain.show(); | ||||
| 		blitAt(gems[2]->ourImages[LOCPLINT->playerID].bitmap,6,6); | ||||
| 		blitAt(gems[0]->ourImages[LOCPLINT->playerID].bitmap,6,508); | ||||
| 		blitAt(gems[1]->ourImages[LOCPLINT->playerID].bitmap,556,508); | ||||
| 		blitAt(gems[3]->ourImages[LOCPLINT->playerID].bitmap,556,6); | ||||
| 		for(int i=0;i<4;i++) | ||||
| 			blitAt(gems[i]->ourImages[LOCPLINT->playerID].bitmap,ADVOPT.gemX[i],ADVOPT.gemY[i]); | ||||
| 		updateScreen=false; | ||||
| 	} | ||||
| 	if (updateMinimap) | ||||
|   | ||||
| @@ -355,7 +355,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate) | ||||
| 	//garrison | ||||
| 	garr = new CGarrisonInt(305,387,4,32,townInt,243,13,town,town->visitingHero); | ||||
|  | ||||
| 	townlist = new CTownList(3,&genRect(128,48,744,414),744,414,744,526); | ||||
| 	townlist = new CTownList(3,744,414,"IAM014.DEF","IAM015.DEF");//744,526); | ||||
| 	exit = new AdventureMapButton | ||||
| 		(CGI->townh->tcommands[8],"",boost::bind(&CCastleInterface::close,this),744,544,"TSBTNS.DEF",SDLK_RETURN); | ||||
| 	split = new AdventureMapButton | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| #include "SDL_Extensions.h" | ||||
| #include "SDL_framerate.h" | ||||
| #include "SDL_framerate.h" | ||||
| #include "client/CConfigHandler.h" | ||||
| #include "client/CCreatureAnimation.h" | ||||
| #include "client/Graphics.h" | ||||
| #include "hch/CAbilityHandler.h" | ||||
| @@ -2353,33 +2354,35 @@ CList::CList(int Size) | ||||
| CHeroList::CHeroList(int Size) | ||||
| :CList(Size) | ||||
| { | ||||
| 	pos = genRect(192,64,609,196); | ||||
|  | ||||
| 	arrupp = genRect(16,64,609,196); | ||||
| 	arrdop = genRect(16,64,609,372); | ||||
|  //32px per hero | ||||
| 	posmobx = 610; | ||||
| 	posmoby = 213; | ||||
| 	posporx = 617; | ||||
| 	pospory = 212; | ||||
| 	posmanx = 666; | ||||
| 	posmany = 213; | ||||
|  | ||||
| 	arrup = CDefHandler::giveDef("IAM012.DEF"); | ||||
| 	arrdo = CDefHandler::giveDef("IAM013.DEF"); | ||||
| 	mobile = CDefHandler::giveDef("IMOBIL.DEF"); | ||||
| 	mana = CDefHandler::giveDef("IMANA.DEF"); | ||||
| 	arrup = CDefHandler::giveDef(conf.go()->ac.hlistAU); | ||||
| 	arrdo = CDefHandler::giveDef(conf.go()->ac.hlistAD); | ||||
| 	mobile = CDefHandler::giveDef(conf.go()->ac.hlistMB); | ||||
| 	mana = CDefHandler::giveDef(conf.go()->ac.hlistMN); | ||||
| 	empty = BitmapHandler::loadBitmap("HPSXXX.bmp"); | ||||
| 	selection = BitmapHandler::loadBitmap("HPSYYY.bmp"); | ||||
| 	SDL_SetColorKey(selection,SDL_SRCCOLORKEY,SDL_MapRGB(selection->format,0,255,255)); | ||||
|  | ||||
| 	pos = genRect(32*SIZE+arrup->h+arrdo->h,std::max(arrup->w,arrdo->w),conf.go()->ac.hlistX,conf.go()->ac.hlistY); | ||||
|  | ||||
| 	arrupp = genRect(arrup->h,arrup->w,pos.x,pos.y); | ||||
| 	arrdop = genRect(arrdo->h,arrdo->w,pos.x,pos.y+32*SIZE+arrup->h); | ||||
|  //32px per hero | ||||
| 	posmobx = pos.x+1; | ||||
| 	posmoby = pos.y+arrup->h+1; | ||||
| 	posporx = pos.x+mobile->w+2; | ||||
| 	pospory = pos.y+arrup->h; | ||||
| 	posmanx = pos.x+1+50+mobile->w; | ||||
| 	posmany = pos.y+arrup->h+1; | ||||
|  | ||||
| 	from = 0; | ||||
| 	pressed = indeterminate; | ||||
| } | ||||
|  | ||||
| void CHeroList::init() | ||||
| { | ||||
| 	bg = CSDL_Ext::newSurface(68,193,screen); | ||||
| 	SDL_BlitSurface(LOCPLINT->adventureInt->bg,&genRect(193,68,607,196),bg,&genRect(193,68,0,0)); | ||||
| 	int w = pos.w+1, h = pos.h+4; | ||||
| 	bg = CSDL_Ext::newSurface(w,h,screen); | ||||
| 	SDL_BlitSurface(LOCPLINT->adventureInt->bg,&genRect(w,h,pos.x,pos.y),bg,&genRect(w,h,0,0)); | ||||
| } | ||||
| void CHeroList::genList() | ||||
| { | ||||
| @@ -2423,7 +2426,7 @@ void CHeroList::clickLeft(tribool down) | ||||
| 			pressed = true; | ||||
| 			return; | ||||
| 		} | ||||
| 		else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5)) | ||||
| 		else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>SIZE)) | ||||
| 		{ | ||||
| 			blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y); | ||||
| 			pressed = false; | ||||
| @@ -2434,7 +2437,7 @@ void CHeroList::clickLeft(tribool down) | ||||
| 		hx-=pos.x; | ||||
| 		hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h; | ||||
| 		int ny = hy/32; | ||||
| 		if (ny>=5 || ny<0) | ||||
| 		if (ny>=SIZE || ny<0) | ||||
| 			return; | ||||
| 		if ( (ny+from)==selected && (LOCPLINT->adventureInt->selection->ID == HEROI_TYPE)) | ||||
| 			LOCPLINT->openHeroWindow(items[selected].first);//print hero screen | ||||
| @@ -2485,7 +2488,7 @@ void CHeroList::mouseMoved (const SDL_MouseMotionEvent & sEvent) | ||||
| 	} | ||||
| 	else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y)) | ||||
| 	{ | ||||
| 		if ((items.size()-from)  >  5) | ||||
| 		if ((items.size()-from)  >  SIZE) | ||||
| 			LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[304].first); | ||||
| 		else | ||||
| 			LOCPLINT->adventureInt->statusbar.clear(); | ||||
| @@ -2496,7 +2499,7 @@ void CHeroList::mouseMoved (const SDL_MouseMotionEvent & sEvent) | ||||
| 	hx-=pos.x; | ||||
| 	hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h; | ||||
| 	int ny = hy/32; | ||||
| 	if ((ny>5 || ny<0) || (from+ny>=items.size())) | ||||
| 	if ((ny>SIZE || ny<0) || (from+ny>=items.size())) | ||||
| 	{ | ||||
| 		LOCPLINT->adventureInt->statusbar.clear(); | ||||
| 		return; | ||||
| @@ -2525,7 +2528,7 @@ void CHeroList::clickRight(tribool down) | ||||
| 		hx-=pos.x; | ||||
| 		hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h; | ||||
| 		int ny = hy/32; | ||||
| 		if ((ny>5 || ny<0) || (from+ny>=items.size())) | ||||
| 		if ((ny>SIZE || ny<0) || (from+ny>=items.size())) | ||||
| 		{ | ||||
| 			return; | ||||
| 		} | ||||
| @@ -2573,7 +2576,7 @@ void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar | ||||
| } | ||||
| void CHeroList::draw() | ||||
| { | ||||
| 	for (int iT=0+from;iT<5+from;iT++) | ||||
| 	for (int iT=0+from;iT<SIZE+from;iT++) | ||||
| 	{ | ||||
| 		int i = iT-from; | ||||
| 		if (iT>=items.size()) | ||||
| @@ -2588,7 +2591,7 @@ void CHeroList::draw() | ||||
| 		if (pom>25) pom=25; | ||||
| 		if (pom<0) pom=0; | ||||
| 		blitAt(mobile->ourImages[pom].bitmap,posmobx,posmoby+i*32); //move point | ||||
| 		pom = cur->mana / 5; //bylo: .../10; | ||||
| 		pom = cur->mana / 5; | ||||
| 		if (pom>25) pom=25; | ||||
| 		if (pom<0) pom=0; | ||||
| 		blitAt(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana | ||||
| @@ -2605,7 +2608,7 @@ void CHeroList::draw() | ||||
| 	else | ||||
| 		blitAt(arrup->ourImages[2].bitmap,arrupp.x,arrupp.y); | ||||
|  | ||||
| 	if (items.size()-from>5) | ||||
| 	if (items.size()-from > SIZE) | ||||
| 		blitAt(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y); | ||||
| 	else | ||||
| 		blitAt(arrdo->ourImages[2].bitmap,arrdop.x,arrdop.y); | ||||
| @@ -2623,21 +2626,23 @@ CTownList::~CTownList() | ||||
| 	delete arrdo; | ||||
| } | ||||
|  | ||||
| CTownList::CTownList(int Size, SDL_Rect * Pos, int arupx, int arupy, int ardox, int ardoy) | ||||
| CTownList::CTownList(int Size, int x, int y, std::string arrupg, std::string arrdog) | ||||
| :CList(Size) | ||||
| { | ||||
| 	pos = *Pos; | ||||
| 	arrup = CDefHandler::giveDef("IAM014.DEF"); | ||||
| 	arrdo = CDefHandler::giveDef("IAM015.DEF"); | ||||
| 	arrup = CDefHandler::giveDef(arrupg); | ||||
| 	arrdo = CDefHandler::giveDef(arrdog); | ||||
| 	pos.x = x; | ||||
| 	pos.y = y; | ||||
| 	pos.w = std::max(arrdo->w,arrup->h); | ||||
|  | ||||
| 	arrupp.x=arupx; | ||||
| 	arrupp.y=arupy; | ||||
| 	arrupp.w=arrup->ourImages[0].bitmap->w; | ||||
| 	arrupp.h=arrup->ourImages[0].bitmap->h; | ||||
| 	arrdop.x=ardox; | ||||
| 	arrdop.y=ardoy; | ||||
| 	arrdop.w=arrdo->ourImages[0].bitmap->w; | ||||
| 	arrdop.h=arrdo->ourImages[0].bitmap->h; | ||||
| 	arrupp.x=x; | ||||
| 	arrupp.y=y; | ||||
| 	arrupp.w=arrup->w; | ||||
| 	arrupp.h=arrup->h; | ||||
| 	arrdop.x=x; | ||||
| 	arrdop.y=y+arrup->h+32*SIZE; | ||||
| 	arrdop.w=arrdo->w; | ||||
| 	arrdop.h=arrdo->h; | ||||
| 	posporx = arrdop.x; | ||||
| 	pospory = arrupp.y + arrupp.h; | ||||
|  | ||||
|   | ||||
| @@ -455,7 +455,7 @@ public: | ||||
| 	std::vector<std::pair<const CGHeroInstance*, CPath *> > items; | ||||
| 	int posmobx, posporx, posmanx, posmoby, pospory, posmany; | ||||
|  | ||||
| 	CHeroList(int Size = 5); | ||||
| 	CHeroList(int Size); | ||||
| 	int getPosOfHero(const CArmedInstance* h); | ||||
| 	void genList(); | ||||
| 	void select(int which); | ||||
| @@ -479,7 +479,7 @@ public: | ||||
| 	std::vector<const CGTownInstance*> items; | ||||
| 	int posporx,pospory; | ||||
|  | ||||
| 	CTownList(int Size, SDL_Rect * Pos, int arupx, int arupy, int ardox, int ardoy); | ||||
| 	CTownList(int Size, int x, int y, std::string arrupg, std::string arrdog); | ||||
| 	~CTownList(); | ||||
| 	void genList(); | ||||
| 	void select(int which); | ||||
|   | ||||
| @@ -1,13 +1,18 @@ | ||||
| //#define BOOST_SPIRIT_DEBUG | ||||
| #include "CConfigHandler.h" | ||||
| #include <boost/bind.hpp> | ||||
| #include <boost/function.hpp> | ||||
| #include <boost/spirit.hpp> | ||||
| #include <fstream> | ||||
| using namespace config; | ||||
| using namespace boost::spirit; | ||||
| using namespace phoenix; | ||||
|  | ||||
| CConfigHandler conf; | ||||
|  | ||||
| GUIOptions *current = NULL; | ||||
| std::pair<int,int> curRes; | ||||
| ButtonInfo *currentButton; | ||||
| int gnb=-1; | ||||
|  | ||||
| struct lerror | ||||
| { | ||||
| @@ -23,6 +28,34 @@ struct lerror | ||||
| 		tlog1 << txt << std::endl; | ||||
| 	} | ||||
| }; | ||||
| struct SetCurButton | ||||
| { | ||||
| 	template<typename IteratorT> | ||||
| 	void operator()(IteratorT t1, IteratorT t2) const | ||||
| 	{ | ||||
| 		std::string str(t1,t2); | ||||
| 		if(str=="KingdomOv") | ||||
| 			currentButton = ¤t->ac.kingOverview; | ||||
| 		else if(str=="Underground") | ||||
| 			currentButton = ¤t->ac.underground; | ||||
| 		else if(str=="QuestLog") | ||||
| 			currentButton = ¤t->ac.questlog; | ||||
| 		else if(str=="SleepWake") | ||||
| 			currentButton = ¤t->ac.sleepWake; | ||||
| 		else if(str=="MoveHero") | ||||
| 			currentButton = ¤t->ac.moveHero; | ||||
| 		else if(str=="Spellbook") | ||||
| 			currentButton = ¤t->ac.spellbook; | ||||
| 		else if(str=="AdvOptions") | ||||
| 			currentButton = ¤t->ac.advOptions; | ||||
| 		else if(str=="SysOptions") | ||||
| 			currentButton = ¤t->ac.sysOptions; | ||||
| 		else if(str=="NextHero") | ||||
| 			currentButton = ¤t->ac.nextHero; | ||||
| 		else if(str=="EndTurn") | ||||
| 			currentButton = ¤t->ac.endTurn; | ||||
| 	} | ||||
| }; | ||||
| struct lerror2 | ||||
| { | ||||
| 	std::string txt; | ||||
| @@ -34,29 +67,114 @@ struct lerror2 | ||||
| 		tlog1 << txt << txt2 << std::endl; | ||||
| 	} | ||||
| }; | ||||
| //template <typename T, typename U> | ||||
| //struct AssignInAll | ||||
| //{ | ||||
| //	std::vector<T> &items; | ||||
| //	U T::*pointer; | ||||
| //	AssignInAll(std::vector<T> &Items, U T::*Pointer) | ||||
| //		:items(Items),pointer(Pointer) | ||||
| //	{} | ||||
| //	void operator()(const U &as) | ||||
| //	{ | ||||
| //		for(int i=0; i<items.size(); i++) | ||||
| //			items[i].*pointer = U; | ||||
| //	} | ||||
| //}; | ||||
|  | ||||
| struct dummy  | ||||
| { | ||||
| 	boost::function<void()> func; | ||||
| 	dummy(const boost::function<void()>  & F) | ||||
| 		:func(F){} | ||||
| 	template<typename IteratorT> | ||||
| 	void operator()(IteratorT t1, IteratorT t2) const | ||||
| 	{ | ||||
| 		func(); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| template<typename T>struct SetButtonProp | ||||
| { | ||||
| 	T point; | ||||
| 	SetButtonProp(T p) | ||||
| 		:point(p){} | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z & val) const | ||||
| 	{ | ||||
| 		currentButton->*point = val; | ||||
| 	} | ||||
| }; | ||||
| template<typename T> SetButtonProp<T> SetButtonProp_a(T p) | ||||
| { | ||||
| 	return SetButtonProp<T>(p); | ||||
| } | ||||
| struct SetButtonStr | ||||
| { | ||||
| 	std::string ButtonInfo::*point; | ||||
| 	SetButtonStr(std::string ButtonInfo::* p) | ||||
| 		:point(p){} | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z first, const Z last) const | ||||
| 	{ | ||||
| 		std::string str(first,last); | ||||
| 		currentButton->*point = str; | ||||
| 	} | ||||
| }; | ||||
| template<typename T>struct SetAdventureProp | ||||
| { | ||||
| 	T point; | ||||
| 	SetAdventureProp(T p) | ||||
| 		:point(p){} | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z & val) const | ||||
| 	{ | ||||
| 		current->ac.*point = val; | ||||
| 	} | ||||
| }; | ||||
| template<typename T> SetAdventureProp<T> SetAdventureProp_a(T p) | ||||
| { | ||||
| 	return SetAdventureProp<T>(p); | ||||
| } | ||||
| struct SetAdventureStr | ||||
| { | ||||
| 	std::string AdventureMapConfig::*point; | ||||
| 	SetAdventureStr(std::string AdventureMapConfig::* p) | ||||
| 		:point(p){} | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z first, const Z last) const | ||||
| 	{ | ||||
| 		std::string str(first,last); | ||||
| 		current->ac.*point = str; | ||||
| 	} | ||||
| }; | ||||
| struct AddDefForButton | ||||
| { | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z first, const Z last) const | ||||
| 	{ | ||||
| 		std::string str(first,last); | ||||
| 		currentButton->additionalDefs.push_back(str); | ||||
| 	} | ||||
| }; | ||||
| void addGRes() | ||||
| { | ||||
| 	if(current) | ||||
| 		conf.guiOptions[curRes] = *current; //we'll use by default settings from previous resolution | ||||
| 	current = &conf.guiOptions[curRes]; | ||||
| } | ||||
| void setGem(int x, int val) | ||||
| { | ||||
| 	if(x)	 | ||||
| 		current->ac.gemX[gnb] = val; | ||||
| 	else | ||||
| 		current->ac.gemY[gnb] = val; | ||||
| } | ||||
| struct AddGemName | ||||
| { | ||||
| 	template <typename Z> | ||||
| 	void operator()(const Z first, const Z last) const | ||||
| 	{ | ||||
| 		current->ac.gemG.push_back(std::string(first,last)); | ||||
| 	} | ||||
| }; | ||||
| struct SettingsGrammar : public grammar<SettingsGrammar> | ||||
| { | ||||
| 	template <typename ScannerT> | ||||
| 	struct definition | ||||
| 	{ | ||||
| 		rule<ScannerT>  r, clientOption, clientOptionsSequence; | ||||
| 		rule<ScannerT>  GUIOption, GUIOptionsSequence, AdvMapOptionsSequence, AdvMapOption; | ||||
| 		rule<ScannerT>  r, clientOption, clientOptionsSequence, ClientSettings; | ||||
| 		rule<ScannerT>  GUISettings, GUIOption, GUIOptionsSequence, AdvMapOptionsSequence, AdvMapOption; | ||||
| 		rule<ScannerT> GUIResolution, fname; | ||||
| 		definition(SettingsGrammar const& self)   | ||||
| 		{  | ||||
| 			fname = lexeme_d[+(alnum_p | '.')]; | ||||
| 			clientOption  | ||||
| 				= str_p("resolution=") >> (uint_p[assign_a(conf.cc.resx)] >> 'x' >> uint_p[assign_a(conf.cc.resy)] | eps_p[lerror("Wrong resolution!")]) | ||||
| 				| str_p("port=") >> (uint_p[assign_a(conf.cc.port)] | eps_p[lerror("Wrong port!")]) | ||||
| @@ -67,34 +185,94 @@ struct SettingsGrammar : public grammar<SettingsGrammar> | ||||
| 				| str_p("defaultAI=") >> ((+(anychar_p - ';'))[assign_a(conf.cc.defaultAI)] | eps_p[lerror("Wrong defaultAI!")]) | ||||
| 				| (+(anychar_p - '}'))[lerror2("Unrecognized client option: ")] | ||||
| 				; | ||||
| 			clientOptionsSequence = *(clientOption >> (';' | eps_p[lerror("Semicolon lacking!")])); | ||||
| 			clientOptionsSequence = *(clientOption >> (';' | eps_p[lerror("Semicolon lacking after client option!")])); | ||||
| 			ClientSettings = '{' >>  clientOptionsSequence >> '}'; | ||||
|  | ||||
| 			AdvMapOption  | ||||
| 				=	str_p("Buttons") >> ((ch_p('{') >> '}') | eps_p[lerror("Wrong Buttons!")]) | ||||
| 				|	str_p("Minimap : ") >>  | ||||
| 				|	str_p("Minimap: ") >>  | ||||
| 						*(	 | ||||
| 							(	"width=" >> uint_p[assign_a(conf.gc.ac.minimap.w)]  | ||||
| 							  |	"height=" >> uint_p[assign_a(conf.gc.ac.minimap.h)] | ||||
| 							  |	"x=" >> uint_p[assign_a(conf.gc.ac.minimap.x)] | ||||
| 							  |	"y=" >> uint_p[assign_a(conf.gc.ac.minimap.y)] | ||||
| 							"width=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::minimapW)]//[assign_a(current->ac.minimapW)]  | ||||
| 							  |	"height=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::minimapH)] | ||||
| 							  |	"x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::minimapX)] | ||||
| 							  |	"y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::minimapY)] | ||||
| 						 ) | ||||
| 				| str_p("Statusbar:") >> | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::statusbarX)] | ||||
| 							  |	"y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::statusbarY)] | ||||
| 							  |	"graphic=" >> fname[SetAdventureStr(&AdventureMapConfig::statusbarG)] | ||||
| 							)  | ||||
| 							>> *ch_p(',') | ||||
| 						 ); | ||||
| 			AdvMapOptionsSequence = *(AdvMapOption >> (';' | eps_p[lerror("Semicolon lacking!")])); | ||||
| 			 | ||||
| 			GUIOption = str_p("AdventureMap") >> (('{' >> AdvMapOptionsSequence >> '}') | eps_p[lerror("Wrong AdventureMap!")]); | ||||
| 						 ) | ||||
| 				| str_p("ResDataBar:") >> | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resdatabarX)] | ||||
| 							  |	"y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resdatabarY)] | ||||
| 							  |	"graphic=" >> fname[SetAdventureStr(&AdventureMapConfig::resdatabarG)] | ||||
| 							)  | ||||
| 						 ) | ||||
| 				| str_p("background=") >> fname[SetAdventureStr(&AdventureMapConfig::mainGraphic)] | ||||
| 				| str_p("Button") >> (+(anychar_p-':'))[SetCurButton()] >> ':' >> | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[SetButtonProp_a(&ButtonInfo::x)] | ||||
| 							  |	"y=" >> uint_p[SetButtonProp_a(&ButtonInfo::y)] | ||||
| 							  |	"playerColoured=" >> uint_p[SetButtonProp_a(&ButtonInfo::playerColoured)] | ||||
| 							  |	"graphic=" >> fname[SetButtonStr(&ButtonInfo::defName)] | ||||
| 							  | "additionalDefs=" >> ch_p('(') >> fname[AddDefForButton()]  | ||||
| 									>> *(',' >> fname[AddDefForButton()]) >> ')' | ||||
| 							)  | ||||
| 						 ) | ||||
| 				 | str_p("HeroList:") >>  | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::hlistX)] | ||||
| 							  |	"y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::hlistY)] | ||||
| 							  |	"size=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::hlistSize)] | ||||
| 							  |	"movePoints=" >> fname[SetAdventureStr(&AdventureMapConfig::hlistMB)] | ||||
| 							  |	"manaPoints=" >> fname[SetAdventureStr(&AdventureMapConfig::hlistMN)] | ||||
| 							  |	"arrowUp=" >> fname[SetAdventureStr(&AdventureMapConfig::hlistAU)] | ||||
| 							  |	"arrowDown=" >> fname[SetAdventureStr(&AdventureMapConfig::hlistAD)] | ||||
| 							)  | ||||
| 						 ) | ||||
| 				 | str_p("TownList:") >>  | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tlistX)] | ||||
| 							  |	"y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tlistY)] | ||||
| 							  |	"size=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tlistSize)] | ||||
| 							  |	"arrowUp=" >> fname[SetAdventureStr(&AdventureMapConfig::tlistAU)] | ||||
| 							  |	"arrowDown=" >> fname[SetAdventureStr(&AdventureMapConfig::tlistAD)] | ||||
| 							)  | ||||
| 						 ) | ||||
| 				 | str_p("gem") >> uint_p[var(gnb) = arg1] >> ':' >> | ||||
| 						*(	 | ||||
| 							(	"x=" >> uint_p[bind(&setGem,1,_1)] | ||||
| 							  | "y=" >> uint_p[bind(&setGem,0,_1)] | ||||
| 							  | "graphic=" >> fname[AddGemName()] | ||||
| 							)  | ||||
| 						 ) | ||||
| 				; | ||||
| 			AdvMapOptionsSequence = *(AdvMapOption >> (';' | eps_p[lerror("Semicolon lacking in advmapopt!")])); | ||||
| 			GUIResolution = (uint_p[assign_a(curRes.first)] >> 'x' >> uint_p[assign_a(curRes.second)]) | ||||
| 								[dummy(&addGRes)]; | ||||
| 			GUIOption = str_p("AdventureMap") >> ('{' >> AdvMapOptionsSequence >> '}' | eps_p[lerror("Wrong AdventureMap!")]); | ||||
| 			GUIOptionsSequence = *(GUIOption >> (';' | eps_p[lerror("Semicolon after GUIOption lacking!")])); | ||||
| 			r	= str_p("clientSettings") >> (('{' >> clientOptionsSequence >> '}') | eps_p[lerror("Wrong clientSettings!")]) | ||||
| 				>> str_p("GUISettings") >> (('{' >> GUIOptionsSequence >> '}') | eps_p[lerror("Wrong GUISettings!")]); | ||||
| 			#ifdef BOOST_SPIRIT_DEBUG | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(clientOption); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(clientOptionsSequence); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(AdvMapOption); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(AdvMapOptionsSequence); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(GUIOption); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(GUIOptionsSequence); | ||||
| 				BOOST_SPIRIT_DEBUG_RULE(r); | ||||
| 			#endif | ||||
| 			GUISettings	= +(GUIResolution >> '{' >> GUIOptionsSequence >> '}'); | ||||
|  | ||||
|  | ||||
| 			r	 | ||||
| 				=	str_p("clientSettings") >> (ClientSettings | eps_p[lerror("Wrong clientSettings!")]) | ||||
| 				>>	str_p("GUISettings") >> ('{' >> GUISettings >> '}' | eps_p[lerror("Wrong GUISettings!")]); | ||||
| #ifdef BOOST_SPIRIT_DEBUG | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(clientOption); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(clientOptionsSequence); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(ClientSettings); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(AdvMapOption); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(AdvMapOptionsSequence); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(GUIOption); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(GUIOptionsSequence); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(GUISettings); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(GUIResolution); | ||||
| 			BOOST_SPIRIT_DEBUG_RULE(r); | ||||
| #endif | ||||
| 		}     | ||||
|  | ||||
| 		rule<ScannerT> const& start() const { return r; } | ||||
| @@ -147,4 +325,9 @@ void config::CConfigHandler::init() | ||||
| 		tlog1 << "Cannot parse config/settings.txt file!\n"; | ||||
| 	else if(!info.full) | ||||
| 		tlog2 << "Not entire config/settings.txt parsed!\n"; | ||||
| } | ||||
|  | ||||
| GUIOptions * config::CConfigHandler::go() | ||||
| { | ||||
| 	return &guiOptions[std::pair<int,int>(cc.resx,cc.resy)]; | ||||
| } | ||||
| @@ -10,23 +10,37 @@ namespace config | ||||
| 		std::string server, //server address (e.g. 127.0.0.1) | ||||
| 			defaultAI; //dll name | ||||
| 	}; | ||||
| 	struct ButtonInfo | ||||
| 	{ | ||||
| 		std::string defName; | ||||
| 		std::vector<std::string> additionalDefs; | ||||
| 		int x, y; //position on the screen | ||||
| 		bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics) | ||||
| 	}; | ||||
| 	struct AdventureMapConfig | ||||
| 	{ | ||||
| 		struct ButtonInfo | ||||
| 		{ | ||||
| 			std::string hoverName, //shows in statusbar when hovered | ||||
| 				helpBox, //shows in pop-up when r-clicked | ||||
| 				defName; | ||||
| 			std::vector<std::string> additionalDefs; | ||||
| 			void (CAdvMapInt::*func)(); //function in advmapint bound to that button | ||||
| 			int x, y; //position on the screen | ||||
| 			bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics) | ||||
| 		}; | ||||
| 		struct Minimap | ||||
| 		{ | ||||
| 			int x, y, w, h; | ||||
| 		} minimap; | ||||
| 		std::vector<ButtonInfo> buttons; | ||||
| 		//minimap properties | ||||
| 		int minimapX, minimapY, minimapW, minimapH; | ||||
| 		//statusbar | ||||
| 		int statusbarX, statusbarY; //pos | ||||
| 		std::string statusbarG; //graphic name | ||||
| 		//resdatabar | ||||
| 		int resdatabarX, resdatabarY; //pos | ||||
| 		std::string resdatabarG; //graphic name | ||||
| 		//general properties | ||||
| 		std::string mainGraphic; | ||||
| 		//buttons | ||||
| 		ButtonInfo kingOverview, underground, questlog,	sleepWake, moveHero, spellbook,	advOptions, | ||||
| 			sysOptions,	nextHero, endTurn; | ||||
| 		//hero list | ||||
| 		int hlistX, hlistY, hlistSize; | ||||
| 		std::string hlistMB, hlistMN, hlistAU, hlistAD; | ||||
| 		//town list | ||||
| 		int tlistX, tlistY, tlistSize; | ||||
| 		std::string tlistAU, tlistAD; | ||||
| 		//gems | ||||
| 		int gemX[4], gemY[4]; | ||||
| 		std::vector<std::string> gemG; | ||||
| 	}; | ||||
| 	struct GUIOptions | ||||
| 	{ | ||||
| @@ -36,7 +50,8 @@ namespace config | ||||
| 	{ | ||||
| 	public: | ||||
| 		ClientConfig cc; | ||||
| 		GUIOptions gc; | ||||
| 		std::map<std::pair<int,int>, GUIOptions > guiOptions; | ||||
| 		GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution | ||||
| 		void init(); | ||||
| 		CConfigHandler(void); | ||||
| 		~CConfigHandler(void); | ||||
|   | ||||
| @@ -12,13 +12,42 @@ clientSettings | ||||
| } | ||||
| GUISettings | ||||
| { | ||||
| 	//800x600 //settings specific for 800x600 resolution | ||||
| 	//{ | ||||
| 	800x600 //settings for 800x600 resolution | ||||
| 	{ | ||||
| 		AdventureMap | ||||
| 		{ | ||||
| 			Buttons | ||||
| 			{ | ||||
| 			}; | ||||
| 			gem0: x=6 y=508 graphic=agemLL.def; | ||||
| 			gem1: x=556 y=508 graphic=agemLR.def; | ||||
| 			gem2: x=6 y=6 graphic=agemUL.def; | ||||
| 			gem3: x=556 y=6 graphic=agemUR.def; | ||||
| 			background=ADVMAP.bmp; | ||||
| 			HeroList: size=5 x=609 y=196 movePoints=IMOBIL.DEF manaPoints=IMANA.DEF arrowUp=IAM012.DEF arrowDown=IAM013.DEF; | ||||
| 			TownList: size=5 x=747 y=196 arrowUp=IAM014.DEF arrowDown=IAM015.DEF; | ||||
| 			Minimap: width=144 height=144 x=630 y=26; | ||||
| 			Statusbar: x=7 y=556 graphic=ADROLLVR.bmp; | ||||
| 			ResDataBar: x=3 y=575 graphic=ZRESBAR.bmp; | ||||
| 			ButtonKingdomOv: x=679 y=196 graphic=IAM002.DEF playerColoured=1; | ||||
| 			ButtonUnderground: x=711 y=196 graphic=IAM010.DEF playerColoured=1 additionalDefs=(IAM003.DEF); | ||||
| 			ButtonQuestLog: x=679 y=228 graphic=IAM004.DEF playerColoured=1; | ||||
| 			ButtonSleepWake: x=711 y=228 graphic=IAM005.DEF playerColoured=1; | ||||
| 			ButtonMoveHero: x=679 y=260 graphic=IAM006.DEF playerColoured=1; | ||||
| 			ButtonSpellbook: x=711 y=260 graphic=IAM007.DEF playerColoured=1; | ||||
| 			ButtonAdvOptions: x=679 y=292 graphic=IAM008.DEF playerColoured=1; | ||||
| 			ButtonSysOptions: x=711 y=292 graphic=IAM009.DEF playerColoured=1; | ||||
| 			ButtonNextHero: x=679 y=324 graphic=IAM000.DEF playerColoured=1; | ||||
| 			ButtonEndTurn: x=679 y=356 graphic=IAM001.DEF playerColoured=1; | ||||
| 		}; | ||||
| 	//}; | ||||
| 	} | ||||
| 	1024x600 //setting specific for this resolution | ||||
| 	{ | ||||
| 		AdventureMap | ||||
| 		{ | ||||
| 		}; | ||||
| 	} | ||||
| 	1024x768 //setting specific for this resolution | ||||
| 	{ | ||||
| 		AdventureMap | ||||
| 		{ | ||||
| 		}; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										2
									
								
								global.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								global.h
									
									
									
									
									
								
							| @@ -18,7 +18,7 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte) | ||||
| #define THC | ||||
| #endif | ||||
|  | ||||
| #define NAME_VER ("VCMI 0.64") | ||||
| #define NAME_VER ("VCMI 0.65") | ||||
| #define CONSOLE_LOGGING_LEVEL 5 | ||||
| #define FILE_LOGGING_LEVEL 6 | ||||
|  | ||||
|   | ||||
| @@ -59,8 +59,8 @@ void CDefHandler::openDef(std::string name) | ||||
| 	delete is; | ||||
| 	i = 0; | ||||
| 	DEFType = readNormalNr(i,4,FDef); i+=4; | ||||
| 	fullWidth = readNormalNr(i,4,FDef); i+=4; | ||||
| 	fullHeight = readNormalNr(i,4,FDef); i+=4; | ||||
| 	w = readNormalNr(i,4,FDef); i+=4; | ||||
| 	h = readNormalNr(i,4,FDef); i+=4; | ||||
| 	i=0xc; | ||||
| 	totalBlocks = readNormalNr(i,4,FDef); i+=4; | ||||
|  | ||||
| @@ -123,8 +123,8 @@ void CDefHandler::openFromMemory(unsigned char *table, std::string name) | ||||
| 	defName=name; | ||||
| 	i = 0; | ||||
| 	DEFType = readNormalNr(i,4,table); i+=4; | ||||
| 	fullWidth = readNormalNr(i,4,table); i+=4; | ||||
| 	fullHeight = readNormalNr(i,4,table); i+=4; | ||||
| 	w = readNormalNr(i,4,table); i+=4; | ||||
| 	h = readNormalNr(i,4,table); i+=4; | ||||
| 	i=0xc; | ||||
| 	totalBlocks = readNormalNr(i,4,table); i+=4; | ||||
|  | ||||
| @@ -168,7 +168,7 @@ void CDefHandler::openFromMemory(unsigned char *table, std::string name) | ||||
| 	{ | ||||
| 		SEntries[j].name = SEntries[j].name.substr(0, SEntries[j].name.find('.')+4); | ||||
| 	} | ||||
| 	RWEntries = new unsigned int[fullHeight]; | ||||
| 	RWEntries = new unsigned int[h]; | ||||
| 	for(int i=0; i<SEntries.size(); ++i) | ||||
| 	{ | ||||
| 		Cimage nimg; | ||||
|   | ||||
| @@ -15,7 +15,7 @@ struct Cimage | ||||
| class CDefHandler | ||||
| { | ||||
| private: | ||||
| 	int totalEntries, DEFType, totalBlocks, fullWidth, fullHeight; | ||||
| 	int totalEntries, DEFType, totalBlocks; | ||||
| 	bool allowRepaint; | ||||
| 	int length; | ||||
| 	unsigned int * RWEntries; | ||||
| @@ -28,6 +28,7 @@ private: | ||||
| 	std::vector<SEntry> SEntries ; | ||||
|  | ||||
| public: | ||||
| 	int w, h; //width and height | ||||
| 	static CLodHandler * Spriteh; | ||||
| 	std::string defName, curDir; | ||||
| 	std::vector<Cimage> ourImages; | ||||
|   | ||||
| @@ -384,11 +384,19 @@ void CLodHandler::init(std::string lodFile, std::string dirName) | ||||
| 				std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper); | ||||
| 				boost::algorithm::replace_all(name,".BMP",".PCX"); | ||||
| 				Entry * e = entries.znajdz(name); | ||||
| 				if(e) | ||||
| 				if(e) //file present in .lod - overwrite its entry | ||||
| 				{ | ||||
| 					e->offset = -1; | ||||
| 					e->realSize = e->size = boost::filesystem::file_size(dir->path()); | ||||
| 				} | ||||
| 				else //file not present in lod - add entry for it | ||||
| 				{ | ||||
| 					Entry e; | ||||
| 					e.offset = -1; | ||||
| 					e.nameStr = name; | ||||
| 					e.realSize = e.size = boost::filesystem::file_size(dir->path()); | ||||
| 					entries.push_back(e); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user