minor change of initialization for EM engine caves
[rocksndiamonds.git] / src / libgame / sdl.c
index 7fb650f1b17e9d6070db72855db59cf9c5e34c61..04cfc0e739fbafa9ca8df4b92d94609e601ec28c 100644 (file)
@@ -353,6 +353,11 @@ SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
   if (new_surface == NULL)
     Error(ERR_EXIT, "SDL_ConvertSurface() failed: %s", SDL_GetError());
 
+  // workaround for a bug in SDL 2.0.12 (which does not convert the color key)
+  if (SDLHasColorKey(surface) && !SDLHasColorKey(new_surface))
+    SDL_SetColorKey(new_surface, SET_TRANSPARENT_PIXEL,
+                   SDLGetColorKey(surface));
+
   return new_surface;
 }
 
@@ -2524,7 +2529,7 @@ static void setJoystickButton(int nr, int button_id_raw, int button_state)
 
 void HandleJoystickEvent(Event *event)
 {
-  switch(event->type)
+  switch (event->type)
   {
     case SDL_CONTROLLERDEVICEADDED:
 #if DEBUG_JOYSTICKS