rnd-20001129-2-src
[rocksndiamonds.git] / src / msdos.c
index 598aa5d2c5b3081c39b1cca2bd0514cacb96eb5d..960609df630896db53207cb3908c91fa2c0c4cb0 100644 (file)
@@ -12,7 +12,9 @@
 *  msdos.c                                                 *
 ***********************************************************/
 
-#ifdef MSDOS
+#include "platform.h"
+
+#if defined(PLATFORM_MSDOS)
 
 #include "main.h"
 #include "misc.h"
@@ -61,7 +63,7 @@ extern struct SoundControl emptySoundControl;
 
 static BITMAP *Read_PCX_to_AllegroBitmap(char *);
 
-static void allegro_drivers()
+static void allegro_init_drivers()
 {
   int i;
 
@@ -87,11 +89,17 @@ static void allegro_drivers()
 
   last_joystick_state = 0;
   joystick_event = FALSE;
+}
 
+static boolean allegro_init_audio()
+{
   reserve_voices(MAX_SOUNDS_PLAYING, 0);
+
   if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1)
     if (install_sound(DIGI_SB, MIDI_NONE, NULL) == -1)
-      sound_status = SOUND_OFF;
+      return FALSE;
+
+  return TRUE;
 }
 
 static boolean hide_mouse(Display *display, int x, int y,
@@ -294,7 +302,7 @@ Display *XOpenDisplay(char *display_name)
   BITMAP *mouse_bitmap = NULL;
   char *filename;
 
-  filename = getPath3(options.base_directory, GRAPHICS_DIRECTORY,
+  filename = getPath3(options.ro_base_directory, GRAPHICS_DIRECTORY,
                      MOUSE_FILENAME);
 
   mouse_bitmap = Read_PCX_to_AllegroBitmap(filename);
@@ -322,7 +330,7 @@ Display *XOpenDisplay(char *display_name)
   display->mouse_ptr = mouse_bitmap;
 
   allegro_init();
-  allegro_drivers();
+  allegro_init_drivers();
   set_color_depth(8);
 
   /* force Windows 95 to switch to fullscreen mode */
@@ -348,6 +356,11 @@ Window XCreateSimpleWindow(Display *display, Window parent, int x, int y,
   display->screens[display->default_screen].height = YRES;
 
   set_mouse_sprite(display->mouse_ptr);
+
+#if 0
+  set_mouse_sprite_focus(1, 1);
+#endif
+
   set_mouse_speed(1, 1);
   set_mouse_range(display->screens[display->default_screen].x + 1,
                  display->screens[display->default_screen].y + 1,
@@ -511,7 +524,10 @@ static BITMAP *Image_to_AllegroBitmap(Image *image)
 
   /* allocate new allegro bitmap structure */
   if ((bitmap = create_bitmap_ex(depth, image->width, image->height)) == NULL)
+  {
+    errno_pcx = PCX_NoMemory;
     return NULL;
+  }
 
   clear(bitmap);
 
@@ -594,7 +610,7 @@ int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename,
   BITMAP *bitmap;
 
   if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
-    return PCX_FileInvalid;
+    return errno_pcx;
 
   *pixmap = (Pixmap)bitmap;
   *pixmap_mask = (Pixmap)bitmap;
@@ -602,20 +618,6 @@ int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename,
   return PCX_Success;
 }
 
-int XpmReadFileToPixmap(Display *display, Drawable d, char *filename,
-                       Pixmap *pixmap_return, Pixmap *shapemask_return,
-                       XpmAttributes *attributes)
-{
-  BITMAP *bitmap;
-
-  if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
-    return XpmOpenFailed;
-
-  *pixmap_return = (Pixmap)bitmap;
-
-  return XpmSuccess;
-}
-
 int XReadBitmapFile(Display *display, Drawable d, char *filename,
                    unsigned int *width_return, unsigned int *height_return,
                    Pixmap *bitmap_return,
@@ -918,9 +920,19 @@ void XAutoRepeatOff(Display *display)
   keyboard_auto_repeat = FALSE;
 }
 
+boolean MSDOSOpenAudio(void)
+{
+  return allegro_init_audio();
+}
+
+boolean MSDOSCloseAudio(void)
+{
+  /* nothing to be done here */
+}
+
 void NetworkServer(int port, int serveronly)
 {
   Error(ERR_WARN, "networking not supported in DOS version");
 }
 
-#endif /* MSDOS */
+#endif /* PLATFORM_MSDOS */