diff --git a/ONDClient/GameMain.cs b/ONDClient/GameMain.cs
index db33396..0df1a6f 100644
--- a/ONDClient/GameMain.cs
+++ b/ONDClient/GameMain.cs
@@ -9,7 +9,7 @@ using ONDClient.Sound;
namespace ONDClient;
-public class GameMain() : Core("OND", 1280, 720, false) {
+public class GameMain(int width, int height) : Core("OND", width, height, false) {
protected override void Initialize() {
Exiting += (_, _) => {
Client.Disconnect();
diff --git a/ONDClient/Net/EventProcessor.cs b/ONDClient/Net/EventProcessor.cs
index 7fc81cd..37d577d 100644
--- a/ONDClient/Net/EventProcessor.cs
+++ b/ONDClient/Net/EventProcessor.cs
@@ -110,7 +110,7 @@ public static class EventProcessor {
private static void EnemyAttack(int enemyId, int pid) {
Console.WriteLine($"E: Enemy {enemyId} attacked player {pid}");
if (pid == Client.Player.State.Pid) {
- UIManager.Jumpscare(ClientEnemyManager.Get(pid));
+ UIManager.Jumpscare(ClientEnemyManager.Get(enemyId));
SoundManager.PlayJumpscare();
}
}
diff --git a/ONDClient/ONDClient.csproj b/ONDClient/ONDClient.csproj
index d1ad6ea..817fdd8 100644
--- a/ONDClient/ONDClient.csproj
+++ b/ONDClient/ONDClient.csproj
@@ -43,21 +43,20 @@
link\MonoGameLibrary.dll
-
-
-
-
-
-
-
+
+
+ Always
+ Always
+
+
\ No newline at end of file
diff --git a/ONDClient/Program.cs b/ONDClient/Program.cs
index 265a1de..128f8fd 100644
--- a/ONDClient/Program.cs
+++ b/ONDClient/Program.cs
@@ -1,5 +1,8 @@
using System;
+using System.IO;
+using System.Linq;
-using var game = new ONDClient.GameMain();
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
+int resMult = int.Parse(File.ReadLines("settings/resolution.txt").First());
+using var game = new ONDClient.GameMain(640 * resMult, 360 * resMult);
game.Run();
\ No newline at end of file
diff --git a/ONDClient/Sound/SoundManager.cs b/ONDClient/Sound/SoundManager.cs
index 550d752..e5f9537 100644
--- a/ONDClient/Sound/SoundManager.cs
+++ b/ONDClient/Sound/SoundManager.cs
@@ -71,27 +71,27 @@ public static class SoundManager {
public static void PlayDoor(bool doorState) {
if (doorState){
- doorClose.Play();
+ GetRandomisedPitchInstance(doorClose).Play();
}
else{
- doorOpen.Play();
+ GetRandomisedPitchInstance(doorOpen).Play();
}
}
public static void PlayDoorRemote(bool doorState) {
if (doorState){
- doorCloseRemote.Play();
+ GetRandomisedPitchInstance(doorCloseRemote).Play();
}
else{
- doorOpenRemote.Play();
+ GetRandomisedPitchInstance(doorOpenRemote).Play();
}
}
public static void PlayLight(bool lightState) {
if (lightState){
- lightOn.Play();
+ GetRandomisedPitchInstance(lightOn).Play();
}
else{
- lightOff.Play();
+ GetRandomisedPitchInstance(lightOff).Play();
}
}
@@ -99,23 +99,23 @@ public static class SoundManager {
public static void PlayPowerOut() => powerOut.Play();
- public static void PlayNekoMove() => nekoMove.Play();
+ public static void PlayNekoMove() => GetRandomisedPitchInstance(nekoMove).Play();
public static void PlayNekoAnger() => nekoAnger.Play();
- public static void PlaySpotActivate() => spotActivate.Play();
+ public static void PlaySpotActivate() => GetRandomisedPitchInstance(spotActivate).Play();
- public static void PlaySpotMove() => spotMove.Play();
+ public static void PlaySpotMove() => GetRandomisedPitchInstance(spotMove).Play();
- public static void PlayDashMove() => dashMove.Play();
+ public static void PlayDashMove() => GetRandomisedPitchInstance(dashMove).Play();
- public static void PlayMareMove() => mareMove.Play();
+ public static void PlayMareMove() => GetRandomisedPitchInstance(mareMove).Play();
- public static void PlayMonitorFlip() => monitorFlip.Play();
+ public static void PlayMonitorFlip() => GetRandomisedPitchInstance(monitorFlip).Play();
- public static void PlayCameraSwitch() => camSwitch.Play();
+ public static void PlayCameraSwitch() => GetRandomisedPitchInstance(camSwitch).Play();
- public static void PlayVentWalk() => ventWalk.Play();
+ public static void PlayVentWalk() => GetRandomisedPitchInstance(ventWalk).Play();
public static void PlayBell() => bell.Play();
@@ -126,10 +126,9 @@ public static class SoundManager {
}
public static void StopNekoPurr() {
- nekoPurrInstance.Stop();
+ nekoPurrInstance?.Stop();
}
-
- // unused
+
private static SoundEffectInstance GetRandomisedPitchInstance(SoundEffect effect) {
SoundEffectInstance instance = effect.CreateInstance();
instance.Pitch = (float)(random.NextDouble() - 0.5) / 5;
diff --git a/ONDClient/settings/resolution.txt b/ONDClient/settings/resolution.txt
new file mode 100644
index 0000000..83c7578
--- /dev/null
+++ b/ONDClient/settings/resolution.txt
@@ -0,0 +1,8 @@
+2
+
+# 1 - 640x360
+# 2 (default) - 1280x720
+# 3 - 1920x1080 (Full HD)
+# 4 - 2560x1440 (QHD)
+# 5 - 3200x1800
+# 6 - 3840x2160 (4K)
\ No newline at end of file
diff --git a/ONDServer/Enemies/Enemy.cs b/ONDServer/Enemies/Enemy.cs
index 5d37158..2e08175 100644
--- a/ONDServer/Enemies/Enemy.cs
+++ b/ONDServer/Enemies/Enemy.cs
@@ -16,12 +16,6 @@ public abstract class Enemy : GlobalEnemy {
MovementOpportunity = new(movementInterval);
SetDifficulty(difficulty);
}
-
- // unused
- public virtual void SpawnSilent(MapTile location) {
- Console.WriteLine($"!!! Silent spawn not implemented for enemy {Type} ({Name}), reverting to regular spawn");
- Spawn(location);
- }
public override void Spawn(MapTile location) {
base.Spawn(location);
diff --git a/ONDServer/GameLogic.cs b/ONDServer/GameLogic.cs
index 2735746..ba9a7e6 100644
--- a/ONDServer/GameLogic.cs
+++ b/ONDServer/GameLogic.cs
@@ -122,10 +122,6 @@ public static class GameLogic {
}
Thread.Sleep(1000);
Server.Stop();
-
- if (!Server.AutoStop){
- Program.Restart();
- }
}
private static (int p1Usage, int p2Usage) CalculatePowerUsage() {
diff --git a/ONDServer/Net/Server.cs b/ONDServer/Net/Server.cs
index 5aa8308..65906ee 100644
--- a/ONDServer/Net/Server.cs
+++ b/ONDServer/Net/Server.cs
@@ -12,8 +12,6 @@ public static class Server {
public static readonly Dictionary Players = new();
public static ServerPlayer OtherPlayer(ServerPlayer player) => player.State.Pid == P1.State.Pid ? P2 : P1;
- public static bool AutoStop{ get; set; } = true;
-
private static EventBasedNetListener listener;
private static NetManager server;
@@ -61,6 +59,10 @@ public static class Server {
listener.PeerDisconnectedEvent += OnPeerDisconnected;
server.Start(port);
+ if (!server.IsRunning){
+ Stop();
+ return;
+ }
Run();
}
diff --git a/ONDServer/Program.cs b/ONDServer/Program.cs
index da43b22..3edb8c4 100644
--- a/ONDServer/Program.cs
+++ b/ONDServer/Program.cs
@@ -1,19 +1,8 @@
-using System.Diagnostics;
-using ONDServer.Net;
+using ONDServer.Net;
-namespace ONDServer;
-
-public static class Program {
- public static void Main(string[] args) {
- if (args.Contains("--persistent")){
- Server.AutoStop = false;
- }
- Server.Start(9012);
- }
-
- public static void Restart() {
- Console.WriteLine("Game concluded -> restarting server");
- Process.Start(new ProcessStartInfo{ FileName = Environment.ProcessPath, UseShellExecute = false });
- Environment.Exit(0);
- }
+try{
+ Server.Start(9012);
+}
+finally{
+ Server.Stop();
}
\ No newline at end of file