This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Instance-Baseline Parsing.
#fancy.
- Loading branch information
1 parent
e61fc17
commit 9672e10
Showing
4 changed files
with
42 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ class CreateStringTableUserInfoHandler : IMessageParser | |
public bool TryApplyMessage(IExtensible message, DemoParser parser) | ||
{ | ||
var create = message as CSVCMsg_CreateStringTable; | ||
if ((create == null) || (create.name != "userinfo")) | ||
if ((create == null)) | ||
return false; | ||
|
||
ParseStringTableUpdate(create, parser); | ||
|
@@ -32,7 +32,6 @@ public void ParseStringTableUpdate(CSVCMsg_CreateStringTable table, DemoParser p | |
while ((nTemp >>= 1) != 0) | ||
++nEntryBits; | ||
|
||
|
||
List<string> history = new List<string>(); | ||
|
||
int lastEntry = -1; | ||
|
@@ -70,6 +69,8 @@ public void ParseStringTableUpdate(CSVCMsg_CreateStringTable table, DemoParser p | |
if (entry == null) | ||
entry = ""; | ||
|
||
history.Add(entry); | ||
|
||
// Read in the user data. | ||
byte[] userdata = new byte[0]; | ||
if (reader.ReadBit()) { | ||
|
@@ -85,14 +86,22 @@ public void ParseStringTableUpdate(CSVCMsg_CreateStringTable table, DemoParser p | |
if (userdata.Length == 0) | ||
break; | ||
|
||
// Now we'll parse the players out of it. | ||
BinaryReader playerReader = new BinaryReader(new MemoryStream(userdata)); | ||
PlayerInfo info = PlayerInfo.ParseFrom(playerReader); | ||
if (table.name == "userinfo") { | ||
|
||
// Now we'll parse the players out of it. | ||
BinaryReader playerReader = new BinaryReader(new MemoryStream(userdata)); | ||
PlayerInfo info = PlayerInfo.ParseFrom(playerReader); | ||
|
||
if (entryIndex < parser.RawPlayers.Count) | ||
parser.RawPlayers[entryIndex] = info; | ||
else | ||
parser.RawPlayers.Add(info); | ||
if (entryIndex < parser.RawPlayers.Count) | ||
parser.RawPlayers[entryIndex] = info; | ||
else | ||
parser.RawPlayers.Add(info); | ||
|
||
} else if (table.name == "instancebaseline") { | ||
int classid = int.Parse(entry); //wtf volvo? | ||
|
||
parser.instanceBaseline[classid] = userdata; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
moritzuehling
via email
Author
Contributor
|
||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.IO; | ||
|
||
namespace DemoInfo.DP.Handler | ||
{ | ||
|
@@ -27,13 +28,11 @@ public bool TryApplyMessage(ProtoBuf.IExtensible message, DemoParser parser) | |
// enter flag | ||
if (reader.ReadBit()) { | ||
var e = ReadEnterPVS(reader, currentEntity, parser); | ||
|
||
e.ApplyUpdate(reader); | ||
} else { | ||
// preserve | ||
Entity e = parser.entites[currentEntity]; | ||
//Console.ForegroundColor = ConsoleColor.Green; | ||
//Console.WriteLine("Entity #" + e.ID + ": " + e.ServerClass.Name); | ||
//Console.ResetColor(); | ||
e.ApplyUpdate(reader); | ||
} | ||
} else { | ||
|
@@ -65,6 +64,13 @@ public Entity ReadEnterPVS(IBitStream reader, int id, DemoParser parser) | |
|
||
parser.entites[newEntity.ID] = newEntity; | ||
|
||
|
||
|
||
MemoryStream ms = new MemoryStream(parser.instanceBaseline[serverClassID]); | ||
ms.Seek(0, SeekOrigin.Begin); | ||
newEntity.ApplyUpdate(BitStreamUtil.Create(ms)); | ||
ms.Close(); | ||
This comment has been minimized.
Sorry, something went wrong.
main--
Contributor
|
||
|
||
return newEntity; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What's the purpose of instanceBaseline ?