mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	- fixed some bugs with artifacts icons
This commit is contained in:
		| @@ -1,10 +1,10 @@ | ||||
| { | ||||
| 	"art144": | ||||
| 	"art144": // placeholder for selection image | ||||
| 	{ | ||||
| 		"index" : 144, | ||||
| 		"type" : ["HERO"] | ||||
| 	}, | ||||
| 	"art145": | ||||
| 	"art145": // placeholder for lock image | ||||
| 	{ | ||||
| 		"index" : 145, | ||||
| 		"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: | ||||
| 	// 1) Vampire mansion in Necropolis (not 1st color is transparent) | ||||
| 	// 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) | ||||
| 	{ | ||||
| 		auto colorID = SDL_MapRGB(ret->format, 0, 255, 255); | ||||
| 		auto & color = ret->format->palette->colors[colorID]; | ||||
|  | ||||
| 		// set color key only if exactly such color was found | ||||
| 		if (color.r == 0 && color.g == 255 && color.b == 255) | ||||
| 			SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID); | ||||
| 	} | ||||
| 	else // always set | ||||
| 	{ | ||||
| 		SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID); | ||||
| 	} | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -199,10 +199,10 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode | ||||
| { | ||||
| 	auto object = loadFromJson(data); | ||||
| 	object->id = ArtifactID(artifacts.size()); | ||||
| 	if (object->id < ArtifactID::ART_SELECTION) | ||||
| 	//if (object->id < ArtifactID::ART_SELECTION) | ||||
| 		object->iconIndex = object->id; | ||||
| 	else | ||||
| 		object->iconIndex = object->id + 2; | ||||
| 	//else | ||||
| 	//	object->iconIndex = object->id + 2; | ||||
|  | ||||
| 	artifacts.push_back(object); | ||||
|  | ||||
| @@ -213,10 +213,10 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode | ||||
| { | ||||
| 	auto object = loadFromJson(data); | ||||
| 	object->id = ArtifactID(index); | ||||
| 	if (object->id < ArtifactID::ART_SELECTION) | ||||
| 	//if (object->id < ArtifactID::ART_SELECTION) | ||||
| 		object->iconIndex = object->id; | ||||
| 	else | ||||
| 		object->iconIndex = object->id + 2; | ||||
| 	//else | ||||
| 	//	object->iconIndex = object->id + 2; | ||||
|  | ||||
| 	assert(artifacts[index] == nullptr); // ensure that this id was not loaded before | ||||
| 	artifacts[index] = object; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user