rnd-20020601-1-src
[rocksndiamonds.git] / src / libgame / misc.c
index c59749ff92e94c71888d2dad04dc23d6d76df1cf..78a5d13e0938ea113457c11806326d41c19d9f95 100644 (file)
@@ -111,10 +111,12 @@ static void sleep_milliseconds(unsigned long milliseconds_delay)
 {
   boolean do_busy_waiting = (milliseconds_delay < 5 ? TRUE : FALSE);
 
+#if 0
 #if defined(PLATFORM_MSDOS)
   /* don't use select() to perform waiting operations under DOS
      environment; always use a busy loop for waiting instead */
   do_busy_waiting = TRUE;
+#endif
 #endif
 
   if (do_busy_waiting)
@@ -134,6 +136,8 @@ static void sleep_milliseconds(unsigned long milliseconds_delay)
   {
 #if defined(TARGET_SDL)
     SDL_Delay(milliseconds_delay);
+#elif defined(TARGET_ALLEGRO)
+    rest(milliseconds_delay);
 #else
     struct timeval delay;
 
@@ -1196,16 +1200,34 @@ boolean FileIsSound(char *basename)
 
 boolean FileIsMusic(char *basename)
 {
+  /* "music" can be a WAV (loop) file or (if compiled with SDL) a MOD file */
+
+  if (FileIsSound(basename))
+    return TRUE;
+
+#if defined(TARGET_SDL)
   if (strlen(basename) > 4 &&
       (strcmp(&basename[strlen(basename) - 4], ".mod") == 0 ||
        strcmp(&basename[strlen(basename) - 4], ".MOD") == 0 ||
        strncmp(basename, "mod.", 4) == 0 ||
        strncmp(basename, "MOD.", 4) == 0))
     return TRUE;
+#endif
 
   return FALSE;
 }
 
+boolean FileIsArtworkType(char *basename, int type)
+{
+  if ((type == TREE_TYPE_GRAPHICS_DIR && FileIsGraphic(basename)) ||
+      (type == TREE_TYPE_SOUNDS_DIR && FileIsSound(basename)) ||
+      (type == TREE_TYPE_MUSIC_DIR && FileIsMusic(basename)))
+    return TRUE;
+
+  return FALSE;
+}
+
+
 /* ========================================================================= */
 /* functions only needed for non-Unix (non-command-line) systems */
 /* ========================================================================= */