Skip to content

Instantly share code, notes, and snippets.

@jbzdarkid
Last active November 22, 2016 05:34
Show Gist options
  • Save jbzdarkid/bea1fef30b4f08f00ca913544c335e96 to your computer and use it in GitHub Desktop.
Save jbzdarkid/bea1fef30b4f08f00ca913544c335e96 to your computer and use it in GitHub Desktop.
// TODO (for the adventurous):
// 1. Find splits for some non-cutscene events (Batman suit, disabling disruptors)
// 2. Find a way to fix the Joker Cutscene being removed from timing
// 3. Find a way to identify the current cutscene to allow users to choose which they want to split on
state("BatmanAC") {
int cutscenePlaying : "BatmanAC.exe", 0x12CAB74; // Out-of engine cutscenes
int inMainMenu : "BatmanAC.exe", 0x151BF2C;
int isLoading : "BatmanAC.exe", 0x1179F90; // Loading via black screen, i.e. area change
int isRestartingCheckpoint : "BatmanAC.exe", 0x12D0848, 0x90, 0x788, 0x17C, 0x314, 0x14; // Holds 1 if restarting, any value o.w.
int fightingClayface : "BatmanAC.exe", 0x151BBF4;
int cutsceneSkippable : "BatmanAC.exe", 0x012D086C, 0x70, 0x7D0, 0x130;
}
init {
// Game state (to detect startup)
// 0: In main menu
// 1: Started a game (probably), waiting to skip cutscene
// 1a: Exited game from main menu
// 1b: Loaded a game
// 2: Skipped first cutscene, start timer
// 3: Game live
vars.state = 0;
}
update {
if (vars.state == 0 && old.inMainMenu == 1 && current.inMainMenu == 0) {
print("Leaving the main menu, getting ready to start a run");
vars.state = 1;
} else if (vars.state == 1 && old.cutscenePlaying == 1 && current.cutscenePlaying == 0) {
print("Leaving initial cutscene, starting run");
vars.state = 2;
} else if (vars.state == 1 && old.inMainMenu == 0 && current.inMainMenu == 1) {
print("Re-opened game or exited from a save, resetting state");
vars.state = 0;
}
print("Clayface: " + current.fightingClayface);
}
start {
if (vars.state == 2) {
print("Started run");
vars.state = 3;
return true;
}
}
reset {
if (vars.state == 3 && old.inMainMenu == 0 && current.inMainMenu == 1) {
print("Resetting because returned to main menu");
vars.state = 0;
return true;
}
}
isLoading {
if (current.isRestartingCheckpoint == 1) {
if (old.isRestartingCheckpoint != 1) {
print("Pausing timer because restarting checkpoint");
}
if (current.cutsceneSkippable == 1) {
if (old.cutsceneSkippable == 0) {
print("Unpausing because cutscene can be skipped");
}
return false;
} else {
return true;
}
}
if (current.isLoading == 1) {
if (old.isLoading == 0) {
print("Pausing timer because of area transition");
}
return true;
}
if (current.cutsceneLoading == 1) {
if (old.cutsceneLoading == 0) {
print("Pausing timer while cutscene loads");
}
return true;
}
return false;
}
split {
if (old.cutscenePlaying == 0 && current.cutscenePlaying == 1) {
print("Splitting because a cutscene started playing");
if (current.fightingClayface == 1) {
print("Split while fighting clayface, removing 14s extra end time");
timer.SetGameTime(timer.CurrentTime.GameTime - TimeSpan.FromMilliseconds(1400));
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment