1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

* animations won't go in the same phase (resolved #55)

* small upgrades
This commit is contained in:
mateuszb 2008-06-03 13:15:34 +00:00
parent 697f26529a
commit 25ab2e5d8b
3 changed files with 17 additions and 15 deletions

View File

@ -159,7 +159,7 @@ bool CGHeroInstance::isHero() const
{
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];
switch(rdtype)
@ -232,7 +232,7 @@ int CGHeroInstance::getCurrentMorale() const
//TODO: write it
return 0;
}
int CGHeroInstance::getSecSkillLevel(int ID) const
int CGHeroInstance::getSecSkillLevel(const int & ID) const
{
for(int i=0;i<secSkills.size();i++)
if(secSkills[i].first==ID)
@ -267,15 +267,15 @@ int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - c
return 0;
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();
}
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];
}
int CGTownInstance::creatureGrowth(int level) const
int CGTownInstance::creatureGrowth(const int & level) const
{
int ret = CGI->creh->creatures[town->basicCreatures[level]].growth;
switch(fortLevel())
@ -330,7 +330,7 @@ CGTownInstance::CGTownInstance()
visitingHero = NULL;
}
CGObjectInstance::CGObjectInstance()
CGObjectInstance::CGObjectInstance(): animPhaseShift(rand()%0xff)
{
//std::cout << "Tworze obiekt "<<this<<std::endl;
//state = new CLuaObjectScript();

View File

@ -309,6 +309,7 @@ public:
CGDefInfo * defInfo;
CCPPObjectScript * state;
CSpecObjInfo * info;
unsigned char animPhaseShift;
int tempOwner; //uzywane dla szybkosci, skrypt ma obowiazek aktualizowac te zmienna
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
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 getAdditiveMoveBonus();
float getMultiplicativeMoveBonus();
unsigned int getAdditiveMoveBonus() const;
float getMultiplicativeMoveBonus() const;
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'
int getSightDistance() const; //returns sight distance of this hero
@ -370,7 +371,7 @@ public:
bool canWalkOnSea() const;
int getCurrentLuck() const;
int getCurrentMorale() const;
int getSecSkillLevel(int ID) const; //-1 - no skill
int getSecSkillLevel(const int & ID) const; //-1 - no skill
CGHeroInstance();
virtual ~CGHeroInstance();
};
@ -402,9 +403,9 @@ public:
int fortLevel() const; //0 - none, 1 - fort, 2 - citadel, 3 - castle
int hallLevel() const; // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
bool creatureDwelling(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 creatureGrowth(int level) const;
bool creatureDwelling(const int & level, bool upgraded=false) const;
int getHordeLevel(const int & HID) const; //HID - 0 or 1; returns creature level or -1 if that horde structure is not present
int creatureGrowth(const int & level) const;
bool hasFort() const;
bool hasCapitol() const;

View File

@ -1002,12 +1002,13 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
else
{
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
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);
}
}
}