1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

* walls block movement now

* minor change
This commit is contained in:
mateuszb 2009-08-28 10:49:11 +00:00
parent 780de79eba
commit e746313565
3 changed files with 26 additions and 14 deletions

View File

@ -476,12 +476,6 @@ void CBattleInterface::show(SDL_Surface * to)
blitAt(images[((animCount+1)/(4/settings.animSpeed))%images.size()].bitmap, x, y, to);
}
//showing siege background
if(siegeH)
{
siegeH->printSiegeBackground(to);
}
//showing hero animations
if(attackingHero)
attackingHero->show(to);
@ -2428,7 +2422,7 @@ void CBattleInterface::showPieceOfWall(SDL_Surface * to, int hex)
if(!siegeH)
return;
static std::map<int, int> hexToPart = boost::assign::map_list_of(12, 8)(29, 7)(62, 12)(78, 6)(112, 10)(147, 5)(165, 11)(182, 4);
static std::map<int, int> hexToPart = boost::assign::map_list_of(12, 8)(16, 1)(29, 7)(62, 12)(78, 6)(112, 10)(147, 5)(165, 11)(182, 4);
std::map<int, int>::const_iterator it = hexToPart.find(hex);
if(it != hexToPart.end())
@ -3272,16 +3266,14 @@ std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, ui16 additInf
}
}
void CBattleInterface::SiegeHelper::printSiegeBackground(SDL_Surface * to)
{
blitAt(backWall, owner->pos.w + owner->pos.x - backWall->w, 50 + owner->pos.y, to);
}
void CBattleInterface::SiegeHelper::printPartOfWall(SDL_Surface * to, int what)
{
Point pos = Point(-1, -1);
switch(what)
{
case 1: //background wall
pos = Point(owner->pos.w + owner->pos.x - backWall->w, 55 + owner->pos.y);
break;
case 2: //keep
pos = Point(owner->pos.w + owner->pos.x - walls[what-2]->w, 154 + owner->pos.y);
break;

View File

@ -244,8 +244,7 @@ private:
//filename getters
std::string getSiegeName(ui16 what, ui16 additInfo = 1) const; //what: 0 - background, 1 - background wall, 2 - keep, 3 - bottom tower, 4 - bottom wall, 5 - below gate, 6 - over gate, 7 - upper wall, 8 - uppert tower, 9 - gate, 10 - gate arch, 11 - bottom static wall, 12 - upper static wall; additInfo: 1 - intact, 2 - damaged, 3 - destroyed
void printSiegeBackground(SDL_Surface * to);
void printPartOfWall(SDL_Surface * to, int what);//what: 2 - keep, 3 - bottom tower, 4 - bottom wall, 5 - below gate, 6 - over gate, 7 - upper wall, 8 - uppert tower, 9 - gate, 10 - gate arch, 11 - bottom static wall, 12 - upper static wall
void printPartOfWall(SDL_Surface * to, int what);//what: 1 - background wall, 2 - keep, 3 - bottom tower, 4 - bottom wall, 5 - below gate, 6 - over gate, 7 - upper wall, 8 - uppert tower, 9 - gate, 10 - gate arch, 11 - bottom static wall, 12 - upper static wall
} * siegeH;
public:
CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2, const SDL_Rect & myRect); //c-tor

View File

@ -300,6 +300,27 @@ void BattleInfo::getAccessibilityMap(bool *accessibility, bool twoHex, bool atta
}
}
//walls
if(siege >= 0)
{
static int permanentlyLocked[] = {12, 45, 78, 112, 147, 182};
for(int b=0; b<ARRAY_COUNT(permanentlyLocked); ++b)
{
accessibility[permanentlyLocked[b]] = false;
}
static std::pair<int, int> lockedIfNotDestroyed[] = //(which part of wall, which hex is blocked if this part of wall is not destroyed
{std::make_pair(2, 165), std::make_pair(3, 130), std::make_pair(4, 62), std::make_pair(5, 29)};
for(int b=0; b<ARRAY_COUNT(lockedIfNotDestroyed); ++b)
{
if(si.wallState[lockedIfNotDestroyed[b].first] < 3)
{
accessibility[lockedIfNotDestroyed[b].second] = false;
}
}
}
//occupyability
if(addOccupiable && twoHex)
{
std::set<int> rem; //tiles to unlock