瀏覽代碼

* resolving #28
* minor changes and improvements

mateuszb 18 年之前
父節點
當前提交
87b3459d14
共有 9 個文件被更改,包括 262 次插入16 次删除
  1. 1 4
      CAdvmapInterface.cpp
  2. 179 0
      CMT.cpp
  3. 4 2
      SDL_Extensions.cpp
  4. 1 1
      SDL_Extensions.h
  5. 8 0
      hch/CAmbarCendamo.cpp
  6. 1 0
      hch/CHeroHandler.h
  7. 1 1
      hch/CObjectHandler.cpp
  8. 2 0
      hch/CObjectHandler.h
  9. 65 8
      mapHandler.cpp

+ 1 - 4
CAdvmapInterface.cpp

@@ -696,10 +696,7 @@ void CTerrainRect::mouseMoved (SDL_MouseMotionEvent & sEvent)
 	std::vector<std::string> temp = LOCPLINT->cb->getObjDescriptions(pom);
 	if (temp.size())
 	{
-		if ((*(((*((temp.end())-1)).end())-1))==(char)9) //usuwamy krzaka// TODO: a tak w ogole, to mh to powinien robic
-			LOCPLINT->adventureInt->statusbar.print((*((temp.end())-1)).substr(0,(*((temp.end())-1)).size()-1)); //ucinamy ostatni znak
-		else
-			LOCPLINT->adventureInt->statusbar.print((*((temp.end())-1)));
+		LOCPLINT->adventureInt->statusbar.print((*((temp.end())-1)));
 	}
 	else
 	{

+ 179 - 0
CMT.cpp

@@ -304,6 +304,185 @@ int _tmain(int argc, _TCHAR* argv[])
 		cgi->heroh = heroh;
 		cgi->generaltexth = new CGeneralTextHandler;
 		cgi->generaltexth->load();
+
+		//initializing hero flags
+
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01L.DEF")); //red
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01G.DEF")); //blue
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01R.DEF")); //tan
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01D.DEF")); //green
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01B.DEF")); //orange
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01P.DEF")); //purple
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01W.DEF")); //teal
+		cgi->heroh->flags1.push_back(cgi->spriteh->giveDef("ABF01K.DEF")); //pink
+
+		for(int q=0; q<8; ++q)
+		{
+			for(int o=0; o<cgi->heroh->flags1[q]->ourImages.size(); ++o)
+			{
+				if(cgi->heroh->flags1[q]->ourImages[o].groupNumber==6)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags1[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 10;
+						nci.imName = std::string();
+						cgi->heroh->flags1[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags1[q]->ourImages[o].groupNumber==7)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags1[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 11;
+						nci.imName = std::string();
+						cgi->heroh->flags1[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags1[q]->ourImages[o].groupNumber==8)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags1[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 12;
+						nci.imName = std::string();
+						cgi->heroh->flags1[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+			}
+
+			for(int ff=0; ff<cgi->heroh->flags1[q]->ourImages.size(); ++ff)
+			{
+				CSDL_Ext::fullAlphaTransform(cgi->heroh->flags1[q]->ourImages[ff].bitmap);
+			}
+			cgi->heroh->flags1[q]->alphaTransformed = true;
+		}
+
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02L.DEF")); //red
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02G.DEF")); //blue
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02R.DEF")); //tan
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02D.DEF")); //green
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02B.DEF")); //orange
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02P.DEF")); //purple
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02W.DEF")); //teal
+		cgi->heroh->flags2.push_back(cgi->spriteh->giveDef("ABF02K.DEF")); //pink
+
+		for(int q=0; q<8; ++q)
+		{
+			for(int o=0; o<cgi->heroh->flags2[q]->ourImages.size(); ++o)
+			{
+				if(cgi->heroh->flags2[q]->ourImages[o].groupNumber==6)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags2[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 10;
+						nci.imName = std::string();
+						cgi->heroh->flags2[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags2[q]->ourImages[o].groupNumber==7)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags2[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 11;
+						nci.imName = std::string();
+						cgi->heroh->flags2[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags2[q]->ourImages[o].groupNumber==8)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags2[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 12;
+						nci.imName = std::string();
+						cgi->heroh->flags2[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+			}
+
+			for(int ff=0; ff<cgi->heroh->flags2[q]->ourImages.size(); ++ff)
+			{
+				CSDL_Ext::fullAlphaTransform(cgi->heroh->flags2[q]->ourImages[ff].bitmap);
+			}
+			cgi->heroh->flags2[q]->alphaTransformed = true;
+		}
+
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03L.DEF")); //red
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03G.DEF")); //blue
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03R.DEF")); //tan
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03D.DEF")); //green
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03B.DEF")); //orange
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03P.DEF")); //purple
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03W.DEF")); //teal
+		cgi->heroh->flags3.push_back(cgi->spriteh->giveDef("ABF03K.DEF")); //pink
+
+		for(int q=0; q<8; ++q)
+		{
+			for(int o=0; o<cgi->heroh->flags3[q]->ourImages.size(); ++o)
+			{
+				if(cgi->heroh->flags3[q]->ourImages[o].groupNumber==6)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags3[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 10;
+						nci.imName = std::string();
+						cgi->heroh->flags3[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags3[q]->ourImages[o].groupNumber==7)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags3[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 11;
+						nci.imName = std::string();
+						cgi->heroh->flags3[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+				if(cgi->heroh->flags3[q]->ourImages[o].groupNumber==8)
+				{
+					for(int e=0; e<8; ++e)
+					{
+						Cimage nci;
+						nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags3[q]->ourImages[o+e].bitmap);
+						nci.groupNumber = 12;
+						nci.imName = std::string();
+						cgi->heroh->flags3[q]->ourImages.push_back(nci);
+					}
+					o+=8;
+				}
+			}
+
+			for(int ff=0; ff<cgi->heroh->flags3[q]->ourImages.size(); ++ff)
+			{
+				CSDL_Ext::fullAlphaTransform(cgi->heroh->flags3[q]->ourImages[ff].bitmap);
+			}
+			cgi->heroh->flags3[q]->alphaTransformed = true;
+		}
+
+		//hero flags initialized
+
 		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;

+ 4 - 2
SDL_Extensions.cpp

@@ -657,11 +657,13 @@ void CSDL_Ext::blueToPlayersNice(SDL_Surface * sur, int player) //incomplete, TO
 	}
 }
 
-void CSDL_Ext::setPlayerColor(SDL_Surface * sur, int player)
+void CSDL_Ext::setPlayerColor(SDL_Surface * sur, unsigned char player)
 {
+	if(player==254)
+		return;
 	if(sur->format->BitsPerPixel==8)
 	{
-		if(player != -1) 
+		if(player != 255) 
 			*(sur->format->palette->colors+5) = CGameInfo::mainObj->playerColors[player];
 		else
 			*(sur->format->palette->colors+5) = CGameInfo::mainObj->neutralColor;

+ 1 - 1
SDL_Extensions.h

@@ -33,7 +33,7 @@ namespace CSDL_Ext
 	void blueToPlayers(SDL_Surface * sur, int player); //simple color substitution
 	void blueToPlayersAdv(SDL_Surface * sur, int player); //substitute blue color by another one, makes it nicer keeping nuances
 	void blueToPlayersNice(SDL_Surface * sur, int player); //uses interface gems to substitute colours
-	void setPlayerColor(SDL_Surface * sur, int player); //sets correct color of flags; -1 for neutral
+	void setPlayerColor(SDL_Surface * sur, unsigned char player); //sets correct color of flags; -1 for neutral
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
 	SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=ekran); //creates new surface, with flags/format same as in surface given
 	SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface

+ 8 - 0
hch/CAmbarCendamo.cpp

@@ -534,6 +534,7 @@ void CAmbarCendamo::deh3m()
 		nobj->defObjInfoNumber = -1;
 		nobj->isHero = false;
 		nobj->moveDir = 0;
+		nobj->owner = 254; //a lot of objs will never have an owner
 
 		//if (((nobj.x==0)&&(nobj.y==0)) || nobj.x>map.width || nobj.y>map.height || nobj.z>1 || nobj.defNumber>map.defy.size())
 		//	std::cout << "Alarm!!! Obiekt "<<ww<<" jest kopniety (lub wystaje poza mape)\n";
@@ -881,6 +882,7 @@ void CAmbarCendamo::deh3m()
 
 				}
 				i+=16;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				//////creating CHeroInstance
 				CHeroInstance * nhi = new CHeroInstance;
@@ -1303,6 +1305,7 @@ void CAmbarCendamo::deh3m()
 				else
 					spec->movableUnits = true;
 				i+=8;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				break;
 			}
@@ -1500,6 +1503,7 @@ void CAmbarCendamo::deh3m()
 				else
 					spec->alignment = 0xff;
 				i+=3;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				//////////// rewriting info to CTownInstance class /////////////////////
 				CTownInstance * nt = new CTownInstance;
@@ -1521,6 +1525,7 @@ void CAmbarCendamo::deh3m()
 				CPlayerOnlyObjInfo * spec = new CPlayerOnlyObjInfo;
 				spec->player = bufor[i]; ++i;
 				i+=3;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				break;
 			}
@@ -1638,6 +1643,7 @@ void CAmbarCendamo::deh3m()
 				{
 					spec->asCastle = true;
 				}
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				break;
 			}
@@ -1666,6 +1672,7 @@ void CAmbarCendamo::deh3m()
 					spec->maxLevel = 7;
 				if(spec->minLevel<1)
 					spec->minLevel = 1;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				break;
 			}
@@ -1680,6 +1687,7 @@ void CAmbarCendamo::deh3m()
 					spec->maxLevel = 7;
 				if(spec->minLevel<1)
 					spec->minLevel = 1;
+				nobj->owner = spec->player;
 				nobj->info = spec;
 				break;
 			}

+ 1 - 0
hch/CHeroHandler.h

@@ -84,6 +84,7 @@ public:
 	std::vector<CHeroInstance *> heroInstances;
 	std::vector<CHero*> heroes; //by³o nodrze
 	std::vector<CHeroClass *> heroClasses;
+	std::vector<CDefHandler *> flags1, flags2, flags3; //flags blitted on heroes when 
 	unsigned int level(unsigned int experience);
 	void loadHeroes();
 	void loadSpecialAbilities();

+ 1 - 1
hch/CObjectHandler.cpp

@@ -14,7 +14,7 @@ void CObjectHandler::loadObjects()
 	{
 		CObject nobj;
 		CGeneralTextHandler::loadToIt(nobj.name,buf,it,3);
-		if(nobj.name.size() && (nobj.name[nobj.name.size()-1]=='/10' || nobj.name[nobj.name.size()-1]=='/13'))
+		if(nobj.name.size() && (nobj.name[nobj.name.size()-1]==(char)10 || nobj.name[nobj.name.size()-1]==(char)13 || nobj.name[nobj.name.size()-1]==(char)9))
 			nobj.name = nobj.name.substr(0, nobj.name.size()-1);
 		objects.push_back(nobj);
 	}

+ 2 - 0
hch/CObjectHandler.h

@@ -298,6 +298,8 @@ public:
 	CSpecObjInfo * info; //pointer to something with additional information
 	bool isHero; //true if this is a hero
 	unsigned char moveDir; //direction of hero movement (0 - default; 1 - lt; 2 - t; 3 - tr; 4 - r; 5 - br; 6 - b; 7 - bl; 8 - l)
+	bool flagPrinted; //true if flag has been printed
+	unsigned char owner; //if 254, object cannot have owner; if it has, it equal to owner's ID (or 255, when no owner)
 	bool operator<(const CObjectInstance & cmp) const;  //screen printing priority comparing
 };
 

+ 65 - 8
mapHandler.cpp

@@ -505,7 +505,8 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 					case 1:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==10)
 								{
@@ -514,12 +515,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 2:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==5)
 								{
@@ -528,12 +535,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);	
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 3:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==6)
 								{
@@ -542,12 +555,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 4:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==7)
 								{
@@ -556,12 +575,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 5:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==8)
 								{
@@ -570,12 +595,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 6:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==9)
 								{
@@ -584,12 +615,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 7:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==12)
 								{
@@ -598,12 +635,18 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					case 8:
 						{
 							std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
-							for(int gg=0; gg<iv.size(); ++gg)
+							int gg;
+							for(gg=0; gg<iv.size(); ++gg)
 							{
 								if(iv[gg].groupNumber==11)
 								{
@@ -612,6 +655,11 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 								}
 							}
 							SDL_BlitSurface(tb,&pp,su,&sr);
+							if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
+							{
+								SDL_BlitSurface(CGI->heroh->flags2[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
+								ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
+							}
 							break;
 						}
 					}
@@ -625,6 +673,15 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 		}
 	}
 
+	///enabling flags
+
+	for(int qq=0; qq<CGI->heroh->heroInstances.size(); ++qq)
+	{
+		CGI->heroh->heroInstances[qq]->ourObject->flagPrinted = false;
+	}
+
+	///flags enabled
+
 	////objects printed, printing shadow
 	for (int bx=0; bx<dx; bx++)
 	{