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