Hex Edge Highlight Images moved to VCMI mod
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
BIN
Mods/vcmi/Sprites/battle/rangeHighlights/green/empty.png
Normal file
After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"basepath" : "battle/rangeHighlights/green/",
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 00, "file" : "empty.png"}, // 000001 -> 00 empty frame
|
||||||
|
|
||||||
|
// load single edges
|
||||||
|
{ "frame" : 01, "file" : "topLeft.png"}, //000001 -> 01
|
||||||
|
{ "frame" : 02, "file" : "topRight.png"}, //000010 -> 02
|
||||||
|
{ "frame" : 03, "file" : "right.png"}, //000100 -> 04
|
||||||
|
{ "frame" : 04, "file" : "bottomRight.png"}, //001000 -> 08
|
||||||
|
{ "frame" : 05, "file" : "bottomLeft.png"}, //010000 -> 16
|
||||||
|
{ "frame" : 06, "file" : "left.png"}, //100000 -> 32
|
||||||
|
|
||||||
|
// load double edges
|
||||||
|
{ "frame" : 07, "file" : "top.png"}, //000011 -> 03
|
||||||
|
{ "frame" : 08, "file" : "bottom.png"}, //011000 -> 24
|
||||||
|
{ "frame" : 09, "file" : "topRightHalfCorner.png"}, //000110 -> 06
|
||||||
|
{ "frame" : 10, "file" : "bottomRightHalfCorner.png"}, //001100 -> 12
|
||||||
|
{ "frame" : 11, "file" : "bottomLeftHalfCorner.png"}, //110000 -> 48
|
||||||
|
{ "frame" : 12, "file" : "topLeftHalfCorner.png"}, //100001 -> 33
|
||||||
|
|
||||||
|
// load halves
|
||||||
|
{ "frame" : 13, "file" : "rightHalf.png"}, //001110 -> 14
|
||||||
|
{ "frame" : 14, "file" : "leftHalf.png"}, //110001 -> 49
|
||||||
|
|
||||||
|
// load corners
|
||||||
|
{ "frame" : 15, "file" : "topRightCorner.png"}, //000111 -> 07
|
||||||
|
{ "frame" : 16, "file" : "bottomRightCorner.png"}, //011100 -> 28
|
||||||
|
{ "frame" : 17, "file" : "bottomLeftCorner.png"}, //111000 -> 56
|
||||||
|
{ "frame" : 18, "file" : "topLeftCorner.png"} //100011 -> 35
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -29,6 +29,7 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../adventureMap/CInGameConsole.h"
|
#include "../adventureMap/CInGameConsole.h"
|
||||||
|
#include "../client/render/CAnimation.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
#include "../../lib/BattleFieldHandler.h"
|
#include "../../lib/BattleFieldHandler.h"
|
||||||
@@ -36,6 +37,76 @@
|
|||||||
#include "../../lib/CStack.h"
|
#include "../../lib/CStack.h"
|
||||||
#include "../../lib/spells/ISpellMechanics.h"
|
#include "../../lib/spells/ISpellMechanics.h"
|
||||||
|
|
||||||
|
namespace HexMasks
|
||||||
|
{
|
||||||
|
// mask definitions that has set to 1 the edges present in the hex edges highlight image
|
||||||
|
/*
|
||||||
|
/\
|
||||||
|
0 1
|
||||||
|
/ \
|
||||||
|
| |
|
||||||
|
5 2
|
||||||
|
| |
|
||||||
|
\ /
|
||||||
|
4 3
|
||||||
|
\/
|
||||||
|
*/
|
||||||
|
enum HexEdgeMasks {
|
||||||
|
empty = 0b000000, // empty used when wanting to keep indexes the same but no highlight should be displayed
|
||||||
|
topLeft = 0b000001,
|
||||||
|
topRight = 0b000010,
|
||||||
|
right = 0b000100,
|
||||||
|
bottomRight = 0b001000,
|
||||||
|
bottomLeft = 0b010000,
|
||||||
|
left = 0b100000,
|
||||||
|
|
||||||
|
top = 0b000011,
|
||||||
|
bottom = 0b011000,
|
||||||
|
topRightHalfCorner = 0b000110,
|
||||||
|
bottomRightHalfCorner = 0b001100,
|
||||||
|
bottomLeftHalfCorner = 0b110000,
|
||||||
|
topLeftHalfCorner = 0b100001,
|
||||||
|
|
||||||
|
rightHalf = 0b001110,
|
||||||
|
leftHalf = 0b110001,
|
||||||
|
|
||||||
|
topRightCorner = 0b000111,
|
||||||
|
bottomRightCorner = 0b011100,
|
||||||
|
bottomLeftCorner = 0b111000,
|
||||||
|
topLeftCorner = 0b100011
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<int, int> hexEdgeMaskToFrameIndex;
|
||||||
|
|
||||||
|
void initializeHexEdgeMaskToFrameIndex()
|
||||||
|
{
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::empty] = 0;
|
||||||
|
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topLeft] = 1;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topRight] = 2;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::right] = 3;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomRight] = 4;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomLeft] = 5;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::left] = 6;
|
||||||
|
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::top] = 7;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottom] = 8;
|
||||||
|
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topRightHalfCorner] = 9;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomRightHalfCorner] = 10;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomLeftHalfCorner] = 11;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topLeftHalfCorner] = 12;
|
||||||
|
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::rightHalf] = 13;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::leftHalf] = 14;
|
||||||
|
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topRightCorner] = 15;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomRightCorner] = 16;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::bottomLeftCorner] = 17;
|
||||||
|
hexEdgeMaskToFrameIndex[HexMasks::topLeftCorner] = 18;
|
||||||
|
}
|
||||||
|
|
||||||
BattleFieldController::BattleFieldController(BattleInterface & owner):
|
BattleFieldController::BattleFieldController(BattleInterface & owner):
|
||||||
owner(owner)
|
owner(owner)
|
||||||
{
|
{
|
||||||
@@ -50,32 +121,10 @@ BattleFieldController::BattleFieldController(BattleInterface & owner):
|
|||||||
attackCursors = std::make_shared<CAnimation>("CRCOMBAT");
|
attackCursors = std::make_shared<CAnimation>("CRCOMBAT");
|
||||||
attackCursors->preload();
|
attackCursors->preload();
|
||||||
|
|
||||||
// load single edges
|
fullDamageRangeLimitImages = std::make_unique<CAnimation>("battle/rangeHighlights/rangeHighlightsGreen.json");
|
||||||
fullDamageRangeLimitImages[0b000001] = IImage::createFromFile("rangeHighlights/green/topLeft.PNG", EImageBlitMode::COLORKEY);
|
fullDamageRangeLimitImages->preload();
|
||||||
fullDamageRangeLimitImages[0b000010] = IImage::createFromFile("rangeHighlights/green/topRight.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b000100] = IImage::createFromFile("rangeHighlights/green/right.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b001000] = IImage::createFromFile("rangeHighlights/green/bottomRight.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b010000] = IImage::createFromFile("rangeHighlights/green/bottomLeft.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b100000] = IImage::createFromFile("rangeHighlights/green/left.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
|
|
||||||
// load double edges
|
initializeHexEdgeMaskToFrameIndex();
|
||||||
fullDamageRangeLimitImages[0b000011] = IImage::createFromFile("rangeHighlights/green/top.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b011000] = IImage::createFromFile("rangeHighlights/green/bottom.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
|
|
||||||
fullDamageRangeLimitImages[0b000110] = IImage::createFromFile("rangeHighlights/green/topRightHalfCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b001100] = IImage::createFromFile("rangeHighlights/green/bottomRightHalfCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b110000] = IImage::createFromFile("rangeHighlights/green/bottomLeftHalfCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b100001] = IImage::createFromFile("rangeHighlights/green/topLeftHalfCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
|
|
||||||
// load halves
|
|
||||||
fullDamageRangeLimitImages[0b001110] = IImage::createFromFile("rangeHighlights/green/rightHalf.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b110001] = IImage::createFromFile("rangeHighlights/green/leftHalf.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
|
|
||||||
// load corners
|
|
||||||
fullDamageRangeLimitImages[0b000111] = IImage::createFromFile("rangeHighlights/green/topRightCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b011100] = IImage::createFromFile("rangeHighlights/green/bottomRightCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b111000] = IImage::createFromFile("rangeHighlights/green/bottomLeftCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
fullDamageRangeLimitImages[0b100011] = IImage::createFromFile("rangeHighlights/green/topLeftCorner.PNG", EImageBlitMode::COLORKEY);
|
|
||||||
|
|
||||||
if(!owner.siegeController)
|
if(!owner.siegeController)
|
||||||
{
|
{
|
||||||
@@ -488,7 +537,7 @@ std::vector<std::shared_ptr<IImage>> BattleFieldController::calculateFullRangedD
|
|||||||
mask.set(direction);
|
mask.set(direction);
|
||||||
|
|
||||||
uint8_t imageKey = static_cast<uint8_t>(mask.to_ulong());
|
uint8_t imageKey = static_cast<uint8_t>(mask.to_ulong());
|
||||||
output.push_back(fullDamageRangeLimitImages[imageKey]);
|
output.push_back(fullDamageRangeLimitImages->getImage(hexEdgeMaskToFrameIndex[imageKey]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
@@ -32,8 +32,8 @@ class BattleFieldController : public CIntObject
|
|||||||
std::shared_ptr<IImage> cellBorder;
|
std::shared_ptr<IImage> cellBorder;
|
||||||
std::shared_ptr<IImage> cellUnitMovementHighlight;
|
std::shared_ptr<IImage> cellUnitMovementHighlight;
|
||||||
std::shared_ptr<IImage> cellUnitMaxMovementHighlight;
|
std::shared_ptr<IImage> cellUnitMaxMovementHighlight;
|
||||||
|
|
||||||
std::shared_ptr<IImage> cellShade;
|
std::shared_ptr<IImage> cellShade;
|
||||||
|
std::unique_ptr<CAnimation> fullDamageRangeLimitImages;
|
||||||
|
|
||||||
std::shared_ptr<CAnimation> attackCursors;
|
std::shared_ptr<CAnimation> attackCursors;
|
||||||
|
|
||||||
|