diff --git a/ConsoleApp/src/DemoArgProcessing/Options/OptTime.cs b/ConsoleApp/src/DemoArgProcessing/Options/OptTime.cs index 14b238f..263affb 100644 --- a/ConsoleApp/src/DemoArgProcessing/Options/OptTime.cs +++ b/ConsoleApp/src/DemoArgProcessing/Options/OptTime.cs @@ -8,6 +8,7 @@ using DemoParser.Parser; using DemoParser.Parser.Components; using DemoParser.Parser.Components.Messages; +using DemoParser.Parser.Components.Messages.UserMessages; using DemoParser.Utils; using static System.Text.RegularExpressions.RegexOptions; @@ -216,6 +217,23 @@ public static void WriteAdjustedTime(SourceDemo demo, TextWriter tw, bool timeFi tw.Write($"{"Adjusted ticks ",FmtIdt}: {demo.AdjustedTickCount(tfs)}"); tw.WriteLine($" ({demo.StartAdjustmentTick}-{demo.EndAdjustmentTick})"); } + + // another hack until we time things better :) + if (demo.DemoInfo.IsPortal2()) { + ScoreboardTempUpdate? lastScoreBoard = + demo.FilterForUserMessage() + .Select(tuple => tuple.userMessage) + .LastOrDefault(); + + if (lastScoreBoard != null) { + float cmTime = lastScoreBoard.TimeTaken / 100f; + float numPortals = lastScoreBoard.NumPortals; + tw.WriteLine($"{"CM time ",FmtIdt}: {Utils.FormatTime(cmTime)}"); + tw.WriteLine($"{"CM ticks ",FmtIdt}: {(int)Math.Round(cmTime / tickInterval)}"); + tw.WriteLine($"{"CM portals ",FmtIdt}: {numPortals}"); + } + } + Utils.PopForegroundColor(); } diff --git a/DemoParser/src/Parser/DemoInfo.cs b/DemoParser/src/Parser/DemoInfo.cs index 5f89853..63282ab 100644 --- a/DemoParser/src/Parser/DemoInfo.cs +++ b/DemoParser/src/Parser/DemoInfo.cs @@ -221,6 +221,8 @@ public DemoInfo(SourceDemo demo) { public bool IsPortal1() => Game >= PORTAL_1_3420 && Game <= PORTAL_1_1910503; + public bool IsPortal2() => Game == PORTAL_2; + public bool IsHL2() => Game == HL2_OE; }