blob: 341e875b88bf13bc197d504c008b4e50cf2f41a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
package types
import (
"github.com/pektezol/sdp.go/pkg/writer"
)
type Demo struct {
Headers Headers `json:"headers"`
Messages []Message `json:"messages"`
Writer *writer.Writer `json:"-"`
GameEventList *SvcGameEventList `json:"-"`
}
type Headers struct {
DemoFileStamp string `json:"demo_file_stamp"`
DemoProtocol int32 `json:"demo_protocol"`
NetworkProtocol int32 `json:"network_protocol"`
ServerName string `json:"server_name"`
ClientName string `json:"client_name"`
MapName string `json:"map_name"`
GameDirectory string `json:"game_directory"`
PlaybackTime float32 `json:"playback_time"`
PlaybackTicks int32 `json:"playback_ticks"`
PlaybackFrames int32 `json:"playback_frames"`
SignOnLength int32 `json:"sign_on_length"`
}
type Message struct {
PacketType MessageType `json:"packet_type"`
TickNumber int32 `json:"tick_number"`
SlotNumber uint8 `json:"slot_number"`
Data any `json:"data"`
}
type MessageType uint8
const (
SignOn MessageType = iota + 1
Packet
SyncTick
ConsoleCmd
UserCmd
DataTables
Stop
CustomData
StringTables
)
func (t MessageType) String() string {
switch t {
case SignOn:
return "SIGNON"
case Packet:
return "PACKET"
case SyncTick:
return "SYNCTICK"
case ConsoleCmd:
return "CONSOLECMD"
case UserCmd:
return "USERCMD"
case DataTables:
return "DATATABLES"
case Stop:
return "STOP"
case CustomData:
return "CUSTOMDATA"
case StringTables:
return "STRINGTABLES"
}
return "INVALID"
}
|