diff --git a/src/Settings.hx b/src/Settings.hx index d8972c7e..2388b1cd 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -48,6 +48,8 @@ typedef OptionsSettings = { var rewindTimescale:Float; var reflectionDetail:Int; var maxPixelRatio:Float; + var huntRandom:Bool; + var fastLoad:Bool; } typedef ControlsSettings = { @@ -121,7 +123,7 @@ class Settings { musicVolume: 1, soundVolume: 0.7, fovX: 90, - frameRateVis: true, + frameRateVis: false, oobInsults: true, marbleIndex: 0, marbleCategoryIndex: 0, @@ -133,10 +135,9 @@ class Settings { rewindTimescale: 1.0, reflectionDetail: 3, maxPixelRatio: 1, - vsync: #if js true #end - #if hl - false - #end + vsync: true, + huntRandom: false, + fastLoad: false }; public static var controlsSettings:ControlsSettings = { @@ -396,6 +397,10 @@ class Settings { #if js if (optionsSettings.reflectionDetail == null) optionsSettings.reflectionDetail = 2; + if (controlsSettings.huntRandom == null) + controlsSettings.huntRandom = false; + if (controlsSettings.fastLoad == null) + controlsSettings.fastLoad = false; #end if (optionsSettings.maxPixelRatio == 0 #if js || optionsSettings.maxPixelRatio == null #end) optionsSettings.maxPixelRatio = 1; diff --git a/src/fs/TorqueFileSystem.hx b/src/fs/TorqueFileSystem.hx index 4158cba9..497d0bd0 100644 --- a/src/fs/TorqueFileSystem.hx +++ b/src/fs/TorqueFileSystem.hx @@ -1,9 +1,54 @@ package fs; import hxd.fs.LocalFileSystem; +import src.Settings; + +class TorqueFileEntry extends LocalEntry { + override function load(?onReady:Void->Void):Void { + #if macro + onReady(); + #else + if (Settings.optionsSettings.fastLoad) + onReady(); + else { + if (onReady != null) + haxe.Timer.delay(onReady, 1); + } + #end + } +} class TorqueFileSystem extends LocalFileSystem { #if hl + public function new(dir:String, configuration:String) { + super(dir, configuration); + baseDir = dir; + if (configuration == null) + configuration = "default"; + + #if (macro && haxe_ver >= 4.0) + var exePath = null; + #elseif (haxe_ver >= 3.3) + var pr = Sys.programPath(); + var exePath = pr == null ? null : pr.split("\\").join("/").split("/"); + #else + var exePath = Sys.executablePath().split("\\").join("/").split("/"); + #end + + if (exePath != null) + exePath.pop(); + var froot = exePath == null ? baseDir : sys.FileSystem.fullPath(exePath.join("/") + "/" + baseDir); + if (froot == null || !sys.FileSystem.exists(froot) || !sys.FileSystem.isDirectory(froot)) { + froot = sys.FileSystem.fullPath(baseDir); + if (froot == null || !sys.FileSystem.exists(froot) || !sys.FileSystem.isDirectory(froot)) + throw "Could not find dir " + dir; + } + baseDir = froot.split("\\").join("/"); + if (!StringTools.endsWith(baseDir, "/")) + baseDir += "/"; + root = new TorqueFileEntry(this, "root", null, baseDir); + } + override function checkPath(path:String) { // make sure the file is loaded with correct case ! var baseDir = new haxe.io.Path(path).dir; @@ -37,7 +82,7 @@ class TorqueFileSystem extends LocalFileSystem { return null; f = f.split("\\").join("/"); if (!check || (sys.FileSystem.exists(f) && checkPath(f))) { - e = new LocalEntry(this, path.split("/").pop(), path, f); + e = new TorqueFileEntry(this, path.split("/").pop(), path, f); convert.run(e); if (e.file == null) e = null; diff --git a/src/gui/MiscOptionsGui.hx b/src/gui/MiscOptionsGui.hx index 7ed0295c..c898a807 100644 --- a/src/gui/MiscOptionsGui.hx +++ b/src/gui/MiscOptionsGui.hx @@ -77,6 +77,20 @@ class MiscOptionsGui extends GuiImage { }, 0.5, 118); rsOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.optionsSettings.rewindTimescale - 0.1) / (1 - 0.1)) * 18), 0, 18))); + var sgOpt = optionCollection.addOption(1, "Seeded Gem Hunt", ["Disabled", "Enabled"], (idx) -> { + Settings.optionsSettings.huntRandom = (idx == 0); + return true; + }, 0.5, 118); + sgOpt.setCurrentOption(Settings.optionsSettings.huntRandom ? 0 : 1); + + #if hl + var flOpt = optionCollection.addOption(1, "Fast Loading", ["Disabled", "Enabled"], (idx) -> { + Settings.optionsSettings.fastLoad = (idx == 1); + return true; + }, 0.5, 118); + flOpt.setCurrentOption(Settings.optionsSettings.fastLoad ? 1 : 0); + #end + var bottomBar = new GuiControl(); bottomBar.position = new Vector(0, 590); bottomBar.extent = new Vector(640, 200); diff --git a/src/modes/HuntMode.hx b/src/modes/HuntMode.hx index 9dcee72e..e830b5af 100644 --- a/src/modes/HuntMode.hx +++ b/src/modes/HuntMode.hx @@ -20,6 +20,7 @@ import src.Mission; import mis.MissionElement.MissionElementSpawnSphere; import src.AudioManager; import src.ResourceLoader; +import src.Settings; @:publicFields class GemSpawnSphere { @@ -218,6 +219,10 @@ class HuntMode extends NullMode { override function onRestart() { rng.setSeed(100); rng2.setSeed(100); + if (Settings.optionsSettings.huntRandom) { + rng.setSeed(cast Math.random() * 10000); + rng2.setSeed(cast Math.random() * 10000); + } setupGems(); points = 0; @:privateAccess level.playGui.formatGemHuntCounter(points); @@ -464,7 +469,9 @@ class HuntMode extends NullMode { var gemBeam = gemToBeamMap.get(gem); gemBeam.setHide(false); } - rng.setSeed(s.rngState); - rng2.setSeed(s.rngState2); + if (!Settings.optionsSettings.huntRandom) { + rng.setSeed(s.rngState); + rng2.setSeed(s.rngState2); + } } }