Selection Event Format

7 views
Skip to first unread message

grom

unread,
Apr 8, 2011, 1:32:38 AM4/8/11
to phpsc2replay
I using Sc2gears --print-action-list and comparing it to what
phpsc2replay outputs. Is the selection event code still correct? Cause
for example here is a snippet from Sc2gears:

0:04 grom Select SCV (101c4)
0:04 grom Select SCV x5 (101b0,101b4,101b8,101bc,101c0)

I added in some debug printouts to phpsc2replay and I get:

SELECTION - type=21101; ids=(0170)
SELECTION - type=21101; ids=(006C,016C,026C,036C,0070)

As you can notice the ids don't match up. And reading the wiki
( http://code.google.com/p/phpsc2replay/wiki/ReplayGameEvents#Selection_event_format
)
It says the UniqueID are in increments of 4. Which matches what is
outputted from Sc2gears.

Any ideas?

grom

unread,
Apr 14, 2011, 7:12:05 PM4/14/11
to phpsc2replay
I ported the ReplayBuffer class from sc2reader to PHP and modified the
parseGameEventsFile function to use it, and I got better results when
parsing selection events.

$first = $buffer->readByte();
$deselectFlag = $buffer->shift(2);

if ($deselectFlag == 0x01) {
$mask = $buffer->readBitmask();
} else if ($deselectFlag == 0x02) {
$count = $buffer->readByte();
$indexes = array();
for ($i = 0; $i < $count; ++$i) {
$indexes[] = $buffer->readByte();
}
} else if ($deselectFlag == 0x03) {
$count = $buffer->readByte();
$indexes = array();
for ($i = 0; $i < $count; ++$i) {
$indexes[] = $buffer->readByte();
}
} else {
}

$uType = array();
$count = $buffer->readByte();
for ($i = 0; $i < $count; ++$i) {
$type = $buffer->readObjectType(true);
$unitTypeCount = $buffer->readByte();
$uType[] = array(
'id' => $type,
'count' => $unitTypeCount
);
}
$count = $buffer->readByte();
$unitIDs = array();
for ($i = 0; $i < $count; ++$i) {
$id = $buffer->readObjectId(true);
$unitIDs[] = $id;
}

Is there some way I can submit the buffer class to you guys?

Zsol

unread,
Apr 15, 2011, 2:14:03 AM4/15/11
to phpsc2...@googlegroups.com, grom
Sure, either make a clone of the project on code.google.com, or just
attach the file.
I'll test it for sure :)
Reply all
Reply to author
Forward
0 new messages