From 4355075eec702c92955fd86036e1fa698981294d Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 18 Jun 2009 21:14:42 +0000 Subject: [PATCH] midi2cfg improvements ;) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7059 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- misc/tools/midi2cfg-ng.conf | 72 +++++++++++++++++++++++++++++-------- misc/tools/midi2cfg-ng.pl | 40 ++++++++++++++------- misc/tools/midichannels.pl | 8 ++++- 3 files changed, 92 insertions(+), 28 deletions(-) diff --git a/misc/tools/midi2cfg-ng.conf b/misc/tools/midi2cfg-ng.conf index f883d09dd..80fa5cd09 100644 --- a/misc/tools/midi2cfg-ng.conf +++ b/misc/tools/midi2cfg-ng.conf @@ -416,6 +416,8 @@ bot uzi busy 0.2 percussion 33 percussion 27 + percussion 54 + percussion 27 bot crylink channels 10 @@ -435,7 +437,7 @@ bot crylink percussion 31 percussion 42 time 0 - buttons attack2 + buttons attack1 time 0.05 buttons time 0.1 @@ -447,6 +449,7 @@ bot crylink bot jetpack init + cmd resetaim cmd barrier cmd console "g_jetpack_attenuation 0.5" percussion 42 @@ -461,9 +464,14 @@ bot jetpack percussion 42 percussion 37 percussion 42 + percussion 51 + percussion 42 + percussion 59 + percussion 42 bot jump init + cmd resetaim cmd barrier percussion 42 time -0.5 @@ -577,13 +585,16 @@ bot instance_tuba_red super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_tuba_blue @@ -595,13 +606,16 @@ bot instance_tuba_blue super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_rocket @@ -613,13 +627,16 @@ bot instance_rocket super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_uzi @@ -631,13 +648,16 @@ bot instance_uzi super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_crylink @@ -649,13 +669,16 @@ bot instance_crylink super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_jetpack @@ -667,13 +690,16 @@ bot instance_jetpack super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_jump @@ -685,31 +711,37 @@ bot instance_jump super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_hagar include hagar - count 4 + count 6 init cmd movetotarget @places_percussion cmd barrier super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_tag @@ -721,13 +753,16 @@ bot instance_tag super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_laser @@ -739,13 +774,16 @@ bot instance_laser super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_electro @@ -757,13 +795,16 @@ bot instance_electro super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start bot instance_hook @@ -775,11 +816,14 @@ bot instance_hook super done cmd movetotarget @places_end + cmd resetaim + cmd aim "90 0" cmd wait 1 barrier buttons crouch - cmd wait 2 + cmd wait 3 buttons cmd wait 1 barrier + cmd console settemp bot_navigation_ignoreplayers 1 cmd movetotarget start diff --git a/misc/tools/midi2cfg-ng.pl b/misc/tools/midi2cfg-ng.pl index 5f6fc795e..f4bab26fa 100755 --- a/misc/tools/midi2cfg-ng.pl +++ b/misc/tools/midi2cfg-ng.pl @@ -28,6 +28,7 @@ my %notechannelbots; my $transpose = 0; my $notetime = undef; my $lowestnotestart = undef; +my $noalloc = 0; sub botconfig_read($) { my ($fn) = @_; @@ -359,6 +360,8 @@ sub busybot_note_on($$$) my $canplay = busybot_note_on_bot $bot, $time, $channel, $note, 1; if($canplay > 0) { + die "noalloc\n" + if $noalloc; --$busybots->{$_}->{count}; $notechannelbots{$channel}{$note} = $bot; push @busybots_allocated, $bot; @@ -540,21 +543,32 @@ sub Deallocate() } my @preallocate = (); +$noalloc = 0; for(;;) { $commands = ""; - Preallocate(@preallocate); - my @l = @midilist; - while(@l) + eval { - my $filename = shift @l; - my $transpose = shift @l; - ConvertMIDI($filename, $transpose); - } - Deallocate(); - my @preallocate_new = map { $_->{classname} } @busybots_allocated; - last if @preallocate_new == @preallocate; - @preallocate = @preallocate_new; + Preallocate(@preallocate); + my @l = @midilist; + while(@l) + { + my $filename = shift @l; + my $transpose = shift @l; + ConvertMIDI($filename, $transpose); + } + Deallocate(); + my @preallocate_new = map { $_->{classname} } @busybots_allocated; + if(@preallocate_new == @preallocate) + { + print "$precommands$commands"; + exit 0; + } + @preallocate = @preallocate_new; + $noalloc = 1; + 1; + } or do { + die "$@" + unless $@ eq "noalloc\n"; + }; } - -print "$precommands$commands"; diff --git a/misc/tools/midichannels.pl b/misc/tools/midichannels.pl index 0bbbccd41..5cfe18817 100644 --- a/misc/tools/midichannels.pl +++ b/misc/tools/midichannels.pl @@ -46,9 +46,15 @@ while() { my %taken = (0 => 1); my @t = ($tracks->[0]); + my $force = 0; for(@arg) { - next if $taken{$_}++; + if($_ eq '--force') + { + $force = 1; + next; + } + next if $taken{$_}++ and not $force; push @t, $tracks->[$_]; } $opus->tracks_r(\@t); -- 2.39.2