diff --git a/src/Marble.hx b/src/Marble.hx index d03b880b..a955ff61 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -74,6 +74,7 @@ import src.InteriorObject; import src.Console; import src.Gamepad; import net.Move; +import src.ProfilerUI; enum Mode { Start; @@ -2128,6 +2129,11 @@ class Marble extends GameObject { // Pad null move on client this.connection.moveManager.duplicateLastMove(); } + if (ProfilerUI.instance.fps < 30) { + this.connection.moveManager.stall = true; // Our fps fucked, stall pls + } else { + this.connection.moveManager.stall = false; + } if (p.netFlags & MarbleNetFlags.UpdateTrapdoor > 0) { for (tId => tTime in p.trapdoorUpdates) { @:privateAccess level.trapdoorPredictions.acknowledgeTrapdoorUpdate(tId, tTime); @@ -2244,7 +2250,7 @@ class Marble extends GameObject { var smooth = 1.0 / (newDt * (newDt * 0.235 * newDt) + newDt + 1.0 + 0.48 * newDt * newDt); this.netSmoothOffset.scale(smooth); var smoothScale = this.netSmoothOffset.lengthSq(); - if (smoothScale < 0.01 || smoothScale > 10.0) + if (smoothScale < 0.01 || smoothScale > 25.0) this.netSmoothOffset.set(0, 0, 0); if (oldPos != null && newPos != null) { diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index 69b640e1..2e50cab1 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -850,7 +850,10 @@ class MarbleWorld extends Scheduler { var store = marble.heldPowerup; marble.heldPowerup = null; - haxe.Timer.delay(() -> marble.heldPowerup = store, 500); // This bs + haxe.Timer.delay(() -> { + if (marble.heldPowerup == null) + marble.heldPowerup = store; + }, 500); // This bs if (marble == this.marble) this.playGui.setCenterText('none'); @@ -2274,9 +2277,12 @@ class MarbleWorld extends Scheduler { if (prevGameplayClock > alarmStart && this.timeState.gameplayClock <= alarmStart) { // Start the alarm - this.alarmSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm.wav", ResourceLoader.getAudio, this.soundResources), - null, true); // AudioManager.createAudioSource('alarm.wav'); - this.displayHelp('You have ${alarmStart} seconds remaining.'); + if (this.alarmSound == null) { + this.alarmSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm.wav", ResourceLoader.getAudio, + this.soundResources), null, + true); // AudioManager.createAudioSource('alarm.wav'); + this.displayHelp('You have ${alarmStart} seconds remaining.'); + } } if (prevGameplayClock > 0 && this.timeState.gameplayClock <= 0) { // Stop the alarm diff --git a/src/gui/MPExitGameDlg.hx b/src/gui/MPExitGameDlg.hx index 157bc5b3..ee171219 100644 --- a/src/gui/MPExitGameDlg.hx +++ b/src/gui/MPExitGameDlg.hx @@ -108,6 +108,7 @@ class MPExitGameDlg extends GuiControl { quickspawnBtn.vertSizing = Top; quickspawnBtn.pressedAction = (e) -> { @:privateAccess Key.keyPressed[Settings.controlsSettings.respawn] = Key.getFrame() - 1; // jank + MarbleGame.canvas.popDialog(this); } dialogImg.addChild(quickspawnBtn); diff --git a/src/gui/MPPlayMissionGui.hx b/src/gui/MPPlayMissionGui.hx index 8b8ca85c..bf64d997 100644 --- a/src/gui/MPPlayMissionGui.hx +++ b/src/gui/MPPlayMissionGui.hx @@ -660,6 +660,9 @@ class MPPlayMissionGui extends GuiImage { } updateLobbyNames(); redrawChat(); + haxe.Timer.delay(() -> { + this.chatScroll.updateScrollVisual(); + }, 50); } public override function render(scene2d:Scene, ?parent:h2d.Flow) { diff --git a/src/gui/MPPreGameDlg.hx b/src/gui/MPPreGameDlg.hx index 5bda7356..41b6dfff 100644 --- a/src/gui/MPPreGameDlg.hx +++ b/src/gui/MPPreGameDlg.hx @@ -255,6 +255,8 @@ class MPPreGameDlg extends GuiControl { }); spectateBtn.anim.currentFrame = Net.clientSpectate ? 2 : 0; readyBtn.anim.currentFrame = Net.lobbyClientReady ? 2 : 0; + spectateBtn.pressed = Net.clientSpectate; + readyBtn.pressed = Net.lobbyClientReady; } if (Net.clientIdMap != null) { for (c => v in Net.clientIdMap) { diff --git a/src/gui/MPSearchGui.hx b/src/gui/MPSearchGui.hx index c7b787e4..d6560f55 100644 --- a/src/gui/MPSearchGui.hx +++ b/src/gui/MPSearchGui.hx @@ -267,8 +267,15 @@ class MPSearchGui extends GuiImage { searchRandom.position = new Vector(44, 45); searchRandom.extent = new Vector(44, 44); searchRandom.pressedAction = (e) -> { - var mis = missionList[Math.floor(Math.random() * missionList.length)]; - cast(this.parent, Canvas).marbleGame.playMission(mis.mis); + var mis = retrieveMissionList[Math.floor(Math.random() * missionList.length)]; + + if (mis.difficulty == "custom") { + var idx = Marbleland.multiplayerMissions.indexOf(mis.mis); + NetCommands.setLobbyLevelIndex(mis.difficulty, idx); + } else { + var idx = MissionList.missionList["multiplayer"][mis.difficulty].indexOf(mis.mis); + NetCommands.setLobbyLevelIndex(mis.difficulty, idx); + } } optionsBg.addChild(searchRandom); } diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index 97899571..ef304f24 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -807,6 +807,9 @@ class PlayGui { if (score == 10) { f[0].p += 1; } + if (f[0].us && Net.isClient) { + @:privateAccess formatGemHuntCounter(f[0].score); + } } if (id == Net.clientId) { diff --git a/src/modes/HuntMode.hx b/src/modes/HuntMode.hx index 5a3a0fb2..1602b284 100644 --- a/src/modes/HuntMode.hx +++ b/src/modes/HuntMode.hx @@ -527,6 +527,11 @@ class HuntMode extends NullMode { @:privateAccess level.timeTravelSound = null; } + if (@:privateAccess level.alarmSound != null) { + @:privateAccess level.alarmSound.stop(); + @:privateAccess level.alarmSound = null; + } + level.schedule(level.timeState.currentAttemptTime + 2, () -> { MarbleGame.canvas.pushDialog(new MPEndGameGui()); level.setCursorLock(false); @@ -548,7 +553,6 @@ class HuntMode extends NullMode { if (expiredGems.exists(gem)) { wasExpiredGem = true; - expiredGems.remove(gem); } if (gemToBlackBeamMap.exists(gem)) { gemToBlackBeamMap.get(gem).setHide(true); @@ -585,7 +589,8 @@ class HuntMode extends NullMode { points += 10; @:privateAccess level.playGui.addMiddleMessage('+10', 0xdddddd); } - @:privateAccess level.playGui.formatGemHuntCounter(points); + if (Net.isHost) + @:privateAccess level.playGui.formatGemHuntCounter(points); } } @@ -624,6 +629,7 @@ class HuntMode extends NullMode { } if (remaining == 0) { NetCommands.setCompetitiveTimerStartTicks(0); + spawnNextGemCluster(); } } @@ -641,6 +647,8 @@ class HuntMode extends NullMode { @:privateAccess level.playGui.incrementPlayerScore(packet.clientId, packet.scoreIncr); } + if (wasExpiredGem) + expiredGems.remove(gem); if (this.level.isMultiplayer && Net.isClient) { gem.pickUpClient = @:privateAccess marble.connection == null ? Net.clientId : @:privateAccess marble.connection.id; } diff --git a/src/shapes/Trapdoor.hx b/src/shapes/Trapdoor.hx index b7c04c6b..7b8a83e2 100644 --- a/src/shapes/Trapdoor.hx +++ b/src/shapes/Trapdoor.hx @@ -53,8 +53,10 @@ class Trapdoor extends DtsObject { direction = -1; if (direction != 0 && direction != this.lastDirection) { // If the direction has changed, play the sound + var distFromUs = @:privateAccess this.level.marble.lastRenderPos.distanceSq(this.getAbsPos().getPosition()); var ch = AudioManager.playSound(ResourceLoader.getResource("data/sound/trapdooropen.wav", ResourceLoader.getAudio, this.soundResources), this.getAbsPos().getPosition()); + ch.volume *= (1 / Math.max(1, distFromUs)); } this.lastCompletion = currentCompletion;