COD4.asl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //original script by KunoDemetries
  2. //cleaned up and some extra features by rythin
  3. //modified pointers for expanded memory .exe file and fixed end split condition -Surviv0r
  4. //fixed ending split for speedrun mod - Dev1ne
  5. state("iw3sp", "V1.0") // Steam Version
  6. {
  7. int Loader : 0x10B1100;
  8. string20 CurrentLevelName : 0x6C3140;
  9. int EndSplit : 0xCDE4C8;
  10. }
  11. state("iw3sp", "V1.5") // Modified .exe to support more physical memory
  12. {
  13. int Loader : 0x1C75F4, 0x0;
  14. string20 CurrentLevelName : 0x4EA64, 0x50C;
  15. int EndSplit : 0xCDE4C8;
  16. }
  17. startup
  18. {
  19. settings.Add("CoD4", true, "Call of Duty 4");
  20. settings.Add("act0", true, "Prologue", "CoD4");
  21. settings.Add("act1", true, "Act 1", "CoD4");
  22. settings.Add("act2", true, "Act 2", "CoD4");
  23. settings.Add("act3", true, "Act 3", "CoD4");
  24. var tB = (Func<string, string, string, Tuple<string, string, string>>) ((elmt1, elmt2, elmt3) => { return Tuple.Create(elmt1, elmt2, elmt3); });
  25. var sB = new List<Tuple<string, string, string>>
  26. {
  27. tB("act0","killhouse", "F.N.G."),
  28. tB("act0","cargoship", "Crew Expendable"),
  29. tB("act0","coup", "The Coup"),
  30. tB("act1","blackout", "Blackout"),
  31. tB("act1","armada", "Charlie Dont Surf"),
  32. tB("act1","bog_a", "The Bog"),
  33. tB("act1","hunted", "Hunted"),
  34. tB("act1","ac130", "Death From Above"),
  35. tB("act1","bog_b", "War Pig"),
  36. tB("act1","airlift", "Shock and Awe"),
  37. tB("act1","aftermath", "Aftermath"),
  38. tB("act2","village_assault", "Safe House"),
  39. tB("act2","scoutsniper", "All Ghillied Up"),
  40. tB("act2","sniperescape", "One Shot, One Kill"),
  41. tB("act2","village_defend", "Heat"),
  42. tB("act2","ambush", "The Sins of the Father"),
  43. tB("act3","icbm", "Ultimatum"),
  44. tB("act3","launchfacility_a", "All In"),
  45. tB("act3","launchfacility_b", "No Fighting in The War Room"),
  46. tB("act3","jeepride", "Game Over"),
  47. };
  48. foreach (var s in sB) settings.Add(s.Item2, true, s.Item3, s.Item1);
  49. refreshRate = 30;
  50. if (timer.CurrentTimingMethod == TimingMethod.RealTime) // stolen from dude simulator 3, basically asks the runner to set their livesplit to game time
  51. {
  52. var timingMessage = MessageBox.Show
  53. (
  54. "This game uses Time without Loads (Game Time) as the main timing method.\n"+
  55. "LiveSplit is currently set to show Real Time (RTA).\n"+
  56. "Would you like to set the timing method to Game Time? This will make verification easier",
  57. "LiveSplit | Call of Duty 4: Modern Warfare",
  58. MessageBoxButtons.YesNo,MessageBoxIcon.Question
  59. );
  60. if (timingMessage == DialogResult.Yes)
  61. {
  62. timer.CurrentTimingMethod = TimingMethod.GameTime;
  63. }
  64. }
  65. }
  66. init
  67. {
  68. vars.doneMaps = new List<string>(); // Actually needed because intel%
  69. vars.coupOffset = false;
  70. vars.currentTime = new TimeSpan(0, 0, 0); //TimeSpan object used to add a timer offset after The Coup
  71. if (modules.First().ModuleMemorySize == 0x1D03000)
  72. version = "V1.0";
  73. else if (modules.First().ModuleMemorySize == 0x1D00EC2)
  74. version = "V1.5";
  75. }
  76. update
  77. {
  78. vars.currentTime = timer.CurrentTime.GameTime; //keep the variable updated with the current time on the timer
  79. }
  80. start
  81. {
  82. //changed start condition to happen only after loading in rather than any time in the load
  83. return (current.CurrentLevelName == "killhouse" && current.Loader != 0 && old.Loader == 0);
  84. }
  85. onStart
  86. {
  87. vars.doneMaps.Clear(); //clear the doneMaps list
  88. vars.coupOffset = false;
  89. }
  90. split
  91. {
  92. if ((current.CurrentLevelName != old.CurrentLevelName) && (!vars.doneMaps.Contains(current.CurrentLevelName)))
  93. { //on map change
  94. if (current.CurrentLevelName == "coup")
  95. { //if the last map was The Coup. kuno note: Changed to do it on coup and not after it's skipped ie into the next level
  96. vars.currentTime = timer.CurrentTime.GameTime; //set a variable to the value of current time
  97. vars.coupOffset = true; //add 4:44 to the timer
  98. if (settings["coup"])
  99. { //if the split for The Coup is enabled
  100. vars.doneMaps.Add(old.CurrentLevelName); //add the last map to done splits list
  101. return true; //split
  102. }
  103. }
  104. else
  105. { //if map is NOT The Coup
  106. if (settings[current.CurrentLevelName])
  107. { //if setting for last map is enabled
  108. vars.doneMaps.Add(old.CurrentLevelName); //add the last map to done splits list
  109. return true; //split
  110. }
  111. }
  112. }
  113. //Endsplit for the game
  114. if (current.CurrentLevelName == "jeepride" && current.EndSplit != 147865)
  115. {
  116. return true;
  117. }
  118. //Endsplit solution for speedrun mod
  119. else if (old.CurrentLevelName == "jeepride" && current.CurrentLevelName == "ac130")
  120. {
  121. return true;
  122. }
  123. }
  124. reset
  125. {
  126. return (current.CurrentLevelName == "ui" && old.CurrentLevelName != "coup");
  127. }
  128. onReset
  129. {
  130. vars.doneMaps.Clear();
  131. }
  132. gameTime
  133. {
  134. if (vars.coupOffset == true)
  135. { //when offset gets set to true
  136. vars.coupOffset = false; //set it back to false
  137. return vars.currentTime.Add(new TimeSpan (0, 4, 44)); //set the timer to current timer time + 284s (4m44s)
  138. }
  139. }
  140. isLoading
  141. {
  142. return (current.Loader == 0) || (current.CurrentLevelName == "coup");
  143. }
  144. exit
  145. {
  146. timer.OnStart -= vars.onStart;
  147. }