[nexuiz-commits] r6994 - trunk/misc/tools
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Jun 12 03:47:49 EDT 2009
Author: div0
Date: 2009-06-12 03:47:37 -0400 (Fri, 12 Jun 2009)
New Revision: 6994
Modified:
trunk/misc/tools/midi2cfg-ng.conf
trunk/misc/tools/midi2cfg-ng.pl
Log:
midi2cfg: use barriers
Modified: trunk/misc/tools/midi2cfg-ng.conf
===================================================================
--- trunk/misc/tools/midi2cfg-ng.conf 2009-06-12 07:46:18 UTC (rev 6993)
+++ trunk/misc/tools/midi2cfg-ng.conf 2009-06-12 07:47:37 UTC (rev 6994)
@@ -1,11 +1,11 @@
bot tuba
channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
init
- time -2
+ cmd barrier
cmd selectweapon 16
+ cmd wait 0.5
raw g_balance_tuba_attenuation 0.1
raw g_balance_tuba_damage 0
- time 0
note on -18
time -0.05
buttons left backward crouch
@@ -371,7 +371,6 @@
include tuba
transpose 0
init
- time -4
cmd cc "color 68"
super
@@ -379,17 +378,16 @@
include tuba
transpose 3
init
- time -4
cmd cc "color 221"
super
bot rocket
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 9
- time 0
+ cmd wait 0.5
percussion 25
time 0
buttons attack2
@@ -401,10 +399,10 @@
bot uzi
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 3
- time 0
+ cmd wait 0.5
percussion 27
time 0
buttons attack2
@@ -420,10 +418,10 @@
bot crylink
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 6
- time 0
+ cmd wait 0.5
percussion 31
time 0
buttons attack2
@@ -446,6 +444,8 @@
percussion 42
bot jetpack
+ init
+ cmd barrier
percussion 42
time 0
buttons hook
@@ -458,6 +458,8 @@
percussion 42
bot jump
+ init
+ cmd barrier
percussion 42
time -0.5
buttons jump
@@ -472,11 +474,11 @@
bot hagar
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 8
+ cmd wait 0.5
raw g_balance_hagar_primary_lifetime 0.1
- time 0
percussion 35
time 0
buttons attack1
@@ -496,11 +498,11 @@
bot tag
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 14
+ cmd wait 0.5
raw g_balance_seeker_tag_lifetime 0.1
- time 0
percussion 36
time 0
buttons attack1
@@ -516,11 +518,11 @@
bot laser
channels 10
init
- time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 1
+ cmd wait 0.5
raw g_balance_laser_primary_lifetime 0.2
- time 0
percussion 39
time 0
buttons attack1
@@ -534,16 +536,18 @@
init
time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 5
- time 0
+ cmd wait 0.5
bot hook
channels 10
init
time -2
cmd aimtarget "tPercussion 1"
+ cmd barrier
cmd selectweapon 12
- time 0
+ cmd wait 0.5
percussion 58
time 0
buttons attack1
@@ -558,8 +562,8 @@
include tuba_red
count 1
init
- time -15
cmd movetotarget tUba1
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -568,8 +572,8 @@
include tuba_blue
count 1
init
- time -15
cmd movetotarget tUba2
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -578,8 +582,8 @@
include tuba_red
count 1
init
- time -15
cmd movetotarget tUba3
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -588,8 +592,8 @@
include tuba_red
count 1
init
- time -15
cmd movetotarget tUba4
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -600,8 +604,8 @@
include rocket
count 1
init
- time -15
cmd movetotarget tChr11
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -610,8 +614,8 @@
include electro
count 1
init
- time -15
cmd movetotarget tChr12
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -620,8 +624,8 @@
include uzi
count 1
init
- time -15
cmd movetotarget tChr21
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -630,8 +634,8 @@
include crylink
count 0
init
- time -15
cmd movetotarget tChr22
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -640,8 +644,8 @@
include crylink
count 0
init
- time -15
cmd movetotarget tChr22
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -650,8 +654,8 @@
include hagar
count 1
init
- time -15
cmd movetotarget tChr23
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -660,8 +664,8 @@
include tag
count 1
init
- time -15
cmd movetotarget tChr31
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -670,8 +674,8 @@
include tag
count 1
init
- time -15
cmd movetotarget tChr32
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -680,8 +684,8 @@
include laser
count 1
init
- time -15
cmd movetotarget tChr33
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -690,8 +694,8 @@
include hook
count 1
init
- time -15
cmd movetotarget tChr41
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -700,8 +704,8 @@
include jetpack
count 1
init
- time -15
cmd movetotarget tChr42
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -710,8 +714,8 @@
include jetpack
count 1
init
- time -15
cmd movetotarget tChr43
+ cmd barrier
super
done
cmd movetotarget goaway
@@ -720,8 +724,8 @@
include jetpack
count 1
init
- time -15
cmd movetotarget tChr44
+ cmd barrier
super
done
cmd movetotarget goaway
Modified: trunk/misc/tools/midi2cfg-ng.pl
===================================================================
--- trunk/misc/tools/midi2cfg-ng.pl 2009-06-12 07:46:18 UTC (rev 6993)
+++ trunk/misc/tools/midi2cfg-ng.pl 2009-06-12 07:47:37 UTC (rev 6994)
@@ -13,9 +13,9 @@
use constant MIDI_FIRST_NONCHANNEL => 17;
use constant MIDI_DRUMS_CHANNEL => 10;
-die "Usage: $0 filename.mid transpose timeoffset timeoffset2 timeoffset3 preallocatedbots..."
- unless @ARGV >= 5;
-my ($filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, @preallocate) = @ARGV;
+die "Usage: $0 filename.mid transpose timeoffset timeoffset2 timeoffset3 timeoffset4 preallocatedbots..."
+ unless @ARGV >= 6;
+my ($filename, $transpose, $timeoffset, $timeoffset2, $timeoffset3, $timeoffset4, @preallocate) = @ARGV;
my $opus = MIDI::Opus->new({from_file => $filename});
#$opus->write_to_file("/tmp/y.mid");
@@ -82,7 +82,6 @@
-my $inittime = undef;
my $notetime = undef;
sub botconfig_read($)
{
@@ -186,27 +185,9 @@
}
}
- my $lowesttime = undef;
- my $highesttime = undef;
- my $highestbusytime = undef;
my $lowestnotestart = undef;
for(values %bots)
{
- my $l = $_->{init};
- next unless defined $l;
- my $t = $l->[0]->[0] eq 'time' ? $l->[0]->[1] : 0;
- $lowesttime = $t if not defined $lowesttime or $t < $lowesttime;
- for(@$l)
- {
- if($_->[0] eq 'time')
- {
- $highesttime = $_->[1] if not defined $highesttime or $_->[1] > $highesttime;
- }
- if($_->[0] eq 'busy')
- {
- $highestbusytime = $_->[1] if not defined $highestbusytime or $_->[1] > $highestbusytime;
- }
- }
for(values %{$_->{notes_on}}, values %{$_->{percussion}})
{
my $t = $_->[0]->[0] eq 'time' ? $_->[0]->[1] : 0;
@@ -214,23 +195,8 @@
}
}
- my $initdelta = $highesttime - $lowesttime - $lowestnotestart;
- if(defined $highestbusytime)
- {
- my $initdelta2 = $highestbusytime - $lowesttime;
- $initdelta = $initdelta2
- if $initdelta2 > $initdelta;
- }
+ $notetime = $timeoffset2 - $lowestnotestart;
- # init shall take place at $timeoffset
- # note playing shall take place at $timeoffset + $initdelta + $timeoffset2
-
- $inittime = $timeoffset - $lowesttime;
- $notetime = $timeoffset + $initdelta + $timeoffset2;
-
- print STDERR "Initialization offset: $inittime (start: @{[$inittime + $lowesttime]}, end: @{[$inittime + $highesttime]})\n";
- print STDERR "Note offset: $notetime (start: @{[$notetime + $lowestnotestart]})\n";
-
return \%bots;
}
@@ -294,7 +260,7 @@
}
elsif($_->[0] eq 'raw')
{
- printf join " ", @{$_}[1..@$_-1];
+ printf "%s\n", join " ", @{$_}[1..@$_-1];
}
}
@@ -335,13 +301,16 @@
}
return -1 # I won't play this note
if not defined $cmds;
- if($init && $bot->{init})
+ if($init)
{
return 0
- if not busybot_cmd_bot_test $bot, $inittime, @{$bot->{init}};
- return 0
if not busybot_cmd_bot_test $bot, $time + $notetime, @$cmds;
- busybot_cmd_bot_execute $bot, $inittime, @{$bot->{init}};
+ busybot_cmd_bot_execute $bot, 0, ['wait', $timeoffset];
+ busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
+ busybot_cmd_bot_execute $bot, 0, @{$bot->{init}}
+ if @{$bot->{init}};
+ busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
+ $bot->{timer} = $bot->{busytimer} = 0;
busybot_cmd_bot_execute $bot, $time + $notetime, @$cmds;
}
else
@@ -440,7 +409,12 @@
my $bot = Storable::dclone $busybots->{$_};
$bot->{id} = @busybots_allocated + 1;
$bot->{classname} = $_;
- busybot_cmd_bot_execute $bot, $inittime, @{$bot->{init}};
+ busybot_cmd_bot_execute $bot, 0, ['wait', $timeoffset];
+ busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
+ busybot_cmd_bot_execute $bot, 0, @{$bot->{init}}
+ if @{$bot->{init}};
+ busybot_cmd_bot_execute $bot, 0, ['cmd', 'barrier'];
+ $bot->{timer} = $bot->{busytimer} = 0;
--$busybots->{$_}->{count};
push @busybots_allocated, $bot;
}
@@ -484,10 +458,14 @@
for(@busybots_allocated)
{
+ busybot_cmd_bot_execute $_, 0, ['wait', $timeoffset3];
+ busybot_cmd_bot_execute $_, 0, ['cmd', 'barrier'];
if($_->{done})
{
- busybot_cmd_bot_execute $_, $notetime + $t + $timeoffset3, @{$_->{done}};
+ busybot_cmd_bot_execute $_, @{$_->{done}};
}
+ busybot_cmd_bot_execute $_, 0, ['cmd', 'barrier'];
+ busybot_cmd_bot_execute $_, 0, ['wait', $timeoffset4];
}
print STDERR "Range of notes: $note_min .. $note_max\n";
More information about the nexuiz-commits
mailing list