mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	| @@ -153,15 +153,34 @@ void AdventureMapInterface::deactivate() | ||||
| void AdventureMapInterface::showAll(Canvas & to) | ||||
| { | ||||
| 	CIntObject::showAll(to); | ||||
| 	dim(to); | ||||
| 	LOCPLINT->cingconsole->show(to); | ||||
| } | ||||
|  | ||||
| void AdventureMapInterface::show(Canvas & to) | ||||
| { | ||||
| 	CIntObject::show(to); | ||||
| 	dim(to); | ||||
| 	LOCPLINT->cingconsole->show(to); | ||||
| } | ||||
|  | ||||
| void AdventureMapInterface::dim(Canvas & to) | ||||
| { | ||||
| 	for (auto window : GH.windows().findWindows<IShowActivatable>()) | ||||
| 	{ | ||||
| 		std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window); | ||||
| 		if (!casted && !window->isPopupWindow()) | ||||
| 		{ | ||||
| 			int backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer(); | ||||
| 			Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y); | ||||
| 			ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255)); | ||||
| 			if(backgroundDimLevel > 0) | ||||
| 				to.drawColor(targetRect, colorToFill); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void AdventureMapInterface::tick(uint32_t msPassed) | ||||
| { | ||||
| 	handleMapScrollingUpdate(msPassed); | ||||
|   | ||||
| @@ -89,6 +89,9 @@ private: | ||||
| 	/// casts current spell at specified location | ||||
| 	void performSpellcasting(const int3 & castTarget); | ||||
|  | ||||
| 	/// dim interface if some windows opened | ||||
| 	void dim(Canvas & to); | ||||
|  | ||||
| protected: | ||||
| 	/// CIntObject interface implementation | ||||
|  | ||||
|   | ||||
| @@ -93,7 +93,7 @@ public: | ||||
| 	/// renders multiple lines of text with specified parameters | ||||
| 	void drawText(const Point & position, const EFonts & font, const ColorRGBA & colorDest, ETextAlignment alignment, const std::vector<std::string> & text ); | ||||
|  | ||||
| 	/// fills selected area with solid color, ignoring any transparency | ||||
| 	/// fills selected area with solid color | ||||
| 	void drawColor(const Rect & target, const ColorRGBA & color); | ||||
|  | ||||
| 	/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished. | ||||
|   | ||||
| @@ -804,7 +804,10 @@ void CSDL_Ext::fillRect( SDL_Surface *dst, const Rect & dstrect, const SDL_Color | ||||
| 	SDL_Rect newRect = CSDL_Ext::toSDL(dstrect); | ||||
|  | ||||
| 	uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a); | ||||
| 	SDL_FillRect(dst, &newRect, sdlColor); | ||||
| 	SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask); | ||||
| 	SDL_FillRect(tmp, NULL, sdlColor); | ||||
| 	SDL_BlitSurface(tmp, NULL, dst, &newRect); | ||||
| 	SDL_FreeSurface(tmp); | ||||
| } | ||||
|  | ||||
| STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color) | ||||
|   | ||||
| @@ -226,7 +226,7 @@ | ||||
| 			"type" : "object", | ||||
| 			"additionalProperties" : false, | ||||
| 			"default" : {}, | ||||
| 			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging" ], | ||||
| 			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel" ], | ||||
| 			"properties" : { | ||||
| 				"heroMoveTime" : { | ||||
| 					"type" : "number", | ||||
| @@ -274,7 +274,11 @@ | ||||
| 				"smoothDragging" : { | ||||
| 					"type" : "boolean", | ||||
| 					"default" : true | ||||
| 				} | ||||
| 				}, | ||||
| 				"backgroundDimLevel" : { | ||||
| 					"type" : "number", | ||||
| 					"default" : 128 | ||||
| 				}, | ||||
| 			} | ||||
| 		}, | ||||
| 		"battle" : { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user