mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
- fixed some bugs with artifacts icons
This commit is contained in:
parent
3fbcf86dec
commit
1c0ccd2b02
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"art144":
|
"art144": // placeholder for selection image
|
||||||
{
|
{
|
||||||
"index" : 144,
|
"index" : 144,
|
||||||
"type" : ["HERO"]
|
"type" : ["HERO"]
|
||||||
},
|
},
|
||||||
"art145":
|
"art145": // placeholder for lock image
|
||||||
{
|
{
|
||||||
"index" : 145,
|
"index" : 145,
|
||||||
"type" : ["HERO"]
|
"type" : ["HERO"]
|
||||||
|
@ -157,15 +157,21 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
|
|||||||
// When modifyin anything here please check two use cases:
|
// When modifyin anything here please check two use cases:
|
||||||
// 1) Vampire mansion in Necropolis (not 1st color is transparent)
|
// 1) Vampire mansion in Necropolis (not 1st color is transparent)
|
||||||
// 2) Battle background when fighting on grass/dirt, topmost sky part (NO transparent color)
|
// 2) Battle background when fighting on grass/dirt, topmost sky part (NO transparent color)
|
||||||
|
// 3) New objects that may use 24-bit images for icons (e.g. witchking arts)
|
||||||
|
auto colorID = SDL_MapRGB(ret->format, 0, 255, 255);
|
||||||
|
|
||||||
if (ret->format->palette)
|
if (ret->format->palette)
|
||||||
{
|
{
|
||||||
auto colorID = SDL_MapRGB(ret->format, 0, 255, 255);
|
|
||||||
auto & color = ret->format->palette->colors[colorID];
|
auto & color = ret->format->palette->colors[colorID];
|
||||||
|
|
||||||
// set color key only if exactly such color was found
|
// set color key only if exactly such color was found
|
||||||
if (color.r == 0 && color.g == 255 && color.b == 255)
|
if (color.r == 0 && color.g == 255 && color.b == 255)
|
||||||
SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID);
|
SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID);
|
||||||
}
|
}
|
||||||
|
else // always set
|
||||||
|
{
|
||||||
|
SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,10 +199,10 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode
|
|||||||
{
|
{
|
||||||
auto object = loadFromJson(data);
|
auto object = loadFromJson(data);
|
||||||
object->id = ArtifactID(artifacts.size());
|
object->id = ArtifactID(artifacts.size());
|
||||||
if (object->id < ArtifactID::ART_SELECTION)
|
//if (object->id < ArtifactID::ART_SELECTION)
|
||||||
object->iconIndex = object->id;
|
object->iconIndex = object->id;
|
||||||
else
|
//else
|
||||||
object->iconIndex = object->id + 2;
|
// object->iconIndex = object->id + 2;
|
||||||
|
|
||||||
artifacts.push_back(object);
|
artifacts.push_back(object);
|
||||||
|
|
||||||
@ -213,10 +213,10 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode
|
|||||||
{
|
{
|
||||||
auto object = loadFromJson(data);
|
auto object = loadFromJson(data);
|
||||||
object->id = ArtifactID(index);
|
object->id = ArtifactID(index);
|
||||||
if (object->id < ArtifactID::ART_SELECTION)
|
//if (object->id < ArtifactID::ART_SELECTION)
|
||||||
object->iconIndex = object->id;
|
object->iconIndex = object->id;
|
||||||
else
|
//else
|
||||||
object->iconIndex = object->id + 2;
|
// object->iconIndex = object->id + 2;
|
||||||
|
|
||||||
assert(artifacts[index] == nullptr); // ensure that this id was not loaded before
|
assert(artifacts[index] == nullptr); // ensure that this id was not loaded before
|
||||||
artifacts[index] = object;
|
artifacts[index] = object;
|
||||||
|
Loading…
Reference in New Issue
Block a user