]> icculus.org git repositories - divverent/nexuiz.git/blob - data/cvars.txt.pl
somewhat huge directory restructuring, all non nexuizXX.zip files are stored in trunk...
[divverent/nexuiz.git] / data / cvars.txt.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 open my $infh, '-|', '/nexuiz/data/darkplaces/darkplaces-dedicated -basedir .. -nexuiz +sys_colortranslation 2 +sys_specialcharactertranslation 0 +cvarlist +quit 2>&1'
6         or die "open: $!";
7
8 my $ignore_re = qr{
9 |       _.*                              # temp cvars
10
11 |       csqc_.*                          # internal
12 |       gamecfg                          # internal
13 |       g_configversion                  # internal
14 |       g_maplist_index                  # internal
15 |       halflifebsp                      # internal
16 |       cvar_check_.*                    # internal
17
18 |       cl_.*                            # client
19 |       con_.*                           # client
20 |       g_campaign.*                     # client
21 |       gl_.*                            # client
22 |       joy.*                            # client
23 |       menu_.*                          # client
24 |       mod_q3bsp_lightmapmergepower     # client
25 |       mod_q3bsp_nolightmaps            # client
26 |       net_slist_.*                     # client
27 |       r_.*                             # client
28 |       sbar_.*                          # client
29 |       scr_.*                           # client
30 |       userbind.*                       # client
31 |       v_.*                             # client
32 |       vid_.*                           # client
33
34 |       g_banned_list                    # private
35 |       g_ban_default_.*                 # private
36 |       g_ban_sync_.*                    # private
37 |       g_chat_flood_.*                  # private
38 |       log_dest_udp                     # private
39 |       log_file                         # private
40 |       net_address                      # private
41 |       port                             # private
42 |       rcon_.*                          # private
43 |       savedgamecfg                     # private
44 |       settemp_.*                       # private
45 |       sv_allowdownloads_.*             # private
46 |       sv_autodemo.*                    # private
47 |       sv_curl_.*                       # private
48 |       sv_eventlog.*                    # private
49 |       sv_heartbeatperoid               # private
50 |       sv_logscores_.*                  # private
51 |       sv_master.*                      # private
52 |       sv_vote_master_password          # private
53 |       sys_colortranslation             # private
54 |       sys_specialcharactertranslation  # private
55 |       timestamps                       # private
56
57 |       capturelimit                     # mapinfo
58 |       timelimit                        # mapinfo
59 |       fraglimit                        # mapinfo
60 |       g_arena                          # mapinfo
61 |       g_assault                        # mapinfo
62 |       g_ctf                            # mapinfo
63 |       g_dm                             # mapinfo
64 |       g_domination                     # mapinfo
65 |       g_keyhunt                        # mapinfo
66 |       g_keyhunt_teams                  # mapinfo
67 |       g_onslaught                      # mapinfo
68 |       g_race                           # mapinfo
69 |       g_runematch                      # mapinfo
70 |       g_tdm                            # mapinfo
71 |       teamplay                         # mapinfo
72
73 |       hostname                         # shown already
74 |       g_maplist                        # too long
75 |       g_maplist_mostrecent             # too long
76 |       sv_motd                          # too long
77 }x;
78
79 my %descr;
80 open my $fh, "<", "cvars.txt"
81         or die "<cvars.txt: $!";
82 while(<$fh>)
83 {
84         chomp;
85         /^"(.*?)\" \"(.*)\"$/ or next;
86         $descr{$1} = $2;
87 }
88 close $fh;
89
90 open $fh, ">", "cvars.txt"
91         or die ">cvars.txt: $!";
92
93 while(<$infh>)
94 {
95         chomp;
96         if(/^(?:\^7)?([a-z0-9_]*) is "(.*?)" \["(.*?)"\] (.*)$/)
97         {
98                 my ($cvar, $value, $default, $description) = ($1, $2, $3, $4);
99                 if($cvar =~ /^$ignore_re$/)
100                 {
101                         next;
102                 }
103                 if($default ne $value)
104                 {
105                         die "Run this on a DEFAULT config ($cvar has been changed from $default to $value)";
106                 }
107                 if($description eq 'custom cvar')
108                 {
109                         if(defined $descr{$cvar})
110                         {
111                                 print $fh "\"$cvar\" \"$descr{$cvar}\"\n";
112                         }
113                         else
114                         {
115                                 print $fh "\"$cvar\" \"TODO: describe me\"\n";
116                         }
117                 }
118                 else
119                 {
120                         print $fh "\"$cvar\"\n";
121                 }
122         }
123 }