Skip to content

Instantly share code, notes, and snippets.

@udoprog
Last active November 4, 2019 02:49
Show Gist options
  • Save udoprog/975a6e5c8b43e6cd06d4ef10e38075ce to your computer and use it in GitHub Desktop.
Save udoprog/975a6e5c8b43e6cd06d4ef10e38075ce to your computer and use it in GitHub Desktop.
state("ModernWarfare")
{
string255 map : 0xAE9E980;
string255 checkpoint : 0x11821030;
bool cinematics : 0xD9D3110;
}
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");
var 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"},
};
var starts = new Dictionary<string, string>() {
{"proxywarstart/proxywar1", "proxywar"},
{"piccadillystart/$default", "piccadilly"},
{"safehouseimmediate_start/safehousestart", "safehouse"},
{"safehouse_finalestart/$default", "safehouse_finale"},
// note: starts early
{"townhousedimmediate_start/townhousedstart", "townhoused"},
{"marinesstart/marines1", "marines"},
{"embassystart/embassy1", "embassy"},
{"highwaystart/highway1", "highway"},
// note: not usable since it starts late
// {"hometownimmediate_start/hometownstart", "hometown"},
{"tunnelsstart/$default", "tunnels"},
// note: starts early
{"captiveimmediate_start/captivestart", "captive"},
{"stpetersburgstart/stpetersburg1", "stpetersburg"},
{"estatestart/estate1", "estate"},
{"labstart/lab1", "lab"},
};
foreach (var start in starts) {
settings.Add(start.Key + "/start", true, "Start timer when you gain control", start.Value);
}
foreach (var split in endSplits) {
settings.Add(split.Key + "/split", true, "Split at end of mission", split.Value);
}
// extra splits since it's such a long mission :/.
settings.Add("embassy14/split", false, "Split after camera section", "embassy");
settings.Add("embassy30/split", false, "Split after receiving drone laser", "embassy");
// clean up the name of the autosave so that it is easier to match against.
Func<string, string> Filter = (name) => {
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;
};
vars.Filter = Filter;
}
update
{
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 (current.cinematics != old.cinematics) {
print("Cinematics Change: " + old.cinematics + " -> " + current.cinematics);
}
}
split
{
if (old.checkpoint != current.checkpoint) {
var o = vars.Filter(old.checkpoint);
var c = vars.Filter(current.checkpoint);
return settings[c + "/split"];
}
return false;
}
start
{
if (old.checkpoint != current.checkpoint) {
var o = vars.Filter(old.checkpoint);
var c = vars.Filter(current.checkpoint);
return settings[o + "/" + c + "/start"];
}
return false;
}
reset
{
return (current.map == "ui");
}
isLoading
{
return current.cinematics;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment