From 296c7e893bf9187689c80fd3feb92f935d5f6b3b Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Sun, 14 Jul 2024 02:04:06 +0530 Subject: [PATCH] various reported bugfixes --- data/shapes/gemlights/gemlight.dts | Bin 6432 -> 1452 bytes src/DtsObject.hx | 2 +- src/MarbleWorld.hx | 9 ++++++-- src/Radar.hx | 3 +++ src/gui/MPServerDlg.hx | 4 ++-- src/gui/PlayGui.hx | 20 ++++++++++------- src/mis/MisParser.hx | 33 ++++++++++++++++++++++------- src/net/NetCommands.hx | 3 +++ 8 files changed, 53 insertions(+), 21 deletions(-) diff --git a/data/shapes/gemlights/gemlight.dts b/data/shapes/gemlights/gemlight.dts index 381648485629a8b06128a3ad979ea0e56622a465..26cc660f4edd4d7eb06363b5dd14e6d279c94d8c 100644 GIT binary patch literal 1452 zcmbtU!A=uV6g|@prIfaoD$0)e0BWMND`UpdXkbTVryB-sfTUUiH6g~Nb?0Z07!w!l z?25!R{R98Pq#7{@YAEnHcRH^=M!K-Rr zFxQ0(;t|)(?6#Ld!|lm;iWVF%hDHm-jgPlJkh^ih!nUXLsmKsLA}L*`-eY>C2Ade^ zJ+%LuAk+Iq9PO_}iQ^?HjS;C}N!JgIbDkzLgyb^DT{%+^KsH>s#3;4t`d(F!Hw^5P z2Qcykbc(-9O?#)R?r!aLnq4*BmV4UV=@bE{eXQ!Om*l1=sw;YA?Awo7h@puhdg zF15ZAqJL)WhFp7&=;6A1a)E!J+E4l=&v!=IBYA$1e+jwvNS-5V-y(jg8TeG}@@#T0 zrS_Uu@QpZaV4-=!x=oLq>%2Zwl6#grdNBXO&1W`TiC9|PeUp288}Ao)wXWw9wNK(8 z{a^D8@(<=fF?IDW{xKHyzTmjC1}BhS#B@5t3B8kS4na5(a=W$2hApCIxg z!eTGRVYA~C{jRne!0Sgq{auosoMPvu*|k|nM@p9Sd!n8kv*&RcS1^gIxQ5m7yACOm*>F>O&9=2cAS`{}zA@Z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this.isMultiplayer) @@ -2836,7 +2841,7 @@ class MarbleWorld extends Scheduler { offset.x = -offset.x; } var mpos = this.currentCheckpoint.obj.getAbsPos().getPosition().add(offset); - this.marble.setPosition(mpos.x, mpos.y, mpos.z); + this.marble.setMarblePosition(mpos.x, mpos.y, mpos.z); marble.velocity.load(new Vector(0, 0, 0)); marble.omega.load(new Vector(0, 0, 0)); Console.log('Respawn:'); diff --git a/src/Radar.hx b/src/Radar.hx index 7f801612..0fead6c0 100644 --- a/src/Radar.hx +++ b/src/Radar.hx @@ -53,6 +53,9 @@ class Radar { radarTileRedGem, radarTileYellowGem, radarTileBlueGem, radarTileGreenGem, radarTileOrangeGem, radarTilePinkGem, radarTilePurpleGem, radarTileTurquoiseGem, radarTileBlackGem, radarTilePlatinumGem, radarTileEndPad ]; + for (tile in radarTiles) { + tile.scaleToSize(tile.width * Settings.uiScale, tile.height * Settings.uiScale); + } } public function init() { diff --git a/src/gui/MPServerDlg.hx b/src/gui/MPServerDlg.hx index 88363e2b..8cb4ce4b 100644 --- a/src/gui/MPServerDlg.hx +++ b/src/gui/MPServerDlg.hx @@ -259,8 +259,8 @@ class MPServerDlg extends GuiImage { playerPlus.position = new Vector(359, 9 + 29 * 5); playerPlus.extent = new Vector(31, 31); playerPlus.pressedAction = (sender) -> { - Settings.serverSettings.maxPlayers = Std.int(Math.min(8, Settings.serverSettings.maxPlayers + 1)); - maxPlayers.text.text = "Max Players: " + Settings.serverSettings.maxPlayers; + curServerMaxPlayers = Std.int(Math.min(8, curServerMaxPlayers + 1)); + maxPlayers.text.text = "Max Players: " + curServerMaxPlayers; }; serverSettingsContainer.addChild(playerPlus); diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index f5eec555..710046a2 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -632,19 +632,23 @@ class PlayGui { this.playGuiCtrl.addChild(playerListContainer); var imgLoader = (s:String) -> { - switch (s) { + var t = switch (s) { case "high": - return ResourceLoader.getResource("data/ui/mp/play/connection-high.png", ResourceLoader.getImage, this.imageResources).toTile(); + ResourceLoader.getResource("data/ui/mp/play/connection-high.png", ResourceLoader.getImage, this.imageResources).toTile(); case "medium": - return ResourceLoader.getResource("data/ui/mp/play/connection-medium.png", ResourceLoader.getImage, this.imageResources).toTile(); + ResourceLoader.getResource("data/ui/mp/play/connection-medium.png", ResourceLoader.getImage, this.imageResources).toTile(); case "low": - return ResourceLoader.getResource("data/ui/mp/play/connection-low.png", ResourceLoader.getImage, this.imageResources).toTile(); + ResourceLoader.getResource("data/ui/mp/play/connection-low.png", ResourceLoader.getImage, this.imageResources).toTile(); case "matanny": - return ResourceLoader.getResource("data/ui/mp/play/connection-matanny.png", ResourceLoader.getImage, this.imageResources).toTile(); + ResourceLoader.getResource("data/ui/mp/play/connection-matanny.png", ResourceLoader.getImage, this.imageResources).toTile(); case "unknown": - return ResourceLoader.getResource("data/ui/mp/play/connection-unknown.png", ResourceLoader.getImage, this.imageResources).toTile(); - } - return null; + ResourceLoader.getResource("data/ui/mp/play/connection-unknown.png", ResourceLoader.getImage, this.imageResources).toTile(); + default: + null; + }; + if (t != null) + t.scaleToSize(t.width * (Settings.uiScale), t.height * (Settings.uiScale)); + return t; } playerListCtrl = new GuiMLTextListCtrl(bfont, [], imgLoader, { diff --git a/src/mis/MisParser.hx b/src/mis/MisParser.hx index c8dfaaab..d3414449 100644 --- a/src/mis/MisParser.hx +++ b/src/mis/MisParser.hx @@ -99,11 +99,11 @@ class MisParser { else if (!lineMatch || (blockMatch && lineMatch && blockCommentRegEx.matchedPos().pos < lineCommentRegEx.matchedPos().pos)) { this.text = this.text.substring(0, blockCommentRegEx.matchedPos().pos) + this.text.substring(blockCommentRegEx.matchedPos().pos + blockCommentRegEx.matchedPos().len); - currentIndex += blockCommentRegEx.matchedPos().pos; + currentIndex = blockCommentRegEx.matchedPos().pos + blockCommentRegEx.matchedPos().len; } else { this.text = this.text.substring(0, lineCommentRegEx.matchedPos().pos) + this.text.substring(lineCommentRegEx.matchedPos().pos + lineCommentRegEx.matchedPos().len); - currentIndex += lineCommentRegEx.matchedPos().pos; + currentIndex = lineCommentRegEx.matchedPos().pos + lineCommentRegEx.matchedPos().len; } } @@ -294,13 +294,30 @@ class MisParser { function readPath(name:String) { var sg:MissionElementSimGroup = cast this.readSimGroup(name); - var obj = new MissionElementPath(); - obj._type = MissionElementType.Path; - obj._name = name; - obj.markers = sg.elements.map(x -> cast x); - obj.markers.sort((a, b) -> cast MisParser.parseNumber(a.seqnum) - MisParser.parseNumber(b.seqnum)); + var allMarkers = true; + // Verify if they are all markers + for (e in sg.elements) { + if (e._type != MissionElementType.Marker) { + allMarkers = false; + break; + } + } + if (allMarkers) { + var obj = new MissionElementPath(); + obj._type = MissionElementType.Path; + obj._name = name; + obj.markers = sg.elements.map(x -> cast x); + obj.markers.sort((a, b) -> cast MisParser.parseNumber(a.seqnum) - MisParser.parseNumber(b.seqnum)); - return obj; + return obj; + } else { + var obj = new MissionElementPath(); + obj._type = MissionElementType.Path; + obj._name = name; + obj.markers = sg.elements.filter(x -> x._type == MissionElementType.Marker).map(x -> cast x); + obj.markers.sort((a, b) -> cast MisParser.parseNumber(a.seqnum) - MisParser.parseNumber(b.seqnum)); + return obj; + } } /** Resolves a TorqueScript rvalue expression. Currently only supports the concatenation @ operator. */ diff --git a/src/net/NetCommands.hx b/src/net/NetCommands.hx index e396b41d..1a7abde8 100644 --- a/src/net/NetCommands.hx +++ b/src/net/NetCommands.hx @@ -18,6 +18,8 @@ import src.Console; import src.Marbleland; import src.Settings; import src.Util; +import src.AudioManager; +import src.ResourceLoader; @:build(net.RPCMacro.build()) class NetCommands { @@ -248,6 +250,7 @@ class NetCommands { MarbleGame.instance.touchInput.setControlsEnabled(true); } MarbleGame.instance.world.marble.camera.stopOverview(); + AudioManager.playSound(ResourceLoader.getAudio('data/sound/spawn.wav').resource); } if (Net.clientSpectate || Net.hostSpectate) {