Skip to content

Commit 5a9d829

Browse files
committed
Improvements to right click location parsing.
1 parent d017a67 commit 5a9d829

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

sc2reader/readers.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,10 @@ def right_click_target(self, buffer, frames, type, code, pid, flag, atype):
603603
def right_click_move(self, buffer, frames, type, code, pid, flag, atype):
604604
#10 bytes total, coordinates have a different format?
605605
#X coordinate definitely is the first byte, with (hopefully) y next
606-
location = buffer.read_coordinate()
607-
buffer.skip(5)
608-
return LocationAbilityEvent(frames, pid, type, code, None, location)
609-
606+
x = buffer.read_short(BIG_ENDIAN)/256.0
607+
y = buffer.read_short(BIG_ENDIAN)/256.0
608+
buffer.skip(6)
609+
return LocationAbilityEvent(frames, pid, type, code, None, (x,y))
610610

611611

612612
class GameEventsReader_18574(GameEventsReader_16561):
@@ -626,6 +626,15 @@ def parse_ability_event(self, buffer, frames, type, code, pid):
626626

627627
raise ParseError()
628628

629+
def right_click_move(self, buffer, frames, type, code, pid, flag, atype):
630+
# This may port back to previous versions. Haven't checked
631+
# 10 bytes total, coordinates have a different format?
632+
x = buffer.read_short(BIG_ENDIAN)/256.0
633+
buffer.shift(5) # what is this for, why 5 bits instead of 4?
634+
y = buffer.read_short(BIG_ENDIAN)/256.0
635+
buffer.read(bits=5) # I'll just assume we should do it again
636+
buffer.skip(4)
637+
return LocationAbilityEvent(frames, pid, type, code, 0x3601, (x,y))
629638

630639

631640
class GameEventsReader_19595(GameEventsReader_18574):

0 commit comments

Comments
 (0)