]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
more fixes for midi2cfg-ng
authorRudolf Polzer <divverent@alientrap.org>
Mon, 19 Sep 2011 10:07:18 +0000 (12:07 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 19 Sep 2011 10:07:18 +0000 (12:07 +0200)
misc/tools/midi2cfg-ng.conf
misc/tools/midi2cfg-ng.pl

index 637bb88dfcdb1d6341e9f7b68797bfad0a7e7e95..ca96f567ce00b43ca06d96f8bf0b9cecb47fd93f 100644 (file)
@@ -352,13 +352,14 @@ bot laser
                cmd barrier
                cmd selectweapon 1
                cmd wait 0.5
+               raw settemp g_balance_laser_primary_refire 0.3
        percussion 38 # 038_Snare_1-0.wav
                time 0
                buttons attack1
                time 0.05
                buttons
                time 0.1
-               busy 0.7
+               busy 0.3
        percussion 40 # 040_Snare_2-0.wav
                percussion 38
 
@@ -386,7 +387,9 @@ bot uzi
                cmd barrier
                cmd selectweapon 3
                cmd wait 0.5
-               raw set g_balance_uzi_reload_ammo 0
+               raw settemp g_balance_uzi_reload_ammo 0
+               raw settemp g_balance_uzi_first_refire 0.2
+               raw settemp g_balance_uzi_sustained_refire 0.2
        percussion 27 # 027_High_Q-0.wav
                time 0
                buttons attack1
@@ -420,13 +423,14 @@ bot electro
                cmd barrier
                cmd selectweapon 6
                cmd wait 0.5
+               raw settemp g_balance_electro_primary_refire 0.2
        percussion 49 # 049_Cymbal_Crash_1-0.wav
                time 0
                buttons attack1
                time 0.05
                buttons
                time 0.1
-               busy 0.6
+               busy 0.2
        percussion 57 # 057_Cymbal_Crash_2-0.wav
                percussion 49
 
@@ -438,13 +442,15 @@ bot crylink
                cmd barrier
                cmd selectweapon 7
                cmd wait 0.5
+               raw settemp g_balance_crylink_primary_refire 0.3
+               raw settemp g_balance_crylink_secondary_refire 0.2
        percussion 34 # 034_Metronome_Bell-0.wav
                time 0
                buttons attack1
                time 0.05
                buttons
                time 0.1
-               busy 0.7
+               busy 0.3
        percussion 45 # 045_Tom_Mid_2-0.wav
                time 0
                buttons attack2
@@ -469,6 +475,7 @@ bot nex
                cmd barrier
                cmd selectweapon 8
                cmd wait 0.5
+               raw settemp g_balance_nex_primary_refire 1.25
        percussion 52 # 052_Cymbal_Chinese-0.wav
                time 0
                buttons attack1
@@ -485,6 +492,7 @@ bot minstanex
                cmd barrier
                cmd selectweapon 12
                cmd wait 0.5
+               raw settemp g_balance_minstanex_refire 1
        percussion 55 # 055_Cymbal_Splash-0.wav
                time 0
                buttons attack1
@@ -501,13 +509,14 @@ bot hagar
                cmd barrier
                cmd selectweapon 9
                cmd wait 0.5
+               raw settemp g_balance_hagar_primary_refire 0.2
        percussion 35 # 035_Kick_1-0.wav
                time 0
                buttons attack1
                time 0.05
                buttons
                time 0.1
-               busy 0.15
+               busy 0.2
        percussion 60 # 060_Bongo_High-0.wav
                percussion 35
        percussion 61 # 061_Bongo_Low-0.wav
@@ -527,6 +536,7 @@ bot rocket
                cmd barrier
                cmd selectweapon 10
                cmd wait 0.5
+               raw settemp g_balance_rocketlauncher_refire 1.1
        percussion 25 # 025_Snare_Roll-0.wav
                time 0
                buttons attack2
@@ -544,13 +554,14 @@ bot hook
                cmd barrier
                cmd selectweapon 13
                cmd wait 0.5
+               raw settemp g_balance_hook_primary_refire 0.3
        percussion 62 # 062_Conga_High_1_Mute-0.wav
                time 0
                buttons attack1
                time 0.05
                buttons
                time 0.1
-               busy 0.1
+               busy 0.3
        percussion 63 # 063_Conga_High_2_Open-0.wav
                percussion 62
 
@@ -563,13 +574,14 @@ bot seeker
                cmd barrier
                cmd selectweapon 18
                cmd wait 0.5
+               raw settemp g_balance_seeker_tag_refire 0.2
        percussion 41 # 041_Tom_Low_2-0.wav
                time 0
                buttons attack2
                time 0.05
                buttons
                time 0.1
-               busy 0.75
+               busy 0.2
        percussion 51 # 051_Cymbal_Ride_1-0.wav
                percussion 41
        percussion 43 # 043_Tom_Low_1-0.wav
index 31aff9e568a4737dc404372bd49f9e59dd6c8dd4..4cb3851c8abce132b003eb093fd9013e9ab0da67 100755 (executable)
@@ -8,7 +8,10 @@ use MIDI;
 use MIDI::Opus;
 use Storable;
 
+# workaround for possible refire time problems
 use constant SYS_TICRATE => 0.033333;
+#use constant SYS_TICRATE => 0;
+
 use constant MIDI_FIRST_NONCHANNEL => 17;
 use constant MIDI_DRUMS_CHANNEL => 10;
 
@@ -294,6 +297,8 @@ sub busybot_note_on_bot($$$$$)
                if defined $bot->{channels} and not $bot->{channels}->{$channel};
        my $cmds;
        my $cmds_off;
+       my $k0;
+       my $k1;
        if($channel <= 0)
        {
                # vocals
@@ -303,18 +308,24 @@ sub busybot_note_on_bot($$$$$)
                {
                        $cmds = [ map { [ map { $_ eq '%s' ? $note : $_ } @$_ ] } @$cmds ];
                }
+               $k0 = "vocals";
+               $k1 = $channel;
        }
        elsif($channel == 10)
        {
                # percussion
                $cmds = $bot->{percussion}->{$note};
                $cmds_off = undef;
+               $k0 = "percussion";
+               $k1 = $note;
        }
        else
        {
                # music
                $cmds = $bot->{notes_on}->{$note - ($bot->{transpose} || 0) - $transpose};
                $cmds_off = $bot->{notes_off}->{$note - ($bot->{transpose} || 0) - $transpose};
+               $k0 = "note";
+               $k1 = $note - ($bot->{transpose} || 0) - $transpose;
        }
        return -1 # I won't play this note
                if not defined $cmds;
@@ -348,6 +359,7 @@ sub busybot_note_on_bot($$$$$)
                #++$busy;
                #print STDERR "BUSY: $busy bots (ON)\n";
        }
+       ++$bot->{seen}{$k0}{$k1};
        return 1;
 }
 
@@ -606,9 +618,31 @@ sub ConvertMIDI($$)
 sub Deallocate()
 {
        print STDERR "Bots allocated:\n";
+       my %notehash;
+       my %counthash;
        for(@busybots_allocated)
        {
                print STDERR "$_->{id} is a $_->{classname}\n";
+               ++$counthash{$_->{classname}};
+               while(my ($type, $notehash) = each %{$_->{seen}})
+               {
+                       while(my ($k, $v) = each %$notehash)
+                       {
+                               $notehash{$_->{classname}}{$type}{$k} += $v;
+                       }
+               }
+       }
+       for my $cn(sort keys %counthash)
+       {
+               print STDERR "$counthash{$cn} bots of $cn have played:\n";
+               for my $type(sort keys %{$notehash{$cn}})
+               {
+                       for my $note(sort { $a <=> $b } keys %{$notehash{$cn}{$type}})
+                       {
+                               my $cnt = $notehash{$cn}{$type}{$note};
+                               print STDERR "  $type $note ($cnt times)\n";
+                       }
+               }
        }
        for(@busybots_allocated)
        {