6 my @cols = qw/omg low med normal high ultra ultimate/;
\r
11 my $fn = "effects-$col.cfg";
\r
12 open my $fh, "<", "$fn"
\r
17 next unless /^(\S+) (.*)$/;
\r
18 $table{$1}{$col} = $2;
\r
23 for my $row(keys %table)
\r
28 for my $col(reverse @cols)
\r
30 if(defined $last && $table{$row}{$col} == $last)
\r
36 $last = $table{$row}{$col};
\r
40 $sortkeys{$row} = \@toggles;
\r
42 sub toggles_compare($$);
\r
43 sub toggles_compare($$)
\r
46 return 0 if !@$a and !@$b;
\r
47 return -1 if !@$a and @$b;
\r
48 return +1 if @$a and !@$b;
\r
49 return -1 if $a->[0] < $b->[0];
\r
50 return +1 if $a->[0] > $b->[0];
\r
55 return toggles_compare \@a, \@b;
\r
57 my @rows_sorted = sort { toggles_compare $sortkeys{$a}, $sortkeys{$b} or $a cmp $b } keys %table;
\r
61 <title>Effects configs</title>
\r
62 <h1>Effects configs</h1>
\r
63 <table cellspacing=0>
\r
64 <tr><th width="40%">cvar</th>
\r
70 <th width="@{[60 / @cols]}%">$col</th>
\r
78 for my $row(@rows_sorted)
\r
84 my $last_colspan = undef;
\r
85 my $total_colspan = 0;
\r
86 my $print_last = sub {
\r
89 my $colorspan = ($last_colspan * 0.5 + $total_colspan) / @cols;
\r
90 my $color = sprintf "#%02x%02x%02x",
\r
91 # red-yellow-green transition
\r
92 # FF0000 -> FFFF00 -> 00FF00
\r
93 ($colorspan > 0.5) ? 255 * (2 - 2 * $colorspan) : 255,
\r
94 ($colorspan < 0.5) ? 255 * (2 * $colorspan) : 255,
\r
96 $total_colspan += $last_colspan;
\r
98 <td colspan="$last_colspan" align="center" bgcolor="$color">$last</td>
\r
104 my $v = $table{$row}{$col};
\r
105 if(defined $last && $v == $last)
\r