minor js fixes

This commit is contained in:
RandomityGuy 2023-07-22 21:16:46 +05:30
parent b0dc369fde
commit 19522a1f5c
3 changed files with 10 additions and 4 deletions

View file

@ -367,10 +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) if (optionsSettings.huntRandom == null)
controlsSettings.huntRandom = false; optionsSettings.huntRandom = false;
if (controlsSettings.fastLoad == null) if (optionsSettings.fastLoad == null)
controlsSettings.fastLoad = false; optionsSettings.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;

View file

@ -3,6 +3,7 @@ package fs;
import hxd.fs.LocalFileSystem; import hxd.fs.LocalFileSystem;
import src.Settings; import src.Settings;
#if hl
class TorqueFileEntry extends LocalEntry { class TorqueFileEntry extends LocalEntry {
override function load(?onReady:Void->Void):Void { override function load(?onReady:Void->Void):Void {
#if macro #if macro
@ -17,6 +18,7 @@ class TorqueFileEntry extends LocalEntry {
#end #end
} }
} }
#end
class TorqueFileSystem extends LocalFileSystem { class TorqueFileSystem extends LocalFileSystem {
#if hl #if hl

View file

@ -302,6 +302,7 @@ class MarblePickerGui extends GuiImage {
mbOpt.position = new Vector(380, yPos); mbOpt.position = new Vector(380, yPos);
mbOpt.extent = new Vector(815, 94); mbOpt.extent = new Vector(815, 94);
mbOpt.setCurrentOption(Settings.optionsSettings.marbleIndex); mbOpt.setCurrentOption(Settings.optionsSettings.marbleIndex);
var curToken = 0;
mbOpt.onChangeFunc = (idx) -> { mbOpt.onChangeFunc = (idx) -> {
var selectedMarble = marbleData[idx]; var selectedMarble = marbleData[idx];
Settings.optionsSettings.marbleIndex = idx; Settings.optionsSettings.marbleIndex = idx;
@ -309,9 +310,12 @@ class MarblePickerGui extends GuiImage {
Settings.optionsSettings.marbleSkin = selectedMarble.skin; Settings.optionsSettings.marbleSkin = selectedMarble.skin;
Settings.optionsSettings.marbleModel = selectedMarble.dts; Settings.optionsSettings.marbleModel = selectedMarble.dts;
Settings.optionsSettings.marbleShader = selectedMarble.shader; Settings.optionsSettings.marbleShader = selectedMarble.shader;
var changeToken = curToken++;
ResourceLoader.load(Settings.optionsSettings.marbleModel).entry.load(() -> { ResourceLoader.load(Settings.optionsSettings.marbleModel).entry.load(() -> {
@:privateAccess MarbleGame.instance.previewWorld.removeMarble(myMarb); @:privateAccess MarbleGame.instance.previewWorld.removeMarble(myMarb);
@:privateAccess MarbleGame.instance.previewWorld.spawnMarble(marb -> { @:privateAccess MarbleGame.instance.previewWorld.spawnMarble(marb -> {
if (changeToken + 1 != curToken)
return;
var spawnPos = @:privateAccess MarbleGame.instance.scene.camera.pos.add(new Vector(0, 1, 1)); var spawnPos = @:privateAccess MarbleGame.instance.scene.camera.pos.add(new Vector(0, 1, 1));
var velAdd = new Vector((1 - 2 * Math.random()) * 2, (1 - 2 * Math.random()) * 1.5, (1 - 2 * Math.random()) * 1); var velAdd = new Vector((1 - 2 * Math.random()) * 2, (1 - 2 * Math.random()) * 1.5, (1 - 2 * Math.random()) * 1);
velAdd = velAdd.add(new Vector(0, 3, 0)); velAdd = velAdd.add(new Vector(0, 3, 0));