hlac fix: proper size for textures, smaller scope, reposition of 1st person view
[divverent/nexuiz.git] / data / effectinfo-addcomments.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my $out = "";
7 my %found;
8
9 open my $fh, '<', 'effectinfo.txt';
10 while(<$fh>)
11 {
12         chomp;
13
14         next if /^\/\/ used in /;
15         next if /^\/\/ used nowhere in code$/;
16
17         if(/^effect\s+([^\s\/]+)\s*(?:\/\/.*)?$/i)
18         {
19                 if(!$found{$1})
20                 {
21                         print STDERR "Handling $1...\n";
22                         $found{$1} = 1;
23                         my $search =
24                                 $1 eq 'TR_BLOOD' ? 'MF_GIB' :
25                                 $1 eq 'TR_SLIGHTBLOOD' ? 'MF_ZOMGIB' :
26                                 $1 eq 'TR_WIZSPIKE' ? 'MF_TRACER' :
27                                 $1 eq 'TR_KNIGHTSPIKE' ? 'MF_TRACER2' :
28                                 $1 eq 'TR_ROCKET' ? 'MF_ROCKET' :
29                                 $1 eq 'TR_GRENADE' ? 'MF_GRENADE' :
30                                 $1 eq 'TR_VORESPIKE' ? 'MF_TRACER3' :
31                                 $1;
32                         local $ENV{effectre} =
33                                 $search eq lc $search
34                                         ? "\"$search\""
35                                         : "\"$search\"|\\<" . lc($search) . "\\>|\\<" . $search . "\\>";
36                         print "$ENV{effectre}\n";
37                         my $occurrences = `grep -E "\$effectre" qcsrc/server/*.qc qcsrc/client/*.qc`;
38                         $occurrences =~ s/\r/\n/g;
39                         $occurrences =~ s/;//g;
40                         my $found = 0;
41                         for(split /\n/, $occurrences)
42                         {
43                                 next if $_ eq '';
44                                 next if /^qcsrc\/server\/gamecommand\.qc:/; # list of quake effects is there
45                                 next if /^qcsrc\/client\/csqc_builtins\.qc:/; # list of quake effects is there
46                                 next if /^qcsrc\/client\/csqc_constants\.qc:/; # list of quake effects is there
47                                 $out .= "// used in $_\n";
48                                 $found = 1;
49                         }
50                         if(!$found)
51                         {
52                                 $out .= "// used nowhere in code\n";
53                         }
54                 }
55         }
56
57         $out .= "$_\n";
58 }
59 close $fh;
60
61 open $fh, '>', 'effectinfo.txt';
62 print $fh $out;
63 close $fh;