mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
vsync is default, add hunt random seed option, add fast load option
This commit is contained in:
parent
9a76eecaca
commit
b0dc369fde
4 changed files with 79 additions and 8 deletions
|
|
@ -47,6 +47,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,
|
||||
|
|
@ -132,10 +134,9 @@ class Settings {
|
|||
rewindTimescale: 1,
|
||||
reflectionDetail: 3,
|
||||
maxPixelRatio: 1,
|
||||
vsync: #if js true #end
|
||||
#if hl
|
||||
false
|
||||
#end
|
||||
vsync: true,
|
||||
huntRandom: false,
|
||||
fastLoad: false
|
||||
};
|
||||
|
||||
public static var controlsSettings:ControlsSettings = {
|
||||
|
|
@ -366,6 +367,10 @@ class Settings {
|
|||
optionsSettings.reflectionDetail = 2;
|
||||
if (controlsSettings.controllerVerticalCenter == null)
|
||||
controlsSettings.controllerVerticalCenter = true;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue