mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Implemented generation of combat unit number window for xbrz mode
This commit is contained in:
parent
915533ed2e
commit
2d08e18f6a
@ -27,6 +27,7 @@
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../gui/WindowHandler.h"
|
||||
#include "../media/ISoundPlayer.h"
|
||||
#include "../render/AssetGenerator.h"
|
||||
#include "../render/Colors.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../render/IRenderHandler.h"
|
||||
@ -79,24 +80,12 @@ BattleStacksController::BattleStacksController(BattleInterface & owner):
|
||||
stackToActivate(nullptr),
|
||||
animIDhelper(0)
|
||||
{
|
||||
AssetGenerator::createCombatUnitNumberWindow();
|
||||
//preparing graphics for displaying amounts of creatures
|
||||
amountNormal = GH.renderHandler().loadImage(ImagePath::builtin("CMNUMWIN.BMP"), EImageBlitMode::COLORKEY);
|
||||
amountPositive = GH.renderHandler().loadImage(ImagePath::builtin("CMNUMWIN.BMP"), EImageBlitMode::COLORKEY);
|
||||
amountNegative = GH.renderHandler().loadImage(ImagePath::builtin("CMNUMWIN.BMP"), EImageBlitMode::COLORKEY);
|
||||
amountEffNeutral = GH.renderHandler().loadImage(ImagePath::builtin("CMNUMWIN.BMP"), EImageBlitMode::COLORKEY);
|
||||
|
||||
static const auto shifterNormal = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 0.6f, 0.2f, 1.0f );
|
||||
static const auto shifterPositive = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 0.2f, 1.0f, 0.2f );
|
||||
static const auto shifterNegative = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 1.0f, 0.2f, 0.2f );
|
||||
static const auto shifterNeutral = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 1.0f, 1.0f, 0.2f );
|
||||
|
||||
// do not change border color
|
||||
static const int32_t ignoredMask = 1 << 26;
|
||||
|
||||
amountNormal->adjustPalette(shifterNormal, ignoredMask);
|
||||
amountPositive->adjustPalette(shifterPositive, ignoredMask);
|
||||
amountNegative->adjustPalette(shifterNegative, ignoredMask);
|
||||
amountEffNeutral->adjustPalette(shifterNeutral, ignoredMask);
|
||||
amountNormal = GH.renderHandler().loadImage(ImagePath::builtin("combatUnitNumberWindowDefault"), EImageBlitMode::COLORKEY);
|
||||
amountPositive = GH.renderHandler().loadImage(ImagePath::builtin("combatUnitNumberWindowPositive"), EImageBlitMode::COLORKEY);
|
||||
amountNegative = GH.renderHandler().loadImage(ImagePath::builtin("combatUnitNumberWindowNegative"), EImageBlitMode::COLORKEY);
|
||||
amountEffNeutral = GH.renderHandler().loadImage(ImagePath::builtin("combatUnitNumberWindowNeutral"), EImageBlitMode::COLORKEY);
|
||||
|
||||
std::vector<const CStack*> stacks = owner.getBattle()->battleGetAllStacks(true);
|
||||
for(const CStack * s : stacks)
|
||||
|
@ -159,3 +159,44 @@ void AssetGenerator::createPlayerColoredBackground(const PlayerColor & player)
|
||||
texture->adjustPalette(filters[player.getNum()], 0);
|
||||
texture->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePath));
|
||||
}
|
||||
|
||||
void AssetGenerator::createCombatUnitNumberWindow()
|
||||
{
|
||||
std::string filenameToSave = "data/combatUnitNumberWindow";
|
||||
|
||||
ResourcePath savePathDefault(filenameToSave + "Default.png", EResType::IMAGE);
|
||||
ResourcePath savePathNeutral(filenameToSave + "Neutral.png", EResType::IMAGE);
|
||||
ResourcePath savePathPositive(filenameToSave + "Positive.png", EResType::IMAGE);
|
||||
ResourcePath savePathNegative(filenameToSave + "Negative.png", EResType::IMAGE);
|
||||
|
||||
if(CResourceHandler::get()->existsResource(savePathDefault)) // overridden by mod, no generation
|
||||
return;
|
||||
|
||||
if(!CResourceHandler::get("local")->createResource(savePathDefault.getOriginalName() + ".png") ||
|
||||
!CResourceHandler::get("local")->createResource(savePathNeutral.getOriginalName() + ".png") ||
|
||||
!CResourceHandler::get("local")->createResource(savePathPositive.getOriginalName() + ".png") ||
|
||||
!CResourceHandler::get("local")->createResource(savePathNegative.getOriginalName() + ".png"))
|
||||
return;
|
||||
|
||||
auto locator = ImageLocator(ImagePath::builtin("CMNUMWIN"));
|
||||
locator.scalingFactor = 1;
|
||||
|
||||
std::shared_ptr<IImage> texture = GH.renderHandler().loadImage(locator, EImageBlitMode::OPAQUE);
|
||||
|
||||
static const auto shifterNormal = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 0.6f, 0.2f, 1.0f );
|
||||
static const auto shifterPositive = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 0.2f, 1.0f, 0.2f );
|
||||
static const auto shifterNegative = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 1.0f, 0.2f, 0.2f );
|
||||
static const auto shifterNeutral = ColorFilter::genRangeShifter( 0.f, 0.f, 0.f, 1.0f, 1.0f, 0.2f );
|
||||
|
||||
// do not change border color
|
||||
static const int32_t ignoredMask = 1 << 26;
|
||||
|
||||
texture->adjustPalette(shifterNormal, ignoredMask);
|
||||
texture->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePathDefault));
|
||||
texture->adjustPalette(shifterPositive, ignoredMask);
|
||||
texture->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePathPositive));
|
||||
texture->adjustPalette(shifterNegative, ignoredMask);
|
||||
texture->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePathNegative));
|
||||
texture->adjustPalette(shifterNeutral, ignoredMask);
|
||||
texture->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePathNeutral));
|
||||
}
|
||||
|
@ -20,4 +20,5 @@ public:
|
||||
static void createAdventureOptionsCleanBackground();
|
||||
static void createBigSpellBook();
|
||||
static void createPlayerColoredBackground(const PlayerColor & player);
|
||||
static void createCombatUnitNumberWindow();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user