From 402bfea838d302e3006724f496c7e8204720b7ad Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 13 Feb 2025 12:11:25 -0500 Subject: [Lingo 2] Added options for one-time panel/map splits --- Lingo 2.asl | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 14 deletions(-) (limited to 'Lingo 2.asl') diff --git a/Lingo 2.asl b/Lingo 2.asl index 9c59387..6616ac8 100644 --- a/Lingo 2.asl +++ b/Lingo 2.asl @@ -26,9 +26,11 @@ startup settings.Add("graves", false, "Split on completing a gravestone"); settings.Add("masteries", false, "Split on collecting a mastery"); - vars.prevPanelMap = ""; - vars.prevPanelPath = ""; + vars.prevPanel = null; + vars.lastPanel = null; + vars.solvedPanels = new HashSet(); vars.prevMap = ""; + vars.visitedMaps = new HashSet(); vars.collectedKeys = new HashSet(); vars.latestKeyKey = null; @@ -48,14 +50,17 @@ init // [94-134]: Map name of latest solved panel (null terminated, truncated at 40 chars excluding null) // [135-235]: Full nodepath of latest solved panel (null terminated, truncated at 100 chars excluding null) IntPtr ptr = IntPtr.Zero; - foreach (var page in game.MemoryPages(true).Reverse()) { + foreach (var page in game.MemoryPages(true).Reverse()) + { var scanner = new SignatureScanner(game, page.BaseAddress, (int)page.RegionSize); ptr = scanner.Scan(new SigScanTarget(0, "9c 46 9f b0 4b 6a e0 8d")); - if (ptr != IntPtr.Zero) { + if (ptr != IntPtr.Zero) + { break; } } - if (ptr == IntPtr.Zero) { + if (ptr == IntPtr.Zero) + { throw new Exception("Could not find magic autosplitter array!"); } vars.loading = new MemoryWatcher(ptr + 8); @@ -81,6 +86,11 @@ update vars.lastPanelMap.Update(game); vars.lastPanelPath.Update(game); + if (vars.lastPanelMap.Current != "") + { + vars.lastPanel = string.Format("{0}/{1}", vars.lastPanelMap.Current, vars.lastPanelPath.Current); + } + if (vars.latestKeyLevel.Current > 0) { vars.latestKeyKey = string.Format("{0}{1}", (char)vars.latestKey.Current, vars.latestKeyLevel.Current); @@ -94,9 +104,14 @@ start onStart { - vars.prevPanelMap = vars.lastPanelMap.Current; - vars.prevPanelPath = vars.lastPanelPath.Current; + vars.prevPanel = vars.lastPanel; vars.prevMap = vars.currentMap.Current; + vars.lastPanel = null; + vars.solvedPanels.Clear(); + vars.visitedMaps.Clear(); + vars.visitedMaps.Add(vars.currentMap.Current); + vars.collectedKeys.Clear(); + vars.latestKeyKey = null; } reset @@ -113,19 +128,55 @@ split { bool should_split = false; - if (vars.lastPanelMap.Current != vars.prevPanelMap || vars.lastPanelPath.Current != vars.prevPanelPath) { - if (settings["panels"]) { + if (vars.lastPanel != vars.prevPanel) + { + if (settings["panels"]) + { should_split = true; - vars.log("Split on any panel: " + vars.lastPanelMap.Current + " / " + vars.lastPanelPath.Current); } - vars.prevPanelMap = vars.lastPanelMap.Current; - vars.prevPanelPath = vars.lastPanelPath.Current; + if (settings["panels_first"]) + { + if (vars.solvedPanels.Contains(vars.lastPanel)) + { + should_split = false; + vars.log("Already solved panel: " + vars.lastPanel); + } + else + { + vars.solvedPanels.Add(vars.lastPanel); + } + } + + if (should_split) + { + vars.log("Split on panel: " + vars.lastPanel); + } + + vars.prevPanel = vars.lastPanel; } else if (vars.currentMap.Current != vars.prevMap) { - if (settings["maps"]) { + if (settings["maps"]) + { should_split = true; + } + + if (settings["maps_first"]) + { + if (vars.visitedMaps.Contains(vars.currentMap.Current)) + { + should_split = false; + vars.log("Already visited map: " + vars.currentMap.Current); + } + else + { + vars.visitedMaps.Add(vars.currentMap.Current); + } + } + + if (should_split) + { vars.log("Split on map change: " + vars.currentMap.Current); } @@ -133,7 +184,8 @@ split } else if (vars.latestKeyKey != null && !vars.collectedKeys.Contains(vars.latestKeyKey)) { - if (settings["keys"]) { + if (settings["keys"]) + { should_split = true; vars.log("Split on collected key: " + vars.latestKeyKey); } -- cgit 1.4.1