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 push @ARGV, "$ARGV[0]-converted.dem"
44 die "Usage: $0 infile outfile"
46 my ($in, $out) = @ARGV;
49 or die "Input and output file may not be the same!";
51 open my $infh, "<", $in
52 or die "open $in: $!";
55 open my $outfh, ">", $out
56 or die "open $out: $!";
59 sub TranslateMapname($)
63 if exists $maps{$map};
70 my $cdtrack = <$infh>;
71 print $outfh $cdtrack;
78 unless 4 == read $infh, my $length, 4;
79 $length = unpack("V", $length);
80 die "Invalid demo packet"
81 unless 12 == read $infh, my $angles, 12;
82 die "Invalid demo packet"
83 unless $length == read $infh, my($data), $length;
91 maps/)([^\0]*)(\.bsp\0)
92 }{$1 . TranslateMapname($2) . $3}sex;
94 print $outfh pack("V", length $data);