r4799 - in trunk/data: . qcsrc/common qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Oct 22 02:08:00 EDT 2008
Author: div0
Date: 2008-10-22 02:07:59 -0400 (Wed, 22 Oct 2008)
New Revision: 4799
Added:
trunk/data/effectinfo-addcomments.pl
Modified:
trunk/data/qcsrc/common/util.qc
trunk/data/qcsrc/server/gamecommand.qc
Log:
add the perl script that annotates effectinfo.txt; fix effectindexdump command
Added: trunk/data/effectinfo-addcomments.pl
===================================================================
--- trunk/data/effectinfo-addcomments.pl (rev 0)
+++ trunk/data/effectinfo-addcomments.pl 2008-10-22 06:07:59 UTC (rev 4799)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $out = "";
+my %found;
+
+open my $fh, '<', 'effectinfo.txt';
+while(<$fh>)
+{
+ chomp;
+
+ next if /^\/\/ used in /;
+ next if /^\/\/ used nowhere in code$/;
+
+ if(/^effect\s+([^\s\/]+)\s*(?:\/\/.*)?$/i)
+ {
+ if(!$found{$1})
+ {
+ print STDERR "Handling $1...\n";
+ $found{$1} = 1;
+ my $search =
+ $1 eq 'TR_BLOOD' ? 'MF_GIB' :
+ $1 eq 'TR_SLIGHTBLOOD' ? 'MF_ZOMGIB' :
+ $1 eq 'TR_WIZSPIKE' ? 'MF_TRACER' :
+ $1 eq 'TR_KNIGHTSPIKE' ? 'MF_TRACER2' :
+ $1 eq 'TR_ROCKET' ? 'MF_ROCKET' :
+ $1 eq 'TR_GRENADE' ? 'MF_GRENADE' :
+ $1 eq 'TR_VORESPIKE' ? 'MF_TRACER3' :
+ $1;
+ local $ENV{effectre} =
+ $search eq lc $search
+ ? "\"$search\""
+ : "\"$search\"|\\<" . lc($search) . "\\>|\\<" . $search . "\\>";
+ print "$ENV{effectre}\n";
+ my $occurrences = `grep -E "\$effectre" qcsrc/server/*.qc qcsrc/client/*.qc`;
+ $occurrences =~ s/\r/\n/g;
+ $occurrences =~ s/;//g;
+ my $found = 0;
+ for(split /\n/, $occurrences)
+ {
+ next if $_ eq '';
+ next if /^qcsrc\/server\/gamecommand\.qc:/; # list of quake effects is there
+ next if /^qcsrc\/client\/csqc_builtins\.qc:/; # list of quake effects is there
+ next if /^qcsrc\/client\/csqc_constants\.qc:/; # list of quake effects is there
+ $out .= "// used in $_\n";
+ $found = 1;
+ }
+ if(!$found)
+ {
+ $out .= "// used nowhere in code\n";
+ }
+ }
+ }
+
+ $out .= "$_\n";
+}
+close $fh;
+
+open $fh, '>', 'effectinfo.txt';
+print $fh $out;
+close $fh;
Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc 2008-10-22 06:02:33 UTC (rev 4798)
+++ trunk/data/qcsrc/common/util.qc 2008-10-22 06:07:59 UTC (rev 4799)
@@ -951,7 +951,7 @@
float data;
float end;
float i;
-
+
_argc_sane = 0;
data = 0;
end = strlen(s);
Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc 2008-10-22 06:02:33 UTC (rev 4798)
+++ trunk/data/qcsrc/server/gamecommand.qc 2008-10-22 06:07:59 UTC (rev 4799)
@@ -420,7 +420,7 @@
fh = fopen("effectinfo.txt", FILE_READ);
while((s = fgets(fh)))
{
- tokenize_sane(s);
+ tokenize_insane(s); // tokenize_sane would hit the loop counter :(
if(argv(0) == "effect")
{
if(db_get(d, argv(1)) != "1")
More information about the nexuiz-commits
mailing list