diff --git a/README.md b/README.md index 7bf98fa..bef2c8f 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ To run tests [Git LFS](https://git-lfs.github.com) is required. ```sh git submodule init git submodule update -pushd test/cs-demos && git lfs pull && popd +pushd test/cs-demos && git lfs pull -I '*' && popd go test ./... ``` diff --git a/csminify.go b/csminify.go index d76d9ed..35810bf 100644 --- a/csminify.go +++ b/csminify.go @@ -159,7 +159,8 @@ func (m *minifier) snapshot() rep.Snapshot { Armor: pl.Armor, FlashDuration: float32(roundTo(float64(pl.FlashDuration), 0.1)), // Round to nearest 0.1 sec - saves space in JSON Positions: []rep.Point{r3VectorToPoint(pl.Position)}, - Angle: int(pl.ViewDirectionX), + AngleX: int(pl.ViewDirectionX), + AngleY: int(pl.ViewDirectionY), } // FIXME: Smoothify Positions diff --git a/examples/minimal.json b/examples/minimal.json index bec4592..aa65f27 100644 --- a/examples/minimal.json +++ b/examples/minimal.json @@ -5,21 +5,6 @@ "snapshotRate": 51 }, "entities": [ - { - "id": 8, - "name": "eswc.com | Samy", - "team": 1 - }, - { - "id": 12, - "name": "Ptikrazy", - "team": 1 - }, - { - "id": 13, - "name": "keev", - "team": 3 - }, { "id": 2, "name": "xms*ASUS ♥ /F/", @@ -30,11 +15,6 @@ "name": "to1nou * Seagate", "team": 2 }, - { - "id": 4, - "name": "tiziaN", - "team": 3 - }, { "id": 5, "name": "ALEX * Intel", @@ -46,10 +26,9 @@ "team": 2 }, { - "id": 1, - "name": "ESWC TV - By VeryGames.net", - "team": 0, - "isNpc": true + "id": 8, + "name": "eswc.com | Samy", + "team": 1 }, { "id": 9, @@ -61,14 +40,35 @@ "name": "syrsoNR", "team": 3 }, + { + "id": 1, + "name": "ESWC TV - By VeryGames.net", + "team": 0, + "isNpc": true + }, + { + "id": 12, + "name": "Ptikrazy", + "team": 1 + }, + { + "id": 13, + "name": "keev", + "team": 3 + }, + { + "id": 14, + "name": "kzy LJ∼", + "team": 3 + }, { "id": 11, "name": "mistou * Cooler Master", "team": 2 }, { - "id": 14, - "name": "kzy LJ∼", + "id": 4, + "name": "tiziaN", "team": 3 }, { @@ -90,33 +90,22 @@ "z": 1613 } ], - "angle": 182, - "hp": 100 - }, - { - "entityId": 13, - "positions": [ - { - "x": -1572, - "y": 722, - "z": 1614 - } - ], - "angle": 270, + "angleX": 182, "hp": 100 }, { - "entityId": 3, + "entityId": 2, "positions": [ { - "x": 555, - "y": 186, - "z": 1613 + "x": 513, + "y": -85, + "z": 1744 } ], - "angle": 187, - "hp": 100, - "armor": 100 + "angleX": 170, + "angleY": 4, + "hp": 24, + "armor": 83 }, { "entityId": 14, @@ -127,22 +116,11 @@ "z": 1636 } ], - "angle": 86, + "angleX": 86, + "angleY": 8, "hp": 8, "armor": 86 }, - { - "entityId": 4, - "positions": [ - { - "x": -817, - "y": -451, - "z": 1614 - } - ], - "angle": 92, - "hp": 97 - }, { "entityId": 5, "positions": [ @@ -152,34 +130,36 @@ "z": 1613 } ], - "angle": 195, + "angleX": 195, + "angleY": 357, "hp": 11, "armor": 86 }, { - "entityId": 2, + "entityId": 10, "positions": [ { - "x": 513, - "y": -85, - "z": 1744 + "x": -1382, + "y": 815, + "z": 1614 } ], - "angle": 170, - "hp": 24, - "armor": 83 + "angleX": 270, + "hp": 100 }, { - "entityId": 10, + "entityId": 3, "positions": [ { - "x": -1382, - "y": 815, - "z": 1614 + "x": 555, + "y": 186, + "z": 1613 } ], - "angle": 270, - "hp": 100 + "angleX": 187, + "angleY": 357, + "hp": 100, + "armor": 100 }, { "entityId": 11, @@ -190,9 +170,36 @@ "z": 1748 } ], - "angle": 195, + "angleX": 195, + "angleY": 6, "hp": 16, "armor": 98 + }, + { + "entityId": 13, + "positions": [ + { + "x": -1572, + "y": 722, + "z": 1614 + } + ], + "angleX": 270, + "angleY": 359, + "hp": 100 + }, + { + "entityId": 4, + "positions": [ + { + "x": -817, + "y": -451, + "z": 1614 + } + ], + "angleX": 92, + "angleY": 12, + "hp": 97 } ] }, @@ -200,55 +207,59 @@ "tick": 102, "entityUpdates": [ { - "entityId": 3, + "entityId": 2, "positions": [ { - "x": 374, - "y": 167, - "z": 1613 + "x": 336, + "y": -127, + "z": 1790 } ], - "angle": 150, - "hp": 100, - "armor": 100 + "angleX": 163, + "angleY": 8, + "hp": 24, + "armor": 83 }, { - "entityId": 4, + "entityId": 14, "positions": [ { - "x": -840, - "y": 37, - "z": 1614 + "x": -825, + "y": 606, + "z": 1636 } ], - "angle": 87, - "hp": 97 + "angleX": 86, + "angleY": 8, + "hp": 8, + "armor": 86 }, { - "entityId": 5, + "entityId": 3, "positions": [ { - "x": -29, - "y": 368, + "x": 374, + "y": 167, "z": 1613 } ], - "angle": 101, - "hp": 11, - "armor": 86 + "angleX": 150, + "hp": 100, + "armor": 100 }, { - "entityId": 2, + "entityId": 5, "positions": [ { - "x": 336, - "y": -127, - "z": 1790 + "x": -29, + "y": 368, + "z": 1613 } ], - "angle": 163, - "hp": 24, - "armor": 83 + "angleX": 101, + "angleY": 353, + "hp": 11, + "armor": 86 }, { "entityId": 9, @@ -259,46 +270,46 @@ "z": 1614 } ], - "angle": 281, + "angleX": 281, + "angleY": 2, "hp": 100 }, { - "entityId": 10, + "entityId": 4, "positions": [ { - "x": -1382, - "y": 815, + "x": -840, + "y": 37, "z": 1614 } ], - "angle": 270, - "hp": 100 + "angleX": 87, + "angleY": 11, + "hp": 97 }, { - "entityId": 11, + "entityId": 7, "positions": [ { - "x": 112, - "y": -366, - "z": 1614 + "x": 2973, + "y": 250, + "z": 1613 } ], - "angle": 201, - "hp": 16, - "armor": 98 + "angleX": 182, + "hp": 100 }, { - "entityId": 14, + "entityId": 10, "positions": [ { - "x": -825, - "y": 606, - "z": 1636 + "x": -1382, + "y": 815, + "z": 1614 } ], - "angle": 86, - "hp": 8, - "armor": 86 + "angleX": 270, + "hp": 100 }, { "entityId": 13, @@ -309,20 +320,23 @@ "z": 1614 } ], - "angle": 270, + "angleX": 270, + "angleY": 359, "hp": 100 }, { - "entityId": 7, + "entityId": 11, "positions": [ { - "x": 2973, - "y": 250, - "z": 1613 + "x": 112, + "y": -366, + "z": 1614 } ], - "angle": 182, - "hp": 100 + "angleX": 201, + "angleY": 1, + "hp": 16, + "armor": 98 } ] } diff --git a/examples/minimal.mp b/examples/minimal.mp index b6661a8..7acc446 100644 Binary files a/examples/minimal.mp and b/examples/minimal.mp differ diff --git a/examples/minimal.pb b/examples/minimal.pb index d641740..ac63e18 100644 Binary files a/examples/minimal.pb and b/examples/minimal.pb differ diff --git a/protobuf/gen/proto/replay.proto b/protobuf/gen/proto/replay.proto index fe33a5c..c9b5210 100644 --- a/protobuf/gen/proto/replay.proto +++ b/protobuf/gen/proto/replay.proto @@ -33,12 +33,13 @@ message Replay { message EntityUpdate{ int32 entityId = 1; repeated Point positions = 2; - int32 angle = 3; + int32 angleX = 3; int32 hp = 4; int32 armor = 5; float flashDuration = 6; Team team = 7; bool isNpc = 8; + int32 angleY = 9; // TODO: move next to angleX, and change to int16 before v1.0 } int32 tick = 1; diff --git a/protobuf/gen/replay.pb.go b/protobuf/gen/replay.pb.go index 2b11f5a..84fb699 100644 --- a/protobuf/gen/replay.pb.go +++ b/protobuf/gen/replay.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -20,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Team int32 @@ -162,7 +163,7 @@ func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Point.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -223,7 +224,7 @@ func (m *Replay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Replay.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -290,7 +291,7 @@ func (m *Replay_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_Replay_Header.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -351,7 +352,7 @@ func (m *Replay_Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_Replay_Entity.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -417,7 +418,7 @@ func (m *Replay_Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_Replay_Snapshot.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -453,12 +454,13 @@ func (m *Replay_Snapshot) GetEntityUpdates() []*Replay_Snapshot_EntityUpdate { type Replay_Snapshot_EntityUpdate struct { EntityId int32 `protobuf:"varint,1,opt,name=entityId,proto3" json:"entityId,omitempty"` Positions []*Point `protobuf:"bytes,2,rep,name=positions,proto3" json:"positions,omitempty"` - Angle int32 `protobuf:"varint,3,opt,name=angle,proto3" json:"angle,omitempty"` + AngleX int32 `protobuf:"varint,3,opt,name=angleX,proto3" json:"angleX,omitempty"` Hp int32 `protobuf:"varint,4,opt,name=hp,proto3" json:"hp,omitempty"` Armor int32 `protobuf:"varint,5,opt,name=armor,proto3" json:"armor,omitempty"` FlashDuration float32 `protobuf:"fixed32,6,opt,name=flashDuration,proto3" json:"flashDuration,omitempty"` Team Team `protobuf:"varint,7,opt,name=team,proto3,enum=gen.Team" json:"team,omitempty"` IsNpc bool `protobuf:"varint,8,opt,name=isNpc,proto3" json:"isNpc,omitempty"` + AngleY int32 `protobuf:"varint,9,opt,name=angleY,proto3" json:"angleY,omitempty"` } func (m *Replay_Snapshot_EntityUpdate) Reset() { *m = Replay_Snapshot_EntityUpdate{} } @@ -475,7 +477,7 @@ func (m *Replay_Snapshot_EntityUpdate) XXX_Marshal(b []byte, deterministic bool) return xxx_messageInfo_Replay_Snapshot_EntityUpdate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -508,9 +510,9 @@ func (m *Replay_Snapshot_EntityUpdate) GetPositions() []*Point { return nil } -func (m *Replay_Snapshot_EntityUpdate) GetAngle() int32 { +func (m *Replay_Snapshot_EntityUpdate) GetAngleX() int32 { if m != nil { - return m.Angle + return m.AngleX } return 0 } @@ -550,6 +552,13 @@ func (m *Replay_Snapshot_EntityUpdate) GetIsNpc() bool { return false } +func (m *Replay_Snapshot_EntityUpdate) GetAngleY() int32 { + if m != nil { + return m.AngleY + } + return 0 +} + type Replay_Tick struct { Nr int32 `protobuf:"varint,1,opt,name=nr,proto3" json:"nr,omitempty"` Events []*Replay_Tick_Event `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"` @@ -569,7 +578,7 @@ func (m *Replay_Tick) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_Replay_Tick.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -621,7 +630,7 @@ func (m *Replay_Tick_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_Replay_Tick_Event.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -675,7 +684,7 @@ func (m *Replay_Tick_Event_Attribute) XXX_Marshal(b []byte, deterministic bool) return xxx_messageInfo_Replay_Tick_Event_Attribute.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -740,65 +749,66 @@ func init() { func init() { proto.RegisterFile("replay.proto", fileDescriptor_eed9461330ccfc03) } var fileDescriptor_eed9461330ccfc03 = []byte{ - // 819 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcd, 0x6e, 0xe3, 0x54, - 0x14, 0x8e, 0x7f, 0x6b, 0x9f, 0x26, 0xd5, 0x9d, 0xab, 0x01, 0x59, 0x41, 0x44, 0x21, 0x02, 0x54, - 0xcd, 0x22, 0x88, 0xb2, 0x62, 0x87, 0x49, 0xee, 0xb4, 0xa6, 0x8d, 0x53, 0x5d, 0xdf, 0x94, 0x9f, - 0x4d, 0x74, 0xdb, 0x98, 0xc6, 0x6a, 0x63, 0x5b, 0xb6, 0x83, 0x26, 0xf3, 0x0a, 0x08, 0x89, 0x25, - 0xef, 0xc2, 0x0b, 0xb0, 0x9c, 0x0d, 0x12, 0x4b, 0x68, 0x97, 0xbc, 0x04, 0xba, 0xd7, 0x76, 0xe2, - 0x8c, 0x06, 0x75, 0x77, 0xce, 0xf9, 0xbe, 0xf3, 0xf7, 0xdd, 0x63, 0x43, 0x3b, 0x0b, 0xd3, 0x7b, - 0xbe, 0x19, 0xa6, 0x59, 0x52, 0x24, 0x58, 0xbb, 0x0d, 0xe3, 0xc1, 0xe7, 0x60, 0x5c, 0x26, 0x51, - 0x5c, 0xe0, 0x36, 0x28, 0xaf, 0x1c, 0xa5, 0xaf, 0x1c, 0x1b, 0x54, 0x79, 0x25, 0xbc, 0x8d, 0xa3, - 0x96, 0xde, 0x46, 0x78, 0xaf, 0x1d, 0xad, 0xf4, 0x5e, 0x0f, 0x7e, 0x07, 0x30, 0xa9, 0x2c, 0x84, - 0x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83, 0x6f, 0xdd, 0xcb, 0x39, 0x23, 0xee, 0x04, 0x99, 0xa2, 0xf7, 0xd8, - 0x0b, 0x46, 0x53, 0xdf, 0x27, 0x23, 0x86, 0x0e, 0x30, 0x82, 0xf6, 0xe8, 0xcc, 0x65, 0xf3, 0x09, - 0x09, 0x02, 0xf7, 0x94, 0x20, 0xab, 0x31, 0x8d, 0xfd, 0xe2, 0x1c, 0x74, 0x71, 0x87, 0x22, 0x6b, - 0xe6, 0x8b, 0x5d, 0x4e, 0x7d, 0x22, 0x36, 0xee, 0x80, 0xcd, 0x08, 0xa5, 0x53, 0xea, 0x05, 0x0c, - 0x29, 0xf8, 0x3d, 0x78, 0x36, 0x9a, 0xce, 0x7c, 0x46, 0xe8, 0x7c, 0x17, 0x56, 0x65, 0xeb, 0x4b, - 0x32, 0x62, 0x2e, 0x9b, 0x52, 0xa4, 0x7d, 0xed, 0xfc, 0xf1, 0xd0, 0x53, 0xde, 0x3c, 0xf4, 0x94, - 0xbf, 0x1f, 0x7a, 0xca, 0xaf, 0x8f, 0xbd, 0xd6, 0x9b, 0xc7, 0x5e, 0xeb, 0xaf, 0xc7, 0x5e, 0xeb, - 0xda, 0x94, 0xff, 0xf8, 0x2f, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xda, 0x90, 0x1f, 0xf3, - 0x05, 0x00, 0x00, + // 833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0x1d, 0xdb, 0xb5, 0x5f, 0x93, 0x6a, 0x76, 0xb4, 0xac, 0x2c, 0x23, 0xa2, 0x10, 0x01, + 0xaa, 0xf6, 0x10, 0x44, 0x39, 0x71, 0xc3, 0x24, 0xb3, 0xad, 0x69, 0xe3, 0x54, 0xe3, 0x49, 0xd9, + 0x72, 0x89, 0xa6, 0x8d, 0x69, 0x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0x85, 0x37, 0x62, 0xde, 0x04, 0x29, + 0xc2, 0x3e, 0xf5, 0xce, 0xce, 0x08, 0x45, 0x2a, 0xee, 0x80, 0xe9, 0x06, 0x81, 0x17, 0x30, 0x42, + 0x51, 0x1b, 0x9b, 0xa0, 0x31, 0xf2, 0x92, 0x21, 0x0d, 0x1f, 0x00, 0x90, 0x0b, 0xe2, 0xb3, 0xb9, + 0xef, 0x4e, 0x08, 0xd2, 0x45, 0xcd, 0x68, 0x16, 0xb0, 0xe9, 0x04, 0x19, 0x83, 0x5f, 0x95, 0x6a, + 0x86, 0x09, 0xda, 0xf7, 0xb3, 0xc9, 0x39, 0x6a, 0x09, 0xeb, 0x85, 0x47, 0x09, 0x52, 0x84, 0x75, + 0x32, 0xa3, 0x0c, 0xa9, 0x78, 0x1f, 0xf6, 0x5e, 0x9c, 0xb9, 0xc1, 0x09, 0x19, 0x97, 0x9d, 0xc5, + 0x4c, 0xa4, 0xe1, 0x27, 0xd0, 0xa5, 0xd3, 0x99, 0x3f, 0x9e, 0x07, 0xcc, 0xa5, 0x8c, 0x8c, 0x91, + 0x2e, 0xb8, 0x06, 0x3f, 0xb8, 0xe7, 0x73, 0x46, 0xdc, 0x09, 0x32, 0xc4, 0xec, 0xb1, 0x17, 0x8c, + 0xa6, 0xbe, 0x4f, 0x46, 0x0c, 0xed, 0x61, 0x04, 0x9d, 0xd1, 0x89, 0xcb, 0xe6, 0x13, 0x12, 0x04, + 0xee, 0x31, 0x41, 0x66, 0x83, 0x8d, 0xf5, 0xfc, 0x14, 0x34, 0x71, 0x9f, 0xa2, 0x6a, 0xe6, 0x8b, + 0x5d, 0x8e, 0x7d, 0x22, 0x36, 0xee, 0x82, 0xc5, 0x08, 0xa5, 0x53, 0xea, 0x05, 0x0c, 0x29, 0xf8, + 0x23, 0x78, 0x32, 0x9a, 0xce, 0x7c, 0x46, 0xe8, 0xfc, 0x31, 0xac, 0xca, 0xd1, 0xe7, 0x64, 0xc4, + 0x5c, 0x36, 0xa5, 0xa8, 0xfd, 0x9d, 0xfd, 0xe7, 0x7d, 0x4f, 0x79, 0x73, 0xdf, 0x53, 0xfe, 0xb9, + 0xef, 0x29, 0xbf, 0x3f, 0xf4, 0x5a, 0x6f, 0x1e, 0x7a, 0xad, 0xbf, 0x1f, 0x7a, 0xad, 0x2b, 0x43, + 0xfe, 0xfd, 0xbf, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x90, 0x0f, 0x22, 0xcb, 0x0d, 0x06, 0x00, + 0x00, } func (m *Point) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -806,32 +816,37 @@ func (m *Point) Marshal() (dAtA []byte, err error) { } func (m *Point) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Point) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.X != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.X)) + if m.Z != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Z)) + i-- + dAtA[i] = 0x18 } if m.Y != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintReplay(dAtA, i, uint64(m.Y)) + i-- + dAtA[i] = 0x10 } - if m.Z != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Z)) + if m.X != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.X)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Replay) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -839,63 +854,76 @@ func (m *Replay) Marshal() (dAtA []byte, err error) { } func (m *Replay) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Header.Size())) - n1, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.Entities) > 0 { - for _, msg := range m.Entities { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Ticks) > 0 { + for iNdEx := len(m.Ticks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ticks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } if len(m.Snapshots) > 0 { - for _, msg := range m.Snapshots { + for iNdEx := len(m.Snapshots) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Snapshots[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + } + if len(m.Entities) > 0 { + for iNdEx := len(m.Entities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entities[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.Ticks) > 0 { - for _, msg := range m.Ticks { - dAtA[i] = 0x22 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Replay_Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -903,34 +931,40 @@ func (m *Replay_Header) Marshal() (dAtA []byte, err error) { } func (m *Replay_Header) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Map) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReplay(dAtA, i, uint64(len(m.Map))) - i += copy(dAtA[i:], m.Map) + if m.SnapshotRate != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.SnapshotRate)) + i-- + dAtA[i] = 0x18 } if m.TickRate != 0 { - dAtA[i] = 0x11 - i++ + i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.TickRate)))) - i += 8 + i-- + dAtA[i] = 0x11 } - if m.SnapshotRate != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.SnapshotRate)) + if len(m.Map) > 0 { + i -= len(m.Map) + copy(dAtA[i:], m.Map) + i = encodeVarintReplay(dAtA, i, uint64(len(m.Map))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Replay_Entity) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -938,43 +972,49 @@ func (m *Replay_Entity) Marshal() (dAtA []byte, err error) { } func (m *Replay_Entity) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Entity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Id)) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if m.Team != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Team)) - } if m.IsNpc { - dAtA[i] = 0x20 - i++ + i-- if m.IsNpc { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 } - return i, nil + if m.Team != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Team)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintReplay(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Replay_Snapshot) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -982,34 +1022,41 @@ func (m *Replay_Snapshot) Marshal() (dAtA []byte, err error) { } func (m *Replay_Snapshot) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Tick != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Tick)) - } if len(m.EntityUpdates) > 0 { - for _, msg := range m.EntityUpdates { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.EntityUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EntityUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if m.Tick != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Tick)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Replay_Snapshot_EntityUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1017,70 +1064,82 @@ func (m *Replay_Snapshot_EntityUpdate) Marshal() (dAtA []byte, err error) { } func (m *Replay_Snapshot_EntityUpdate) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Snapshot_EntityUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.EntityId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.EntityId)) + if m.AngleY != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.AngleY)) + i-- + dAtA[i] = 0x48 } - if len(m.Positions) > 0 { - for _, msg := range m.Positions { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if m.IsNpc { + i-- + if m.IsNpc { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x40 } - if m.Angle != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Angle)) + if m.Team != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Team)) + i-- + dAtA[i] = 0x38 } - if m.Hp != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Hp)) + if m.FlashDuration != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.FlashDuration)))) + i-- + dAtA[i] = 0x35 } if m.Armor != 0 { - dAtA[i] = 0x28 - i++ i = encodeVarintReplay(dAtA, i, uint64(m.Armor)) + i-- + dAtA[i] = 0x28 } - if m.FlashDuration != 0 { - dAtA[i] = 0x35 - i++ - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.FlashDuration)))) - i += 4 + if m.Hp != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Hp)) + i-- + dAtA[i] = 0x20 } - if m.Team != 0 { - dAtA[i] = 0x38 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Team)) + if m.AngleX != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.AngleX)) + i-- + dAtA[i] = 0x18 } - if m.IsNpc { - dAtA[i] = 0x40 - i++ - if m.IsNpc { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Positions) > 0 { + for iNdEx := len(m.Positions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Positions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i++ } - return i, nil + if m.EntityId != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.EntityId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Replay_Tick) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1088,34 +1147,41 @@ func (m *Replay_Tick) Marshal() (dAtA []byte, err error) { } func (m *Replay_Tick) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Tick) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Nr != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Nr)) - } if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if m.Nr != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Nr)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Replay_Tick_Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1123,34 +1189,41 @@ func (m *Replay_Tick_Event) Marshal() (dAtA []byte, err error) { } func (m *Replay_Tick_Event) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Tick_Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Kind != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Kind)) - } if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReplay(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if m.Kind != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Kind)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Replay_Tick_Event_Attribute) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1158,44 +1231,53 @@ func (m *Replay_Tick_Event_Attribute) Marshal() (dAtA []byte, err error) { } func (m *Replay_Tick_Event_Attribute) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replay_Tick_Event_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Kind != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReplay(dAtA, i, uint64(m.Kind)) - } - if len(m.StringValue) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintReplay(dAtA, i, uint64(len(m.StringValue))) - i += copy(dAtA[i:], m.StringValue) + if len(m.CustomName) > 0 { + i -= len(m.CustomName) + copy(dAtA[i:], m.CustomName) + i = encodeVarintReplay(dAtA, i, uint64(len(m.CustomName))) + i-- + dAtA[i] = 0x22 } if m.NumberValue != 0 { - dAtA[i] = 0x19 - i++ + i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.NumberValue)))) - i += 8 + i-- + dAtA[i] = 0x19 } - if len(m.CustomName) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintReplay(dAtA, i, uint64(len(m.CustomName))) - i += copy(dAtA[i:], m.CustomName) + if len(m.StringValue) > 0 { + i -= len(m.StringValue) + copy(dAtA[i:], m.StringValue) + i = encodeVarintReplay(dAtA, i, uint64(len(m.StringValue))) + i-- + dAtA[i] = 0x12 } - return i, nil + if m.Kind != 0 { + i = encodeVarintReplay(dAtA, i, uint64(m.Kind)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func encodeVarintReplay(dAtA []byte, offset int, v uint64) int { + offset -= sovReplay(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Point) Size() (n int) { if m == nil { @@ -1320,8 +1402,8 @@ func (m *Replay_Snapshot_EntityUpdate) Size() (n int) { n += 1 + l + sovReplay(uint64(l)) } } - if m.Angle != 0 { - n += 1 + sovReplay(uint64(m.Angle)) + if m.AngleX != 0 { + n += 1 + sovReplay(uint64(m.AngleX)) } if m.Hp != 0 { n += 1 + sovReplay(uint64(m.Hp)) @@ -1338,6 +1420,9 @@ func (m *Replay_Snapshot_EntityUpdate) Size() (n int) { if m.IsNpc { n += 2 } + if m.AngleY != 0 { + n += 1 + sovReplay(uint64(m.AngleY)) + } return n } @@ -1401,14 +1486,7 @@ func (m *Replay_Tick_Event_Attribute) Size() (n int) { } func sovReplay(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozReplay(x uint64) (n int) { return sovReplay(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -2162,9 +2240,9 @@ func (m *Replay_Snapshot_EntityUpdate) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Angle", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AngleX", wireType) } - m.Angle = 0 + m.AngleX = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowReplay @@ -2174,7 +2252,7 @@ func (m *Replay_Snapshot_EntityUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Angle |= int32(b&0x7F) << shift + m.AngleX |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -2267,6 +2345,25 @@ func (m *Replay_Snapshot_EntityUpdate) Unmarshal(dAtA []byte) error { } } m.IsNpc = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AngleY", wireType) + } + m.AngleY = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReplay + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AngleY |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipReplay(dAtA[iNdEx:]) @@ -2653,6 +2750,7 @@ func (m *Replay_Tick_Event_Attribute) Unmarshal(dAtA []byte) error { func skipReplay(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2684,10 +2782,8 @@ func skipReplay(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2708,55 +2804,30 @@ func skipReplay(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthReplay } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthReplay - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowReplay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipReplay(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthReplay - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupReplay + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthReplay + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthReplay = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowReplay = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthReplay = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowReplay = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupReplay = fmt.Errorf("proto: unexpected end of group") ) diff --git a/protobuf/marshal.go b/protobuf/marshal.go index 5c1bc42..0ddf0e5 100644 --- a/protobuf/marshal.go +++ b/protobuf/marshal.go @@ -73,7 +73,8 @@ func mapToEntityUpdates(entityUpdates []rep.EntityUpdate) []*gen.Replay_Snapshot result := make([]*gen.Replay_Snapshot_EntityUpdate, 0) for _, u := range entityUpdates { result = append(result, &gen.Replay_Snapshot_EntityUpdate{ - Angle: int32(u.Angle), + AngleX: int32(u.AngleX), + AngleY: int32(u.AngleY), Armor: int32(u.Armor), EntityId: int32(u.EntityID), FlashDuration: u.FlashDuration, diff --git a/protobuf/unmarshal.go b/protobuf/unmarshal.go index 2e7fb40..623a5e7 100644 --- a/protobuf/unmarshal.go +++ b/protobuf/unmarshal.go @@ -97,7 +97,8 @@ func mapFromEntityUpdates(entityUpdates []*gen.Replay_Snapshot_EntityUpdate) []r result := make([]rep.EntityUpdate, len(entityUpdates)) for i, u := range entityUpdates { result[i] = rep.EntityUpdate{ - Angle: int(u.Angle), + AngleX: int(u.AngleX), + AngleY: int(u.AngleY), Armor: int(u.Armor), EntityID: int(u.EntityId), FlashDuration: u.FlashDuration, diff --git a/replay/nondefault/nondefault_replay.go b/replay/nondefault/nondefault_replay.go index e41d567..4d20c5d 100644 --- a/replay/nondefault/nondefault_replay.go +++ b/replay/nondefault/nondefault_replay.go @@ -36,7 +36,8 @@ func init() { var entUpd []rep.EntityUpdate entUpd = append(entUpd, rep.EntityUpdate{ - Angle: 90, + AngleX: 90, + AngleY: 45, Armor: 80, EntityID: 5, FlashDuration: 2.35, diff --git a/replay/replay.go b/replay/replay.go index 8f6f18d..c9132af 100644 --- a/replay/replay.go +++ b/replay/replay.go @@ -62,7 +62,8 @@ type EntityUpdate struct { Team int `json:"team,omitempty" msgpack:"team,omitempty"` IsNpc bool `json:"isNpc,omitempty" msgpack:"isNpc,omitempty"` Positions []Point `json:"positions,omitempty" msgpack:"positions,omitempty"` // This allows us smoother replay with less overhead compared to higher snapshot rate - Angle int `json:"angle,omitempty" msgpack:"angle,omitempty"` + AngleX int `json:"angleX,omitempty" msgpack:"angleX,omitempty"` + AngleY int `json:"angleY,omitempty" msgpack:"angleY,omitempty"` Hp int `json:"hp,omitempty" msgpack:"hp,omitempty"` Armor int `json:"armor,omitempty" msgpack:"armor,omitempty"` FlashDuration float32 `json:"flashDuration,omitempty" msgpack:"flashDuration,omitempty"` diff --git a/schema.json b/schema.json index 58229d9..118f851 100644 --- a/schema.json +++ b/schema.json @@ -30,7 +30,10 @@ "entityId" ], "properties": { - "angle": { + "angleX": { + "type": "integer" + }, + "angleY": { "type": "integer" }, "armor": {