[nexuiz-commits] r8307 - trunk/misc/tools

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Nov 21 16:11:56 EST 2009


Author: div0
Date: 2009-11-21 16:11:56 -0500 (Sat, 21 Nov 2009)
New Revision: 8307

Modified:
   trunk/misc/tools/midi2cfg-ng.conf
   trunk/misc/tools/midi2cfg-ng.pl
Log:
tuba orchestra improvements, but seems broken at the moment (apparently uses wrong notes when enabling both red and blue tuba bots)


Modified: trunk/misc/tools/midi2cfg-ng.conf
===================================================================
--- trunk/misc/tools/midi2cfg-ng.conf	2009-11-21 15:24:11 UTC (rev 8306)
+++ trunk/misc/tools/midi2cfg-ng.conf	2009-11-21 21:11:56 UTC (rev 8307)
@@ -1,3 +1,4 @@
+raw exec balance25.cfg
 raw set places_tuba "tUba1 tUba2 tUba3 tUba4 tUba5 tUba6 tUba7 tUba8 tUba9 tUba10 tUba11 tUba12 tUba13 tUba14 tUba15 tUba16 tUba17 tUba18 tUba19 tUba20 tUba21 tUba22 tUba23 tUba24"
 raw set places_percussion "tChr1 tChr2 tChr3 tChr4 tChr5 tChr6 tChr7 tChr8 tChr9 tChr10 tChr11 tChr12 tChr13 tChr14 tChr15 tChr16 tChr17 tChr18 tChr19"
 raw set places_end "end1 end2 end3 end4 end5 end6 end7 end8 end9 end10 end11 end12 end13 end14 end15 end16 end17 end24 end25 end26 end27 end28 end29 end30 end31 end32 end33 end34 end35 end36 end37 end38 end39 end40 end41 end42 end43 end44 end45 end46 end47 end48 end49 end50 end51 end52 end53 end54 end55 end56 end57"
@@ -6,370 +7,330 @@
 	channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
 	init
 		cmd barrier
-		cmd selectweapon 16
+		cmd selectweapon 14
 		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
+		buttons left backward crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -18
+		time 0
+		buttons 
+		time 0.05
 	note on -17
-		time -0.05
-		buttons backward crouch
 		time 0
-		buttons attack1 backward crouch
+		buttons backward crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -17
+		time 0
+		buttons 
+		time 0.05
 	note on -16
-		time -0.05
-		buttons backward right crouch
 		time 0
-		buttons attack1 backward right crouch
+		buttons right backward crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -16
+		time 0
+		buttons 
+		time 0.05
 	note on -13
-		time -0.05
-		buttons forward right crouch
 		time 0
-		buttons attack1 forward right crouch
+		buttons forward right crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -13
+		time 0
+		buttons 
+		time 0.05
 	note on -12
-		time -0.05
-		buttons crouch
 		time 0
-		buttons attack1 crouch
+		buttons crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -12
+		time 0
+		buttons 
+		time 0.05
 	note on -11
-		time -0.05
-		buttons left backward crouch
 		time 0
-		buttons attack2 left backward crouch
+		buttons left backward crouch attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -11
+		time 0
+		buttons 
+		time 0.05
 	note on -10
-		time -0.05
-		buttons right crouch
 		time 0
-		buttons attack1 right crouch
+		buttons right crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -10
+		time 0
+		buttons 
+		time 0.05
 	note on -9
-		time -0.05
-		buttons forward left crouch
 		time 0
-		buttons attack1 forward left crouch
+		buttons forward left crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -9
+		time 0
+		buttons 
+		time 0.05
 	note on -8
-		time -0.05
-		buttons forward crouch
 		time 0
-		buttons attack1 forward crouch
+		buttons forward crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -8
+		time 0
+		buttons 
+		time 0.05
 	note on -7
-		time -0.05
-		buttons left crouch
 		time 0
-		buttons attack1 left crouch
+		buttons left crouch attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -7
+		time 0
+		buttons 
+		time 0.05
 	note on -6
-		time -0.05
-		buttons left backward
 		time 0
-		buttons attack1 left backward
+		buttons left backward attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -6
+		time 0
+		buttons 
+		time 0.05
 	note on -5
-		time -0.05
-		buttons backward
 		time 0
-		buttons attack1 backward
+		buttons backward attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -5
+		time 0
+		buttons 
+		time 0.05
 	note on -4
-		time -0.05
-		buttons backward right
 		time 0
-		buttons attack1 backward right
+		buttons backward right attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -4
+		time 0
+		buttons 
+		time 0.05
 	note on -3
-		time -0.05
-		buttons right crouch
 		time 0
-		buttons attack2 right crouch
+		buttons right crouch attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -3
+		time 0
+		buttons 
+		time 0.05
 	note on -2
-		time -0.05
-		buttons forward left crouch
 		time 0
-		buttons attack2 forward left crouch
+		buttons forward left crouch attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -2
+		time 0
+		buttons 
+		time 0.05
 	note on -1
-		time -0.05
-		buttons forward right
 		time 0
-		buttons attack1 forward right
+		buttons forward right attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off -1
+		time 0
+		buttons 
+		time 0.05
 	note on 0
-		time -0.05
-		buttons
 		time 0
 		buttons attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 0
+		time 0
+		buttons 
+		time 0.05
 	note on 1
-		time -0.05
-		buttons left backward
 		time 0
-		buttons attack2 left backward
+		buttons left backward attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 1
+		time 0
+		buttons 
+		time 0.05
 	note on 2
-		time -0.05
-		buttons right
 		time 0
-		buttons attack1 right
+		buttons right attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 2
+		time 0
+		buttons 
+		time 0.05
 	note on 3
-		time -0.05
-		buttons forward left
 		time 0
-		buttons attack1 forward left
+		buttons forward left attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 3
+		time 0
+		buttons 
+		time 0.05
 	note on 4
-		time -0.05
-		buttons forward
 		time 0
-		buttons attack1 forward
+		buttons forward attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 4
+		time 0
+		buttons 
+		time 0.05
 	note on 5
-		time -0.05
-		buttons left
 		time 0
-		buttons attack1 left
+		buttons left attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 5
+		time 0
+		buttons 
+		time 0.05
 	note on 6
-		time -0.05
-		buttons forward right
 		time 0
-		buttons attack2 forward right
+		buttons forward right attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 6
+		time 0
+		buttons 
+		time 0.05
 	note on 7
-		time -0.05
-		buttons
 		time 0
 		buttons attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 7
+		time 0
+		buttons 
+		time 0.05
 	note on 8
-		time -0.05
-		buttons backward right jump
 		time 0
-		buttons attack1 backward right jump
+		buttons backward right jump attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 8
+		time 0
+		buttons 
+		time 0.05
 	note on 9
-		time -0.05
-		buttons right
 		time 0
-		buttons attack2 right
+		buttons right attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 9
+		time 0
+		buttons 
+		time 0.05
 	note on 10
-		time -0.05
-		buttons forward left
 		time 0
-		buttons attack2 forward left
+		buttons forward left attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 10
+		time 0
+		buttons 
+		time 0.05
 	note on 11
-		time -0.05
-		buttons forward
 		time 0
-		buttons attack2 forward
+		buttons forward attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 11
+		time 0
+		buttons 
+		time 0.05
 	note on 12
-		time -0.05
-		buttons left
 		time 0
-		buttons attack2 left
+		buttons left attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 12
+		time 0
+		buttons 
+		time 0.05
 	note on 13
-		time -0.05
-		buttons left backward jump
 		time 0
-		buttons attack2 left backward jump
+		buttons left backward jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 13
+		time 0
+		buttons 
+		time 0.05
 	note on 14
-		time -0.05
-		buttons right jump
 		time 0
-		buttons attack1 right jump
+		buttons right jump attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 14
+		time 0
+		buttons 
+		time 0.05
 	note on 15
-		time -0.05
-		buttons forward left jump
 		time 0
-		buttons attack1 forward left jump
+		buttons forward left jump attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 15
+		time 0
+		buttons 
+		time 0.05
 	note on 16
-		time -0.05
-		buttons forward jump
 		time 0
-		buttons attack1 forward jump
+		buttons forward jump attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 16
+		time 0
+		buttons 
+		time 0.05
 	note on 17
-		time -0.05
-		buttons left jump
 		time 0
-		buttons attack1 left jump
+		buttons left jump attack1
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 17
+		time 0
+		buttons 
+		time 0.05
 	note on 18
-		time -0.05
-		buttons forward right jump
 		time 0
-		buttons attack2 forward right jump
+		buttons forward right jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 18
+		time 0
+		buttons 
+		time 0.05
 	note on 19
-		time -0.05
-		buttons jump
 		time 0
-		buttons attack2 jump
+		buttons jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 19
+		time 0
+		buttons 
+		time 0.05
 	note on 21
-		time -0.05
-		buttons right jump
 		time 0
-		buttons attack2 right jump
+		buttons right jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 21
+		time 0
+		buttons 
+		time 0.05
 	note on 22
-		time -0.05
-		buttons forward left jump
 		time 0
-		buttons attack2 forward left jump
+		buttons forward left jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 22
+		time 0
+		buttons 
+		time 0.05
 	note on 23
-		time -0.05
-		buttons forward jump
 		time 0
-		buttons attack2 forward jump
+		buttons forward jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 23
+		time 0
+		buttons 
+		time 0.05
 	note on 24
-		time -0.05
-		buttons left jump
 		time 0
-		buttons attack2 left jump
+		buttons left jump attack2
 		time 0.05
-		buttons
-		time 0.1
-		busy 0.25
+	note off 24
+		time 0
+		buttons 
+		time 0.05
 
 bot tuba_red
 	include tuba
@@ -498,34 +459,20 @@
 		buttons
 		time 0.1
 		busy 0.15
+	percussion 36
+		percussion 35
 	percussion 38
 		percussion 35
 	percussion 40
 		percussion 35
 	percussion 60
 		percussion 35
+	percussion 61
+		percussion 35
 	percussion 65
 		percussion 35
-
-bot tag
-	channels 10
-	init
-		cmd aimtarget "tPercussion 1"
-		cmd barrier
-		cmd selectweapon 14
-		cmd wait 0.5
-		cmd console "g_balance_seeker_tag_lifetime 0.1"
-	percussion 36
-		time 0
-		buttons attack1
-		time 0.05
-		buttons
-		time 0.1
-		busy 0.7
-	percussion 61
-		percussion 36
 	percussion 66
-		percussion 36
+		percussion 35
 
 bot laser
 	channels 10
@@ -578,7 +525,7 @@
 
 bot instance_tuba_red
 	include tuba_red
-	count 16
+	count 32
 	init
 		cmd movetotarget @places_tuba
 		cmd barrier
@@ -599,7 +546,7 @@
 
 bot instance_tuba_blue
 	include tuba_blue
-	count 16
+	count 32
 	init
 		cmd movetotarget @places_tuba
 		cmd barrier
@@ -744,27 +691,6 @@
 		cmd console settemp bot_navigation_ignoreplayers 1
 		cmd movetotarget start
 
-bot instance_tag
-	include tag
-	count 5
-	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 3
-		buttons
-		cmd wait 1
-		barrier
-		cmd console settemp bot_navigation_ignoreplayers 1
-		cmd movetotarget start
-
 bot instance_laser
 	include laser
 	count 4
@@ -827,3 +753,27 @@
 		barrier
 		cmd console settemp bot_navigation_ignoreplayers 1
 		cmd movetotarget start
+
+
+# rocket_fly = 025 snare roll
+## rocket_impact = 049 cymbal crash = 057 cymbal crash
+# electro_fire = 049 cymbal crash = 057 cymbal crash
+# electro_fire2 = 040 snare 2
+# uzi = 033 high q
+# crylink_fire2 = 046 hihat open
+# crylink_fire = 042 hihat closed
+# jetpack = 044 hihat pedal
+# jump = 036 kick 2
+# hagar_fire = 038 snare 1
+# lasergun_fire = 039 clap hand
+# hook_fire = 058 vibra slap
+# hookbomb_fire = 055 cymbal splash
+# campingrifle_fire = 065 timbale high
+# campingrifle_fire2 = 066 timbale low
+# fireball_fire = 052 cymbal chinese
+# fireball_prefire2 = 072 whistle 2 low long
+# grenade_fire = 035 kick 1
+# minstanexfire = 053 cymbal ride bell
+# nexfire = 051 cymbal ride
+# shotgun_fire = 059 cymbal ride
+# weapon_switch = 037 stick rim

Modified: trunk/misc/tools/midi2cfg-ng.pl
===================================================================
--- trunk/misc/tools/midi2cfg-ng.pl	2009-11-21 15:24:11 UTC (rev 8306)
+++ trunk/misc/tools/midi2cfg-ng.pl	2009-11-21 21:11:56 UTC (rev 8307)
@@ -20,6 +20,39 @@
 	return map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, rand] } @_;
 }
 
+sub override($$);
+sub override($$)
+{
+	my ($dest, $src) = @_;
+	if(ref $src eq 'HASH')
+	{
+		$dest = {}
+			if not defined $dest;
+		for(keys %$src)
+		{
+			$dest->{$_} = override $dest->{$_}, $src->{$_};
+		}
+	}
+	elsif(ref $src eq 'ARRAY')
+	{
+		$dest = []
+			if not defined $dest;
+		for(@$src)
+		{
+			push @$dest, override undef, $_;
+		}
+	}
+	elsif(ref $src)
+	{
+		$dest = Storable::dclone $src;
+	}
+	else
+	{
+		$dest = $src;
+	}
+	return $dest;
+}
+
 my $precommands = "";
 my $commands = "";
 my $busybots;
@@ -66,18 +99,7 @@
 			if(/^include (.*)/)
 			{
 				my $base = $bots{$1};
-				for(keys %$base)
-				{
-					if(ref $base->{$_})
-					{
-						$currentbot->{$_} = Storable::dclone $base->{$_}; # copy array items as new array
-					}
-					else
-					{
-						$currentbot->{$_} = $base->{$_};
-					}
-				}
-				# better: do some merging TODO
+				$currentbot = override $currentbot, $base;
 			}
 			elsif(/^count (\d+)/)
 			{
@@ -241,15 +263,19 @@
 	$notetime = $timeoffset_postintermission - $lowestnotestart;
 }
 
+#my $busy = 0;
 sub busybot_note_off_bot($$$$)
 {
 	my ($bot, $time, $channel, $note) = @_;
+	#print STDERR "note off $bot:$time:$channel:$note\n";
 	return 1
 		if $channel == 10;
 	my $cmds = $bot->{notes_off}->{$note - $bot->{transpose} - $transpose};
 	return 1
 		if not defined $cmds; # note off cannot fail
 	$bot->{busy} = 0;
+	#--$busy;
+	#print STDERR "BUSY: $busy bots (OFF)\n";
 	busybot_cmd_bot_execute $bot, $time + $notetime, @$cmds; 
 	return 1;
 }
@@ -261,19 +287,18 @@
 		if defined $bot->{channels} and not $bot->{channels}->{$channel};
 	return 0
 		if $bot->{busy};
+	#print STDERR "note on $bot:$time:$channel:$note\n";
 	my $cmds;
+	my $cmds_off;
 	if($channel == 10)
 	{
 		$cmds = $bot->{percussion}->{$note};
+		$cmds_off = undef;
 	}
 	else
 	{
 		$cmds = $bot->{notes_on}->{$note - $bot->{transpose} - $transpose};
-		my $cmds_off = $bot->{notes_off}->{$note - $bot->{transpose} - $transpose};
-		if(defined $cmds and defined $cmds_off)
-		{
-			$bot->{busy} = 1;
-		}
+		$cmds_off = $bot->{notes_off}->{$note - $bot->{transpose} - $transpose};
 	}
 	return -1 # I won't play this note
 		if not defined $cmds;
@@ -298,6 +323,12 @@
 			if not busybot_cmd_bot_test $bot, $time + $notetime, @$cmds; 
 		busybot_cmd_bot_execute $bot, $time + $notetime, @$cmds; 
 	}
+	if(defined $cmds and defined $cmds_off)
+	{
+		$bot->{busy} = 1;
+		#++$busy;
+		#print STDERR "BUSY: $busy bots (ON)\n";
+	}
 	return 1;
 }
 
@@ -314,6 +345,8 @@
 {
 	my ($time, $channel, $note) = @_;
 
+	#print STDERR "note off $time:$channel:$note\n";
+
 	return 0
 		if $channel == 10;
 
@@ -336,6 +369,8 @@
 		busybot_note_off $time, $channel, $note;
 	}
 
+	#print STDERR "note on $time:$channel:$note\n";
+
 	my $overflow = 0;
 
 	for(unsort @busybots_allocated)



More information about the nexuiz-commits mailing list