rnd-20010115-1-src
[rocksndiamonds.git] / src / libgame / system.c
index 8a5feabea7f532cc343c83acc8e1661b72f14c87..51b38c16862237ef181c707aacdc6e1a4eb19785 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2000 Artsoft Entertainment                      *
+* (c) 1994-2001 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -179,7 +179,7 @@ inline static int GetRealDepth(int depth)
 
 inline void InitVideoDisplay(void)
 {
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
   SDLInitVideoDisplay();
 #else
   X11InitVideoDisplay();
@@ -188,7 +188,11 @@ inline void InitVideoDisplay(void)
 
 inline void CloseVideoDisplay(void)
 {
-#if defined(TARGET_X11)
+  KeyboardAutoRepeatOn();
+
+#if defined(TARGET_SDL)
+  SDL_QuitSubSystem(SDL_INIT_VIDEO);
+#else
   if (display)
     XCloseDisplay(display);
 #endif
@@ -441,6 +445,8 @@ inline Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
 
 #if defined(TARGET_SDL)
   pixel = SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
+#elif defined(TARGET_ALLEGRO)
+  pixel = AllegroAllocColorCell(color_r << 8, color_g << 8, color_b << 8);
 #elif defined(TARGET_X11_NATIVE)
   XColor xcolor;
 
@@ -555,10 +561,8 @@ inline boolean ChangeVideoModeIfNeeded(boolean fullscreen)
 Bitmap *LoadImage(char *basename)
 {
   Bitmap *new_bitmap;
-  char filename[256];
-
-  sprintf(filename, "%s/%s/%s",
-         options.ro_base_directory, GRAPHICS_DIRECTORY, basename);
+  char *filename = getPath3(options.ro_base_directory, GRAPHICS_DIRECTORY,
+                           basename);
 
 #if defined(TARGET_SDL)
   new_bitmap = SDLLoadImage(filename);
@@ -566,6 +570,8 @@ Bitmap *LoadImage(char *basename)
   new_bitmap = X11LoadImage(filename);
 #endif
 
+  free(filename);
+
   return new_bitmap;
 }