diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2022-11-08 20:50:13 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-16 21:39:38 +0300 |
| commit | 335e1b1b94a46795bab95e3eec5fecb303bb4171 (patch) | |
| tree | cddd561f2fa5c7ae0e44258422da87a817d51b7b | |
| parent | stringtable done, can't see data properly (diff) | |
| download | sdp.go-335e1b1b94a46795bab95e3eec5fecb303bb4171.tar.gz sdp.go-335e1b1b94a46795bab95e3eec5fecb303bb4171.tar.bz2 sdp.go-335e1b1b94a46795bab95e3eec5fecb303bb4171.zip | |
put class type into individual files
| -rw-r--r-- | packets/classes/cmdinfo.go | 10 | ||||
| -rw-r--r-- | packets/classes/stringtable.go | 12 | ||||
| -rw-r--r-- | packets/classes/types.go | 40 | ||||
| -rw-r--r-- | packets/classes/usercmd.go | 17 |
4 files changed, 39 insertions, 40 deletions
diff --git a/packets/classes/cmdinfo.go b/packets/classes/cmdinfo.go index bfe732d..52df05c 100644 --- a/packets/classes/cmdinfo.go +++ b/packets/classes/cmdinfo.go | |||
| @@ -2,6 +2,16 @@ package classes | |||
| 2 | 2 | ||
| 3 | import "github.com/pektezol/bitreader" | 3 | import "github.com/pektezol/bitreader" |
| 4 | 4 | ||
| 5 | type CmdInfo struct { | ||
| 6 | Flags int32 | ||
| 7 | ViewOrigin []float32 | ||
| 8 | ViewAngles []float32 | ||
| 9 | LocalViewAngles []float32 | ||
| 10 | ViewOrigin2 []float32 | ||
| 11 | ViewAngles2 []float32 | ||
| 12 | LocalViewAngles2 []float32 | ||
| 13 | } | ||
| 14 | |||
| 5 | func ParseCmdInfo(reader *bitreader.ReaderType, MSSC int) []CmdInfo { | 15 | func ParseCmdInfo(reader *bitreader.ReaderType, MSSC int) []CmdInfo { |
| 6 | var out []CmdInfo | 16 | var out []CmdInfo |
| 7 | for i := 0; i < MSSC; i++ { | 17 | for i := 0; i < MSSC; i++ { |
diff --git a/packets/classes/stringtable.go b/packets/classes/stringtable.go index 64e8496..a1432f9 100644 --- a/packets/classes/stringtable.go +++ b/packets/classes/stringtable.go | |||
| @@ -6,6 +6,18 @@ import ( | |||
| 6 | "github.com/pektezol/bitreader" | 6 | "github.com/pektezol/bitreader" |
| 7 | ) | 7 | ) |
| 8 | 8 | ||
| 9 | type StringTable struct { | ||
| 10 | TableName string | ||
| 11 | NumOfEntries int16 | ||
| 12 | EntryName string | ||
| 13 | EntrySize int16 | ||
| 14 | EntryData []byte | ||
| 15 | NumOfClientEntries int16 | ||
| 16 | ClientEntryName string | ||
| 17 | ClientEntrySize int16 | ||
| 18 | ClientEntryData []byte | ||
| 19 | } | ||
| 20 | |||
| 9 | func ParseStringTable(data []byte) []StringTable { | 21 | func ParseStringTable(data []byte) []StringTable { |
| 10 | reader := bitreader.Reader(bytes.NewReader(data), true) | 22 | reader := bitreader.Reader(bytes.NewReader(data), true) |
| 11 | var stringTables []StringTable | 23 | var stringTables []StringTable |
diff --git a/packets/classes/types.go b/packets/classes/types.go deleted file mode 100644 index a1a281e..0000000 --- a/packets/classes/types.go +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | package classes | ||
| 2 | |||
| 3 | type CmdInfo struct { | ||
| 4 | Flags int32 | ||
| 5 | ViewOrigin []float32 | ||
| 6 | ViewAngles []float32 | ||
| 7 | LocalViewAngles []float32 | ||
| 8 | ViewOrigin2 []float32 | ||
| 9 | ViewAngles2 []float32 | ||
| 10 | LocalViewAngles2 []float32 | ||
| 11 | } | ||
| 12 | |||
| 13 | type UserCmdInfo struct { | ||
| 14 | CommandNumber int32 | ||
| 15 | TickCount int32 | ||
| 16 | ViewAnglesX float32 | ||
| 17 | ViewAnglesY float32 | ||
| 18 | ViewAnglesZ float32 | ||
| 19 | ForwardMove float32 | ||
| 20 | SideMove float32 | ||
| 21 | UpMove float32 | ||
| 22 | Buttons int32 | ||
| 23 | Impulse byte | ||
| 24 | WeaponSelect int | ||
| 25 | WeaponSubtype int | ||
| 26 | MouseDx int16 | ||
| 27 | MouseDy int16 | ||
| 28 | } | ||
| 29 | |||
| 30 | type StringTable struct { | ||
| 31 | TableName string | ||
| 32 | NumOfEntries int16 | ||
| 33 | EntryName string | ||
| 34 | EntrySize int16 | ||
| 35 | EntryData []byte | ||
| 36 | NumOfClientEntries int16 | ||
| 37 | ClientEntryName string | ||
| 38 | ClientEntrySize int16 | ||
| 39 | ClientEntryData []byte | ||
| 40 | } | ||
diff --git a/packets/classes/usercmd.go b/packets/classes/usercmd.go index 78e9c58..d3328fd 100644 --- a/packets/classes/usercmd.go +++ b/packets/classes/usercmd.go | |||
| @@ -6,6 +6,23 @@ import ( | |||
| 6 | "github.com/pektezol/bitreader" | 6 | "github.com/pektezol/bitreader" |
| 7 | ) | 7 | ) |
| 8 | 8 | ||
| 9 | type UserCmdInfo struct { | ||
| 10 | CommandNumber int32 | ||
| 11 | TickCount int32 | ||
| 12 | ViewAnglesX float32 | ||
| 13 | ViewAnglesY float32 | ||
| 14 | ViewAnglesZ float32 | ||
| 15 | ForwardMove float32 | ||
| 16 | SideMove float32 | ||
| 17 | UpMove float32 | ||
| 18 | Buttons int32 | ||
| 19 | Impulse byte | ||
| 20 | WeaponSelect int | ||
| 21 | WeaponSubtype int | ||
| 22 | MouseDx int16 | ||
| 23 | MouseDy int16 | ||
| 24 | } | ||
| 25 | |||
| 9 | func ParseUserCmdInfo(data []byte) UserCmdInfo { | 26 | func ParseUserCmdInfo(data []byte) UserCmdInfo { |
| 10 | reader := bitreader.Reader(bytes.NewReader(data), true) | 27 | reader := bitreader.Reader(bytes.NewReader(data), true) |
| 11 | var userCmdInfo UserCmdInfo | 28 | var userCmdInfo UserCmdInfo |