File tree Expand file tree Collapse file tree 5 files changed +8
-17
lines changed Expand file tree Collapse file tree 5 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ import (
1818// A frame can contain multiple ticks (usually 2 or 4) if the tv_snapshotrate differs from the tick-rate the game was played at.
1919type FrameDone struct {}
2020
21+ // RecordingPlayerDetected signals that a player started recording the demo locally.
22+ // If this event is dispatched, it means it's a client-side (POV) demo.
23+ type RecordingPlayerDetected struct {
24+ PlayerSlot int
25+ PlayerInfo common.PlayerInfo
26+ }
27+
2128// MatchStart signals that the match has started.
2229type MatchStart struct {}
2330
Original file line number Diff line number Diff line change @@ -195,11 +195,6 @@ func (p *parser) Progress() float32 {
195195 return float32 (p .currentFrame ) / float32 (p .header .PlaybackFrames )
196196}
197197
198- // IsPOV indicates if the demo being parsed is a POV demo.
199- func (p * parser ) IsPOV () bool {
200- return p .recordingPlayerSlot != - 1
201- }
202-
203198/*
204199RegisterEventHandler registers a handler for game events.
205200
Original file line number Diff line number Diff line change @@ -64,8 +64,6 @@ type Parser interface {
6464 // Might not be 100% correct since it's just based on the reported tick count of the header.
6565 // May always return 0 if the demo header is corrupt.
6666 Progress () float32
67- // IsPOV indicates if the demo being parsed is a POV demo.
68- IsPOV () bool
6967 /*
7068 RegisterEventHandler registers a handler for game events.
7169
Original file line number Diff line number Diff line change @@ -23,16 +23,6 @@ func TestParser_GameState(t *testing.T) {
2323 assert .Equal (t , gs , (& parser {gameState : gs }).GameState ())
2424}
2525
26- func TestParser_IsPOV (t * testing.T ) {
27- p := & parser {recordingPlayerSlot : - 1 }
28-
29- assert .Equal (t , false , p .IsPOV ())
30-
31- p .recordingPlayerSlot = 3
32-
33- assert .Equal (t , true , p .IsPOV ())
34- }
35-
3626func TestParser_CurrentTime (t * testing.T ) {
3727 p := & parser {
3828 tickInterval : 2 ,
Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ func (p *parser) processStringTable(tab *msg.CSVCMsg_CreateStringTable) {
241241
242242 if p .header .ClientName == player .Name {
243243 p .recordingPlayerSlot = entryIndex
244+ p .eventDispatcher .Dispatch (events.RecordingPlayerDetected {PlayerSlot : entryIndex , PlayerInfo : player })
244245 }
245246
246247 p .setRawPlayer (entryIndex , player )
You can’t perform that action at this time.
0 commit comments