瀏覽代碼

- fixed #982:
-- replaced 8to24 bilt with sdl blit
-- fixed alpha values for images loaded via SDL

Ivan Savenko 13 年之前
父節點
當前提交
c512069177

+ 3 - 3
client/BattleInterface/CBattleInterfaceClasses.cpp

@@ -700,9 +700,9 @@ void CStackQueue::StackBox::showAll(SDL_Surface * to)
 	{
 		graphics->blueToPlayersAdv(bg, my->owner);
 		//SDL_UpdateRect(bg, 0, 0, 0, 0);
-		SDL_Rect temp_rect = genRect(bg->h, bg->w, pos.x, pos.y);
-		CSDL_Ext::blit8bppAlphaTo24bpp(bg, NULL, to, &temp_rect);
-		//blitAt(bg, pos, to);
+		//SDL_Rect temp_rect = genRect(bg->h, bg->w, pos.x, pos.y);
+		//CSDL_Ext::blit8bppAlphaTo24bpp(bg, NULL, to, &temp_rect);
+		blitAt(bg, pos, to);
 		blitAt(graphics->bigImgs[my->getCreature()->idNumber], pos.x +9, pos.y + 1, to);
 		printAtMiddleLoc(makeNumberShort(my->count), pos.w/2, pos.h - 12, FONT_MEDIUM, Colors::Cornsilk, to);
 	}

+ 6 - 0
client/CBitmapHandler.cpp

@@ -170,6 +170,12 @@ SDL_Surface * BitmapHandler::loadBitmapFromLod(CLodHandler *lod, std::string fna
 		if (!ret)
 			tlog1<<"Failed to open "<<fname<<" via SDL_Image\n";
 		delete [] file;
+		if (ret->format->palette)
+		{
+			//set correct value for alpha\unused channel
+			for (int i=0; i< ret->format->palette->ncolors; i++)
+				ret->format->palette->colors[i].unused = 255;
+		}
 	}
 	return ret;
 }

+ 1 - 1
client/Graphics.cpp

@@ -171,7 +171,7 @@ void Graphics::loadPaletteAndColors()
 		col.r = pals[startPoint++];
 		col.g = pals[startPoint++];
 		col.b = pals[startPoint++];
-		col.unused = !pals[startPoint++];
+		col.unused = pals[startPoint++];
 		playerColorPalette[i] = col;
 	}
 

+ 1 - 1
client/UIFramework/SDL_Pixels.h

@@ -20,7 +20,7 @@ namespace Channels
 	struct channel_empty
 	{
 		static STRONG_INLINE void set(Uint8*, Uint8) {}
-		static STRONG_INLINE Uint8 get(const Uint8 *) { return 0;}
+		static STRONG_INLINE Uint8 get(const Uint8 *) { return 255;}
 	};
 
 	// channel which uses whole pixel