Skip to content

Commit d2f43ae

Browse files
committed
Print out demo-commands when debugging
1 parent 5bcd0c0 commit d2f43ae

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

debug_off.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ func debugUnhandledMessage(cmd int, name string) {
2121
func debugIngameTick(tickNr int) {
2222
// NOP
2323
}
24+
25+
func debugDemoCommand(cmd demoCommand) {
26+
// NOP
27+
}

debug_on.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222
var debugGameEvents = yes
2323
var debugUnhandledMessages = yes
2424
var debugIngameTicks = no
25+
var debugDemoCommands = yes
2526

2627
func debugGameEvent(d *msg.CSVCMsg_GameEventListDescriptorT, ge *msg.CSVCMsg_GameEvent) {
2728
if debugGameEvents == yes {
@@ -60,3 +61,34 @@ func debugIngameTick(tickNr int) {
6061
fmt.Printf("IngameTick=%d\n", tickNr)
6162
}
6263
}
64+
65+
func (dc demoCommand) String() string {
66+
switch dc {
67+
case dcConsoleCommand:
68+
return "ConsoleCommand"
69+
case dcCustomData:
70+
return "CustomData"
71+
case dcDataTables:
72+
return "DataTables"
73+
case dcPacket:
74+
return "Packet"
75+
case dcSignon:
76+
return "Signon"
77+
case dcStop:
78+
return "Stop"
79+
case dcStringTables:
80+
return "StringTables"
81+
case dcSynctick:
82+
return "Synctick"
83+
case dcUserCommand:
84+
return "UserCommand"
85+
default:
86+
return "UnknownCommand"
87+
}
88+
}
89+
90+
func debugDemoCommand(cmd demoCommand) {
91+
if debugDemoCommands == yes {
92+
fmt.Println("Demo-Command:", cmd)
93+
}
94+
}

parsing.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ func (p *Parser) parseFrame() bool {
169169
// Skip 'player slot'
170170
p.bitReader.Skip(8)
171171

172+
debugDemoCommand(cmd)
173+
172174
switch cmd {
173175
case dcSynctick:
174176
// Ignore

0 commit comments

Comments
 (0)