Skip to content

Commit b0dc369

Browse files
committed
vsync is default, add hunt random seed option, add fast load option
1 parent 9a76eec commit b0dc369

File tree

4 files changed

+79
-8
lines changed

4 files changed

+79
-8
lines changed

src/Settings.hx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ typedef OptionsSettings = {
4747
var rewindTimescale:Float;
4848
var reflectionDetail:Int;
4949
var maxPixelRatio:Float;
50+
var huntRandom:Bool;
51+
var fastLoad:Bool;
5052
}
5153

5254
typedef ControlsSettings = {
@@ -121,7 +123,7 @@ class Settings {
121123
musicVolume: 1,
122124
soundVolume: 0.7,
123125
fovX: 90,
124-
frameRateVis: true,
126+
frameRateVis: false,
125127
oobInsults: true,
126128
marbleIndex: 0,
127129
marbleCategoryIndex: 0,
@@ -132,10 +134,9 @@ class Settings {
132134
rewindTimescale: 1,
133135
reflectionDetail: 3,
134136
maxPixelRatio: 1,
135-
vsync: #if js true #end
136-
#if hl
137-
false
138-
#end
137+
vsync: true,
138+
huntRandom: false,
139+
fastLoad: false
139140
};
140141

141142
public static var controlsSettings:ControlsSettings = {
@@ -366,6 +367,10 @@ class Settings {
366367
optionsSettings.reflectionDetail = 2;
367368
if (controlsSettings.controllerVerticalCenter == null)
368369
controlsSettings.controllerVerticalCenter = true;
370+
if (controlsSettings.huntRandom == null)
371+
controlsSettings.huntRandom = false;
372+
if (controlsSettings.fastLoad == null)
373+
controlsSettings.fastLoad = false;
369374
#end
370375
if (optionsSettings.maxPixelRatio == 0 #if js || optionsSettings.maxPixelRatio == null #end)
371376
optionsSettings.maxPixelRatio = 1;

src/fs/TorqueFileSystem.hx

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,54 @@
11
package fs;
22

33
import hxd.fs.LocalFileSystem;
4+
import src.Settings;
5+
6+
class TorqueFileEntry extends LocalEntry {
7+
override function load(?onReady:Void->Void):Void {
8+
#if macro
9+
onReady();
10+
#else
11+
if (Settings.optionsSettings.fastLoad)
12+
onReady();
13+
else {
14+
if (onReady != null)
15+
haxe.Timer.delay(onReady, 1);
16+
}
17+
#end
18+
}
19+
}
420

521
class TorqueFileSystem extends LocalFileSystem {
622
#if hl
23+
public function new(dir:String, configuration:String) {
24+
super(dir, configuration);
25+
baseDir = dir;
26+
if (configuration == null)
27+
configuration = "default";
28+
29+
#if (macro && haxe_ver >= 4.0)
30+
var exePath = null;
31+
#elseif (haxe_ver >= 3.3)
32+
var pr = Sys.programPath();
33+
var exePath = pr == null ? null : pr.split("\\").join("/").split("/");
34+
#else
35+
var exePath = Sys.executablePath().split("\\").join("/").split("/");
36+
#end
37+
38+
if (exePath != null)
39+
exePath.pop();
40+
var froot = exePath == null ? baseDir : sys.FileSystem.fullPath(exePath.join("/") + "/" + baseDir);
41+
if (froot == null || !sys.FileSystem.exists(froot) || !sys.FileSystem.isDirectory(froot)) {
42+
froot = sys.FileSystem.fullPath(baseDir);
43+
if (froot == null || !sys.FileSystem.exists(froot) || !sys.FileSystem.isDirectory(froot))
44+
throw "Could not find dir " + dir;
45+
}
46+
baseDir = froot.split("\\").join("/");
47+
if (!StringTools.endsWith(baseDir, "/"))
48+
baseDir += "/";
49+
root = new TorqueFileEntry(this, "root", null, baseDir);
50+
}
51+
752
override function checkPath(path:String) {
853
// make sure the file is loaded with correct case !
954
var baseDir = new haxe.io.Path(path).dir;
@@ -37,7 +82,7 @@ class TorqueFileSystem extends LocalFileSystem {
3782
return null;
3883
f = f.split("\\").join("/");
3984
if (!check || (sys.FileSystem.exists(f) && checkPath(f))) {
40-
e = new LocalEntry(this, path.split("/").pop(), path, f);
85+
e = new TorqueFileEntry(this, path.split("/").pop(), path, f);
4186
convert.run(e);
4287
if (e.file == null)
4388
e = null;

src/gui/MiscOptionsGui.hx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ class MiscOptionsGui extends GuiImage {
8282
}, 0.5, 118);
8383
rsOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.optionsSettings.rewindTimescale - 0.1) / (1 - 0.1)) * 18), 0, 18)));
8484

85+
var sgOpt = optionCollection.addOption(1, "Seeded Gem Hunt", ["Disabled", "Enabled"], (idx) -> {
86+
Settings.optionsSettings.huntRandom = (idx == 0);
87+
return true;
88+
}, 0.5, 118);
89+
sgOpt.setCurrentOption(Settings.optionsSettings.huntRandom ? 0 : 1);
90+
91+
#if hl
92+
var flOpt = optionCollection.addOption(1, "Fast Loading", ["Disabled", "Enabled"], (idx) -> {
93+
Settings.optionsSettings.fastLoad = (idx == 1);
94+
return true;
95+
}, 0.5, 118);
96+
flOpt.setCurrentOption(Settings.optionsSettings.fastLoad ? 1 : 0);
97+
#end
98+
8599
var bottomBar = new GuiControl();
86100
bottomBar.position = new Vector(0, 590);
87101
bottomBar.extent = new Vector(640, 200);

src/modes/HuntMode.hx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import src.Mission;
2020
import mis.MissionElement.MissionElementSpawnSphere;
2121
import src.AudioManager;
2222
import src.ResourceLoader;
23+
import src.Settings;
2324

2425
@:publicFields
2526
class GemSpawnSphere {
@@ -218,6 +219,10 @@ class HuntMode extends NullMode {
218219
override function onRestart() {
219220
rng.setSeed(100);
220221
rng2.setSeed(100);
222+
if (Settings.optionsSettings.huntRandom) {
223+
rng.setSeed(cast Math.random() * 10000);
224+
rng2.setSeed(cast Math.random() * 10000);
225+
}
221226
setupGems();
222227
points = 0;
223228
@:privateAccess level.playGui.formatGemHuntCounter(points);
@@ -464,7 +469,9 @@ class HuntMode extends NullMode {
464469
var gemBeam = gemToBeamMap.get(gem);
465470
gemBeam.setHide(false);
466471
}
467-
rng.setSeed(s.rngState);
468-
rng2.setSeed(s.rngState2);
472+
if (!Settings.optionsSettings.huntRandom) {
473+
rng.setSeed(s.rngState);
474+
rng2.setSeed(s.rngState2);
475+
}
469476
}
470477
}

0 commit comments

Comments
 (0)