1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Now less source images are used. Flipped versions will be calculated.

This commit is contained in:
krs
2023-05-25 22:36:42 +03:00
parent 0ee1866f73
commit 0a8daf4d02
15 changed files with 44 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

View File

@@ -5,30 +5,30 @@
{ "frame" : 00, "file" : "empty.png"}, // 000001 -> 00 empty frame { "frame" : 00, "file" : "empty.png"}, // 000001 -> 00 empty frame
// load single edges // load single edges
{ "frame" : 01, "file" : "topLeft.png"}, //000001 -> 01 { "frame" : 01, "file" : "topLeft.png"}, //000001 -> 01 topLeft
{ "frame" : 02, "file" : "topRight.png"}, //000010 -> 02 { "frame" : 02, "file" : "topLeft.png"}, //000010 -> 02 topRight
{ "frame" : 03, "file" : "right.png"}, //000100 -> 04 { "frame" : 03, "file" : "left.png"}, //000100 -> 04 right
{ "frame" : 04, "file" : "bottomRight.png"}, //001000 -> 08 { "frame" : 04, "file" : "topLeft.png"}, //001000 -> 08 bottomRight
{ "frame" : 05, "file" : "bottomLeft.png"}, //010000 -> 16 { "frame" : 05, "file" : "topLeft.png"}, //010000 -> 16 bottomLeft
{ "frame" : 06, "file" : "left.png"}, //100000 -> 32 { "frame" : 06, "file" : "left.png"}, //100000 -> 32 left
// load double edges // load double edges
{ "frame" : 07, "file" : "top.png"}, //000011 -> 03 { "frame" : 07, "file" : "top.png"}, //000011 -> 03 top
{ "frame" : 08, "file" : "bottom.png"}, //011000 -> 24 { "frame" : 08, "file" : "top.png"}, //011000 -> 24 bottom
{ "frame" : 09, "file" : "topRightHalfCorner.png"}, //000110 -> 06 { "frame" : 09, "file" : "topLeftHalfCorner.png"}, //000110 -> 06 topRightHalfCorner
{ "frame" : 10, "file" : "bottomRightHalfCorner.png"}, //001100 -> 12 { "frame" : 10, "file" : "topLeftHalfCorner.png"}, //001100 -> 12 bottomRightHalfCorner
{ "frame" : 11, "file" : "bottomLeftHalfCorner.png"}, //110000 -> 48 { "frame" : 11, "file" : "topLeftHalfCorner.png"}, //110000 -> 48 bottomLeftHalfCorner
{ "frame" : 12, "file" : "topLeftHalfCorner.png"}, //100001 -> 33 { "frame" : 12, "file" : "topLeftHalfCorner.png"}, //100001 -> 33 topLeftHalfCorner
// load halves // load halves
{ "frame" : 13, "file" : "rightHalf.png"}, //001110 -> 14 { "frame" : 13, "file" : "leftHalf.png"}, //001110 -> 14 rightHalf
{ "frame" : 14, "file" : "leftHalf.png"}, //110001 -> 49 { "frame" : 14, "file" : "leftHalf.png"}, //110001 -> 49 leftHalf
// load corners // load corners
{ "frame" : 15, "file" : "topRightCorner.png"}, //000111 -> 07 { "frame" : 15, "file" : "topLeftCorner.png"}, //000111 -> 07 topRightCorner
{ "frame" : 16, "file" : "bottomRightCorner.png"}, //011100 -> 28 { "frame" : 16, "file" : "topLeftCorner.png"}, //011100 -> 28 bottomRightCorner
{ "frame" : 17, "file" : "bottomLeftCorner.png"}, //111000 -> 56 { "frame" : 17, "file" : "topLeftCorner.png"}, //111000 -> 56 bottomLeftCorner
{ "frame" : 18, "file" : "topLeftCorner.png"} //100011 -> 35 { "frame" : 18, "file" : "topLeftCorner.png"} //100011 -> 35 topLeftCorner
] ]
} }

View File

@@ -67,8 +67,8 @@ namespace HexMasks
bottomLeftHalfCorner = 0b110000, bottomLeftHalfCorner = 0b110000,
topLeftHalfCorner = 0b100001, topLeftHalfCorner = 0b100001,
rightTopAndBottom = 0b001010, rightTopAndBottom = 0b001010, // special case, right half can be drawn instead of only top and bottom
leftTopAndBottom = 0b010001, leftTopAndBottom = 0b010001, // special case, left half can be drawn instead of only top and bottom
rightHalf = 0b001110, rightHalf = 0b001110,
leftHalf = 0b110001, leftHalf = 0b110001,
@@ -131,6 +131,7 @@ BattleFieldController::BattleFieldController(BattleInterface & owner):
fullDamageRangeLimitImages->preload(); fullDamageRangeLimitImages->preload();
initializeHexEdgeMaskToFrameIndex(); initializeHexEdgeMaskToFrameIndex();
flipRangedFullDamageLimitImagesIntoPositions();
if(!owner.siegeController) if(!owner.siegeController)
{ {
@@ -549,6 +550,26 @@ std::vector<std::shared_ptr<IImage>> BattleFieldController::calculateRangedFullD
return output; return output;
} }
void BattleFieldController::flipRangedFullDamageLimitImagesIntoPositions()
{
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::topRight])->verticalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::right])->verticalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomRight])->doubleFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomLeft])->horizontalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottom])->horizontalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::topRightHalfCorner])->verticalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomRightHalfCorner])->doubleFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomLeftHalfCorner])->horizontalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::rightHalf])->verticalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::topRightCorner])->verticalFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomRightCorner])->doubleFlip();
rangedFullDamageLimitImages->getImage(hexEdgeMaskToFrameIndex[HexMasks::bottomLeftCorner])->horizontalFlip();
}
void BattleFieldController::showHighlightedHexes(Canvas & canvas) void BattleFieldController::showHighlightedHexes(Canvas & canvas)
{ {
std::set<BattleHex> hoveredStackMovementRangeHexes = getMovementRangeForHoveredStack(); std::set<BattleHex> hoveredStackMovementRangeHexes = getMovementRangeForHoveredStack();

View File

@@ -87,6 +87,9 @@ class BattleFieldController : public CIntObject
/// based on this mask the corresponding image is selected /// 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>> calculateRangedFullDamageHighlightImages(std::vector<std::vector<BattleHex::EDir>> fullRangeLimitHexesNeighbourDirections);
/// to reduce the number of source images used, some images will be used as flipped versions of preloaded ones
void flipRangedFullDamageLimitImagesIntoPositions();
void showBackground(Canvas & canvas); void showBackground(Canvas & canvas);
void showBackgroundImage(Canvas & canvas); void showBackgroundImage(Canvas & canvas);
void showBackgroundImageWithHexes(Canvas & canvas); void showBackgroundImageWithHexes(Canvas & canvas);