Package: rocksndiamonds
Version: 3.3.0.1+dfsg1-2.2
Severity: wishlist
Tags: patch

Hi,

on the Rocks'n'Diamonds homepage there are additional levelsets available for 
download. The attached patch adds the additional levelsets to the download 
script and also updates the download for Emerald Mine Club.

Thanks

Andreas
Added downloads for 15 new levelsets.

--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@
 Conflicts: rocksndiamonds-data, rocksndiamonds-zelda, rocks-n-diamonds
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
- perl-modules, p7zip, wget, unzip
+ perl-modules, p7zip, wget, unzip, zip
 Description: arcade-style game
  This package provides the game engine for Rocks'n'Diamonds, an arcade
  game in the tradition of "Boulder Dash", "Emerald Mine", "Supaplex",
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -11,6 +11,7 @@
 umask 022;
 our $pkg="rocksndiamonds";
 our $game_dir="/usr/share/games/$pkg";
+our $oldout;
 our %info=
 (
   'Base games' =>
@@ -40,8 +41,8 @@
   'Emerald Mine Club' =>
   {
     url =>
-      'http://www.artsoft.org/RELEASES/rocksndiamonds/levels/Emerald_Mine_Club-2.0.0.7z',
-    md5 => '4276673a791c66747a438a3a94d20121',
+      'http://www.artsoft.org/RELEASES/rocksndiamonds/levels/Emerald_Mine_Club-2.1.1.7z',
+    md5 => '11437b4a7a2731449dcd3aff50fa7737',
     topdir => 'Emerald_Mine_Club',
   },
 
@@ -92,6 +93,171 @@
     md5 => 'fbc250f7995c666c1c745dbaf591ce32',
     topdir => 'levels/DX_Boulderdash',
   },
+
+  'Sokoban' =>
+  {
+    url =>
+      'http://www.artsoft.org/RELEASES/rocksndiamonds/levels/Sokoban-1.0.0.7z',
+    md5 => '2d34a14fbee9f62a8d8bec9fdb333ec6',
+    topdir => 'Sokoban',
+  },
+
+  'Tutorial Alpha' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/r-structure.zip',
+    md5 => '6ad651c8f04994d557c241a790babe16',
+    topdir => 'levels/Tutorials/Tutorial Alpha',
+  },
+
+  'Earth 3120' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/earth_3120.zip',
+    md5 => '3e6ada1f672b08df9cb348d54df5c2e0',
+    topdir => 'levels/Richard/Earth 3120',
+    graphics => {
+      requires => 'eem',
+      section => 'Dependency: r-graphics',
+    },
+    sounds => {
+      requires => 'eem',
+      section => 'Dependency: r-sounds',
+    },
+  },
+
+  'Enhanced Emerald Mine' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/eem.zip',
+    md5 => 'a5a9c997c702b544026986668b7e7186',
+    topdir => 'levels/Richard',
+    graphics => {
+      requires => 'eem',
+      section => 'Dependency: r-graphics',
+    },
+    sounds => {
+      requires => 'eem',
+      section => 'Dependency: r-sounds',
+    },
+  },
+
+  'Might of Elementals' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/might_of_elementals.zip',
+    md5 => '54f647dadcd5aa39db1c836dd03d6af4',
+    topdir => 'levels/Richard',
+  },
+
+  'Secret Command' =>	
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/mod_secret_command.zip',
+    md5 => '9d72ad5c4ee4d5fde7868d3ef304182d',
+    topdir => 'levels/Modules/Secret Command',
+  },
+
+  'Natural' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/natural.zip',
+    md5 => '11409200f7edd721a9e11dd188604930',
+    topdir => 'levels/Richard/Natural',
+    graphics => {
+      requires => 'natural',
+      section => 'Dependency: r-graphics',
+    },
+    sounds => {
+      requires => 'natural',
+      section => 'Dependency: r-sounds',
+    },
+  },
+
+  'World of Amoeba' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/world_of_amoeba.zip',
+    md5 => 'fa264ac9f298afe57f8c78ecea96a369',
+    topdir => 'levels/Richard/World of Amoeba',
+  },
+
+  'Some Levels' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/r-old.zip',
+    md5 => '49417b50bf9b954f9691294583176f90',
+    topdir => 'levels/Richard',
+    graphics => {
+      requires => 'vulcano',
+      section => 'Dependency: r-graphics',
+    },
+  },
+
+  'Dependency: r-graphics' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/r-graphics.zip',
+    md5 => '174eba719c19243ea46e3010596d3a18',
+    topdir => '',
+  },
+
+  'Dependency: r-sounds' =>
+  {
+    url =>
+      'http://www.artsoft.org/rocksndiamonds/levels/richardkleber/RnD/r-sounds.zip',
+    md5 => '0d18d4b2117be8150d383f6103c9106e',
+    topdir => '',
+  },
+
+  'Walpurgis World' =>
+  {
+    url =>
+      'https://web.archive.org/web/20110101150015/http://home.freeuk.net/jamiecullen/zips/ww_v1-0.zip',
+    md5 => 'd81fdfd41e83124d23bb1fbd343f5e53',
+    topdir => 'Walpurgis World',
+  },
+
+  'Walpurgis Gardens' =>
+  {
+    url =>
+      'https://web.archive.org/web/20110101150015/http://home.freeuk.net/jamiecullen/zips/wg_v1-0.zip',
+    md5 => '5cc90787e89b69275b3662e4bbe5ff2e',
+    topdir => 'Walpurgis Gardens',
+  },
+
+  'Walpurgis Flashbacks' =>
+  {
+    url =>
+      'https://web.archive.org/web/20110101150015/http://home.freeuk.net/jamiecullen/zips/wf_v1-3.zip',
+    md5 => 'fe9066ed9fd2d4600cdb99d210402c4f',
+    topdir => 'Walpurgis Flashbacks',
+  },
+
+  'Earth Shaker' =>
+  {
+    url =>
+      'https://web.archive.org/web/20110101150015/http://home.freeuk.net/jamiecullen/zips/es_b_v1-2.zip',
+    md5 => '88f8c700d6689cda0ad9fe3486307168',
+    topdir => 'Earth Shaker Old Set B',
+  },
+
+  'Earth Shaker Explosions' =>
+  {
+    url =>
+      'https://web.archive.org/web/20110101150015/http://home.freeuk.net/jamiecullen/zips/ese_v1-1.zip',
+    md5 => 'f1efe6f8f88a368744eb0ba99db1df7b',
+    topdir => 'Earth Shaker Explosions',
+  },
+
+  'rnd_jue' =>
+  {
+    url =>
+      'http://www.jb-line.de/hp/rnd_jue-v8.zip',
+    md5 => '330c6eb97cf19f4dbed6e6f21a783c06',
+    topdir => 'rnd_jue',
+  },
+
 );
 
 # execute shell command
@@ -108,6 +274,34 @@
     return 1;
 }
 
+# install section
+sub install_section($)
+{
+    my $section=shift;
+
+    unless (exists $info{$section}{url})
+    {
+        print "Unknown key: $section\n";
+        return;
+    }
+
+    my $file=(split /\//, $info{$section}{url})[-1];
+
+    unless (-f "$game_dir/downloads/$file")
+    {
+        unless(cmd_execute("wget -c -P $game_dir/downloads $info{$section}{url}"))
+        {
+            open STDOUT, ">&", $oldout;
+            fset "$pkg/error_download", "seen", "false";
+            input "critical", "$pkg/error_download";
+            go;
+            stop;
+            exit 0;
+        }
+    }
+    install_file("$game_dir/downloads/$file", $section);
+}
+
 # install game data
 sub install_file($$)
 {
@@ -117,7 +311,13 @@
     my $tempdir=File::Temp::tempdir(CLEANUP=>1);
 
     my $cmd;
-    if ($file =~ /zip$/i )
+    if ($section =~ /rnd_jue/)
+    {
+        # fix Windows path names in zip file (required by rnd_jue)
+        cmd_execute "zip -FF $file --out $tempdir/fixed_rnd_jue.zip >/dev/null";
+        $cmd="unzip -q $tempdir/fixed_rnd_jue.zip -d $tempdir";
+    }
+    elsif ($file =~ /zip$/i )
     {
         $cmd="unzip -q $file -d $tempdir";
     }
@@ -147,6 +347,14 @@
         cmd_execute "cp -r $tempdir/$topdir/$_ $game_dir"
             for (qw(graphics levels music sounds));
     }
+    elsif ($section =~ /^Dependency:/i)
+    {
+        for (qw(graphics music sounds))
+        {
+            -d "$tempdir/$topdir/$_" and
+                cmd_execute "cp -r $tempdir/$topdir/$_ $game_dir";
+        }
+    }
     else
     {
         -d "$game_dir/levels" or
@@ -154,7 +362,42 @@
         -d "$game_dir/levels/$section" and 
             cmd_execute "rm -fr \"$game_dir/levels/$section\"";
         cmd_execute "mkdir \"$game_dir/levels/$section\"";
-        cmd_execute "mv -f $tempdir/$topdir/* \"$game_dir/levels/$section\"";
+        cmd_execute "mv -f \"$tempdir/$topdir\"/* \"$game_dir/levels/$section\"";
+
+        # create levelinfo.conf if missing
+        # (required by Enhanced Emerald Mine, Might of Elementals and Some Levels)
+        unless (-e "$game_dir/levels/$section/levelinfo.conf")
+        {
+           open(FH, '>', "$game_dir/levels/$section/levelinfo.conf")
+                or die "Can not open file $game_dir/levels/$section/levelinfo.conf: $!\n";
+            printf FH "file_identifier:  ROCKSNDIAMONDS_LEVELINFO_FILE_VERSION_1.2\n";
+            printf FH "name:             $section\n";
+            printf FH "sort_priority:    500\n";
+            printf FH "level_group:      true\n";
+            close FH;
+        }
+
+        # copy graphics, music and sounds directories if not covered by $topdir
+        # (required by Might of Elementals and Secret Command)
+        if (length $topdir)
+        {
+            for (qw(graphics music sounds))
+                {
+                    -d "$tempdir/$_" and
+                        cmd_execute "cp -r $tempdir/$_/* $game_dir/$_";
+                }
+        }
+
+        # resolve dependencies
+        # (required by Earth 3120, Enhanced Emerald Mine, Natural and Some Levels)
+        for (qw(graphics music sounds))
+        {
+            if (exists $info{$section}{$_})
+            {
+                install_section($info{$section}{$_}{section})
+                    unless (-d "$game_dir/$_/$info{$section}{$_}{requires}");
+            }
+        }
     }
 
     cmd_execute 'rm', '-fr', $tempdir;
@@ -226,7 +469,7 @@
 # select downloading
 my @sel=split /\s*,\s*/, get("$pkg/select_games");
 
-open my $oldout, ">&STDOUT";
+open $oldout, ">&STDOUT";
 open STDOUT, ">&STDERR";
 
 unless (-d "$game_dir/downloads")
@@ -239,29 +482,7 @@
 }
 clean_downloads_dir();
 
-for my $what ('Base games', @sel)
-{
-    unless (exists $info{$what}{url})
-    {
-        print "Unknown key: $what\n";
-        next;
-    }
-
-    my $file=(split /\//, $info{$what}{url})[-1];
-
-    unless (-f "$game_dir/downloads/$file")
-    {
-        unless(cmd_execute("wget -c -P $game_dir/downloads $info{$what}{url}"))
-        {
-            open STDOUT, ">&", $oldout;
-            fset "$pkg/error_download", "seen", "false";
-            input "critical", "$pkg/error_download";
-            go;
-            stop;
-            exit 0;
-        }
-    }
-    install_file("$game_dir/downloads/$file", $what);
-}
+install_section($_)
+    for ('Base games', @sel);
 __END__
 #DEBHELPER#
--- a/debian/templates
+++ b/debian/templates
@@ -17,7 +17,7 @@
 
 Template: rocksndiamonds/select_games
 Type: multiselect
-Choices: Legend Of Zelda, Legend Of Zelda II, Emerald Mine Club, Contributions 1995 - 2006, Snake Bite, BD2K3, BD Dream, Supaplex, DX-Boulderdash
+Choices: Legend Of Zelda, Legend Of Zelda II, Emerald Mine Club, Contributions 1995 - 2006, Snake Bite, BD2K3, BD Dream, Supaplex, DX-Boulderdash, Sokoban, Tutorial Alpha, Earth 3120, Enhanced Emerald Mine, Might of Elementals, Secret Command, Natural, World of Amoeba, Some Levels, Walpurgis World, Walpurgis Gardens, Walpurgis Flashbacks, Earth Shaker, Earth Shaker Explosions, rnd_jue
 _Description: Games to download data for:
 
 Template: rocksndiamonds/util_notfound

Reply via email to