git.shiar.nl
/
perl
/
schtarr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
screp: do not include trailing nulls in map name
[perl/schtarr.git]
/
screp
diff --git
a/screp
b/screp
index 10a2554826707ef615ef04465ce76b808b43c8c2..7bf178fa6e8d43708fb63cd696387aaf24e6cf4e 100755
(executable)
--- a/
screp
+++ b/
screp
@@
-10,6
+10,8
@@
GetOptions(
"verbose|v!" => \$SHOWWARN,
);
"verbose|v!" => \$SHOWWARN,
);
+use constant { APM_FIRSTFRAME => 80 / .042 };
+
{
package Data::StarCraft::Replay;
{
package Data::StarCraft::Replay;
@@
-310,6
+312,7
@@
my %cmdread = (
0x18 => ["cancel"],
0x19 => ["cancel hatch"],
0x1A => ["stop", 1],
0x18 => ["cancel"],
0x19 => ["cancel hatch"],
0x1A => ["stop", 1],
+# 0x1B => ["move-thing??"], # tim: after hotkey (unit, reaver??) select; soon after reselected and moved
0x1E => ["return cargo", 1],
0x1F => ["train", 2, \%unit],
0x20 => ["cancel train", 2], # == 254
0x1E => ["return cargo", 1],
0x1F => ["train", 2, \%unit],
0x20 => ["cancel train", 2], # == 254
@@
-426,7
+429,7
@@
sub unpackhash {
}
local $_ = Data::StarCraft::Replay::_read(undef, \*STDIN, 633)
}
local $_ = Data::StarCraft::Replay::_read(undef, \*STDIN, 633)
- and my ($head, @headdata) = unpackhash("CVa3Va12Z28v2Z16Z24C
a
26a38a*", $_, qw(
+ and my ($head, @headdata) = unpackhash("CVa3Va12Z28v2Z16Z24C
Z
26a38a*", $_, qw(
engine frames mag1 time mag2 name width height
unknown1 creator unknown2 map unknown3
))
engine frames mag1 time mag2 name width height
unknown1 creator unknown2 map unknown3
))
@@
-475,8
+478,6
@@
if ($SHOWWARN) {
}
}
}
}
-printf "duration: %s\n", showtime($map->[-1][0]);
-
my %cmdmacro = map {$_ => 1} (
(map {$_, "cancel $_"}
qw/train build hatch research upgrade arm/,
my %cmdmacro = map {$_ => 1} (
(map {$_, "cancel $_"}
qw/train build hatch research upgrade arm/,
@@
-488,7
+489,7
@@
my %cmdmacro = map {$_ => 1} (
my %stats; # player => count
for (@$map) {
$stats{$_->[1]}{actions}++;
my %stats; # player => count
for (@$map) {
$stats{$_->[1]}{actions}++;
- $stats{$_->[1]}{gameactions}++ if $_->[0] >
80 / .042
;
+ $stats{$_->[1]}{gameactions}++ if $_->[0] >
= APM_FIRSTFRAME
;
$stats{$_->[1]}{last} = $_->[0] if $_->[2] eq "part";
$stats{$_->[1]}{$cmdmacro{$_->[2]} ? "macro" : "micro"}++;
$stats{$_->[1]}{count}{$_->[2]}++;
$stats{$_->[1]}{last} = $_->[0] if $_->[2] eq "part";
$stats{$_->[1]}{$cmdmacro{$_->[2]} ? "macro" : "micro"}++;
$stats{$_->[1]}{count}{$_->[2]}++;
@@
-498,13
+499,12
@@
for my $player (sort keys %stats) {
my $row = $stats{$player};
$row->{last} ||= $map->[-1][0];
# printf("%d:%6d actions (%3d micro,%4d macro);%4d APM\n",
my $row = $stats{$player};
$row->{last} ||= $map->[-1][0];
# printf("%d:%6d actions (%3d micro,%4d macro);%4d APM\n",
- printf("%d:%6d actions
;%4
d APM\n",
- $player,
-
$row->{actions}
,
+ printf("%d:%6d actions
in%7d frames (%s) = %
d APM\n",
+ $player,
$row->{actions}, $row->{last},
+
showtime($row->{last})
,
# $row->{micro} / $row->{last} * 60 / .042 * 1.05,
# $row->{macro} / $row->{last} * 60 / .042 * 1.05,
# $row->{micro} / $row->{last} * 60 / .042 * 1.05,
# $row->{macro} / $row->{last} * 60 / .042 * 1.05,
- $row->{gameactions} / $row->{last} * 60 / .042 * 1.042,
- # $row->{gameactions} / $map->[-1][0] * 60 / .042,
+ $row->{gameactions} / ($row->{last} - APM_FIRSTFRAME) * 60 / .042,
);
if (0) {
);
if (0) {