mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	*improvements in CPreGame
* uptated specification * minor stuff
This commit is contained in:
		| @@ -490,22 +490,6 @@ void CAmbarCendamo::deh3m() | ||||
| 		} | ||||
| 		map.defy.push_back(vinya); // add this def to the vector | ||||
| 		defsToUnpack.push_back(vinya.name); | ||||
| 		//testing - only fragment////////////////////////////////////////////////////////////// | ||||
| 		/*map.defy[idd].handler = new CDefHandler(); | ||||
| 		CGameInfo::mainObj->lodh->extractFile(std::string("newH3sprite.lod"), map.defy[idd].name); | ||||
| 		map.defy[idd].handler->openDef( std::string("newH3sprite\\")+map.defy[idd].name); | ||||
| 		for(int ff=0; ff<map.defy[idd].handler->ourImages.size(); ++ff) //adding shadows and transparency | ||||
| 		{ | ||||
| 			map.defy[idd].handler->ourImages[ff].bitmap = CSDL_Ext::alphaTransform(map.defy[idd].handler->ourImages[ff].bitmap); | ||||
| 			SDL_Surface * bufs = CSDL_Ext::secondAlphaTransform(map.defy[idd].handler->ourImages[ff].bitmap, alphaTransSurf); | ||||
| 			SDL_FreeSurface(map.defy[idd].handler->ourImages[ff].bitmap); | ||||
| 			map.defy[idd].handler->ourImages[ff].bitmap = bufs; | ||||
| 		} | ||||
| 		boost::filesystem::remove(boost::filesystem::path(std::string("newH3sprite\\")+map.defy[idd].name));*/ | ||||
| 		//system((std::string("DEL newH3sprite\\")+map.defy[idd].name).c_str()); | ||||
| 		//end fo testing - only fragment/////////////////////////////////////////////////////// | ||||
|  | ||||
| 		//teceDef(); | ||||
| 	} | ||||
| 	THC std::cout<<"Reading defs: "<<th.getDif()<<std::endl; | ||||
| 	////loading objects | ||||
|   | ||||
							
								
								
									
										9
									
								
								CMT.cpp
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								CMT.cpp
									
									
									
									
									
								
							| @@ -117,6 +117,7 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		cgi->spriteh->init(std::string("Data\\H3sprite.lod")); | ||||
| 		cgi->bitmaph = new CLodHandler; | ||||
| 		cgi->bitmaph->init(std::string("Data\\H3bitmap.lod")); | ||||
| 		THC std::cout<<"Loading .lod files: "<<tmh.getDif()<<std::endl; | ||||
|  | ||||
| 		cgi->curh->initCursor(); | ||||
| 		cgi->curh->showGraphicCursor(); | ||||
| @@ -149,7 +150,6 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
|  | ||||
| 		cgi->townh = new CTownHandler; | ||||
| 		cgi->townh->loadNames(); | ||||
|  | ||||
| 		CAbilityHandler * abilh = new CAbilityHandler; | ||||
| 		abilh->loadAbilities(); | ||||
| 		cgi->abilh = abilh; | ||||
| @@ -157,8 +157,9 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		heroh->loadHeroes(); | ||||
| 		heroh->loadPortraits(); | ||||
| 		cgi->heroh = heroh; | ||||
|  | ||||
| 		THC std::cout<<"Loading .lods: "<<tmh.getDif()<<std::endl; | ||||
| 		cgi->generaltexth = new CGeneralTextHandler; | ||||
| 		cgi->generaltexth->load(); | ||||
| 		THC std::cout<<"Preparing first handlers: "<<tmh.getDif()<<std::endl; | ||||
| 		CPreGame * cpg = new CPreGame(); //main menu and submenus | ||||
| 		THC std::cout<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl; | ||||
| 		cpg->mush = mush; | ||||
| @@ -183,8 +184,6 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		CObjectHandler * objh = new CObjectHandler; | ||||
| 		objh->loadObjects(); | ||||
| 		cgi->objh = objh; | ||||
| 		cgi->generaltexth = new CGeneralTextHandler; | ||||
| 		cgi->generaltexth->load(); | ||||
| 		cgi->dobjinfo = new CDefObjInfoHandler; | ||||
| 		cgi->dobjinfo->load(); | ||||
| 		cgi->state = new CGameState(); | ||||
|   | ||||
| @@ -296,7 +296,6 @@ public: | ||||
| 	int3 pos; // position | ||||
| 	CSpecObjInfo * info; //pointer to something with additional information | ||||
| 	bool operator<(const CObjectInstance & cmp) const;  //screen printing priority comparing | ||||
|  | ||||
| }; | ||||
|  | ||||
| class CObjectHandler | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								CPreGame.cpp
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								CPreGame.cpp
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -89,7 +89,7 @@ public: | ||||
| 	IntSelBut(){}; | ||||
| 	IntSelBut( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CPoinGroup<T>* gr=NULL, int My=-1) | ||||
| 		: Button(Pos,Fun,Imgs,Sel,gr),key(My){ourPoinGroup=gr;}; | ||||
| 	void select(bool on=true) {(*this).Button::select(on);ourPoinGroup->setYour(this);} | ||||
| 	void select(bool on=true) {(*this).Button::select(on);ourPoinGroup->setYour(this);CPG->printRating();} | ||||
| }; | ||||
| template <class T=ttt> class CPoinGroup :public CGroup<T> | ||||
| { | ||||
| @@ -223,6 +223,7 @@ public: | ||||
| class CPreGame | ||||
| { | ||||
| public:	 | ||||
| 	std::string playerName; | ||||
| 	HighButton * highlighted; | ||||
| 	PreGameTab* currentTab; | ||||
| 	StartInfo ret; | ||||
| @@ -271,6 +272,7 @@ public: | ||||
| 	void showCenBox (std::string data); // | ||||
| 	void showAskBox (std::string data, void(*f1)(),void(*f2)()); | ||||
| 	void hideBox (); | ||||
| 	void printRating(); | ||||
| 	void printMapsFrom(int from); | ||||
| 	void setTurnLength(int on); | ||||
| 	void sortMaps(); | ||||
|   | ||||
| @@ -46,6 +46,34 @@ void updateRect (SDL_Rect * rect, SDL_Surface * scr) | ||||
| { | ||||
| 	SDL_UpdateRect(scr,rect->x,rect->y,rect->w,rect->h); | ||||
| } | ||||
| void CSDL_Ext::printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor, SDL_Surface * dst) | ||||
| { | ||||
| 	std::vector<std::string> * ws = CMessage::breakText(text,charpr); | ||||
| 	std::vector<SDL_Surface*> wesu; | ||||
| 	wesu.resize(ws->size()); | ||||
| 	for (int i=0;i<wesu.size();i++) | ||||
| 		wesu[i]=TTF_RenderText_Blended(font,(*ws)[i].c_str(),kolor); | ||||
|  | ||||
| 	int tox=0, toy=0; | ||||
| 	for (int i=0;i<wesu.size();i++) | ||||
| 	{ | ||||
| 		toy+=wesu[i]->h; | ||||
| 		if (tox < wesu[i]->w) | ||||
| 			tox=wesu[i]->w; | ||||
| 	} | ||||
| 	int evx, evy = y - (toy/2); | ||||
| 	for (int i=0;i<wesu.size();i++) | ||||
| 	{ | ||||
| 		evx = (x - (tox/2)) + ((tox-wesu[i]->w)/2); | ||||
| 		blitAt(wesu[i],evx,evy); | ||||
| 		evy+=wesu[i]->h; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	for (int i=0;i<wesu.size();i++) | ||||
| 		SDL_FreeSurface(wesu[i]); | ||||
| 	delete ws; | ||||
| } | ||||
| void CSDL_Ext::printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality) | ||||
| { | ||||
| 	if(text.length()==0) return; | ||||
|   | ||||
| @@ -26,6 +26,7 @@ namespace CSDL_Ext | ||||
| 	void fullAlphaTransform(SDL_Surface *& src); //performs first and second alpha transform | ||||
| 	Uint32 colorToUint32(const SDL_Color * color); //little endian only | ||||
| 	void printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest | ||||
| 	void printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran); | ||||
| 	void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest | ||||
| 	void update(SDL_Surface * what = ekran); //updates whole surface (default - main screen) | ||||
| 	void blueToPlayers(SDL_Surface * sur, int player); //simple color substitution | ||||
|   | ||||
| @@ -432,7 +432,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, | ||||
|     int bmask = 0x00ff0000; | ||||
|     int amask = 0xff000000; | ||||
| #endif | ||||
| 	std::cout<<"x to "<<x<<std::endl; | ||||
| 	SDL_Surface * su = SDL_CreateRGBSurface(SDL_SWSURFACE, dx*32, dy*32, 32, | ||||
|                                    rmask, gmask, bmask, amask); | ||||
| 	if (((dx+x)>((reader->map.width+Woff)) || (dy+y)>((reader->map.height+Hoff))) || ((x<-Woff)||(y<-Hoff) ) ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user