extended automatic tape playing modes
authorHolger Schemel <info@artsoft.org>
Sun, 21 Jun 2015 19:24:44 +0000 (21:24 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 21 Jun 2015 19:24:44 +0000 (21:24 +0200)
ChangeLog
src/init.c
src/main.c
src/main.h
src/tape.c

index 52c31379808a1688e2b703f446a9d1dc9a9edce0..00eea69a1ae883fa8e7ecefff57d0bdfd740a8a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-21
+       * extended automatic tape playing modes:
+         - "autotest" to automatically test tapes (this was "autoplay" before)
+         - "autoplay" to automatically play tapes (visibly)
+         - "autoffwd" to automatically play tapes (visibly, with maximum speed)
+
 2015-06-16
        * fixed and enhanced screen fading and background/border handling
 
index 629133e8e61451eecb2b347069aff99590931d57..42c4ce1b0c0cb28c46d32c2a5d28b0caafa8bef6 100644 (file)
@@ -4678,10 +4678,16 @@ void Execute_Command(char *command)
 
     exit(0);
   }
-  else if (strPrefix(command, "autoplay "))
+  else if (strPrefix(command, "autotest ") ||
+          strPrefix(command, "autoplay ") ||
+          strPrefix(command, "autoffwd "))
   {
     char *str_ptr = getStringCopy(&command[9]);        /* read command parameters */
 
+    global.autoplay_mode = (strPrefix(command, "autotest") ? AUTOPLAY_TEST :
+                           strPrefix(command, "autoplay") ? AUTOPLAY_PLAY :
+                           strPrefix(command, "autoffwd") ? AUTOPLAY_FFWD : 0);
+
     while (*str_ptr != '\0')                   /* continue parsing string */
     {
       /* cut leading whitespace from string, replace it by string terminator */
@@ -5217,6 +5223,15 @@ static void InitLevelInfo()
   LoadLevelInfo();                             /* global level info */
   LoadLevelSetup_LastSeries();                 /* last played series info */
   LoadLevelSetup_SeriesInfo();                 /* last played level info */
+
+  if (global.autoplay_leveldir &&
+      global.autoplay_mode != AUTOPLAY_TEST)
+  {
+    leveldir_current = getTreeInfoFromIdentifier(leveldir_first,
+                                                 global.autoplay_leveldir);
+    if (leveldir_current == NULL)
+      leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
+  }
 }
 
 static void InitLevelArtworkInfo()
index aa45c472d7e1f2909e0e405fc69c1e811bc915ad..af4bcd34a58b0f218827a87756f8b6152296cffc 100644 (file)
@@ -5579,7 +5579,9 @@ static void print_usage()
        "  \"print helptext.conf\"            print default helptext config\n"
        "  \"dump level FILE\"                dump level data from FILE\n"
        "  \"dump tape FILE\"                 dump tape data from FILE\n"
+       "  \"autotest LEVELDIR [NR ...]\"     test level tapes for LEVELDIR\n"
        "  \"autoplay LEVELDIR [NR ...]\"     play level tapes for LEVELDIR\n"
+       "  \"autoffwd LEVELDIR [NR ...]\"     ffwd level tapes for LEVELDIR\n"
        "  \"convert LEVELDIR [NR]\"          convert levels in LEVELDIR\n"
        "  \"create images DIRECTORY\"        write BMP images to DIRECTORY\n"
        "  \"create CE image DIRECTORY\"      write BMP image to DIRECTORY\n"
index faf24a99a057b426d5411c8f517246d260bfabfa..63eacc0167c4621eb686a402301506efd22dd14f 100644 (file)
 
 #define NUM_ENGINE_TYPES               4
 
+/* values for automatically playing tapes */
+#define AUTOPLAY_TEST                  0
+#define AUTOPLAY_PLAY                  1
+#define AUTOPLAY_FFWD                  2
+
 
 struct BorderInfo
 {
@@ -2516,6 +2521,7 @@ struct GlobalInfo
   char *autoplay_leveldir;
   int autoplay_level[MAX_TAPES_PER_SET];
   boolean autoplay_all;
+  boolean autoplay_mode;
 
   char *convert_leveldir;
   int convert_level_nr;
index 4ff0c9687de9577369e54cbb935b61605ed562d5..58159cc5cb35058e0f5ba8ec3f5de6b0f6db1cd1 100644 (file)
@@ -1197,7 +1197,12 @@ void AutoPlayTape()
     printf("playing tape ... ");
 
     TapeStartGamePlaying();
-    TapeStartWarpForward();
+
+    if (global.autoplay_mode == AUTOPLAY_FFWD)
+      tape.fast_forward = TRUE;
+
+    if (global.autoplay_mode != AUTOPLAY_PLAY)
+      TapeStartWarpForward();
 
     return;
   }