Permalink
Browse files

GLVideoDriver: Improved magic effects

  • Loading branch information...
1 parent 094f3a0 commit 0927698506e9d1880f5231096f34064800a9d2c9 @BehoIder BehoIder committed with lynxlynxlynx Feb 24, 2014
Showing with 13 additions and 5 deletions.
  1. +7 −4 gemrb/plugins/SDLVideo/GLPaletteManager.cpp
  2. +6 −1 gemrb/plugins/SDLVideo/SDL20GLVideo.cpp
@@ -40,14 +40,17 @@ GLuint GLPaletteManager::CreatePaletteTexture(Palette* palette, unsigned int col
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
Color* colors = new Color[256];
memcpy(colors, palette->col, sizeof(Color)*256);
- for (unsigned int i=0; i<256; i++)
+ if (!palette->alpha)
{
- if (colors[i].a == 0)
+ for (unsigned int i=0; i<256; i++)
{
- colors[i].a = 0xFF;
+ if (colors[i].a == 0)
+ {
+ colors[i].a = 0xFF;
+ }
}
- if (i == colorKey) colors[i].a = 0;
}
+ colors[colorKey].a = 0;
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#ifdef USE_GL
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
@@ -531,6 +531,8 @@ void GLVideoDriver::BlitGameSprite(const Sprite2D* spr, int x, int y, unsigned i
}
}
+
+
if(glSprite->IsPaletted())
{
if (cover)
@@ -567,7 +569,10 @@ void GLVideoDriver::BlitGameSprite(const Sprite2D* spr, int x, int y, unsigned i
}
}
- blitSprite(glSprite, tx, ty, clip, palette, flags, &tint);
+ if (tint.r == tint.g == tint.b == 0)
+ blitSprite(glSprite, tx, ty, clip, palette, flags);
+ else
+ blitSprite(glSprite, tx, ty, clip, palette, flags, &tint);
if (coverTexture != 0)
{
glActiveTexture(GL_TEXTURE2);

0 comments on commit 0927698

Please sign in to comment.