mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-10 00:43:59 +02:00
fix image generation
This commit is contained in:
parent
443bcf6d50
commit
1c715e39ba
@ -369,20 +369,20 @@ void AssetGenerator::createPaletteShiftedSprites()
|
|||||||
auto anim = GH.renderHandler().loadAnimation(filename, EImageBlitMode::COLORKEY);
|
auto anim = GH.renderHandler().loadAnimation(filename, EImageBlitMode::COLORKEY);
|
||||||
for(int j = 0; j < anim->size(); j++)
|
for(int j = 0; j < anim->size(); j++)
|
||||||
{
|
{
|
||||||
int counter = 0;
|
for(int l = 0; l < 11; l++)
|
||||||
for(int k = 0; k < paletteAnimations[i].size(); k++)
|
|
||||||
{
|
{
|
||||||
auto element = paletteAnimations[i][k];
|
std::string filenameNew = "sprites/" + sprite + "_Shifted" + "/" + sprite + boost::str(boost::format("%02d") % j) + "_" + std::to_string(l) + ".png";
|
||||||
int length = std::holds_alternative<TerrainPaletteAnimation>(element) ? std::get<TerrainPaletteAnimation>(element).length : std::get<RiverPaletteAnimation>(element).length;
|
ResourcePath savePath(filenameNew, EResType::IMAGE);
|
||||||
for(int l = 0; l < length; l++)
|
|
||||||
|
if(!CResourceHandler::get("local")->createResource(filenameNew))
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto imgLoc = anim->getImageLocator(j, 0);
|
||||||
|
imgLoc.scalingFactor = 1;
|
||||||
|
auto img = GH.renderHandler().loadImage(imgLoc, EImageBlitMode::COLORKEY);
|
||||||
|
for(int k = 0; k < paletteAnimations[i].size(); k++)
|
||||||
{
|
{
|
||||||
std::string filenameNew = "sprites/" + sprite + "_Shifted" + "/" + sprite + boost::str(boost::format("%02d") % j) + "_" + std::to_string(counter) + ".png";
|
auto element = paletteAnimations[i][k];
|
||||||
ResourcePath savePath(filenameNew, EResType::IMAGE);
|
|
||||||
|
|
||||||
if(!CResourceHandler::get("local")->createResource(filenameNew))
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto img = anim->getImage(j);
|
|
||||||
if(std::holds_alternative<TerrainPaletteAnimation>(element))
|
if(std::holds_alternative<TerrainPaletteAnimation>(element))
|
||||||
{
|
{
|
||||||
auto tmp = std::get<TerrainPaletteAnimation>(element);
|
auto tmp = std::get<TerrainPaletteAnimation>(element);
|
||||||
@ -393,11 +393,8 @@ void AssetGenerator::createPaletteShiftedSprites()
|
|||||||
auto tmp = std::get<RiverPaletteAnimation>(element);
|
auto tmp = std::get<RiverPaletteAnimation>(element);
|
||||||
img->shiftPalette(tmp.start, tmp.length, l);
|
img->shiftPalette(tmp.start, tmp.length, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
img->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePath));
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
}
|
}
|
||||||
|
img->exportBitmap(*CResourceHandler::get("local")->getResourceName(savePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,6 @@ private:
|
|||||||
void printError(size_t frame, size_t group, std::string type) const;
|
void printError(size_t frame, size_t group, std::string type) const;
|
||||||
|
|
||||||
std::shared_ptr<IImage> getImageImpl(size_t frame, size_t group=0, bool verbose=true);
|
std::shared_ptr<IImage> getImageImpl(size_t frame, size_t group=0, bool verbose=true);
|
||||||
|
|
||||||
ImageLocator getImageLocator(size_t frame, size_t group) const;
|
|
||||||
public:
|
public:
|
||||||
CAnimation(const AnimationPath & Name, std::map<size_t, std::vector <ImageLocator> > layout, EImageBlitMode mode);
|
CAnimation(const AnimationPath & Name, std::map<size_t, std::vector <ImageLocator> > layout, EImageBlitMode mode);
|
||||||
~CAnimation();
|
~CAnimation();
|
||||||
@ -74,5 +72,7 @@ public:
|
|||||||
void playerColored(PlayerColor player);
|
void playerColored(PlayerColor player);
|
||||||
|
|
||||||
void createFlippedGroup(const size_t sourceGroup, const size_t targetGroup);
|
void createFlippedGroup(const size_t sourceGroup, const size_t targetGroup);
|
||||||
|
|
||||||
|
ImageLocator getImageLocator(size_t frame, size_t group) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user