From 80bbe13153a018da9473d161d5323196071282d6 Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 12 Jun 2009 18:51:18 +0000 Subject: [PATCH] use dynamic place assignment git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7012 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- misc/tools/midi2cfg-ng-simple.conf | 384 +++++++++++++++++++++++++++++ misc/tools/midi2cfg-ng.conf | 247 ++++--------------- misc/tools/midi2cfg-ng.pl | 14 +- 3 files changed, 436 insertions(+), 209 deletions(-) create mode 100644 misc/tools/midi2cfg-ng-simple.conf diff --git a/misc/tools/midi2cfg-ng-simple.conf b/misc/tools/midi2cfg-ng-simple.conf new file mode 100644 index 000000000..13ffe7a0d --- /dev/null +++ b/misc/tools/midi2cfg-ng-simple.conf @@ -0,0 +1,384 @@ +bot tuba + channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 + init + cmd barrier + cmd selectweapon 16 + cmd wait 0.5 + cmd console "g_balance_tuba_attenuation 0.1" + cmd console "g_balance_tuba_damage 0" + note on -18 + time -0.05 + buttons left backward crouch + time 0 + buttons attack1 left backward crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -17 + time -0.05 + buttons backward crouch + time 0 + buttons attack1 backward crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -16 + time -0.05 + buttons backward right crouch + time 0 + buttons attack1 backward right crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -13 + time -0.05 + buttons forward right crouch + time 0 + buttons attack1 forward right crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -12 + time -0.05 + buttons crouch + time 0 + buttons attack1 crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -11 + time -0.05 + buttons left backward crouch + time 0 + buttons attack2 left backward crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -10 + time -0.05 + buttons right crouch + time 0 + buttons attack1 right crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -9 + time -0.05 + buttons forward left crouch + time 0 + buttons attack1 forward left crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -8 + time -0.05 + buttons forward crouch + time 0 + buttons attack1 forward crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -7 + time -0.05 + buttons left crouch + time 0 + buttons attack1 left crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -6 + time -0.05 + buttons left backward + time 0 + buttons attack1 left backward + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -5 + time -0.05 + buttons backward + time 0 + buttons attack1 backward + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -4 + time -0.05 + buttons backward right + time 0 + buttons attack1 backward right + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -3 + time -0.05 + buttons right crouch + time 0 + buttons attack2 right crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -2 + time -0.05 + buttons forward left crouch + time 0 + buttons attack2 forward left crouch + time 0.05 + buttons + time 0.1 + busy 0.25 + note on -1 + time -0.05 + buttons forward right + time 0 + buttons attack1 forward right + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 0 + time -0.05 + buttons + time 0 + buttons attack1 + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 1 + time -0.05 + buttons left backward + time 0 + buttons attack2 left backward + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 2 + time -0.05 + buttons right + time 0 + buttons attack1 right + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 3 + time -0.05 + buttons forward left + time 0 + buttons attack1 forward left + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 4 + time -0.05 + buttons forward + time 0 + buttons attack1 forward + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 5 + time -0.05 + buttons left + time 0 + buttons attack1 left + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 6 + time -0.05 + buttons forward right + time 0 + buttons attack2 forward right + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 7 + time -0.05 + buttons + time 0 + buttons attack2 + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 8 + time -0.05 + buttons backward right jump + time 0 + buttons attack1 backward right jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 9 + time -0.05 + buttons right + time 0 + buttons attack2 right + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 10 + time -0.05 + buttons forward left + time 0 + buttons attack2 forward left + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 11 + time -0.05 + buttons forward + time 0 + buttons attack2 forward + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 12 + time -0.05 + buttons left + time 0 + buttons attack2 left + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 13 + time -0.05 + buttons left backward jump + time 0 + buttons attack2 left backward jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 14 + time -0.05 + buttons right jump + time 0 + buttons attack1 right jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 15 + time -0.05 + buttons forward left jump + time 0 + buttons attack1 forward left jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 16 + time -0.05 + buttons forward jump + time 0 + buttons attack1 forward jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 17 + time -0.05 + buttons left jump + time 0 + buttons attack1 left jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 18 + time -0.05 + buttons forward right jump + time 0 + buttons attack2 forward right jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 19 + time -0.05 + buttons jump + time 0 + buttons attack2 jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 21 + time -0.05 + buttons right jump + time 0 + buttons attack2 right jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 22 + time -0.05 + buttons forward left jump + time 0 + buttons attack2 forward left jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 23 + time -0.05 + buttons forward jump + time 0 + buttons attack2 forward jump + time 0.05 + buttons + time 0.1 + busy 0.25 + note on 24 + time -0.05 + buttons left jump + time 0 + buttons attack2 left jump + time 0.05 + buttons + time 0.1 + busy 0.25 + +bot tuba_red + include tuba + count 256 + transpose 0 + init + cmd cc "color 68" + super + +bot tuba_blue + include tuba + count 256 + transpose 3 + init + cmd cc "color 221" + super diff --git a/misc/tools/midi2cfg-ng.conf b/misc/tools/midi2cfg-ng.conf index 1ad0f65d1..f1fd9aad9 100644 --- a/misc/tools/midi2cfg-ng.conf +++ b/misc/tools/midi2cfg-ng.conf @@ -1,3 +1,6 @@ +raw set places_tuba "tUba1 tUba2 tUba3 tUba4 tUba5 tUba6 tUba7 tUba8 tUba9 tUba10 tUba11 tUba12 tUba13 tUba14 tUba15 tUba16" +raw set places_percussion "tChr11 tChr12 tChr21 tChr22 tChr23 tChr31 tChr32 tChr33 tChr41 tChr42 tChr43 tChr44" + bot tuba channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 init @@ -564,283 +567,121 @@ bot hook # instantiate our bots! -bot tuba1 - include tuba_red - count 1 - init - cmd movetotarget tUba1 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba2 - include tuba_blue - count 1 - init - cmd movetotarget tUba2 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba3 +bot instance_tuba_red include tuba_red - count 1 + count 16 init - cmd movetotarget tUba3 + cmd movetotarget $places_tuba cmd barrier super done cmd movetotarget goaway -bot tuba4 +bot instance_tuba_blue include tuba_blue - count 1 + count 16 init - cmd movetotarget tUba4 + cmd movetotarget $places_tuba cmd barrier super done cmd movetotarget goaway -bot tuba5 - include tuba_red - count 1 - init - cmd movetotarget tUba5 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba6 - include tuba_blue - count 1 - init - cmd movetotarget tUba6 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba7 - include tuba_red - count 1 - init - cmd movetotarget tUba7 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba8 - include tuba_blue - count 1 - init - cmd movetotarget tUba8 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba9 - include tuba_red - count 1 - init - cmd movetotarget tUba9 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba10 - include tuba_blue - count 1 - init - cmd movetotarget tUba10 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba11 - include tuba_red - count 1 - init - cmd movetotarget tUba11 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba12 - include tuba_blue - count 1 - init - cmd movetotarget tUba12 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba13 - include tuba_red - count 1 - init - cmd movetotarget tUba13 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba14 - include tuba_blue - count 1 - init - cmd movetotarget tUba14 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba15 - include tuba_red - count 1 - init - cmd movetotarget tUba15 - cmd barrier - super - done - cmd movetotarget goaway - -bot tuba16 - include tuba_blue - count 1 - init - cmd movetotarget tUba16 - cmd barrier - super - done - cmd movetotarget goaway - -# percussion bots: - -bot chair11 +bot instance_rocket include rocket count 1 init - cmd movetotarget tChr11 - cmd barrier - super - done - cmd movetotarget goaway - -bot chair12 - include electro - count 1 - init - cmd movetotarget tChr12 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair21 - include jetpack - count 1 +bot instance_uzi + include uzi + count 2 init - cmd movetotarget tChr21 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair22 - include uzi - count 1 +bot instance_crylink + include crylink + count 2 init - cmd movetotarget tChr22 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair23 +bot instance_jetpack include jetpack - count 1 + count 2 init - cmd movetotarget tChr23 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair31 - include tag - count 1 +bot instance_jump + include jump + count 0 init - cmd movetotarget tChr31 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair32 - include tag - count 1 +bot instance_hagar + include hagar + count 4 init - cmd movetotarget tChr32 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair33 +bot instance_tag include tag - count 1 + count 4 init - cmd movetotarget tChr33 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair41 - include hook - count 1 - init - cmd movetotarget tChr41 - cmd barrier - super - done - cmd movetotarget goaway - -bot chair42 - include hagar - count 1 +bot instance_laser + include laser + count 4 init - cmd movetotarget tChr42 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair43 - include laser +bot instance_electro + include electro count 1 init - cmd movetotarget tChr43 + cmd movetotarget $places_percussion cmd barrier super done cmd movetotarget goaway -bot chair44 - include jetpack - count 0 +bot instance_hook + include hook + count 2 init - cmd movetotarget tChr44 + cmd movetotarget $places_percussion cmd barrier super done diff --git a/misc/tools/midi2cfg-ng.pl b/misc/tools/midi2cfg-ng.pl index 514b5f301..23bcfb8d9 100755 --- a/misc/tools/midi2cfg-ng.pl +++ b/misc/tools/midi2cfg-ng.pl @@ -13,9 +13,9 @@ use Storable; use constant MIDI_FIRST_NONCHANNEL => 17; use constant MIDI_DRUMS_CHANNEL => 10; -die "Usage: $0 filename.mid transpose timeoffset timeoffset2 timeoffset3 timeoffset4 preallocatedbots..." - unless @ARGV >= 6; -my ($filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, $timeoffset4, @preallocate) = @ARGV; +die "Usage: $0 filename.conf filename.mid transpose timeoffset timeoffset2 timeoffset3 timeoffset4 preallocatedbots..." + unless @ARGV >= 7; +my ($config, $filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, $timeoffset4, @preallocate) = @ARGV; my $opus = MIDI::Opus->new({from_file => $filename}); #$opus->write_to_file("/tmp/y.mid"); @@ -180,6 +180,10 @@ sub botconfig_read($) { $currentbot = ($bots{$1} ||= {count => 0, transpose => 0}); } + elsif(/^raw (.*)/) + { + printf "$1\n"; + } else { print "unknown command: $_\n"; @@ -306,7 +310,6 @@ sub busybot_note_on_bot($$$$$) { return 0 if not busybot_cmd_bot_test $bot, $time + $notetime, @$cmds; - busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier_init']; busybot_cmd_bot_execute $bot, 0, ['cmd', 'wait', $timeoffset]; busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier']; busybot_cmd_bot_execute $bot, 0, @{$bot->{init}} @@ -324,7 +327,7 @@ sub busybot_note_on_bot($$$$$) return 1; } -my $busybots = botconfig_read "midi2cfg-ng.conf"; +my $busybots = botconfig_read $config; my @busybots_allocated; my %notechannelbots; @@ -406,7 +409,6 @@ for(@preallocate) my $bot = Storable::dclone $busybots->{$_}; $bot->{id} = @busybots_allocated + 1; $bot->{classname} = $_; - busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier_init']; busybot_cmd_bot_execute $bot, 0, ['cmd', 'wait', $timeoffset]; busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier']; busybot_cmd_bot_execute $bot, 0, @{$bot->{init}} -- 2.39.2