mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
parent
87b3459d14
commit
65ae2cd217
@ -220,6 +220,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
|
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
|
||||||
{
|
{
|
||||||
ho->moveDir = 1;
|
ho->moveDir = 1;
|
||||||
|
ho->isStanding = false;
|
||||||
CGI->mh->ttiles[hp.x-3][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, -31)));
|
CGI->mh->ttiles[hp.x-3][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, -31)));
|
||||||
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 1, -31)));
|
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 1, -31)));
|
||||||
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 33, -31)));
|
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 33, -31)));
|
||||||
@ -253,6 +254,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x == details.src.x && details.dst.y+1 == details.src.y) //t
|
else if(details.dst.x == details.src.x && details.dst.y+1 == details.src.y) //t
|
||||||
{
|
{
|
||||||
ho->moveDir = 2;
|
ho->moveDir = 2;
|
||||||
|
ho->isStanding = false;
|
||||||
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 0, -31)));
|
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 0, -31)));
|
||||||
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 32, -31)));
|
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 32, -31)));
|
||||||
CGI->mh->ttiles[hp.x][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 64, -31)));
|
CGI->mh->ttiles[hp.x][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 64, -31)));
|
||||||
@ -280,6 +282,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x-1 == details.src.x && details.dst.y+1 == details.src.y) //tr
|
else if(details.dst.x-1 == details.src.x && details.dst.y+1 == details.src.y) //tr
|
||||||
{
|
{
|
||||||
ho->moveDir = 3;
|
ho->moveDir = 3;
|
||||||
|
ho->isStanding = false;
|
||||||
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -1, -31)));
|
CGI->mh->ttiles[hp.x-2][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -1, -31)));
|
||||||
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 31, -31)));
|
CGI->mh->ttiles[hp.x-1][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 31, -31)));
|
||||||
CGI->mh->ttiles[hp.x][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 63, -31)));
|
CGI->mh->ttiles[hp.x][hp.y-2][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, 63, -31)));
|
||||||
@ -313,6 +316,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x-1 == details.src.x && details.dst.y == details.src.y) //r
|
else if(details.dst.x-1 == details.src.x && details.dst.y == details.src.y) //r
|
||||||
{
|
{
|
||||||
ho->moveDir = 4;
|
ho->moveDir = 4;
|
||||||
|
ho->isStanding = false;
|
||||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, -1, 0), ho->id);
|
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, -1, 0), ho->id);
|
||||||
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 31, 0), ho->id);
|
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 31, 0), ho->id);
|
||||||
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 63, 0), ho->id);
|
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 63, 0), ho->id);
|
||||||
@ -336,6 +340,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x-1 == details.src.x && details.dst.y-1 == details.src.y) //br
|
else if(details.dst.x-1 == details.src.x && details.dst.y-1 == details.src.y) //br
|
||||||
{
|
{
|
||||||
ho->moveDir = 5;
|
ho->moveDir = 5;
|
||||||
|
ho->isStanding = false;
|
||||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, -1, -1), ho->id);
|
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, -1, -1), ho->id);
|
||||||
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 31, -1), ho->id);
|
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 31, -1), ho->id);
|
||||||
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 63, -1), ho->id);
|
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 63, -1), ho->id);
|
||||||
@ -369,6 +374,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x == details.src.x && details.dst.y-1 == details.src.y) //b
|
else if(details.dst.x == details.src.x && details.dst.y-1 == details.src.y) //b
|
||||||
{
|
{
|
||||||
ho->moveDir = 6;
|
ho->moveDir = 6;
|
||||||
|
ho->isStanding = false;
|
||||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 0, -1), ho->id);
|
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 0, -1), ho->id);
|
||||||
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 32, -1), ho->id);
|
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 32, -1), ho->id);
|
||||||
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 64, -1), ho->id);
|
subRect(hp.x, hp.y-1, hp.z, genRect(32, 32, 64, -1), ho->id);
|
||||||
@ -396,6 +402,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x+1 == details.src.x && details.dst.y-1 == details.src.y) //bl
|
else if(details.dst.x+1 == details.src.x && details.dst.y-1 == details.src.y) //bl
|
||||||
{
|
{
|
||||||
ho->moveDir = 7;
|
ho->moveDir = 7;
|
||||||
|
ho->isStanding = false;
|
||||||
CGI->mh->ttiles[hp.x-3][hp.y-1][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, -1)));
|
CGI->mh->ttiles[hp.x-3][hp.y-1][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, -1)));
|
||||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 1, -1), ho->id);
|
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 1, -1), ho->id);
|
||||||
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 33, -1), ho->id);
|
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 33, -1), ho->id);
|
||||||
@ -429,6 +436,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
else if(details.dst.x+1 == details.src.x && details.dst.y == details.src.y) //l
|
else if(details.dst.x+1 == details.src.x && details.dst.y == details.src.y) //l
|
||||||
{
|
{
|
||||||
ho->moveDir = 8;
|
ho->moveDir = 8;
|
||||||
|
ho->isStanding = false;
|
||||||
CGI->mh->ttiles[hp.x-3][hp.y-1][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, 0)));
|
CGI->mh->ttiles[hp.x-3][hp.y-1][hp.z].objects.push_back(std::make_pair(ho, genRect(32, 32, -31, 0)));
|
||||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 1, 0), ho->id);
|
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 1, 0), ho->id);
|
||||||
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 33, 0), ho->id);
|
subRect(hp.x-1, hp.y-1, hp.z, genRect(32, 32, 33, 0), ho->id);
|
||||||
@ -744,7 +752,8 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
delObjRect(hp.x, hp.y, hp.z, ho->id);
|
delObjRect(hp.x, hp.y, hp.z, ho->id);
|
||||||
}
|
}
|
||||||
ho->pos = details.dst; //copy of hero's position
|
ho->pos = details.dst; //copy of hero's position
|
||||||
ho->moveDir = 0; //move ended
|
//ho->moveDir = 0; //move ended
|
||||||
|
ho->isStanding = true;
|
||||||
//move finished
|
//move finished
|
||||||
}
|
}
|
||||||
void CPlayerInterface::heroKilled(const CHeroInstance * hero)
|
void CPlayerInterface::heroKilled(const CHeroInstance * hero)
|
||||||
|
98
CMT.cpp
98
CMT.cpp
@ -481,6 +481,104 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
cgi->heroh->flags3[q]->alphaTransformed = true;
|
cgi->heroh->flags3[q]->alphaTransformed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF00.DEF")); //red
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF01.DEF")); //blue
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF02.DEF")); //tan
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF03.DEF")); //green
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF04.DEF")); //orange
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF05.DEF")); //purple
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF06.DEF")); //teal
|
||||||
|
cgi->heroh->flags4.push_back(cgi->spriteh->giveDef("AF07.DEF")); //pink
|
||||||
|
|
||||||
|
for(int q=0; q<8; ++q)
|
||||||
|
{
|
||||||
|
for(int o=0; o<cgi->heroh->flags4[q]->ourImages.size(); ++o)
|
||||||
|
{
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==6)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 10;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==7)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 11;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==8)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 12;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int o=0; o<cgi->heroh->flags4[q]->ourImages.size(); ++o)
|
||||||
|
{
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==1)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 13;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==2)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 14;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
if(cgi->heroh->flags4[q]->ourImages[o].groupNumber==3)
|
||||||
|
{
|
||||||
|
for(int e=0; e<8; ++e)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(cgi->heroh->flags4[q]->ourImages[o+e].bitmap);
|
||||||
|
nci.groupNumber = 15;
|
||||||
|
nci.imName = std::string();
|
||||||
|
cgi->heroh->flags4[q]->ourImages.push_back(nci);
|
||||||
|
}
|
||||||
|
o+=8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int ff=0; ff<cgi->heroh->flags4[q]->ourImages.size(); ++ff)
|
||||||
|
{
|
||||||
|
CSDL_Ext::fullAlphaTransform(cgi->heroh->flags4[q]->ourImages[ff].bitmap);
|
||||||
|
}
|
||||||
|
cgi->heroh->flags4[q]->alphaTransformed = true;
|
||||||
|
}
|
||||||
|
|
||||||
//hero flags initialized
|
//hero flags initialized
|
||||||
|
|
||||||
THC std::cout<<"Preparing first handlers: "<<tmh.getDif()<<std::endl;
|
THC std::cout<<"Preparing first handlers: "<<tmh.getDif()<<std::endl;
|
||||||
|
@ -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->isStanding = true;
|
||||||
nobj->owner = 254; //a lot of objs will never have an owner
|
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())
|
||||||
@ -888,6 +889,7 @@ void CAmbarCendamo::deh3m()
|
|||||||
CHeroInstance * nhi = new CHeroInstance;
|
CHeroInstance * nhi = new CHeroInstance;
|
||||||
spec->myInstance = nhi;
|
spec->myInstance = nhi;
|
||||||
nobj->isHero = true;
|
nobj->isHero = true;
|
||||||
|
nobj->moveDir = 4;
|
||||||
nhi->exp = spec->experience;
|
nhi->exp = spec->experience;
|
||||||
nhi->level = CGI->heroh->level(nhi->exp);
|
nhi->level = CGI->heroh->level(nhi->exp);
|
||||||
nhi->primSkills.resize(PRIMARY_SKILLS);
|
nhi->primSkills.resize(PRIMARY_SKILLS);
|
||||||
|
@ -359,6 +359,36 @@ void CHeroHandler::loadHeroClasses()
|
|||||||
o+=8;
|
o+=8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(int o=0; o<hc->moveAnim->ourImages.size(); ++o)
|
||||||
|
{
|
||||||
|
if(hc->moveAnim->ourImages[o].groupNumber==1)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
|
||||||
|
nci.groupNumber = 13;
|
||||||
|
nci.imName = std::string();
|
||||||
|
hc->moveAnim->ourImages.push_back(nci);
|
||||||
|
//o+=1;
|
||||||
|
}
|
||||||
|
if(hc->moveAnim->ourImages[o].groupNumber==2)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
|
||||||
|
nci.groupNumber = 14;
|
||||||
|
nci.imName = std::string();
|
||||||
|
hc->moveAnim->ourImages.push_back(nci);
|
||||||
|
//o+=1;
|
||||||
|
}
|
||||||
|
if(hc->moveAnim->ourImages[o].groupNumber==3)
|
||||||
|
{
|
||||||
|
Cimage nci;
|
||||||
|
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
|
||||||
|
nci.groupNumber = 15;
|
||||||
|
nci.imName = std::string();
|
||||||
|
hc->moveAnim->ourImages.push_back(nci);
|
||||||
|
//o+=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(int ff=0; ff<hc->moveAnim->ourImages.size(); ++ff)
|
for(int ff=0; ff<hc->moveAnim->ourImages.size(); ++ff)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
|
std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
|
||||||
int selectionProbability[9]; //probability of selection in towns
|
int selectionProbability[9]; //probability of selection in towns
|
||||||
std::vector<int> terrCosts; //default costs of going through terrains: dirt, sand, grass, snow, swamp, rough, subterrain, lava, water, rock; -1 means terrain is imapassable
|
std::vector<int> terrCosts; //default costs of going through terrains: dirt, sand, grass, snow, swamp, rough, subterrain, lava, water, rock; -1 means terrain is imapassable
|
||||||
CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down
|
CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHeroInstance
|
class CHeroInstance
|
||||||
@ -84,7 +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
|
std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //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();
|
||||||
|
@ -298,6 +298,7 @@ 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 isStanding; //true if is standing, flase if is moving
|
||||||
bool flagPrinted; //true if flag has been printed
|
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)
|
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
|
||||||
|
186
mapHandler.cpp
186
mapHandler.cpp
@ -496,7 +496,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
|||||||
sr.y = (by)*32;
|
sr.y = (by)*32;
|
||||||
|
|
||||||
SDL_Rect pp = ttiles[x+bx][y+by][level].objects[h].second;
|
SDL_Rect pp = ttiles[x+bx][y+by][level].objects[h].second;
|
||||||
if(ttiles[x+bx][y+by][level].objects[h].first->isHero && ttiles[x+bx][y+by][level].objects[h].first->moveDir)
|
if(ttiles[x+bx][y+by][level].objects[h].first->isHero && ttiles[x+bx][y+by][level].objects[h].first->moveDir && !ttiles[x+bx][y+by][level].objects[h].first->isStanding)
|
||||||
{
|
{
|
||||||
int imgVal = 8;
|
int imgVal = 8;
|
||||||
SDL_Surface * tb;
|
SDL_Surface * tb;
|
||||||
@ -517,7 +517,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -537,7 +537,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -557,7 +557,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -577,7 +577,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -597,7 +597,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -617,7 +617,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -637,7 +637,7 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -657,7 +657,175 @@ 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)
|
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);
|
SDL_BlitSurface(CGI->heroh->flags4[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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(ttiles[x+bx][y+by][level].objects[h].first->isHero && ttiles[x+bx][y+by][level].objects[h].first->moveDir && ttiles[x+bx][y+by][level].objects[h].first->isStanding)
|
||||||
|
{
|
||||||
|
int imgVal = 8;
|
||||||
|
SDL_Surface * tb;
|
||||||
|
switch(ttiles[x+bx][y+by][level].objects[h].first->moveDir)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
std::vector<Cimage> & iv = ((CHeroObjInfo*)ttiles[x+bx][y+by][level].objects[h].first->info)->myInstance->type->heroClass->moveAnim->ourImages;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==13)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[13*8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==0)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==1)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==2)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[2*8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==3)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[3*8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==4)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[4*8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==15)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[15*8+anim%imgVal].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;
|
||||||
|
int gg;
|
||||||
|
for(gg=0; gg<iv.size(); ++gg)
|
||||||
|
{
|
||||||
|
if(iv[gg].groupNumber==14)
|
||||||
|
{
|
||||||
|
tb = iv[gg].bitmap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||||
|
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[14*8+anim%imgVal].bitmap, NULL, su, &sr);
|
||||||
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user