Zamiel

isaac-afterbirthplus.asl - The LiveSplit Auto-Splitter

Oct 1st, 2020 (edited)
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. // AutoSplitter for The Binding of Isaac: Afterbirth+
  2. // Code by Hyphen-ated
  3. // Checkpoint code & pointer annotations by blcd/Zamiel
  4.  
  5. state("isaac-ng", "1.06.J168")
  6. {
  7. // 0x0053A0E0 old(0x005380E0) - GlobalsPtr
  8. int wins: 0x0053A0E0, 0x80C;
  9. int character: 0x0053A0E0, 0x76A0;
  10. int winstreak: 0x0053A0E0, 0x230;
  11.  
  12.  
  13. // 0x0053A0D0 - old(0x005380D0) - GamePtr (which is the same thing as the Lua "game" pointer)
  14. int timer: 0x0053A0D0, 0x001F37C8;
  15. int floor: 0x0053A0D0, 0x0;
  16. int curse: 0x0053A0D0, 0xC;
  17.  
  18. // Checkpoint is a custom item planted at the end of a run in the Racing+ mod
  19. int cpCount: 0x0053A0D0, 0x9768, 0x0, 0x2770, 0x8C4; // "Checkpoint" (ID 561) count
  20.  
  21. // Off Limits is a custom item used by the Racing+ mod to signal the AutoSplitter that the mod is sending the player back to the first character
  22. int olCount: 0x0053A0D0, 0x9768, 0x0, 0x2770, 0x8C0; // "Off Limits" (ID 560) count
  23.  
  24. // Pre BP5
  25. // Equivalent Lua: Game():GetPlayer(0):GetCollectibleNum(541)
  26. // 0x9d8c - PlayerVectorPtr
  27. // 0x0 - Player1
  28. // 0x2764 - Player1 CollectibleNum Vector Ptr
  29. //# 0x864 - Item 537 count
  30. //# 0x86C - Item 539 count
  31. // 0x874 - Item 541 count
  32. // 0x87C - Item 543 count
  33.  
  34. // BP5
  35. // Equivalent Lua: Game():GetPlayer(0):GetCollectibleNum(541)
  36. // 0x94D8 - PlayerVectorPtr
  37. // 0x0 - Player1
  38. // 0x221C - Player1 CollectibleNum Vector Ptr
  39. // 0x8BC - Item 559 count - current
  40. // 0x8C4 - Item 561 count - current
  41. }
  42.  
  43. startup
  44. {
  45. settings.Add("character_run", true, "Multi-character run");
  46. settings.SetToolTip("character_run", "Disables auto-resetting when you're past the first split.");
  47. settings.Add("racing_plus_custom_challenge", false, "You're using the Racing+ custom challenge for multi-character runs", "character_run");
  48. settings.Add("floor_splits", false, "Split on floors");
  49. settings.Add("grouped_floors", false, "Combine Basement, Caves, Depths, and Womb into one split each", "floor_splits");
  50. settings.Add("blck_cndl", false, "You're using the \"BLCK CNDL\" seed (the \"Total Curse Immunity\" Easter Egg) or using the Racing+ mod (which disables curses)", "floor_splits");
  51. }
  52.  
  53. init
  54. {
  55. vars.timer_during_floor_change = 0;
  56. }
  57.  
  58. update
  59. {
  60. //print("wins: " + current.wins + ", floor: " + current.floor + ", character: " + current.character + ", timer: " + current.timer + ", curse: " + current.curse);
  61. //print("cpCount: " + current.cpCount);
  62. }
  63.  
  64. start
  65. {
  66. if (old.timer == 0 && current.timer != 0)
  67. {
  68. vars.timer_during_floor_change = 0;
  69. return true;
  70. }
  71. }
  72.  
  73. reset
  74. {
  75. // old.timer is 0 immediately during a reset, and also when you're on the main menu
  76. // this "current.timer < 10" is to stop a reset from happening when you s+q.
  77. // (unless you s+q during the first 1/3 second of the run, but why would you)
  78. if (old.timer == 0 && current.timer != 0 && current.timer < 10
  79. && (!settings["character_run"] || timer.CurrentSplitIndex == 0))
  80. {
  81. vars.timer_during_floor_change = 0;
  82. return true;
  83. }
  84.  
  85. if (settings["racing_plus_custom_challenge"] && current.olCount == 1 && old.olCount != 1)
  86. {
  87. return true;
  88. }
  89. }
  90.  
  91. split
  92. {
  93. if (current.wins == old.wins + 1)
  94. {
  95. return true;
  96. }
  97.  
  98. if (settings["racing_plus_custom_challenge"] && current.cpCount == 1 && old.cpCount != 1)
  99. {
  100. return true;
  101. }
  102.  
  103. if (settings["floor_splits"])
  104. {
  105. if (current.floor > old.floor && current.floor > 1 && old.floor > 0
  106. && (!settings["grouped_floors"] || (current.floor != 2 && current.floor != 4 && current.floor != 6 && current.floor != 8)))
  107. {
  108. // when using floor splits, if they just got into an xl floor, we are going to doublesplit
  109. vars.timer_during_floor_change = current.timer;
  110. return true;
  111. }
  112.  
  113. if (vars.timer_during_floor_change != -1
  114. && current.timer > vars.timer_during_floor_change)
  115. {
  116. vars.timer_during_floor_change = -1;
  117. // if they're in blck_cndl mode, there is no xl even if the xl curse looks like it's on
  118. // similarly, with grouped floors, there's no split to skip
  119. if (current.curse == 2 && !settings["blck_cndl"] && !settings["grouped_floors"])
  120. {
  121. var model = new TimerModel { CurrentState = timer };
  122. model.SkipSplit();
  123. }
  124. }
  125. }
  126. }
  127.  
Advertisement
Add Comment
Please, Sign In to add comment