1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

* resolving #28

* minor changes and improvements
This commit is contained in:
mateuszb
2007-10-07 16:01:53 +00:00
parent caef46059c
commit 87b3459d14
9 changed files with 262 additions and 16 deletions

View File

@ -696,10 +696,7 @@ void CTerrainRect::mouseMoved (SDL_MouseMotionEvent & sEvent)
std::vector<std::string> temp = LOCPLINT->cb->getObjDescriptions(pom); std::vector<std::string> temp = LOCPLINT->cb->getObjDescriptions(pom);
if (temp.size()) 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)));
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)));
} }
else else
{ {

179
CMT.cpp
View File

@ -304,6 +304,185 @@ int _tmain(int argc, _TCHAR* argv[])
cgi->heroh = heroh; cgi->heroh = heroh;
cgi->generaltexth = new CGeneralTextHandler; cgi->generaltexth = new CGeneralTextHandler;
cgi->generaltexth->load(); 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; THC std::cout<<"Preparing first handlers: "<<tmh.getDif()<<std::endl;
CPreGame * cpg = new CPreGame(); //main menu and submenus CPreGame * cpg = new CPreGame(); //main menu and submenus
THC std::cout<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl; THC std::cout<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl;

View File

@ -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(sur->format->BitsPerPixel==8)
{ {
if(player != -1) if(player != 255)
*(sur->format->palette->colors+5) = CGameInfo::mainObj->playerColors[player]; *(sur->format->palette->colors+5) = CGameInfo::mainObj->playerColors[player];
else else
*(sur->format->palette->colors+5) = CGameInfo::mainObj->neutralColor; *(sur->format->palette->colors+5) = CGameInfo::mainObj->neutralColor;

View File

@ -33,7 +33,7 @@ namespace CSDL_Ext
void blueToPlayers(SDL_Surface * sur, int player); //simple color substitution 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 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 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 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 * 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 SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface

View File

@ -534,6 +534,7 @@ void CAmbarCendamo::deh3m()
nobj->defObjInfoNumber = -1; nobj->defObjInfoNumber = -1;
nobj->isHero = false; nobj->isHero = false;
nobj->moveDir = 0; 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()) //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"; // std::cout << "Alarm!!! Obiekt "<<ww<<" jest kopniety (lub wystaje poza mape)\n";
@ -881,6 +882,7 @@ void CAmbarCendamo::deh3m()
} }
i+=16; i+=16;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
//////creating CHeroInstance //////creating CHeroInstance
CHeroInstance * nhi = new CHeroInstance; CHeroInstance * nhi = new CHeroInstance;
@ -1303,6 +1305,7 @@ void CAmbarCendamo::deh3m()
else else
spec->movableUnits = true; spec->movableUnits = true;
i+=8; i+=8;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
break; break;
} }
@ -1500,6 +1503,7 @@ void CAmbarCendamo::deh3m()
else else
spec->alignment = 0xff; spec->alignment = 0xff;
i+=3; i+=3;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
//////////// rewriting info to CTownInstance class ///////////////////// //////////// rewriting info to CTownInstance class /////////////////////
CTownInstance * nt = new CTownInstance; CTownInstance * nt = new CTownInstance;
@ -1521,6 +1525,7 @@ void CAmbarCendamo::deh3m()
CPlayerOnlyObjInfo * spec = new CPlayerOnlyObjInfo; CPlayerOnlyObjInfo * spec = new CPlayerOnlyObjInfo;
spec->player = bufor[i]; ++i; spec->player = bufor[i]; ++i;
i+=3; i+=3;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
break; break;
} }
@ -1638,6 +1643,7 @@ void CAmbarCendamo::deh3m()
{ {
spec->asCastle = true; spec->asCastle = true;
} }
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
break; break;
} }
@ -1666,6 +1672,7 @@ void CAmbarCendamo::deh3m()
spec->maxLevel = 7; spec->maxLevel = 7;
if(spec->minLevel<1) if(spec->minLevel<1)
spec->minLevel = 1; spec->minLevel = 1;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
break; break;
} }
@ -1680,6 +1687,7 @@ void CAmbarCendamo::deh3m()
spec->maxLevel = 7; spec->maxLevel = 7;
if(spec->minLevel<1) if(spec->minLevel<1)
spec->minLevel = 1; spec->minLevel = 1;
nobj->owner = spec->player;
nobj->info = spec; nobj->info = spec;
break; break;
} }

View File

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

View File

@ -14,7 +14,7 @@ void CObjectHandler::loadObjects()
{ {
CObject nobj; CObject nobj;
CGeneralTextHandler::loadToIt(nobj.name,buf,it,3); 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); nobj.name = nobj.name.substr(0, nobj.name.size()-1);
objects.push_back(nobj); objects.push_back(nobj);
} }

View File

@ -298,6 +298,8 @@ public:
CSpecObjInfo * info; //pointer to something with additional information CSpecObjInfo * info; //pointer to something with additional information
bool isHero; //true if this is a hero 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) 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 bool operator<(const CObjectInstance & cmp) const; //screen printing priority comparing
}; };

View File

@ -505,7 +505,8 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
case 1: case 1:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 2: case 2:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 3: case 3:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 4: case 4:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 5: case 5:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 6: case 6:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 7: case 7:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; break;
} }
case 8: case 8:
{ {
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages; 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) 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); 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; 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 ////objects printed, printing shadow
for (int bx=0; bx<dx; bx++) for (int bx=0; bx<dx; bx++)
{ {