4 # ./democonv-15-20.pl infile outfile
10 my $svc_print = "\010";
11 my $svc_serverinfo = "\013";
14 nexdm01 => 'basement',
16 nexdm03 => 'slimepit',
19 nexdm06 => 'starship',
21 nexdm08 => 'glowarena',
22 nexdm09 => 'aneurism',
23 nexdm10 => 'stormkeep',
24 nexdm11 => 'ruinsofslaughter',
25 nexdm12 => 'evilspace',
29 nexdm16 => 'silvercity',
30 nexdm17 => 'dieselpower',
31 nexdm18 => 'runningman',
32 nexdm18_1on1remix => 'runningman_1on1remix',
33 nexdmextra1 => 'darkzone',
34 nexdmextra2 => 'aggressor',
35 nexctf01 => 'basementctf',
36 nexctf02 => 'runningmanctf',
41 die "Usage: $0 infile outfile"
43 my ($in, $out) = @ARGV;
46 or die "Input and output file may not be the same!";
48 open my $infh, "<", $in
49 or die "open $in: $!";
52 open my $outfh, ">", $out
53 or die "open $out: $!";
56 sub TranslateMapname($)
60 if exists $maps{$map};
67 my $cdtrack = <$infh>;
68 print $outfh $cdtrack;
75 unless 4 == read $infh, my $length, 4;
76 $length = unpack("V", $length);
77 die "Invalid demo packet"
78 unless 12 == read $infh, my $angles, 12;
79 die "Invalid demo packet"
80 unless $length == read $infh, my($data), $length;
88 maps/)([^\0]*)(\.bsp\0)
89 }{$1 . TranslateMapname($2) . $3}sex;
91 print $outfh pack("V", length $data);