mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
* animations won't go in the same phase (resolved #55)
* small upgrades
This commit is contained in:
@ -159,7 +159,7 @@ bool CGHeroInstance::isHero() const
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
unsigned int CGHeroInstance::getTileCost(EterrainType & ttype, Eroad & rdtype, Eriver & rvtype)
|
unsigned int CGHeroInstance::getTileCost(const EterrainType & ttype, const Eroad & rdtype, const Eriver & rvtype) const
|
||||||
{
|
{
|
||||||
unsigned int ret = type->heroClass->terrCosts[ttype];
|
unsigned int ret = type->heroClass->terrCosts[ttype];
|
||||||
switch(rdtype)
|
switch(rdtype)
|
||||||
@ -232,7 +232,7 @@ int CGHeroInstance::getCurrentMorale() const
|
|||||||
//TODO: write it
|
//TODO: write it
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int CGHeroInstance::getSecSkillLevel(int ID) const
|
int CGHeroInstance::getSecSkillLevel(const int & ID) const
|
||||||
{
|
{
|
||||||
for(int i=0;i<secSkills.size();i++)
|
for(int i=0;i<secSkills.size();i++)
|
||||||
if(secSkills[i].first==ID)
|
if(secSkills[i].first==ID)
|
||||||
@ -267,15 +267,15 @@ int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - c
|
|||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bool CGTownInstance::creatureDwelling(int level, bool upgraded) const
|
bool CGTownInstance::creatureDwelling(const int & level, bool upgraded) const
|
||||||
{
|
{
|
||||||
return builtBuildings.find(30+level+upgraded*7)!=builtBuildings.end();
|
return builtBuildings.find(30+level+upgraded*7)!=builtBuildings.end();
|
||||||
}
|
}
|
||||||
int CGTownInstance::getHordeLevel(int HID) const//HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
int CGTownInstance::getHordeLevel(const int & HID) const//HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
||||||
{
|
{
|
||||||
return town->hordeLvl[HID];
|
return town->hordeLvl[HID];
|
||||||
}
|
}
|
||||||
int CGTownInstance::creatureGrowth(int level) const
|
int CGTownInstance::creatureGrowth(const int & level) const
|
||||||
{
|
{
|
||||||
int ret = CGI->creh->creatures[town->basicCreatures[level]].growth;
|
int ret = CGI->creh->creatures[town->basicCreatures[level]].growth;
|
||||||
switch(fortLevel())
|
switch(fortLevel())
|
||||||
@ -330,7 +330,7 @@ CGTownInstance::CGTownInstance()
|
|||||||
visitingHero = NULL;
|
visitingHero = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGObjectInstance::CGObjectInstance()
|
CGObjectInstance::CGObjectInstance(): animPhaseShift(rand()%0xff)
|
||||||
{
|
{
|
||||||
//std::cout << "Tworze obiekt "<<this<<std::endl;
|
//std::cout << "Tworze obiekt "<<this<<std::endl;
|
||||||
//state = new CLuaObjectScript();
|
//state = new CLuaObjectScript();
|
||||||
|
@ -309,6 +309,7 @@ public:
|
|||||||
CGDefInfo * defInfo;
|
CGDefInfo * defInfo;
|
||||||
CCPPObjectScript * state;
|
CCPPObjectScript * state;
|
||||||
CSpecObjInfo * info;
|
CSpecObjInfo * info;
|
||||||
|
unsigned char animPhaseShift;
|
||||||
|
|
||||||
int tempOwner; //uzywane dla szybkosci, skrypt ma obowiazek aktualizowac te zmienna
|
int tempOwner; //uzywane dla szybkosci, skrypt ma obowiazek aktualizowac te zmienna
|
||||||
bool blockVisit;
|
bool blockVisit;
|
||||||
@ -358,10 +359,10 @@ public:
|
|||||||
std::vector<CArtifact *> artifWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
std::vector<CArtifact *> artifWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||||
|
|
||||||
virtual bool isHero() const;
|
virtual bool isHero() const;
|
||||||
unsigned int getTileCost(EterrainType & ttype, Eroad & rdtype, Eriver & rvtype);
|
unsigned int getTileCost(const EterrainType & ttype, const Eroad & rdtype, const Eriver & rvtype) const;
|
||||||
unsigned int getLowestCreatureSpeed();
|
unsigned int getLowestCreatureSpeed();
|
||||||
unsigned int getAdditiveMoveBonus();
|
unsigned int getAdditiveMoveBonus() const;
|
||||||
float getMultiplicativeMoveBonus();
|
float getMultiplicativeMoveBonus() const;
|
||||||
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
|
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
|
||||||
int3 getPosition(bool h3m) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
|
int3 getPosition(bool h3m) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
|
||||||
int getSightDistance() const; //returns sight distance of this hero
|
int getSightDistance() const; //returns sight distance of this hero
|
||||||
@ -370,7 +371,7 @@ public:
|
|||||||
bool canWalkOnSea() const;
|
bool canWalkOnSea() const;
|
||||||
int getCurrentLuck() const;
|
int getCurrentLuck() const;
|
||||||
int getCurrentMorale() const;
|
int getCurrentMorale() const;
|
||||||
int getSecSkillLevel(int ID) const; //-1 - no skill
|
int getSecSkillLevel(const int & ID) const; //-1 - no skill
|
||||||
CGHeroInstance();
|
CGHeroInstance();
|
||||||
virtual ~CGHeroInstance();
|
virtual ~CGHeroInstance();
|
||||||
};
|
};
|
||||||
@ -402,9 +403,9 @@ public:
|
|||||||
|
|
||||||
int fortLevel() const; //0 - none, 1 - fort, 2 - citadel, 3 - castle
|
int fortLevel() const; //0 - none, 1 - fort, 2 - citadel, 3 - castle
|
||||||
int hallLevel() const; // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
|
int hallLevel() const; // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
|
||||||
bool creatureDwelling(int level, bool upgraded=false) const;
|
bool creatureDwelling(const int & level, bool upgraded=false) const;
|
||||||
int getHordeLevel(int HID) const; //HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
int getHordeLevel(const int & HID) const; //HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
||||||
int creatureGrowth(int level) const;
|
int creatureGrowth(const int & level) const;
|
||||||
|
|
||||||
bool hasFort() const;
|
bool hasFort() const;
|
||||||
bool hasCapitol() const;
|
bool hasCapitol() const;
|
||||||
|
@ -1002,12 +1002,13 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int imgVal = ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages.size();
|
int imgVal = ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages.size();
|
||||||
|
int phaseShift = ttiles[x+bx][y+by][level].objects[h].first->animPhaseShift;
|
||||||
|
|
||||||
//setting appropriate flag color
|
//setting appropriate flag color
|
||||||
if((ttiles[x+bx][y+by][level].objects[h].first->tempOwner>=0 && ttiles[x+bx][y+by][level].objects[h].first->tempOwner<8) || ttiles[x+bx][y+by][level].objects[h].first->tempOwner==255)
|
if((ttiles[x+bx][y+by][level].objects[h].first->tempOwner>=0 && ttiles[x+bx][y+by][level].objects[h].first->tempOwner<8) || ttiles[x+bx][y+by][level].objects[h].first->tempOwner==255)
|
||||||
CSDL_Ext::setPlayerColor(ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages[anim%imgVal].bitmap, ttiles[x+bx][y+by][level].objects[h].first->tempOwner);
|
CSDL_Ext::setPlayerColor(ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages[(anim+phaseShift)%imgVal].bitmap, ttiles[x+bx][y+by][level].objects[h].first->tempOwner);
|
||||||
|
|
||||||
CSDL_Ext::blit8bppAlphaTo24bpp(ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages[anim%imgVal].bitmap,&pp,su,&sr);
|
CSDL_Ext::blit8bppAlphaTo24bpp(ttiles[x+bx][y+by][level].objects[h].first->defInfo->handler->ourImages[(anim+phaseShift)%imgVal].bitmap,&pp,su,&sr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user