@@ -531,13 +531,13 @@ def player_send_resource_event(self, data, fstamp, pid, event_type):
531
531
def player_request_resource_event (self , data , fstamp , pid , event_type ):
532
532
flags = data .read_bits (3 ) #??
533
533
custom = minerals = vespene = terrazine = 0
534
- if data .read_bits ( 1 ):
534
+ if data .read_bool ( ):
535
535
custom = data .read_bits (31 ) #??
536
- if data .read_bits ( 1 ):
536
+ if data .read_bool ( ):
537
537
minerals = data .read_bits (31 )
538
- if data .read_bits ( 1 ):
538
+ if data .read_bool ( ):
539
539
vespene = data .read_bits (31 )
540
- if data .read_bits ( 1 ):
540
+ if data .read_bool ( ):
541
541
terrazine = data .read_bits (31 ) #??
542
542
return RequestResourceEvent (fstamp , pid , event_type , minerals , vespene , terrazine , custom )
543
543
@@ -546,17 +546,17 @@ def camera_event(self, data, fstamp, pid, event_type):
546
546
x = data .read_uint16 ()/ 256.0
547
547
y = data .read_uint16 ()/ 256.0
548
548
distance = pitch = yaw = height = 0
549
- if data .read_bits ( 1 ):
549
+ if data .read_bool ( ):
550
550
distance = data .read_uint16 ()/ 256.0
551
- if data .read_bits ( 1 ):
551
+ if data .read_bool ( ):
552
552
#Note: this angle is relative to the horizontal plane, but the editor shows the angle relative to the vertical plane. Subtract from 90 degrees to convert.
553
553
pitch = data .read_uint16 () #?
554
554
pitch = 45 * (((((pitch * 0x10 - 0x2000 ) << 17 ) - 1 ) >> 17 ) + 1 ) / 4096.0
555
- if data .read_bits ( 1 ):
555
+ if data .read_bool ( ):
556
556
#Note: this angle is the vector from the camera head to the camera target projected on to the x-y plane in positive coordinates. So, default is 90 degrees, while insert and delete produce 45 and 135 degrees by default.
557
557
yaw = data .read_uint16 () #?
558
558
yaw = 45 * (((((yaw * 0x10 - 0x2000 ) << 17 ) - 1 ) >> 17 ) + 1 ) / 4096.0
559
- if data .read_bits ( 1 ):
559
+ if data .read_bool ( ):
560
560
height_offset = data .read_uint16 ()/ 256.0
561
561
return CameraEvent (fstamp , pid , event_type , x , y , distance , pitch , yaw , height )
562
562
@@ -616,10 +616,10 @@ def player_ability_event(self, data, fstamp, pid, event_type):
616
616
# See sc2replay-csharp wiki for details
617
617
flags = data .read_bits (self .PLAYER_ABILITY_FLAGS )
618
618
619
- default_ability = not data .read_bits ( 1 )
619
+ default_ability = not data .read_bool ( )
620
620
if not default_ability :
621
621
ability = data .read_uint16 () << 5 | data .read_bits (5 )
622
- default_actor = not data .read_bits ( 1 )
622
+ default_actor = not data .read_bool ( )
623
623
else :
624
624
ability = 0
625
625
@@ -629,7 +629,7 @@ def player_ability_event(self, data, fstamp, pid, event_type):
629
629
y = data .read_bits (20 )/ 4096.0
630
630
z = data .read_uint32 ()
631
631
z = (z >> 1 )/ 8192.0 * pow (- 1 , z & 0x1 )
632
- unknown = data .read_bits ( 1 )
632
+ unknown = data .read_bool ( )
633
633
return LocationAbilityEvent (fstamp , pid , event_type , ability , flags , (x , y , z ))
634
634
635
635
elif target_type == 2 :
@@ -639,22 +639,22 @@ def player_ability_event(self, data, fstamp, pid, event_type):
639
639
unit = (data .read_uint32 (), data .read_uint16 ())
640
640
if fstamp == 9007 or unit [0 ] == 0x94880002 :
641
641
print fstamp , hex (unit [0 ])
642
- if self .ABILITY_TEAM_FLAG and data .read_bits ( 1 ):
642
+ if self .ABILITY_TEAM_FLAG and data .read_bool ( ):
643
643
team = data .read_bits (4 )
644
644
645
- if data .read_bits ( 1 ):
645
+ if data .read_bool ( ):
646
646
player = data .read_bits (4 )
647
647
648
648
x = data .read_bits (20 )/ 4096.0
649
649
y = data .read_bits (20 )/ 4096.0
650
650
z = data .read_uint32 ()
651
651
z = (z >> 1 )/ 8192.0 * pow (- 1 , z & 0x1 )
652
- unknown = data .read_bits ( 1 )
652
+ unknown = data .read_bool ( )
653
653
return TargetAbilityEvent (fstamp , pid , event_type , ability , flags , unit , player , team , (x , y , z ))
654
654
655
655
elif target_type == 3 :
656
656
unit_id = data .read_uint32 ()
657
- unknown = data .read_bits ( 1 )
657
+ unknown = data .read_bool ( )
658
658
return SelfAbilityEvent (fstamp , pid , event_type , ability , flags , unit_id )
659
659
660
660
else :
@@ -693,16 +693,16 @@ def beta_end_game_event(self, data, fstamp, pid, event_type):
693
693
694
694
def camera_event (self , data , fstamp , pid , event_type ):
695
695
x = y = distance = pitch = yaw = height = 0
696
- if data .read_bits ( 1 ):
696
+ if data .read_bool ( ):
697
697
x = data .read_uint16 ()/ 256.0
698
698
y = data .read_uint16 ()/ 256.0
699
- if data .read_bits ( 1 ):
699
+ if data .read_bool ( ):
700
700
distance = data .read_uint16 ()/ 256.0
701
- if data .read_bits ( 1 ):
701
+ if data .read_bool ( ):
702
702
#Note: this angle is relative to the horizontal plane, but the editor shows the angle relative to the vertical plane. Subtract from 90 degrees to convert.
703
703
pitch = data .read_uint16 () #?
704
704
pitch = 45 * (((((pitch * 0x10 - 0x2000 ) << 17 ) - 1 ) >> 17 ) + 1 ) / 4096.0
705
- if data .read_bits ( 1 ):
705
+ if data .read_bool ( ):
706
706
#Note: this angle is the vector from the camera head to the camera target projected on to the x-y plane in positive coordinates. So, default is 90 degrees, while insert and delete produce 45 and 135 degrees by default.
707
707
yaw = data .read_uint16 () #?
708
708
yaw = 45 * (((((yaw * 0x10 - 0x2000 ) << 17 ) - 1 ) >> 17 ) + 1 ) / 4096.0
0 commit comments