Last active
November 9, 2019 07:25
-
-
Save udoprog/d89a1cccef6fc1d3a10f901b437458dc to your computer and use it in GitHub Desktop.
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
state("ModernWarfare") | |
{ | |
string64 map : 0xB0A1E08; | |
// Need to use this pointer instead of the address available in modules since | |
// this changes correctly regardless of how you save/load. | |
string64 checkpoint : 0xB297DB8, 0x20, 0x108; | |
// shit the bed on hometown and forward. | |
// bool missiontext : 0xB2E6B94; | |
bool missiontext : 0xE7A70DC; | |
bool prompts : 0xB2E5EA4; | |
// Used for everything else. | |
bool noninteractive : 0xFC44AF0; | |
// Needed for Going Dark. | |
bool noninteractive2 : 0xDB6B468; | |
} | |
// example: levelshots/autosave/autosave_picadilly1 | |
startup | |
{ | |
settings.Add("proxywar", true, "Fog Of War"); | |
settings.Add("piccadilly", true, "Piccadilly"); | |
settings.Add("safehouse", true, "Embedded"); | |
settings.Add("safehouse_finale", true, "Proxy War"); | |
settings.Add("townhoused", true, "Clean House"); | |
settings.Add("marines", true, "Hunting Party"); | |
settings.Add("embassy", true, "The Embassy"); | |
settings.Add("highway", true, "Highway of Death"); | |
settings.Add("hometown", true, "Hometown"); | |
settings.Add("tunnels", true, "The Wolf's Den"); | |
settings.Add("captive", true, "Captive"); | |
settings.Add("stpetersburg", true, "Old Comrads"); | |
settings.Add("estate", true, "Going Dark"); | |
settings.Add("lab", true, "Into The Furnace"); | |
vars.endSplits = new Dictionary<string, string>() { | |
{"proxywarend", "proxywar"}, | |
{"piccadillyend", "piccadilly"}, | |
{"safehouseend", "safehouse"}, | |
{"safehouse_finaleend", "safehouse_finale"}, | |
{"townhousedend", "townhoused"}, | |
{"marinesend", "marines"}, | |
{"embassyend", "embassy"}, | |
{"highwayend", "highway"}, | |
{"hometownend", "hometown"}, | |
{"tunnelsend", "tunnels"}, | |
{"captiveend", "captive"}, | |
{"stpetersburgend", "stpetersburg"}, | |
{"estateend", "estate"}, | |
{"labend", "lab"}, | |
}; | |
vars.endLoadingCheckpoints = new Dictionary<string, string>() { | |
{"finale15", "safehouse_finale"}, | |
// TODO: remove once you've figured out the interactive value. | |
{"townhousedend", "townhoused"}, | |
}; | |
// clean up the name of the autosave so that it is easier to match against. | |
Func<string, string> Filter = (name) => { | |
if (name == null) { | |
return ""; | |
} | |
string o = name; | |
var parts = o.Split('/'); | |
if (parts.Length > 2) { | |
o = parts[2].Trim(); | |
} else { | |
o = o.Trim(); | |
} | |
if (o.StartsWith("autosave_")) { | |
o = o.Substring("autosave_".Length); | |
} | |
return o; | |
}; | |
Action Start = () => { | |
vars.start = true; | |
vars.loading = false; | |
}; | |
Action Stop = () => { | |
vars.loading = true; | |
}; | |
vars.Start = Start; | |
vars.Stop = Stop; | |
vars.Filter = Filter; | |
vars.loading = true; | |
vars.start = false; | |
} | |
update | |
{ | |
var currentNoninteractive = current.noninteractive || current.noninteractive2; | |
var oldNoninteractive = old.noninteractive || old.noninteractive2; | |
if (current.map != old.map) { | |
print("Map Change: " + old.map + " -> " + current.map); | |
} | |
if (current.checkpoint != old.checkpoint) { | |
print("Checkpoint Change: " + old.checkpoint + " -> " + current.checkpoint); | |
} | |
if (currentNoninteractive != oldNoninteractive) { | |
print("Noninteractive Change: " + oldNoninteractive + " -> " + currentNoninteractive); | |
} | |
if (current.missiontext != old.missiontext) { | |
print("Mission Text Change: " + old.missiontext + " -> " + current.missiontext); | |
} | |
// reset | |
if (current.map != old.map && current.map == "techsets_ui_boot") { | |
vars.loading = true; | |
} | |
// when mission text is shown. | |
if (current.missiontext && !old.missiontext) { | |
if (current.map == "techsets_proxywar" && settings["proxywar"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_piccadilly" && settings["piccadilly"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_safehouse" && settings["safehouse"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_safehouse_finale" && settings["safehouse_finale"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_townhoused" && settings["townhoused"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_embassy" && settings["embassy"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_highway" && settings["highway"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_hometown" && settings["hometown"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_tunnels" && settings["tunnels"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_captive" && settings["captive"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_stpetersburg" && settings["stpetersburg"]) { | |
vars.Start(); | |
} else if (current.map == "techsets_lab" && settings["lab"]) { | |
vars.Start(); | |
} | |
} | |
// when we lose interactivity. | |
if (currentNoninteractive && !oldNoninteractive) { | |
var checkpoint = vars.Filter(current.checkpoint); | |
// at the car door | |
if (checkpoint == "proxywar14" && settings["proxywar"]) { | |
vars.Stop(); | |
} | |
// defusing vest | |
else if (checkpoint == "piccadilly7" && settings["piccadilly"]) { | |
vars.Stop(); | |
} | |
// interacting with ladder | |
else if (checkpoint == "safehouse16" && settings["safehouse"]) { | |
vars.Stop(); | |
} | |
// interacting with the detonator | |
else if (checkpoint == "townhoused12" && settings["townhoused"]) { | |
vars.Stop(); | |
} | |
// capturing The Wolf | |
else if (current.map == "techsets_marines" && checkpoint == "$default" && settings["marines"]) { | |
vars.Stop(); | |
} | |
} | |
// when we gain interactivity | |
if (!currentNoninteractive && oldNoninteractive) { | |
var checkpoint = vars.Filter(current.checkpoint); | |
if ((checkpoint == "marinesimmediate_start" || checkpoint == "marinesstart" || checkpoint == "marines1") && settings["marines"]) { | |
vars.loading = false; | |
vars.start = true; | |
} | |
else if (current.map == "techsets_highway" && settings["highway"]) { | |
vars.Start(); | |
} | |
else if (current.map == "techsets_estate" && settings["estate"]) { | |
vars.Start(); | |
} | |
} | |
if (old.prompts && !current.prompts) { | |
var checkpoint = vars.Filter(current.checkpoint); | |
// after acknowledging that | |
if (checkpoint == "safehouse_finale9") { | |
vars.Stop(); | |
} | |
} | |
// failsafe in case the more detailed load remover fails. | |
if (current.checkpoint != old.checkpoint) { | |
string mission; | |
var checkpoint = vars.Filter(current.checkpoint); | |
// after disengaging with the chopper. | |
if (vars.endLoadingCheckpoints.TryGetValue(checkpoint, out mission) && settings[mission]) { | |
vars.Stop(); | |
} | |
} | |
} | |
split | |
{ | |
if (old.checkpoint != current.checkpoint) { | |
string mission; | |
var checkpoint = vars.Filter(current.checkpoint); | |
if (vars.endSplits.TryGetValue(checkpoint, out mission)) { | |
return settings[mission]; | |
} | |
} | |
return false; | |
} | |
start | |
{ | |
if (vars.start) { | |
vars.start = false; | |
return true; | |
} | |
return false; | |
} | |
reset | |
{ | |
return old.map != current.map && current.map == "techsets_ui_boot"; | |
} | |
isLoading | |
{ | |
return vars.loading; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment