mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	| @@ -847,7 +847,8 @@ bool CCallback::battleCanShoot(int ID, int dest) //TODO: finish | ||||
| { | ||||
| 	if(battleGetStackByID(ID).creature->isShooting()  | ||||
| 		&& battleGetStack(dest) != -1  | ||||
| 		&& battleGetStackByPos(dest).owner != battleGetStackByID(ID).owner) | ||||
| 		&& battleGetStackByPos(dest).owner != battleGetStackByID(ID).owner | ||||
| 		&& battleGetStackByPos(dest).alive) | ||||
| 		return true; | ||||
| 	return false; | ||||
| } | ||||
|   | ||||
| @@ -509,7 +509,7 @@ bool CGameState::battleShootCreatureStack(int ID, int dest) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if(IDOfStackAtEnd == -1 || curB->stacks[numberOfStackAtEnd]->owner == curStack->owner) | ||||
| 	if(IDOfStackAtEnd == -1 || curB->stacks[numberOfStackAtEnd]->owner == curStack->owner || !curB->stacks[numberOfStackAtEnd]->alive) | ||||
| 		return false; | ||||
|  | ||||
| 	LOCPLINT->battleStackIsShooting(ID, dest); | ||||
|   | ||||
| @@ -731,7 +731,7 @@ void CHeroWindow::redrawCurBack() | ||||
| 	blitAt(skillpics->ourImages[4].bitmap, 20, 230, curBack); | ||||
| 	blitAt(skillpics->ourImages[3].bitmap, 162, 230, curBack); | ||||
|  | ||||
| 	blitAt(curHero->type->portraitLarge, 19, 19, curBack); | ||||
| 	blitAt(CGI->heroh->largePortraits[curHero->portrait], 19, 19, curBack); | ||||
|  | ||||
| 	CSDL_Ext::printAtMiddle(curHero->name, 190, 40, GEORXX, tytulowy, curBack); | ||||
|  | ||||
| @@ -796,14 +796,14 @@ void CHeroWindow::redrawCurBack() | ||||
| 	for(int g=0; g<LOCPLINT->cb->howManyHeroes(); ++g) | ||||
| 	{ | ||||
| 		const CGHeroInstance * cur = LOCPLINT->cb->getHeroInfo(player, g, false); | ||||
| 		blitAt(cur->type->portraitSmall, 611, 87+g*54, curBack); | ||||
| 		blitAt(CGI->heroh->smallPortraits[cur->portrait], 611, 87+g*54, curBack); | ||||
| 		//printing yellow border | ||||
| 		if(cur->name == curHero->name) | ||||
| 		{ | ||||
| 			for(int f=0; f<cur->type->portraitSmall->w; ++f) | ||||
| 			for(int f=0; f<CGI->heroh->smallPortraits[cur->portrait]->w; ++f) | ||||
| 			{ | ||||
| 				for(int h=0; h<cur->type->portraitSmall->h; ++h) | ||||
| 					if(f==0 || h==0 || f==cur->type->portraitSmall->w-1 || h==cur->type->portraitSmall->h-1) | ||||
| 				for(int h=0; h<CGI->heroh->smallPortraits[cur->portrait]->h; ++h) | ||||
| 					if(f==0 || h==0 || f==CGI->heroh->smallPortraits[cur->portrait]->w-1 || h==CGI->heroh->smallPortraits[cur->portrait]->h-1) | ||||
| 					{ | ||||
| 						CSDL_Ext::SDL_PutPixel(curBack, 611+f, 87+g*54+h, 240, 220, 120); | ||||
| 					} | ||||
|   | ||||
| @@ -1586,7 +1586,7 @@ SDL_Surface * CPlayerInterface::drawHeroInfoWin(const CGHeroInstance * curh) | ||||
| 		SDL_itoa((*i).second.second,buf,10); | ||||
| 		printAtMiddle(buf,slotsPos[(*i).first].first+17,slotsPos[(*i).first].second+39,GEORM,zwykly,ret); | ||||
| 	} | ||||
| 	blitAt(curh->type->portraitLarge,11,12,ret); | ||||
| 	blitAt(CGI->heroh->largePortraits[curh->portrait],11,12,ret); | ||||
| 	SDL_itoa(curh->mana,buf,10); | ||||
| 	printAtMiddle(buf,166,109,GEORM,zwykly,ret); //mana points | ||||
| 	delete[] buf; | ||||
| @@ -2435,7 +2435,7 @@ void CHeroList::draw() | ||||
| 		if (pom>25) pom=25; | ||||
| 		if (pom<0) pom=0; | ||||
| 		blitAt(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana | ||||
| 		SDL_Surface * temp = LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->type->portraitSmall; | ||||
| 		SDL_Surface * temp = CGI->heroh->smallPortraits[LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->portrait]; | ||||
| 		blitAt(temp,posporx,pospory+i*32); | ||||
| 		if ((selected == iT) && (LOCPLINT->adventureInt->selection.type == HEROI_TYPE)) | ||||
| 		{ | ||||
|   | ||||
| @@ -556,7 +556,7 @@ void Options::showIcon (int what, int nr, bool abs) //what: -1=castle, 0=hero, 1 | ||||
| 			{ | ||||
| 				if(ourOpt->heroPortrait>=0) | ||||
| 				{ | ||||
| 					blitAtWR(CGI->heroh->heroes[ourOpt->heroPortrait]->portraitSmall,252,130+50*se); | ||||
| 					blitAtWR(CGI->heroh->smallPortraits[ourOpt->heroPortrait],252,130+50*se); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| @@ -565,7 +565,7 @@ void Options::showIcon (int what, int nr, bool abs) //what: -1=castle, 0=hero, 1 | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				blitAtWR(CGI->heroh->heroes[pom]->portraitSmall,252,130+50*se); | ||||
| 				blitAtWR(CGI->heroh->smallPortraits[pom],252,130+50*se); | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| 163 | ||||
| 0	HPS000KN.bmp | ||||
| 1	HPS001KN.bmp | ||||
| 2	HPS002KN.bmp | ||||
| @@ -154,3 +155,10 @@ | ||||
| 153	HPS008SH.bmp | ||||
| 154	HPS001SH.bmp | ||||
| 155	HPS131DM.bmp | ||||
| 156	HPS129MK.bmp | ||||
| 157	HPS002SH.bmp | ||||
| 158	HPS132Wl.bmp | ||||
| 159	HPS133Nc.bmp | ||||
| 160	HPS134Nc.bmp | ||||
| 161	HPS135Wi.bmp | ||||
| 162	HPS136Wi.bmp | ||||
| @@ -14,22 +14,30 @@ CHeroHandler::~CHeroHandler() | ||||
| { | ||||
| 	for (int j=0;j<heroes.size();j++) | ||||
| 	{ | ||||
| 		if (heroes[j]->portraitSmall) | ||||
| 			SDL_FreeSurface(heroes[j]->portraitSmall); | ||||
| 		delete heroes[j]; | ||||
| 	} | ||||
| 	for(std::map<int, SDL_Surface*>::iterator it = smallPortraits.begin(); it!=smallPortraits.end(); ++it) | ||||
| 	{ | ||||
| 		delete it->second; | ||||
| 	} | ||||
| 	for(std::map<int, SDL_Surface*>::iterator it = largePortraits.begin(); it!=largePortraits.end(); ++it) | ||||
| 	{ | ||||
| 		delete it->second; | ||||
| 	} | ||||
| } | ||||
| void CHeroHandler::loadPortraits() | ||||
| { | ||||
| 	std::ifstream of("config/portrety.txt"); | ||||
| 	for (int j=0;j<heroes.size();j++) | ||||
| 	int numberOfPortraits; | ||||
| 	of>>numberOfPortraits; | ||||
| 	for (int j=0; j<numberOfPortraits; j++) | ||||
| 	{ | ||||
| 		int ID; | ||||
| 		of>>ID; | ||||
| 		std::string path; | ||||
| 		of>>path; | ||||
| 		heroes[ID]->portraitSmall=CGI->bitmaph->loadBitmap(path); | ||||
| 		if (!heroes[ID]->portraitSmall) | ||||
| 		smallPortraits[ID] = CGI->bitmaph->loadBitmap(path); | ||||
| 		if (!smallPortraits[ID]) | ||||
| 			std::cout<<"Can't read small portrait for "<<ID<<" ("<<path<<")\n"; | ||||
| 		for(int ff=0; ff<path.size(); ++ff) //size letter is usually third one, but there are exceptions an it should fix the problem | ||||
| 		{ | ||||
| @@ -39,10 +47,10 @@ void CHeroHandler::loadPortraits() | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		heroes[ID]->portraitLarge=CGI->bitmaph->loadBitmap(path); | ||||
| 		if (!heroes[ID]->portraitLarge) | ||||
| 		largePortraits[ID] = CGI->bitmaph->loadBitmap(path); | ||||
| 		if (!largePortraits[ID]) | ||||
| 			std::cout<<"Can't read large portrait for "<<ID<<" ("<<path<<")\n";	 | ||||
| 		SDL_SetColorKey(heroes[ID]->portraitLarge,SDL_SRCCOLORKEY,SDL_MapRGB(heroes[ID]->portraitLarge->format,0,255,255)); | ||||
| 		SDL_SetColorKey(largePortraits[ID],SDL_SRCCOLORKEY,SDL_MapRGB(largePortraits[ID]->format,0,255,255)); | ||||
|  | ||||
| 	} | ||||
| 	of.close(); | ||||
|   | ||||
| @@ -26,8 +26,6 @@ public: | ||||
| 	CHeroClass * heroClass; | ||||
| 	EHeroClasses heroType; //hero class | ||||
| 	//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;} | ||||
| 	SDL_Surface * portraitSmall; //48x32 px | ||||
| 	SDL_Surface * portraitLarge; //58x64 px | ||||
| }; | ||||
|  | ||||
| class CHeroClass | ||||
| @@ -50,6 +48,7 @@ public: | ||||
| 	std::vector<CHero*> heroes; //by�o nodrze | ||||
| 	std::vector<CHeroClass *> heroClasses; | ||||
| 	std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when , | ||||
| 	std::map<int, SDL_Surface *> smallPortraits, largePortraits; //there are more portraits than playable heroes! ; small - 48x32 px ; large - 58x64 px | ||||
| 	CDefHandler * pskillsb, *resources; //82x93 | ||||
| 	CDefHandler * un44; //many things | ||||
| 	std::vector<std::string> pskillsn; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user