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 rewindTimescale:Float;
|
||||||
var reflectionDetail:Int;
|
var reflectionDetail:Int;
|
||||||
var maxPixelRatio:Float;
|
var maxPixelRatio:Float;
|
||||||
|
var huntRandom:Bool;
|
||||||
|
var fastLoad:Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef ControlsSettings = {
|
typedef ControlsSettings = {
|
||||||
|
|
@ -121,7 +123,7 @@ class Settings {
|
||||||
musicVolume: 1,
|
musicVolume: 1,
|
||||||
soundVolume: 0.7,
|
soundVolume: 0.7,
|
||||||
fovX: 90,
|
fovX: 90,
|
||||||
frameRateVis: true,
|
frameRateVis: false,
|
||||||
oobInsults: true,
|
oobInsults: true,
|
||||||
marbleIndex: 0,
|
marbleIndex: 0,
|
||||||
marbleCategoryIndex: 0,
|
marbleCategoryIndex: 0,
|
||||||
|
|
@ -132,10 +134,9 @@ class Settings {
|
||||||
rewindTimescale: 1,
|
rewindTimescale: 1,
|
||||||
reflectionDetail: 3,
|
reflectionDetail: 3,
|
||||||
maxPixelRatio: 1,
|
maxPixelRatio: 1,
|
||||||
vsync: #if js true #end
|
vsync: true,
|
||||||
#if hl
|
huntRandom: false,
|
||||||
false
|
fastLoad: false
|
||||||
#end
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static var controlsSettings:ControlsSettings = {
|
public static var controlsSettings:ControlsSettings = {
|
||||||
|
|
@ -366,6 +367,10 @@ class Settings {
|
||||||
optionsSettings.reflectionDetail = 2;
|
optionsSettings.reflectionDetail = 2;
|
||||||
if (controlsSettings.controllerVerticalCenter == null)
|
if (controlsSettings.controllerVerticalCenter == null)
|
||||||
controlsSettings.controllerVerticalCenter = true;
|
controlsSettings.controllerVerticalCenter = true;
|
||||||
|
if (controlsSettings.huntRandom == null)
|
||||||
|
controlsSettings.huntRandom = false;
|
||||||
|
if (controlsSettings.fastLoad == null)
|
||||||
|
controlsSettings.fastLoad = false;
|
||||||
#end
|
#end
|
||||||
if (optionsSettings.maxPixelRatio == 0 #if js || optionsSettings.maxPixelRatio == null #end)
|
if (optionsSettings.maxPixelRatio == 0 #if js || optionsSettings.maxPixelRatio == null #end)
|
||||||
optionsSettings.maxPixelRatio = 1;
|
optionsSettings.maxPixelRatio = 1;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,54 @@
|
||||||
package fs;
|
package fs;
|
||||||
|
|
||||||
import hxd.fs.LocalFileSystem;
|
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 {
|
class TorqueFileSystem extends LocalFileSystem {
|
||||||
#if hl
|
#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) {
|
override function checkPath(path:String) {
|
||||||
// make sure the file is loaded with correct case !
|
// make sure the file is loaded with correct case !
|
||||||
var baseDir = new haxe.io.Path(path).dir;
|
var baseDir = new haxe.io.Path(path).dir;
|
||||||
|
|
@ -37,7 +82,7 @@ class TorqueFileSystem extends LocalFileSystem {
|
||||||
return null;
|
return null;
|
||||||
f = f.split("\\").join("/");
|
f = f.split("\\").join("/");
|
||||||
if (!check || (sys.FileSystem.exists(f) && checkPath(f))) {
|
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);
|
convert.run(e);
|
||||||
if (e.file == null)
|
if (e.file == null)
|
||||||
e = null;
|
e = null;
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,20 @@ class MiscOptionsGui extends GuiImage {
|
||||||
}, 0.5, 118);
|
}, 0.5, 118);
|
||||||
rsOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.optionsSettings.rewindTimescale - 0.1) / (1 - 0.1)) * 18), 0, 18)));
|
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();
|
var bottomBar = new GuiControl();
|
||||||
bottomBar.position = new Vector(0, 590);
|
bottomBar.position = new Vector(0, 590);
|
||||||
bottomBar.extent = new Vector(640, 200);
|
bottomBar.extent = new Vector(640, 200);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import src.Mission;
|
||||||
import mis.MissionElement.MissionElementSpawnSphere;
|
import mis.MissionElement.MissionElementSpawnSphere;
|
||||||
import src.AudioManager;
|
import src.AudioManager;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
|
import src.Settings;
|
||||||
|
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class GemSpawnSphere {
|
class GemSpawnSphere {
|
||||||
|
|
@ -218,6 +219,10 @@ class HuntMode extends NullMode {
|
||||||
override function onRestart() {
|
override function onRestart() {
|
||||||
rng.setSeed(100);
|
rng.setSeed(100);
|
||||||
rng2.setSeed(100);
|
rng2.setSeed(100);
|
||||||
|
if (Settings.optionsSettings.huntRandom) {
|
||||||
|
rng.setSeed(cast Math.random() * 10000);
|
||||||
|
rng2.setSeed(cast Math.random() * 10000);
|
||||||
|
}
|
||||||
setupGems();
|
setupGems();
|
||||||
points = 0;
|
points = 0;
|
||||||
@:privateAccess level.playGui.formatGemHuntCounter(points);
|
@:privateAccess level.playGui.formatGemHuntCounter(points);
|
||||||
|
|
@ -464,7 +469,9 @@ class HuntMode extends NullMode {
|
||||||
var gemBeam = gemToBeamMap.get(gem);
|
var gemBeam = gemToBeamMap.get(gem);
|
||||||
gemBeam.setHide(false);
|
gemBeam.setHide(false);
|
||||||
}
|
}
|
||||||
rng.setSeed(s.rngState);
|
if (!Settings.optionsSettings.huntRandom) {
|
||||||
rng2.setSeed(s.rngState2);
|
rng.setSeed(s.rngState);
|
||||||
|
rng2.setSeed(s.rngState2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue