]> git.sesse.net Git - s573compress/commitdiff
In dwi2ssq, make sure to put the lighter step charts first.
authorSteinar H. Gunderson <steinar+ddr@gunderson.no>
Sat, 21 Dec 2019 22:35:14 +0000 (23:35 +0100)
committerSteinar H. Gunderson <steinar+ddr@gunderson.no>
Sat, 21 Dec 2019 22:35:14 +0000 (23:35 +0100)
dwi2ssq.pl

index 9a7accad149063703109b0494779a5f06ad480ee..d9c15faf9ff60f5079fd393daf1ac12635c9279e 100755 (executable)
@@ -20,6 +20,7 @@ my %difficulty_codes = (
        SINGLE_BASIC => 0x114,      # Standard/Light
        SINGLE_BEGINNER => 0x414    # Beginner
 );
+my %stepchart_text = ();
 
 while (<STDIN>) {
        chomp;
@@ -53,11 +54,19 @@ while (<STDIN>) {
                }
                $text =~ s/[\s\n;]//sg;
 
-               my $code = $difficulty_codes{'SINGLE_' . $difficulty};
-               push @stepcharts, make_stepchart_chunk($code, $text);  # Also updates $len_beats.
+               $stepchart_text{'SINGLE_' . $difficulty} = $text;
        }
 }
 
+# Append the step charts. The ordering matters; the first one in the file seems
+# to be chosen if beginner is unavailable.
+for my $code (qw(SINGLE_BEGINNER SINGLE_BASIC SINGLE_ANOTHER SINGLE_MANIAC)) {
+       next if (!exists($stepchart_text{$code}));
+
+       my $text = $stepchart_text{$code};
+       push @stepcharts, make_stepchart_chunk($difficulty_codes{$code}, $text);  # Also updates $len_beats.
+}
+
 # Add one measure of margin after the last step.
 $len_beats += 4.0;