1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

First working prototype that mimics rangedFullDamageLimit code

Next step is to create more generic functions that can be shared between the 2.
This commit is contained in:
krs
2023-06-13 00:16:38 +03:00
parent 1c135456f4
commit 33bbbefdeb
14 changed files with 163 additions and 41 deletions

View File

@@ -33,7 +33,8 @@ class BattleFieldController : public CIntObject
std::shared_ptr<IImage> cellUnitMovementHighlight;
std::shared_ptr<IImage> cellUnitMaxMovementHighlight;
std::shared_ptr<IImage> cellShade;
std::unique_ptr<CAnimation> rangedFullDamageLimitImages;
std::shared_ptr<CAnimation> rangedFullDamageLimitImages;
std::shared_ptr<CAnimation> shootingRangeLimitImages;
std::shared_ptr<CAnimation> attackCursors;
@@ -62,19 +63,23 @@ class BattleFieldController : public CIntObject
/// get all hexes where a ranged unit can do full damage
std::vector<BattleHex> getRangedFullDamageHexes();
std::vector<BattleHex> getSootingRangeHexes();
/// get only hexes at the limit of a ranged unit's full damage range
std::vector<BattleHex> getRangedFullDamageLimitHexes(std::vector<BattleHex> rangedFullDamageHexes);
std::vector<BattleHex> getShootingRangeLimitHexes(std::vector<BattleHex> shootingRangeHexes);
/// get an array that has for each hex in range, an aray with all directions where an ouside neighbour hex exists
std::vector<std::vector<BattleHex::EDir>> getOutsideNeighbourDirectionsForLimitHexes(std::vector<BattleHex> rangedFullDamageHexes, std::vector<BattleHex> rangedFullDamageLimitHexes);
/// calculates what image to use as range limit, depending on the direction of neighbors
/// a mask is used internally to mark the directions of all neighbours
/// based on this mask the corresponding image is selected
std::vector<std::shared_ptr<IImage>> calculateRangedFullDamageHighlightImages(std::vector<std::vector<BattleHex::EDir>> fullRangeLimitHexesNeighbourDirections);
std::vector<std::shared_ptr<IImage>> calculateRangeHighlightImages(std::vector<std::vector<BattleHex::EDir>> hexesNeighbourDirections, std::shared_ptr<CAnimation> limitImages);
/// to reduce the number of source images used, some images will be used as flipped versions of preloaded ones
void flipRangedFullDamageLimitImagesIntoPositions();
void flipRangedFullDamageLimitImagesIntoPositions(std::shared_ptr<CAnimation> images);
void showBackground(Canvas & canvas);
void showBackgroundImage(Canvas & canvas);