mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- fixed several bugs with siege graphics, including #1389
- removed "shooterHeight" property - seems to be same in all towns.
This commit is contained in:
parent
a20e53acb5
commit
b57b14b752
@ -995,7 +995,7 @@ void CBattleInterface::newStack(const CStack * stack)
|
||||
coords.x = siegeH->town->town->clientInfo.siegePositions[posID].x + this->pos.x;
|
||||
coords.y = siegeH->town->town->clientInfo.siegePositions[posID].y + this->pos.y;
|
||||
}
|
||||
creAnims[stack->ID]->pos.h = siegeH->town->town->clientInfo.siegeShooterCropHeight;
|
||||
creAnims[stack->ID]->pos.h = 225;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2945,13 +2945,18 @@ std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, ui16 additInf
|
||||
void CBattleInterface::SiegeHelper::printPartOfWall(SDL_Surface * to, int what)
|
||||
{
|
||||
Point pos = Point(-1, -1);
|
||||
auto & ci = owner->siegeH->town->town->clientInfo;
|
||||
|
||||
if (what >= 1 && what <= 17)
|
||||
{
|
||||
pos.x = owner->siegeH->town->town->clientInfo.siegePositions[what].x + owner->pos.x;
|
||||
pos.y = owner->siegeH->town->town->clientInfo.siegePositions[what].y + owner->pos.y;
|
||||
pos.x = ci.siegePositions[what].x + owner->pos.x;
|
||||
pos.y = ci.siegePositions[what].y + owner->pos.y;
|
||||
}
|
||||
|
||||
if (town->town->faction->index == ETownType::TOWER
|
||||
&& (what == 13 || what == 14))
|
||||
return; // no moat in Tower. TODO: remove hardcode somehow?
|
||||
|
||||
if(pos.x != -1)
|
||||
{
|
||||
blitAt(walls[what], pos.x, pos.y, to);
|
||||
@ -3054,6 +3059,8 @@ void CBattleInterface::showAbsoluteObstacles(SDL_Surface * to)
|
||||
if(oi->obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE)
|
||||
blitAt(getObstacleImage(*oi), pos.x + oi->getInfo().width, pos.y + oi->getInfo().height, to);
|
||||
|
||||
if (siegeH && siegeH->town->hasBuilt(BuildingID::CITADEL))
|
||||
siegeH->printPartOfWall(to, 14); // show moat background
|
||||
}
|
||||
|
||||
void CBattleInterface::showHighlightedHexes(SDL_Surface * to)
|
||||
@ -3463,22 +3470,28 @@ BattleObjectsByHex CBattleInterface::sortObjectsByHex()
|
||||
if (siegeH)
|
||||
{
|
||||
sorted.beforeAll.walls.push_back(1); // 1. background wall
|
||||
sorted.hex[135].walls.push_back(2); // 2. keep
|
||||
sorted.afterAll.walls.push_back(3); // 3. bottom tower
|
||||
sorted.hex[182].walls.push_back(4); // 4. bottom wall
|
||||
sorted.hex[130].walls.push_back(5); // 5. wall below gate,
|
||||
sorted.hex[62].walls.push_back(6); // 6. wall over gate
|
||||
sorted.hex[12].walls.push_back(7); // 7. upper wall
|
||||
sorted.beforeAll.walls.push_back(8); // 8. upper tower
|
||||
//sorted.hex[94].walls.push_back(9); // 9. gate // Not implemented it seems
|
||||
//sorted.hex[94].walls.push_back(9); // 9. gate // Not implemented it seems
|
||||
sorted.hex[112].walls.push_back(10); // 10. gate arch
|
||||
sorted.hex[165].walls.push_back(11); // 11. bottom static wall
|
||||
sorted.beforeAll.walls.push_back(12); // 12. upper static wall
|
||||
sorted.beforeAll.walls.push_back(13); // 13. moat
|
||||
sorted.beforeAll.walls.push_back(14); // 14. mlip
|
||||
sorted.hex[135].walls.push_back(15); // 15. keep turret cover
|
||||
sorted.afterAll.walls.push_back(16); // 16. lower turret cover
|
||||
sorted.beforeAll.walls.push_back(17); // 17. upper turret cover
|
||||
sorted.hex[45].walls.push_back(12); // 12. upper static wall
|
||||
if (siegeH && siegeH->town->hasBuilt(BuildingID::CITADEL))
|
||||
{
|
||||
sorted.beforeAll.walls.push_back(13); // 13. moat
|
||||
//sorted.beforeAll.walls.push_back(14); // 14. mlip (moat background terrain), blit as absolute obstacle
|
||||
sorted.hex[135].walls.push_back(2); // 2. keep
|
||||
sorted.hex[135].walls.push_back(15); // 15. keep turret cover
|
||||
}
|
||||
if (siegeH && siegeH->town->hasBuilt(BuildingID::CASTLE))
|
||||
{
|
||||
sorted.afterAll.walls.push_back(16); // 16. lower turret cover
|
||||
sorted.beforeAll.walls.push_back(17); // 17. upper turret cover
|
||||
}
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
|
@ -401,7 +401,8 @@ ui8 * CCreatureAnimation::getPixelAddr(SDL_Surface * dest, int X, int Y) const
|
||||
template<int bpp>
|
||||
inline void CCreatureAnimation::putPixelAt(SDL_Surface * dest, int X, int Y, size_t index, const std::array<SDL_Color, 8> & special) const
|
||||
{
|
||||
putPixel<bpp>(getPixelAddr(dest, X, Y), palette[index], index, special);
|
||||
if ( X < pos.x + pos.w && Y < pos.y + pos.h)
|
||||
putPixel<bpp>(getPixelAddr(dest, X, Y), palette[index], index, special);
|
||||
}
|
||||
|
||||
template<int bpp>
|
||||
|
@ -204,7 +204,6 @@
|
||||
"bank" : { "x" : 403, "y" : 80 },
|
||||
"moat" : { "x" : 410, "y" : 90 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 600, "y" : 49 },
|
||||
|
@ -212,7 +212,6 @@
|
||||
"bank" : { "x" : 407, "y" : 80 },
|
||||
"moat" : { "x" : 407, "y" : 80 }
|
||||
},
|
||||
"shooterHeight" : 229,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 600, "y" : 50 },
|
||||
|
@ -196,28 +196,27 @@
|
||||
"imagePrefix" : "SGDN",
|
||||
"gate" :
|
||||
{
|
||||
"arch" : { "x" : 471, "y" : 164 },
|
||||
"arch" : { "x" : 471, "y" : 165 },
|
||||
"gate" : { "x" : 395, "y" : 260 }
|
||||
},
|
||||
"moat" :
|
||||
{
|
||||
"bank" : { "x" : 283, "y" : 94 },
|
||||
"moat" : { "x" : 283, "y" : 94 }
|
||||
"bank" : { "x" : 284, "y" : 94 },
|
||||
"moat" : { "x" : 284, "y" : 94 }
|
||||
},
|
||||
"shooterHeight" : 230,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 608, "y" : 50 },
|
||||
"bottom" : { "x" : 522, "y" : 305 },
|
||||
"bottom" : { "x" : 522, "y" : 306 },
|
||||
"top" : { "x" : 494, "y" : 53 }
|
||||
},
|
||||
"towers" :
|
||||
{
|
||||
"bottom" :
|
||||
{
|
||||
"battlement" : { "x" : 600, "y" : 495 },
|
||||
"battlement" : { "x" : 595, "y" : 496 },
|
||||
"creature" : { "x" : 410, "y" : 293 },
|
||||
"tower" : { "x" : 560, "y" : 495 }
|
||||
"tower" : { "x" : 595, "y" : 496 }
|
||||
},
|
||||
"keep" :
|
||||
{
|
||||
@ -227,9 +226,9 @@
|
||||
},
|
||||
"top" :
|
||||
{
|
||||
"battlement" : { "x" : 565, "y" : 15 },
|
||||
"battlement" : { "x" : 562, "y" : 15 },
|
||||
"creature" : { "x" : 381, "y" : -187 },
|
||||
"tower" : { "x" : 565, "y" : 15 }
|
||||
"tower" : { "x" : 562, "y" : 15 }
|
||||
}
|
||||
},
|
||||
"walls" :
|
||||
@ -237,7 +236,7 @@
|
||||
"bottom" : { "x" : 559, "y" : 448 },
|
||||
"bottomMid" : { "x" : 471, "y" : 296 },
|
||||
"upper" : { "x" : 523, "y" : 56 },
|
||||
"upperMid" : { "x" : 477, "y" : 180 }
|
||||
"upperMid" : { "x" : 478, "y" : 181 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,6 @@
|
||||
"bank" : { "x" : 376, "y" : 70 },
|
||||
"moat" : { "x" : 383, "y" : 95 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 599, "y" : 62 },
|
||||
|
@ -205,7 +205,6 @@
|
||||
"bank" : { "x" : 403, "y" : 68 },
|
||||
"moat" : { "x" : 403, "y" : 68 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 606, "y" : 52 },
|
||||
|
@ -211,7 +211,6 @@
|
||||
"bank" : { "x" : -1, "y" : -1 },
|
||||
"moat" : { "x" : 406, "y" : 77 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 604, "y" : 58 },
|
||||
|
@ -212,7 +212,6 @@
|
||||
"bank" : { "x" : 410, "y" : 97 },
|
||||
"moat" : { "x" : 410, "y" : 77 }
|
||||
},
|
||||
"shooterHeight" : 232,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 608, "y" : 46 },
|
||||
|
@ -202,7 +202,6 @@
|
||||
"bank" : { "x" : 410, "y" : 91 },
|
||||
"moat" : { "x" : 410, "y" : 90 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 617, "y" : 62 },
|
||||
|
@ -142,7 +142,7 @@
|
||||
"primaryResource" : "gems",
|
||||
"mageGuild" : 5,
|
||||
"warMachine" : "ammoCart",
|
||||
"moatDamage" : -1,
|
||||
"moatDamage" : 0, //TODO: minefield
|
||||
|
||||
"buildings" :
|
||||
{
|
||||
@ -204,7 +204,6 @@
|
||||
"bank" : { "x" : 410, "y" : 80 },
|
||||
"moat" : { "x" : 410, "y" : 90 }
|
||||
},
|
||||
"shooterHeight" : 231,
|
||||
"static" :
|
||||
{
|
||||
"background" : { "x" : 615, "y" : 57 },
|
||||
|
@ -76,10 +76,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"shooterHeight": {
|
||||
"type":"number",
|
||||
"description" : "Height at which shooter image will be cropped"
|
||||
},
|
||||
"shooter": {
|
||||
"type":"string",
|
||||
"description" : "Identifier of creature that will be used as tower shooter"
|
||||
|
@ -395,8 +395,6 @@ void CTownHandler::loadSiegeScreen(CTown &town, const JsonNode & source)
|
||||
town.clientInfo.siegeShooter = CreatureID(creature);
|
||||
});
|
||||
|
||||
town.clientInfo.siegeShooterCropHeight = source["shooterHeight"].Float();
|
||||
|
||||
auto & pos = town.clientInfo.siegePositions;
|
||||
pos.resize(21);
|
||||
|
||||
|
@ -185,13 +185,12 @@ public:
|
||||
std::string siegePrefix;
|
||||
std::vector<Point> siegePositions;
|
||||
CreatureID siegeShooter; // shooter creature ID
|
||||
si32 siegeShooterCropHeight; //trim height for shooters in turrets
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & icons & iconSmall & iconLarge & musicTheme & townBackground & guildWindow & buildingsIcons & hallBackground;
|
||||
h & advMapVillage & advMapCastle & advMapCapitol & hallSlots & structures;
|
||||
h & siegePrefix & siegePositions & siegeShooter & siegeShooterCropHeight;
|
||||
h & siegePrefix & siegePositions & siegeShooter;
|
||||
}
|
||||
} clientInfo;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user