misc stuff, klein bottle used by midi2cfg now optionally

This commit is contained in:
Rudolf Polzer 2012-09-24 13:44:51 +02:00
parent 29a0f2021b
commit 0a6b93cb7a
6 changed files with 166 additions and 73 deletions

View File

@ -1,14 +1,13 @@
// for walking bots:
// :%s/cc teleport\(totarget\)/move\1/g
// for teleporting bots:
// :%s/move\(totarget\)/cc teleport\1/g
timeoffset_preinit 2
timeoffset_postinit 2
timeoffset_predone 2
timeoffset_postdone 2
timeoffset_preintermission 2
timeoffset_postintermission 2
list WAIT_SELECTWEAPON 0.5
list WAIT_RELOAD 0.5
list WAIT_AIMTARGET 1
time_forgetfulness 3
list 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 tUba25 tUba26 tUba27 tUba28 tUba29 tUba30 tUba31 tUba32
@ -18,7 +17,8 @@ list places_metalsteps tMetalSteps1 tMetalSteps2 tMetalSteps3
list places_nosteps tNoSteps1 tNoSteps2 tNoSteps3 tNoSteps4
raw settemp bot_ai_thinkinterval 0
raw settemp bot_sound_monopoly 1
raw settemp g_balance_tuba_attenuation 0.1
// raw settemp bot_sound_monopoly 1
bot notebot
note on -18
@ -505,13 +505,12 @@ bot notebot
bot tuba
include notebot
channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
transpose 48
init
cmd barrier
cmd selectweapon 15
cmd wait 0.5
raw settemp g_balance_tuba_attenuation 0.1
cmd wait @WAIT_SELECTWEAPON
bot accordeon
include notebot
@ -521,9 +520,23 @@ bot accordeon
init
cmd barrier
cmd selectweapon 15
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
cmd impulse 20
raw settemp g_balance_tuba_attenuation 0.1
cmd wait @WAIT_RELOAD
bot kleinbottle
include notebot
channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
programs 81 82
transpose 48
init
cmd barrier
cmd selectweapon 15
cmd wait @WAIT_SELECTWEAPON
cmd impulse 20
cmd wait @WAIT_RELOAD
cmd impulse 20
cmd wait @WAIT_RELOAD
bot tuba_red
include tuba
@ -553,14 +566,28 @@ bot accordeon_blue
cmd cc color 221
super
bot kleinbottle_red
include kleinbottle
transpose 0
init
cmd cc color 68
super
bot kleinbottle_blue
include kleinbottle
transpose 3
init
cmd cc color 221
super
// laser = lasershot NONE
bot laser
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 1
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_laser_primary_refire 0.3
percussion 38 // 038_Snare_1-0.wav
time 0
@ -578,10 +605,10 @@ bot laser
bot shotgun
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 2
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
percussion 74 // 074_Guiro_2_Long-0.wav
time -0.4
cmd debug_assert_canfire 1
@ -598,10 +625,10 @@ bot shotgun
bot uzi
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 3
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_uzi_reload_ammo 0
raw settemp g_balance_uzi_first_refire 0.1
raw settemp g_balance_uzi_sustained_refire 0.1
@ -633,10 +660,10 @@ bot electro
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 6
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_electro_primary_refire 0.2
percussion 49 // 049_Cymbal_Crash_1-0.wav
time 0
@ -654,10 +681,10 @@ bot electro
bot crylink
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 7
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
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
@ -701,10 +728,10 @@ bot crylink
bot nex
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 8
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_nex_primary_refire 1.25
percussion 52 // 052_Cymbal_Chinese-0.wav
time 0
@ -720,10 +747,10 @@ bot nex
bot minstanex
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 12
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_minstanex_refire 1
percussion 55 // 055_Cymbal_Splash-0.wav
time 0
@ -739,10 +766,10 @@ bot minstanex
bot hagar
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 9
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_hagar_primary_refire 0.2
percussion 35 // 035_Kick_1-0.wav
time 0
@ -766,10 +793,10 @@ bot hagar
bot rocket
channels 10
init
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 10
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_rocketlauncher_refire 1.1
percussion 25 // 025_Snare_Roll-0.wav
time 0
@ -786,10 +813,10 @@ bot hook
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 13
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_hook_primary_refire 0.3
raw settemp g_balance_hook_secondary_refire 0.9
percussion 62 // 062_Conga_High_1_Mute-0.wav
@ -822,10 +849,10 @@ bot seeker
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 18
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_seeker_tag_refire 0.2
percussion 41 // 041_Tom_Low_2-0.wav
time 0
@ -854,10 +881,10 @@ bot rifle
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd selectweapon 16
cmd wait 0.5
cmd wait @WAIT_SELECTWEAPON
raw settemp g_balance_rifle_secondary_refire 0.3
// percussion FIXME
// time 0
@ -882,10 +909,9 @@ bot jetpack
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
raw settemp g_jetpack_attenuation 0.5
cmd wait 0.5
percussion 42 // 042_Hi-Hat_Closed-0.wav
time 0
buttons hook
@ -904,9 +930,8 @@ bot jumper
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd wait 0.5
percussion 36 // 036_Kick_2-0.wav
time -0.6666666
buttons jump
@ -919,9 +944,8 @@ bot metaljumper
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd wait 0.5
percussion 65 // 065_Timbale_High-0.wav
time -0.6666666
buttons jump
@ -936,9 +960,8 @@ bot switcher
channels 10
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd wait 0.5
percussion 29 // not in freepats
time 0
cmd impulse 10
@ -948,13 +971,11 @@ bot switcher
percussion 29
bot vocals
channels -1
init
time -2
cmd aimtarget tPercussion 1
cmd aimtarget tPercussion @WAIT_AIMTARGET
cmd barrier
cmd wait 0.5
vocals
text vocals
time 0
cmd sound %s
buttons left
@ -987,6 +1008,7 @@ bot instance_tuba_red
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
@ -996,6 +1018,7 @@ bot instance_tuba_blue
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
@ -1005,6 +1028,7 @@ bot instance_accordeon_red
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
@ -1014,6 +1038,27 @@ bot instance_accordeon_blue
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
bot instance_kleinbottle_red
include kleinbottle_red
include common
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
bot instance_kleinbottle_blue
include kleinbottle_blue
include common
count 16
init
cmd cc teleporttotarget @places_tuba
// cmd movetotarget @places_tuba
cmd barrier
super
@ -1023,6 +1068,7 @@ bot instance_laser
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1032,6 +1078,7 @@ bot instance_shotgun
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1041,6 +1088,7 @@ bot instance_uzi
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1050,6 +1098,7 @@ bot instance_electro
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1059,6 +1108,7 @@ bot instance_crylink
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1068,6 +1118,7 @@ bot instance_nex
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1077,6 +1128,7 @@ bot instance_minstanex
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1086,6 +1138,7 @@ bot instance_hagar
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1095,6 +1148,7 @@ bot instance_rocket
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1104,6 +1158,7 @@ bot instance_hook
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1113,6 +1168,7 @@ bot instance_seeker
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1122,6 +1178,7 @@ bot instance_rifle
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1131,6 +1188,7 @@ bot instance_jetpack
count 16
init
cmd cc teleporttotarget @places_nosteps
// cmd movetotarget @places_nosteps
cmd barrier
super
@ -1140,6 +1198,7 @@ bot instance_jumper
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1149,6 +1208,7 @@ bot instance_metaljumper
count 16
init
cmd cc teleporttotarget @places_metalsteps
// cmd movetotarget @places_metalsteps
cmd barrier
super
@ -1158,6 +1218,7 @@ bot instance_switcher
count 16
init
cmd cc teleporttotarget @places_percussion
// cmd movetotarget @places_percussion
cmd barrier
super
@ -1168,7 +1229,9 @@ bot instance_vocals
init
cmd cc playermodel models/player/suiseiseki.zym
cmd cc teleporttotarget @places_vocals
// cmd movetotarget @places_vocals
cmd barrier
super
// TODO jumping?

View File

@ -14,6 +14,7 @@ use constant SYS_TICRATE => 0.033333;
use constant MIDI_FIRST_NONCHANNEL => 17;
use constant MIDI_DRUMS_CHANNEL => 10;
use constant TEXT_EVENT_CHANNEL => -1;
die "Usage: $0 filename.conf midifile1 transpose1 midifile2 transpose2 ..."
unless @ARGV > 1 and @ARGV % 2;
@ -163,14 +164,14 @@ sub botconfig_read($)
$super = $currentbot->{percussion}->{$1};
$currentbot->{percussion}->{$1} = $appendref = [];
}
elsif(/^vocals$/)
elsif(/^text (.*)$/)
{
$super = $currentbot->{vocals};
$currentbot->{vocals} = $appendref = [];
$super = $currentbot->{text}->{$1};
$currentbot->{text}->{$1} = $appendref = [];
}
else
{
print "unknown command: $_\n";
print STDERR "unknown command: $_\n";
}
}
elsif(/^bot (.*)/)
@ -216,7 +217,7 @@ sub botconfig_read($)
}
else
{
print "unknown command: $_\n";
print STDERR "unknown command: $_\n";
}
}
@ -401,6 +402,8 @@ sub busybot_note_off_bot($$$$)
{
my ($bot, $time, $channel, $note) = @_;
#print STDERR "note off $bot:$time:$channel:$note\n";
return 1
if not $bot->{busy};
my ($busychannel, $busynote, $cmds) = @{$bot->{busy}};
return 1
if not defined $cmds; # note off cannot fail
@ -425,16 +428,19 @@ sub busybot_get_cmds_bot($$$)
{
my ($bot, $channel, $note) = @_;
my ($k0, $k1, $cmds, $cmds_off) = (undef, undef, undef, undef);
if($channel <= 0)
if($channel == TEXT_EVENT_CHANNEL)
{
# vocals
$cmds = $bot->{vocals};
$note =~ /^([^:]*):(.*)$/;
my $name = $1;
my $data = $2;
$cmds = $bot->{text}->{$name};
if(defined $cmds)
{
$cmds = [ map { [ map { $_ eq '%s' ? $note : $_ } @$_ ] } @$cmds ];
$cmds = [ map { [ map { $_ eq '%s' ? $data : $_ } @$_ ] } @$cmds ];
}
$k0 = "vocals";
$k1 = $channel;
$k0 = "text";
$k1 = $name;
}
elsif($channel == 10)
{
@ -457,6 +463,7 @@ sub busybot_get_cmds_bot($$$)
sub busybot_note_on_bot($$$$$$$)
{
my ($bot, $time, $channel, $program, $note, $init, $force) = @_;
return -1 # I won't play on this channel
if defined $bot->{channels} and not $bot->{channels}->{$channel};
return -1 # I won't play this program
@ -491,7 +498,7 @@ sub busybot_note_on_bot($$$$$$$)
if not busybot_cmd_bot_test $bot, $time + $notetime, $force, @$cmds;
busybot_cmd_bot_execute $bot, $time + $notetime, @$cmds;
}
if(defined $cmds and defined $cmds_off)
if(defined $cmds_off)
{
$bot->{busy} = [$channel, $note, $cmds_off];
}
@ -529,11 +536,6 @@ sub busybot_note_off($$$)
# print STDERR "note off $time:$channel:$note\n";
return 0
if $channel <= 0;
return 0
if $channel == 10;
if(my $bot = $notechannelbots{$channel}{$note})
{
busybot_note_off_bot $bot, $time, $channel, $note;
@ -589,6 +591,7 @@ sub busybot_note_on($$$$)
if($notechannelbots{$channel}{$note})
{
print STDERR "THIS SHOULD NEVER HAPPEN\n";
busybot_note_off $time, $channel, $note;
}
@ -792,6 +795,8 @@ sub ConvertMIDI($$)
my ($command, $delta, @data) = @$_;
$command = 'note_off' if $command eq 'note_on' and $data[2] == 0;
$tick += $delta;
next
if $command eq 'text_event' && $data[0] !~ /:/;
push @allmidievents, [$command, $tick, $sequence++, $track, @data];
}
}
@ -814,17 +819,25 @@ sub ConvertMIDI($$)
}
else
{
push @allmidievents, ['note_on', $tick * $scale + $shift, $sequence++, -1, -1, $file];
push @allmidievents, ['note_off', $tick * $scale + $shift, $sequence++, -1, -1, $file];
push @allmidievents, ['text_event', $tick * $scale + $shift, $sequence++, -1, "vocals:$file"];
}
}
}
# HACK for broken rosegarden export: put patch changes first by clearing their sequence number
for(@allmidievents)
{
if($_->[0] eq 'patch_change')
{
$_->[2] = -1;
}
}
# sort events
@allmidievents = sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } @allmidievents;
# find the first interesting event
my $shift = [grep { $_->[0] eq 'note_on' } @allmidievents]->[0][1];
my $shift = [grep { $_->[0] eq 'note_on' || $_->[0] eq 'text_event' } @allmidievents]->[0][1];
die "No notes!"
unless defined $shift;
@ -873,6 +886,16 @@ sub ConvertMIDI($$)
$midinotes{$chan}{$ev->[5]} = 0;
};
my $text_event = sub
{
my ($ev) = @_;
my $chan = TEXT_EVENT_CHANNEL;
busybot_note_on($t, TEXT_EVENT_CHANNEL, -1, $ev->[4]);
busybot_note_off($t, TEXT_EVENT_CHANNEL, $ev->[4]);
};
my $patch_change = sub
{
my ($ev) = @_;
@ -914,6 +937,10 @@ sub ConvertMIDI($$)
{
$note_off->($_);
}
elsif($_->[0] eq 'text_event')
{
$text_event->($_);
}
elsif($_->[0] eq 'patch_change')
{
$patch_change->($_);
@ -940,7 +967,7 @@ sub ConvertMIDI($$)
my $good = 0;
for my $channel(sort keys %notes_seen)
{
next if $channel == 10 or $channel < 0;
next if $channel == 10;
for my $program(sort keys %{$notes_seen{$channel}})
{
for my $note(sort keys %{$notes_seen{$channel}{$program}})
@ -1046,7 +1073,7 @@ sub Deallocate()
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}})
for my $note(sort keys %{$notehash{$cn}{$type}})
{
my $cnt = $notehash{$cn}{$type}{$note};
print STDERR " $type $note ($cnt times)\n";
@ -1086,7 +1113,6 @@ for(;;)
my @preallocate_new = map { $_->{classname} } @busybots_allocated;
if(@preallocate_new == @preallocate)
{
print "sv_cmd bot_cmd reset\n";
print "sv_cmd bot_cmd setbots @{[scalar @preallocate_new]}\n";
print "$precommands$commands";
exit 0;

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ snd_channel8volume 0 // bgm OFF
snd_channel9volume 0 // ambient OFF
// graphics
r_shadow_lightattenuationlinearscale 0.15
r_shadow_lightattenuationdividebias 0.03125
r_shadow_lightintensityscale 4
r_coronas 0.0625
// r_shadow_lightattenuationlinearscale 0.15
// r_shadow_lightattenuationdividebias 0.03125
// r_shadow_lightintensityscale 4
// r_coronas 0.0625
r_shadows_throwdistance 10000
r_shadows_shadowmapscale 0.25
r_usedepthtextures 1 // workaround for broken shadowmaps

View File

@ -54,6 +54,10 @@ while(<STDIN>)
$tracks->[$_]->events_r([clean($tracks->[$_]->events())])
for 0..@$tracks-1;
}
elsif($cmd eq 'dump')
{
print $opus->dump({ dump_tracks => 1 });
}
elsif($cmd eq 'ticks')
{
if(@arg)