diff --git a/ClassicalSharp.sln b/ClassicalSharp/ClassicalSharp.sln
similarity index 100%
rename from ClassicalSharp.sln
rename to ClassicalSharp/ClassicalSharp.sln
diff --git a/ClassicalSharp/2D/Drawing/CanvasDrawer2D.cs b/ClassicalSharp/ClassicalSharp/2D/Drawing/CanvasDrawer2D.cs
similarity index 100%
rename from ClassicalSharp/2D/Drawing/CanvasDrawer2D.cs
rename to ClassicalSharp/ClassicalSharp/2D/Drawing/CanvasDrawer2D.cs
diff --git a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs b/ClassicalSharp/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
similarity index 100%
rename from ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
rename to ClassicalSharp/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
diff --git a/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs b/ClassicalSharp/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs
similarity index 100%
rename from ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs
rename to ClassicalSharp/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs
diff --git a/ClassicalSharp/2D/Drawing/IDrawer2D.cs b/ClassicalSharp/ClassicalSharp/2D/Drawing/IDrawer2D.cs
similarity index 100%
rename from ClassicalSharp/2D/Drawing/IDrawer2D.cs
rename to ClassicalSharp/ClassicalSharp/2D/Drawing/IDrawer2D.cs
diff --git a/ClassicalSharp/2D/GuiElement.cs b/ClassicalSharp/ClassicalSharp/2D/GuiElement.cs
similarity index 100%
rename from ClassicalSharp/2D/GuiElement.cs
rename to ClassicalSharp/ClassicalSharp/2D/GuiElement.cs
diff --git a/ClassicalSharp/2D/IsometricBlockDrawer.cs b/ClassicalSharp/ClassicalSharp/2D/IsometricBlockDrawer.cs
similarity index 100%
rename from ClassicalSharp/2D/IsometricBlockDrawer.cs
rename to ClassicalSharp/ClassicalSharp/2D/IsometricBlockDrawer.cs
diff --git a/ClassicalSharp/2D/Screens/ChatScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/ChatScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/ChatScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/ChatScreen.cs
diff --git a/ClassicalSharp/2D/Screens/DeathScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/DeathScreen.cs
similarity index 96%
rename from ClassicalSharp/2D/Screens/DeathScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/DeathScreen.cs
index 320bdd919..e17224096 100644
--- a/ClassicalSharp/2D/Screens/DeathScreen.cs
+++ b/ClassicalSharp/ClassicalSharp/2D/Screens/DeathScreen.cs
@@ -1,43 +1,43 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.Drawing;
-using ClassicalSharp.Gui.Widgets;
-using OpenTK.Input;
-
-namespace ClassicalSharp.Gui.Screens {
- public class DeathScreen : MenuScreen {
-
- public DeathScreen(Game game) : base(game) {
- }
-
- public override void Init() {
- textFont = new Font(game.FontName, 40);
- base.Init();
- ContextRecreated();
- }
-
- protected override void ContextRecreated() {
- string score = game.Chat.Status1.Text;
- widgets = new Widget[] {
- TextWidget.Create(game, "Game over!", textFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -150),
- TextWidget.Create(game, score, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75),
- ButtonWidget.Create(game, 400, "Generate new level...", titleFont, GenLevelClick)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 25),
- ButtonWidget.Create(game, 400, "Load level...", titleFont, LoadLevelClick)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 75),
- };
- }
-
- public override bool HandlesKeyDown(Key key) { return true; }
-
- void GenLevelClick(Game g, Widget w) {
- game.Gui.SetNewScreen(new GenLevelScreen(game));
- }
-
- void LoadLevelClick(Game g, Widget w) {
- game.Gui.SetNewScreen(new LoadLevelScreen(game));
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.Drawing;
+using ClassicalSharp.Gui.Widgets;
+using OpenTK.Input;
+
+namespace ClassicalSharp.Gui.Screens {
+ public class DeathScreen : MenuScreen {
+
+ public DeathScreen(Game game) : base(game) {
+ }
+
+ public override void Init() {
+ textFont = new Font(game.FontName, 40);
+ base.Init();
+ ContextRecreated();
+ }
+
+ protected override void ContextRecreated() {
+ string score = game.Chat.Status1.Text;
+ widgets = new Widget[] {
+ TextWidget.Create(game, "Game over!", textFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -150),
+ TextWidget.Create(game, score, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75),
+ ButtonWidget.Create(game, 400, "Generate new level...", titleFont, GenLevelClick)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 25),
+ ButtonWidget.Create(game, 400, "Load level...", titleFont, LoadLevelClick)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 75),
+ };
+ }
+
+ public override bool HandlesKeyDown(Key key) { return true; }
+
+ void GenLevelClick(Game g, Widget w) {
+ game.Gui.SetNewScreen(new GenLevelScreen(game));
+ }
+
+ void LoadLevelClick(Game g, Widget w) {
+ game.Gui.SetNewScreen(new LoadLevelScreen(game));
+ }
+ }
+}
diff --git a/ClassicalSharp/2D/Screens/DisconnectScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/DisconnectScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/DisconnectScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/DisconnectScreen.cs
diff --git a/ClassicalSharp/2D/Screens/HudScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/HudScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/HudScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/HudScreen.cs
diff --git a/ClassicalSharp/2D/Screens/InventoryScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/InventoryScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/InventoryScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/InventoryScreen.cs
diff --git a/ClassicalSharp/2D/Screens/LoadingMapScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/LoadingMapScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/LoadingMapScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/LoadingMapScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/ClassicOptionsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ClassicOptionsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/ClassicOptionsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ClassicOptionsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/ClickableScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ClickableScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/ClickableScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ClickableScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/EditHotkeyScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/EditHotkeyScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/EditHotkeyScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/EditHotkeyScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/FontListScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/FontListScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/FontListScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/FontListScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/GraphicsOptionsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GraphicsOptionsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/GraphicsOptionsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GraphicsOptionsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/GuiOptionsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GuiOptionsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/GuiOptionsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/GuiOptionsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/HotkeyListScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/HotkeyListScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/HotkeyListScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/HotkeyListScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreens.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreens.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/KeyBindingsScreens.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreens.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/ListScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ListScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/ListScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/ListScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/MenuOptionsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MenuOptionsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/MenuOptionsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MenuOptionsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/MiscOptionsScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MiscOptionsScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/MiscOptionsScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/MiscOptionsScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/OptionsGroupScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/OptionsGroupScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/OptionsGroupScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/OptionsGroupScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
diff --git a/ClassicalSharp/2D/Screens/Overlays/Overlay.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/Overlay.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Overlays/Overlay.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/Overlay.cs
diff --git a/ClassicalSharp/2D/Screens/Overlays/TexIdsOverlay.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/TexIdsOverlay.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Overlays/TexIdsOverlay.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/TexIdsOverlay.cs
diff --git a/ClassicalSharp/2D/Screens/Overlays/WarningOverlays.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/WarningOverlays.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/Overlays/WarningOverlays.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/Overlays/WarningOverlays.cs
diff --git a/ClassicalSharp/2D/Screens/StatusScreen.cs b/ClassicalSharp/ClassicalSharp/2D/Screens/StatusScreen.cs
similarity index 100%
rename from ClassicalSharp/2D/Screens/StatusScreen.cs
rename to ClassicalSharp/ClassicalSharp/2D/Screens/StatusScreen.cs
diff --git a/ClassicalSharp/2D/Texture.cs b/ClassicalSharp/ClassicalSharp/2D/Texture.cs
similarity index 100%
rename from ClassicalSharp/2D/Texture.cs
rename to ClassicalSharp/ClassicalSharp/2D/Texture.cs
diff --git a/ClassicalSharp/2D/Utils/FastBitmap.cs b/ClassicalSharp/ClassicalSharp/2D/Utils/FastBitmap.cs
similarity index 100%
rename from ClassicalSharp/2D/Utils/FastBitmap.cs
rename to ClassicalSharp/ClassicalSharp/2D/Utils/FastBitmap.cs
diff --git a/ClassicalSharp/2D/Utils/PackedCol.cs b/ClassicalSharp/ClassicalSharp/2D/Utils/PackedCol.cs
similarity index 100%
rename from ClassicalSharp/2D/Utils/PackedCol.cs
rename to ClassicalSharp/ClassicalSharp/2D/Utils/PackedCol.cs
diff --git a/ClassicalSharp/2D/Utils/TextAtlas.cs b/ClassicalSharp/ClassicalSharp/2D/Utils/TextAtlas.cs
similarity index 100%
rename from ClassicalSharp/2D/Utils/TextAtlas.cs
rename to ClassicalSharp/ClassicalSharp/2D/Utils/TextAtlas.cs
diff --git a/ClassicalSharp/2D/Widgets/ButtonWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/ButtonWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/ButtonWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/ButtonWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/Chat/ChatInputWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/ChatInputWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/Chat/ChatInputWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/ChatInputWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/Chat/SpecialInputWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/SpecialInputWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/Chat/SpecialInputWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/SpecialInputWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/HotbarWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/HotbarWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/HotbarWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/HotbarWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/InputWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/InputWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/InputWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/InputWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/Menu/MenuInputValidator.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/Menu/MenuInputValidator.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/Menu/MenuInputValidator.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/Menu/MenuInputValidator.cs
diff --git a/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/PlayerListWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/PlayerListWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/PlayerListWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/PlayerListWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/ScrollbarWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/ScrollbarWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/ScrollbarWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/ScrollbarWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/SurvivalHotbarWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/SurvivalHotbarWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/SurvivalHotbarWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/SurvivalHotbarWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/TableWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/TableWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/TableWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/TableWidget.cs
diff --git a/ClassicalSharp/2D/Widgets/TextWidget.cs b/ClassicalSharp/ClassicalSharp/2D/Widgets/TextWidget.cs
similarity index 100%
rename from ClassicalSharp/2D/Widgets/TextWidget.cs
rename to ClassicalSharp/ClassicalSharp/2D/Widgets/TextWidget.cs
diff --git a/ClassicalSharp/Audio/AudioPlayer.Sounds.cs b/ClassicalSharp/ClassicalSharp/Audio/AudioPlayer.Sounds.cs
similarity index 100%
rename from ClassicalSharp/Audio/AudioPlayer.Sounds.cs
rename to ClassicalSharp/ClassicalSharp/Audio/AudioPlayer.Sounds.cs
diff --git a/ClassicalSharp/Audio/AudioPlayer.cs b/ClassicalSharp/ClassicalSharp/Audio/AudioPlayer.cs
similarity index 100%
rename from ClassicalSharp/Audio/AudioPlayer.cs
rename to ClassicalSharp/ClassicalSharp/Audio/AudioPlayer.cs
diff --git a/ClassicalSharp/Audio/Soundboard.cs b/ClassicalSharp/ClassicalSharp/Audio/Soundboard.cs
similarity index 100%
rename from ClassicalSharp/Audio/Soundboard.cs
rename to ClassicalSharp/ClassicalSharp/Audio/Soundboard.cs
diff --git a/ClassicalSharp/Blocks/AutoRotate.cs b/ClassicalSharp/ClassicalSharp/Blocks/AutoRotate.cs
similarity index 100%
rename from ClassicalSharp/Blocks/AutoRotate.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/AutoRotate.cs
diff --git a/ClassicalSharp/Blocks/Block.cs b/ClassicalSharp/ClassicalSharp/Blocks/Block.cs
similarity index 100%
rename from ClassicalSharp/Blocks/Block.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/Block.cs
diff --git a/ClassicalSharp/Blocks/BlockInfo.BoundsBox.cs b/ClassicalSharp/ClassicalSharp/Blocks/BlockInfo.BoundsBox.cs
similarity index 100%
rename from ClassicalSharp/Blocks/BlockInfo.BoundsBox.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/BlockInfo.BoundsBox.cs
diff --git a/ClassicalSharp/Blocks/BlockInfo.cs b/ClassicalSharp/ClassicalSharp/Blocks/BlockInfo.cs
similarity index 100%
rename from ClassicalSharp/Blocks/BlockInfo.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/BlockInfo.cs
diff --git a/ClassicalSharp/Blocks/DefaultSet.cs b/ClassicalSharp/ClassicalSharp/Blocks/DefaultSet.cs
similarity index 100%
rename from ClassicalSharp/Blocks/DefaultSet.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/DefaultSet.cs
diff --git a/ClassicalSharp/Blocks/aaa.cs b/ClassicalSharp/ClassicalSharp/Blocks/aaa.cs
similarity index 100%
rename from ClassicalSharp/Blocks/aaa.cs
rename to ClassicalSharp/ClassicalSharp/Blocks/aaa.cs
diff --git a/ClassicalSharp/ClassicalSharp.csproj b/ClassicalSharp/ClassicalSharp/ClassicalSharp.csproj
similarity index 100%
rename from ClassicalSharp/ClassicalSharp.csproj
rename to ClassicalSharp/ClassicalSharp/ClassicalSharp.csproj
diff --git a/ClassicalSharp/Commands/CommandList.cs b/ClassicalSharp/ClassicalSharp/Commands/CommandList.cs
similarity index 100%
rename from ClassicalSharp/Commands/CommandList.cs
rename to ClassicalSharp/ClassicalSharp/Commands/CommandList.cs
diff --git a/ClassicalSharp/Commands/Commands.cs b/ClassicalSharp/ClassicalSharp/Commands/Commands.cs
similarity index 100%
rename from ClassicalSharp/Commands/Commands.cs
rename to ClassicalSharp/ClassicalSharp/Commands/Commands.cs
diff --git a/ClassicalSharp/Entities/Components/AnimatedComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/AnimatedComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/AnimatedComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/AnimatedComponent.cs
diff --git a/ClassicalSharp/Entities/Components/CollisionsComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/CollisionsComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/CollisionsComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/CollisionsComponent.cs
diff --git a/ClassicalSharp/Entities/Components/HacksComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/HacksComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/HacksComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/HacksComponent.cs
diff --git a/ClassicalSharp/Entities/Components/IInterpComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/IInterpComponent.cs
similarity index 96%
rename from ClassicalSharp/Entities/Components/IInterpComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/IInterpComponent.cs
index 096770861..59cc8e72d 100644
--- a/ClassicalSharp/Entities/Components/IInterpComponent.cs
+++ b/ClassicalSharp/ClassicalSharp/Entities/Components/IInterpComponent.cs
@@ -1,180 +1,180 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using ClassicalSharp.Renderers;
-using OpenTK;
-
-namespace ClassicalSharp.Entities {
-
- /// Entity component that performs interpolation of position and orientation over time.
- public abstract class IInterpComponent {
-
- public abstract void SetLocation(LocationUpdate update, bool interpolate);
-
- public virtual void AdvanceState() {
- prevRotY = nextRotY;
- if (rotYStateCount == 0) return;
-
- nextRotY = rotYStates[0];
- RemoveOldest(rotYStates, ref rotYStateCount);
- }
-
-
- public State prev, next;
- public float prevRotY, nextRotY;
-
- public struct State {
- public Vector3 Pos;
- public float HeadX, HeadY, RotX, RotZ;
-
- public State(Vector3 pos, float headX, float headY, float rotX, float rotZ) {
- this.Pos = pos;
- this.HeadX = headX; this.HeadY = headY;
- this.RotX = rotX; this.RotZ = rotZ;
- }
- }
-
- public void LerpAngles(float t) {
- entity.HeadX = Utils.LerpAngle(prev.HeadX, next.HeadX, t);
- entity.HeadY = Utils.LerpAngle(prev.HeadY, next.HeadY, t);
- entity.RotX = Utils.LerpAngle(prev.RotX, next.RotX, t);
- entity.RotY = Utils.LerpAngle(prevRotY, nextRotY, t);
- entity.RotZ = Utils.LerpAngle(prev.RotZ, next.RotZ, t);
- }
-
-
- protected Entity entity;
- protected int rotYStateCount;
- protected float[] rotYStates = new float[15];
-
- protected void AddRotY(float state) {
- if (rotYStateCount == rotYStates.Length)
- RemoveOldest(rotYStates, ref rotYStateCount);
- rotYStates[rotYStateCount++] = state;
- }
-
- protected void RemoveOldest(T[] array, ref int count) {
- for (int i = 0; i < array.Length - 1; i++)
- array[i] = array[i + 1];
- count--;
- }
- }
-
-
- public sealed class NetInterpComponent : IInterpComponent {
-
- public NetInterpComponent(Game game, Entity entity) {
- this.entity = entity;
- }
-
- // Last known position and orientation sent by the server.
- internal State cur;
-
- public override void SetLocation(LocationUpdate update, bool interpolate) {
- State last = cur;
- byte flags = update.Flags;
- if ((flags & LocationUpdateFlag.Pos) != 0) {
- cur.Pos = update.RelativePos ? cur.Pos + update.Pos : update.Pos;
- }
-
- if ((flags & LocationUpdateFlag.HeadX) != 0) cur.HeadX = update.HeadX;
- if ((flags & LocationUpdateFlag.HeadY) != 0) cur.HeadY = update.HeadY;
- if ((flags & LocationUpdateFlag.RotX) != 0) cur.RotX = update.RotX;
- if ((flags & LocationUpdateFlag.RotZ) != 0) cur.RotZ = update.RotZ;
-
- if (!interpolate) {
- stateCount = 0;
- next = cur; prev = next;
- rotYStateCount = 0;
- nextRotY = prevRotY = cur.HeadY;
- } else {
- // Smoother interpolation by also adding midpoint.
- State mid;
- mid.Pos = Vector3.Lerp(last.Pos, cur.Pos, 0.5f);
- mid.RotX = Utils.LerpAngle(last.RotX, cur.RotX, 0.5f);
- mid.RotZ = Utils.LerpAngle(last.RotZ, cur.RotZ, 0.5f);
- mid.HeadX = Utils.LerpAngle(last.HeadX, cur.HeadX, 0.5f);
- mid.HeadY = Utils.LerpAngle(last.HeadY, cur.HeadY, 0.5f);
- AddState(mid); AddState(cur);
-
- for (int i = 0; i < 3; i++) {
- AddRotY(Utils.LerpAngle(last.HeadY, cur.HeadY, (i + 1) / 3f));
- }
- }
- }
-
- public override void AdvanceState() {
- prev = next;
- if (stateCount > 0) {
- next = states[0];
- RemoveOldest(states, ref stateCount);
- }
- base.AdvanceState();
- }
-
- State[] states = new State[10];
- int stateCount;
-
- void AddState(State state) {
- if (stateCount == states.Length)
- RemoveOldest(states, ref stateCount);
- states[stateCount++] = state;
- }
- }
-
-
- /// Entity component that performs interpolation of position and orientation over time.
- public sealed class LocalInterpComponent : IInterpComponent {
-
- public LocalInterpComponent(Game game, Entity entity) {
- this.entity = entity;
- }
-
- void Angle(ref float prev, ref float next, float value, bool interpolate) {
- next = value;
- if (!interpolate) prev = value;
- }
-
- public override void SetLocation(LocationUpdate update, bool interpolate) {
- byte flags = update.Flags;
- if ((flags & LocationUpdateFlag.Pos) != 0) {
- next.Pos = update.RelativePos ? next.Pos + update.Pos : update.Pos;
- // If server sets Y position exactly on ground, push up a tiny bit
- float yOffset = next.Pos.Y - Utils.Floor(next.Pos.Y);
- if (yOffset < Entity.Adjustment) { next.Pos.Y += Entity.Adjustment; }
- if (!interpolate) { prev.Pos = next.Pos; entity.Position = next.Pos; }
- }
-
- if ((flags & LocationUpdateFlag.HeadX) != 0) {
- Angle(ref prev.HeadX, ref next.HeadX, update.HeadX, interpolate);
- }
- if ((flags & LocationUpdateFlag.HeadY) != 0) {
- Angle(ref prev.HeadY, ref next.HeadY, update.HeadY, interpolate);
- }
- if ((flags & LocationUpdateFlag.RotX) != 0) {
- Angle(ref prev.RotX, ref next.RotX, update.RotX, interpolate);
- }
- if ((flags & LocationUpdateFlag.RotZ) != 0) {
- Angle(ref prev.RotZ, ref next.RotZ, update.RotZ, interpolate);
- }
-
- if ((flags & LocationUpdateFlag.HeadY) != 0) {
- // Body Y rotation lags slightly behind
- if (!interpolate) {
- nextRotY = update.HeadY; entity.RotY = update.HeadY;
- rotYStateCount = 0;
- } else {
- for (int i = 0; i < 3; i++)
- AddRotY(Utils.LerpAngle(prev.HeadY, next.HeadY, (i + 1) / 3f));
- nextRotY = rotYStates[0];
- }
- }
-
- LerpAngles(0);
- }
-
- public override void AdvanceState() {
- prev = next; entity.Position = next.Pos;
- base.AdvanceState();
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using ClassicalSharp.Renderers;
+using OpenTK;
+
+namespace ClassicalSharp.Entities {
+
+ /// Entity component that performs interpolation of position and orientation over time.
+ public abstract class IInterpComponent {
+
+ public abstract void SetLocation(LocationUpdate update, bool interpolate);
+
+ public virtual void AdvanceState() {
+ prevRotY = nextRotY;
+ if (rotYStateCount == 0) return;
+
+ nextRotY = rotYStates[0];
+ RemoveOldest(rotYStates, ref rotYStateCount);
+ }
+
+
+ public State prev, next;
+ public float prevRotY, nextRotY;
+
+ public struct State {
+ public Vector3 Pos;
+ public float HeadX, HeadY, RotX, RotZ;
+
+ public State(Vector3 pos, float headX, float headY, float rotX, float rotZ) {
+ this.Pos = pos;
+ this.HeadX = headX; this.HeadY = headY;
+ this.RotX = rotX; this.RotZ = rotZ;
+ }
+ }
+
+ public void LerpAngles(float t) {
+ entity.HeadX = Utils.LerpAngle(prev.HeadX, next.HeadX, t);
+ entity.HeadY = Utils.LerpAngle(prev.HeadY, next.HeadY, t);
+ entity.RotX = Utils.LerpAngle(prev.RotX, next.RotX, t);
+ entity.RotY = Utils.LerpAngle(prevRotY, nextRotY, t);
+ entity.RotZ = Utils.LerpAngle(prev.RotZ, next.RotZ, t);
+ }
+
+
+ protected Entity entity;
+ protected int rotYStateCount;
+ protected float[] rotYStates = new float[15];
+
+ protected void AddRotY(float state) {
+ if (rotYStateCount == rotYStates.Length)
+ RemoveOldest(rotYStates, ref rotYStateCount);
+ rotYStates[rotYStateCount++] = state;
+ }
+
+ protected void RemoveOldest(T[] array, ref int count) {
+ for (int i = 0; i < array.Length - 1; i++)
+ array[i] = array[i + 1];
+ count--;
+ }
+ }
+
+
+ public sealed class NetInterpComponent : IInterpComponent {
+
+ public NetInterpComponent(Game game, Entity entity) {
+ this.entity = entity;
+ }
+
+ // Last known position and orientation sent by the server.
+ internal State cur;
+
+ public override void SetLocation(LocationUpdate update, bool interpolate) {
+ State last = cur;
+ byte flags = update.Flags;
+ if ((flags & LocationUpdateFlag.Pos) != 0) {
+ cur.Pos = update.RelativePos ? cur.Pos + update.Pos : update.Pos;
+ }
+
+ if ((flags & LocationUpdateFlag.HeadX) != 0) cur.HeadX = update.HeadX;
+ if ((flags & LocationUpdateFlag.HeadY) != 0) cur.HeadY = update.HeadY;
+ if ((flags & LocationUpdateFlag.RotX) != 0) cur.RotX = update.RotX;
+ if ((flags & LocationUpdateFlag.RotZ) != 0) cur.RotZ = update.RotZ;
+
+ if (!interpolate) {
+ stateCount = 0;
+ next = cur; prev = next;
+ rotYStateCount = 0;
+ nextRotY = prevRotY = cur.HeadY;
+ } else {
+ // Smoother interpolation by also adding midpoint.
+ State mid;
+ mid.Pos = Vector3.Lerp(last.Pos, cur.Pos, 0.5f);
+ mid.RotX = Utils.LerpAngle(last.RotX, cur.RotX, 0.5f);
+ mid.RotZ = Utils.LerpAngle(last.RotZ, cur.RotZ, 0.5f);
+ mid.HeadX = Utils.LerpAngle(last.HeadX, cur.HeadX, 0.5f);
+ mid.HeadY = Utils.LerpAngle(last.HeadY, cur.HeadY, 0.5f);
+ AddState(mid); AddState(cur);
+
+ for (int i = 0; i < 3; i++) {
+ AddRotY(Utils.LerpAngle(last.HeadY, cur.HeadY, (i + 1) / 3f));
+ }
+ }
+ }
+
+ public override void AdvanceState() {
+ prev = next;
+ if (stateCount > 0) {
+ next = states[0];
+ RemoveOldest(states, ref stateCount);
+ }
+ base.AdvanceState();
+ }
+
+ State[] states = new State[10];
+ int stateCount;
+
+ void AddState(State state) {
+ if (stateCount == states.Length)
+ RemoveOldest(states, ref stateCount);
+ states[stateCount++] = state;
+ }
+ }
+
+
+ /// Entity component that performs interpolation of position and orientation over time.
+ public sealed class LocalInterpComponent : IInterpComponent {
+
+ public LocalInterpComponent(Game game, Entity entity) {
+ this.entity = entity;
+ }
+
+ void Angle(ref float prev, ref float next, float value, bool interpolate) {
+ next = value;
+ if (!interpolate) prev = value;
+ }
+
+ public override void SetLocation(LocationUpdate update, bool interpolate) {
+ byte flags = update.Flags;
+ if ((flags & LocationUpdateFlag.Pos) != 0) {
+ next.Pos = update.RelativePos ? next.Pos + update.Pos : update.Pos;
+ // If server sets Y position exactly on ground, push up a tiny bit
+ float yOffset = next.Pos.Y - Utils.Floor(next.Pos.Y);
+ if (yOffset < Entity.Adjustment) { next.Pos.Y += Entity.Adjustment; }
+ if (!interpolate) { prev.Pos = next.Pos; entity.Position = next.Pos; }
+ }
+
+ if ((flags & LocationUpdateFlag.HeadX) != 0) {
+ Angle(ref prev.HeadX, ref next.HeadX, update.HeadX, interpolate);
+ }
+ if ((flags & LocationUpdateFlag.HeadY) != 0) {
+ Angle(ref prev.HeadY, ref next.HeadY, update.HeadY, interpolate);
+ }
+ if ((flags & LocationUpdateFlag.RotX) != 0) {
+ Angle(ref prev.RotX, ref next.RotX, update.RotX, interpolate);
+ }
+ if ((flags & LocationUpdateFlag.RotZ) != 0) {
+ Angle(ref prev.RotZ, ref next.RotZ, update.RotZ, interpolate);
+ }
+
+ if ((flags & LocationUpdateFlag.HeadY) != 0) {
+ // Body Y rotation lags slightly behind
+ if (!interpolate) {
+ nextRotY = update.HeadY; entity.RotY = update.HeadY;
+ rotYStateCount = 0;
+ } else {
+ for (int i = 0; i < 3; i++)
+ AddRotY(Utils.LerpAngle(prev.HeadY, next.HeadY, (i + 1) / 3f));
+ nextRotY = rotYStates[0];
+ }
+ }
+
+ LerpAngles(0);
+ }
+
+ public override void AdvanceState() {
+ prev = next; entity.Position = next.Pos;
+ base.AdvanceState();
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Entities/Components/NewCollisionsComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/NewCollisionsComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/NewCollisionsComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/NewCollisionsComponent.cs
diff --git a/ClassicalSharp/Entities/Components/PhysicsComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/PhysicsComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/PhysicsComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/PhysicsComponent.cs
diff --git a/ClassicalSharp/Entities/Components/ShadowComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/ShadowComponent.cs
similarity index 100%
rename from ClassicalSharp/Entities/Components/ShadowComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/ShadowComponent.cs
diff --git a/ClassicalSharp/Entities/Components/SoundComponent.cs b/ClassicalSharp/ClassicalSharp/Entities/Components/SoundComponent.cs
similarity index 96%
rename from ClassicalSharp/Entities/Components/SoundComponent.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Components/SoundComponent.cs
index aaeb29b81..1580cb571 100644
--- a/ClassicalSharp/Entities/Components/SoundComponent.cs
+++ b/ClassicalSharp/ClassicalSharp/Entities/Components/SoundComponent.cs
@@ -1,103 +1,103 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using ClassicalSharp.Physics;
-using OpenTK;
-using BlockID = System.UInt16;
-
-namespace ClassicalSharp.Entities {
-
- /// Entity component that plays block step sounds.
- public sealed class SoundComponent {
-
- LocalPlayer p;
- Game game;
- Predicate checkSoundNonSolid, checkSoundSolid;
-
- public SoundComponent(Game game, Entity entity) {
- this.game = game;
- p = (LocalPlayer)entity;
- checkSoundNonSolid = CheckSoundNonSolid;
- checkSoundSolid = CheckSoundSolid;
- lastSoundPos = -Utils.MaxPos();
- }
-
- Vector3 lastSoundPos;
- public void Tick(bool wasOnGround) {
- Vector3 soundPos = p.interp.next.Pos;
- GetSound();
- if (!anyNonAir) soundPos = Utils.MaxPos();
-
- if (p.onGround && (DoPlaySound(soundPos) || !wasOnGround)) {
- game.AudioPlayer.PlayStepSound(sndType);
- lastSoundPos = soundPos;
- }
- }
-
- bool DoPlaySound(Vector3 soundPos) {
- float distSq = (lastSoundPos - soundPos).LengthSquared;
- bool enoughDist = distSq > 1.75f * 1.75f;
- // just play every certain block interval when not animating
- if (p.anim.swing < 0.999f) return enoughDist;
-
- // have our legs just crossed over the '0' point?
- float oldLegRot, newLegRot;
- if (game.Camera.IsThirdPerson) {
- oldLegRot = (float)Math.Cos(p.anim.walkTimeO);
- newLegRot = (float)Math.Cos(p.anim.walkTimeN);
- } else {
- oldLegRot = (float)Math.Sin(p.anim.walkTimeO);
- newLegRot = (float)Math.Sin(p.anim.walkTimeN);
- }
- return Math.Sign(oldLegRot) != Math.Sign(newLegRot);
- }
-
- bool anyNonAir = false;
- byte sndType = SoundType.None;
- void GetSound() {
- Vector3 pos = p.interp.next.Pos;
- AABB bounds = p.Bounds;
- sndType = SoundType.None;
- anyNonAir = false;
-
- // first check surrounding liquids/gas for sounds
- p.TouchesAny(bounds, checkSoundNonSolid);
- if (sndType != SoundType.None) return;
-
- // then check block standing on
- pos.Y -= 0.01f;
- Vector3I feetPos = Vector3I.Floor(pos);
- BlockID blockUnder = game.World.SafeGetBlock(feetPos);
- float maxY = feetPos.Y + BlockInfo.MaxBB[blockUnder].Y;
-
- byte typeUnder = BlockInfo.StepSounds[blockUnder];
- byte collideUnder = BlockInfo.Collide[blockUnder];
- if (maxY >= pos.Y && collideUnder == CollideType.Solid && typeUnder != SoundType.None) {
- anyNonAir = true; sndType = typeUnder; return;
- }
-
- // then check all solid blocks at feet
- bounds.Max.Y = bounds.Min.Y = pos.Y;
- p.TouchesAny(bounds, checkSoundSolid);
- }
-
- bool CheckSoundNonSolid(BlockID b) {
- byte newType = BlockInfo.StepSounds[b];
- byte collide = BlockInfo.Collide[b];
- if (newType != SoundType.None && collide != CollideType.Solid)
- sndType = newType;
-
- if (BlockInfo.Draw[b] != DrawType.Gas)
- anyNonAir = true;
- return false;
- }
-
- bool CheckSoundSolid(BlockID b) {
- byte newType = BlockInfo.StepSounds[b];
- if (newType != SoundType.None) sndType = newType;
-
- if (BlockInfo.Draw[b] != DrawType.Gas)
- anyNonAir = true;
- return false;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using ClassicalSharp.Physics;
+using OpenTK;
+using BlockID = System.UInt16;
+
+namespace ClassicalSharp.Entities {
+
+ /// Entity component that plays block step sounds.
+ public sealed class SoundComponent {
+
+ LocalPlayer p;
+ Game game;
+ Predicate checkSoundNonSolid, checkSoundSolid;
+
+ public SoundComponent(Game game, Entity entity) {
+ this.game = game;
+ p = (LocalPlayer)entity;
+ checkSoundNonSolid = CheckSoundNonSolid;
+ checkSoundSolid = CheckSoundSolid;
+ lastSoundPos = -Utils.MaxPos();
+ }
+
+ Vector3 lastSoundPos;
+ public void Tick(bool wasOnGround) {
+ Vector3 soundPos = p.interp.next.Pos;
+ GetSound();
+ if (!anyNonAir) soundPos = Utils.MaxPos();
+
+ if (p.onGround && (DoPlaySound(soundPos) || !wasOnGround)) {
+ game.AudioPlayer.PlayStepSound(sndType);
+ lastSoundPos = soundPos;
+ }
+ }
+
+ bool DoPlaySound(Vector3 soundPos) {
+ float distSq = (lastSoundPos - soundPos).LengthSquared;
+ bool enoughDist = distSq > 1.75f * 1.75f;
+ // just play every certain block interval when not animating
+ if (p.anim.swing < 0.999f) return enoughDist;
+
+ // have our legs just crossed over the '0' point?
+ float oldLegRot, newLegRot;
+ if (game.Camera.IsThirdPerson) {
+ oldLegRot = (float)Math.Cos(p.anim.walkTimeO);
+ newLegRot = (float)Math.Cos(p.anim.walkTimeN);
+ } else {
+ oldLegRot = (float)Math.Sin(p.anim.walkTimeO);
+ newLegRot = (float)Math.Sin(p.anim.walkTimeN);
+ }
+ return Math.Sign(oldLegRot) != Math.Sign(newLegRot);
+ }
+
+ bool anyNonAir = false;
+ byte sndType = SoundType.None;
+ void GetSound() {
+ Vector3 pos = p.interp.next.Pos;
+ AABB bounds = p.Bounds;
+ sndType = SoundType.None;
+ anyNonAir = false;
+
+ // first check surrounding liquids/gas for sounds
+ p.TouchesAny(bounds, checkSoundNonSolid);
+ if (sndType != SoundType.None) return;
+
+ // then check block standing on
+ pos.Y -= 0.01f;
+ Vector3I feetPos = Vector3I.Floor(pos);
+ BlockID blockUnder = game.World.SafeGetBlock(feetPos);
+ float maxY = feetPos.Y + BlockInfo.MaxBB[blockUnder].Y;
+
+ byte typeUnder = BlockInfo.StepSounds[blockUnder];
+ byte collideUnder = BlockInfo.Collide[blockUnder];
+ if (maxY >= pos.Y && collideUnder == CollideType.Solid && typeUnder != SoundType.None) {
+ anyNonAir = true; sndType = typeUnder; return;
+ }
+
+ // then check all solid blocks at feet
+ bounds.Max.Y = bounds.Min.Y = pos.Y;
+ p.TouchesAny(bounds, checkSoundSolid);
+ }
+
+ bool CheckSoundNonSolid(BlockID b) {
+ byte newType = BlockInfo.StepSounds[b];
+ byte collide = BlockInfo.Collide[b];
+ if (newType != SoundType.None && collide != CollideType.Solid)
+ sndType = newType;
+
+ if (BlockInfo.Draw[b] != DrawType.Gas)
+ anyNonAir = true;
+ return false;
+ }
+
+ bool CheckSoundSolid(BlockID b) {
+ byte newType = BlockInfo.StepSounds[b];
+ if (newType != SoundType.None) sndType = newType;
+
+ if (BlockInfo.Draw[b] != DrawType.Gas)
+ anyNonAir = true;
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Entities/Entity.cs b/ClassicalSharp/ClassicalSharp/Entities/Entity.cs
similarity index 100%
rename from ClassicalSharp/Entities/Entity.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Entity.cs
diff --git a/ClassicalSharp/Entities/EntityList.cs b/ClassicalSharp/ClassicalSharp/Entities/EntityList.cs
similarity index 100%
rename from ClassicalSharp/Entities/EntityList.cs
rename to ClassicalSharp/ClassicalSharp/Entities/EntityList.cs
diff --git a/ClassicalSharp/Entities/LocalPlayer.cs b/ClassicalSharp/ClassicalSharp/Entities/LocalPlayer.cs
similarity index 100%
rename from ClassicalSharp/Entities/LocalPlayer.cs
rename to ClassicalSharp/ClassicalSharp/Entities/LocalPlayer.cs
diff --git a/ClassicalSharp/Entities/LocationUpdate.cs b/ClassicalSharp/ClassicalSharp/Entities/LocationUpdate.cs
similarity index 100%
rename from ClassicalSharp/Entities/LocationUpdate.cs
rename to ClassicalSharp/ClassicalSharp/Entities/LocationUpdate.cs
diff --git a/ClassicalSharp/Entities/Mobs/AI.cs b/ClassicalSharp/ClassicalSharp/Entities/Mobs/AI.cs
similarity index 96%
rename from ClassicalSharp/Entities/Mobs/AI.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Mobs/AI.cs
index 8ccc30dca..ccfcb6c3b 100644
--- a/ClassicalSharp/Entities/Mobs/AI.cs
+++ b/ClassicalSharp/ClassicalSharp/Entities/Mobs/AI.cs
@@ -1,84 +1,84 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-#if SURVIVAL_TEST
-using System;
-using OpenTK;
-
-namespace ClassicalSharp.Entities.Mobs {
-
- public abstract class AI {
-
- protected Game game;
- protected Entity entity;
- static Random random = new Random();
-
- public Vector3 MoveVelocity;
-
- public AI(Game game, Entity entity) {
- this.game = game;
- this.entity = entity;
- }
-
- public abstract void Tick(Entity target);
-
- public abstract void AttackedBy(Entity source);
-
-
- int randomCount;
- Vector3 randomDir;
- protected void MoveRandomly(Entity source) {
- // Move in new direction
- if (randomCount == 0) {
- randomDir.X = (float)(random.NextDouble() - 0.5);
- randomDir.Z = (float)(random.NextDouble() - 0.5);
- }
-
- randomCount = (randomCount + 1) & 0x1F;
- MoveInDirection(source, randomDir);
- }
-
- protected void MoveInDirection(Entity source, Vector3 dir) {
- double rotYRadians, headXRadians;
- Utils.GetHeading(dir, out rotYRadians, out headXRadians);
-
- float rotY = (float)(rotYRadians * Utils.Rad2Deg);
- float headX = (float)(headXRadians * Utils.Rad2Deg);
- LocationUpdate update = LocationUpdate.MakeOri(rotY, headX);
- source.SetLocation(update, false);
- MoveVelocity = dir * 0.9f;
- }
- }
-
- public sealed class FleeAI : AI {
-
- public FleeAI(Game game, Entity entity) : base(game, entity) { }
-
- public override void Tick(Entity target) {
- MoveRandomly(entity);
- }
-
- public override void AttackedBy(Entity source) {
- Vector3 fleeDir = -Vector3.Normalize(source.Position - entity.Position);
- MoveInDirection(source, fleeDir * 5);
- }
- }
-
- public sealed class HostileAI : AI {
-
- public HostileAI(Game game, Entity entity) : base(game, entity) { }
-
- public override void Tick(Entity target) {
- float distSq = (target.Position - entity.Position).LengthSquared;
- if (distSq > 16 * 16) {
- MoveRandomly(entity);
- } else {
- Vector3 dir = Vector3.Normalize(target.Position - entity.Position);
- dir.Y = 0;
- MoveInDirection(entity, dir);
- }
- }
-
- public override void AttackedBy(Entity source) {
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+#if SURVIVAL_TEST
+using System;
+using OpenTK;
+
+namespace ClassicalSharp.Entities.Mobs {
+
+ public abstract class AI {
+
+ protected Game game;
+ protected Entity entity;
+ static Random random = new Random();
+
+ public Vector3 MoveVelocity;
+
+ public AI(Game game, Entity entity) {
+ this.game = game;
+ this.entity = entity;
+ }
+
+ public abstract void Tick(Entity target);
+
+ public abstract void AttackedBy(Entity source);
+
+
+ int randomCount;
+ Vector3 randomDir;
+ protected void MoveRandomly(Entity source) {
+ // Move in new direction
+ if (randomCount == 0) {
+ randomDir.X = (float)(random.NextDouble() - 0.5);
+ randomDir.Z = (float)(random.NextDouble() - 0.5);
+ }
+
+ randomCount = (randomCount + 1) & 0x1F;
+ MoveInDirection(source, randomDir);
+ }
+
+ protected void MoveInDirection(Entity source, Vector3 dir) {
+ double rotYRadians, headXRadians;
+ Utils.GetHeading(dir, out rotYRadians, out headXRadians);
+
+ float rotY = (float)(rotYRadians * Utils.Rad2Deg);
+ float headX = (float)(headXRadians * Utils.Rad2Deg);
+ LocationUpdate update = LocationUpdate.MakeOri(rotY, headX);
+ source.SetLocation(update, false);
+ MoveVelocity = dir * 0.9f;
+ }
+ }
+
+ public sealed class FleeAI : AI {
+
+ public FleeAI(Game game, Entity entity) : base(game, entity) { }
+
+ public override void Tick(Entity target) {
+ MoveRandomly(entity);
+ }
+
+ public override void AttackedBy(Entity source) {
+ Vector3 fleeDir = -Vector3.Normalize(source.Position - entity.Position);
+ MoveInDirection(source, fleeDir * 5);
+ }
+ }
+
+ public sealed class HostileAI : AI {
+
+ public HostileAI(Game game, Entity entity) : base(game, entity) { }
+
+ public override void Tick(Entity target) {
+ float distSq = (target.Position - entity.Position).LengthSquared;
+ if (distSq > 16 * 16) {
+ MoveRandomly(entity);
+ } else {
+ Vector3 dir = Vector3.Normalize(target.Position - entity.Position);
+ dir.Y = 0;
+ MoveInDirection(entity, dir);
+ }
+ }
+
+ public override void AttackedBy(Entity source) {
+ }
+ }
+}
#endif
\ No newline at end of file
diff --git a/ClassicalSharp/Entities/Mobs/MobEntity.cs b/ClassicalSharp/ClassicalSharp/Entities/Mobs/MobEntity.cs
similarity index 100%
rename from ClassicalSharp/Entities/Mobs/MobEntity.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Mobs/MobEntity.cs
diff --git a/ClassicalSharp/Entities/Model/BlockModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/BlockModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/BlockModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/BlockModel.cs
diff --git a/ClassicalSharp/Entities/Model/ChickenModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/ChickenModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/ChickenModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/ChickenModel.cs
diff --git a/ClassicalSharp/Entities/Model/CreeperModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/CreeperModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/CreeperModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/CreeperModel.cs
diff --git a/ClassicalSharp/Entities/Model/CustomModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/CustomModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/CustomModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/CustomModel.cs
diff --git a/ClassicalSharp/Entities/Model/HumanModels.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/HumanModels.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/HumanModels.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/HumanModels.cs
diff --git a/ClassicalSharp/Entities/Model/HumanoidModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/HumanoidModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/HumanoidModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/HumanoidModel.cs
diff --git a/ClassicalSharp/Entities/Model/IModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/IModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/IModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/IModel.cs
diff --git a/ClassicalSharp/Entities/Model/ModelBuilder.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/ModelBuilder.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/ModelBuilder.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/ModelBuilder.cs
diff --git a/ClassicalSharp/Entities/Model/ModelCache.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/ModelCache.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/ModelCache.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/ModelCache.cs
diff --git a/ClassicalSharp/Entities/Model/ModelPart.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/ModelPart.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/ModelPart.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/ModelPart.cs
diff --git a/ClassicalSharp/Entities/Model/PigModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/PigModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/PigModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/PigModel.cs
diff --git a/ClassicalSharp/Entities/Model/SheepModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/SheepModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/SheepModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/SheepModel.cs
diff --git a/ClassicalSharp/Entities/Model/SkeletonModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/SkeletonModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/SkeletonModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/SkeletonModel.cs
diff --git a/ClassicalSharp/Entities/Model/SpiderModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/SpiderModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/SpiderModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/SpiderModel.cs
diff --git a/ClassicalSharp/Entities/Model/ZombieModel.cs b/ClassicalSharp/ClassicalSharp/Entities/Model/ZombieModel.cs
similarity index 100%
rename from ClassicalSharp/Entities/Model/ZombieModel.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Model/ZombieModel.cs
diff --git a/ClassicalSharp/Entities/NetPlayer.cs b/ClassicalSharp/ClassicalSharp/Entities/NetPlayer.cs
similarity index 96%
rename from ClassicalSharp/Entities/NetPlayer.cs
rename to ClassicalSharp/ClassicalSharp/Entities/NetPlayer.cs
index ebc07f0b4..942038a4f 100644
--- a/ClassicalSharp/Entities/NetPlayer.cs
+++ b/ClassicalSharp/ClassicalSharp/Entities/NetPlayer.cs
@@ -1,45 +1,45 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using ClassicalSharp.Model;
-using OpenTK;
-
-namespace ClassicalSharp.Entities {
-
- public sealed class NetPlayer : Player {
-
- NetInterpComponent interp;
- public NetPlayer(string displayName, string skinName, Game game) : base(game) {
- DisplayName = displayName;
- SkinName = skinName;
- interp = new NetInterpComponent(game, this);
- }
-
- public override void SetLocation(LocationUpdate update, bool interpolate) {
- interp.SetLocation(update, interpolate);
- }
-
- public override void Tick(double delta) {
- CheckSkin();
- tickCount++;
- interp.AdvanceState();
- anim.UpdateAnimState(interp.prev.Pos, interp.next.Pos, delta);
- }
-
- bool shouldRender = false;
- public override void RenderModel(double deltaTime, float t) {
- Position = Vector3.Lerp(interp.prev.Pos, interp.next.Pos, t);
- interp.LerpAngles(t);
-
- anim.GetCurrentAnimState(t);
- shouldRender = IModel.ShouldRender(this, game.Culling);
- if (shouldRender) Model.Render(this);
- }
-
- public override void RenderName() {
- if (!shouldRender) return;
- float dist = IModel.RenderDistance(this, game.CurrentCameraPos);
- float threshold = game.Entities.NamesMode == NameMode.AllUnscaled ? 8192 * 8192 : 32 * 32;
- if (dist <= threshold) DrawName();
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using ClassicalSharp.Model;
+using OpenTK;
+
+namespace ClassicalSharp.Entities {
+
+ public sealed class NetPlayer : Player {
+
+ NetInterpComponent interp;
+ public NetPlayer(string displayName, string skinName, Game game) : base(game) {
+ DisplayName = displayName;
+ SkinName = skinName;
+ interp = new NetInterpComponent(game, this);
+ }
+
+ public override void SetLocation(LocationUpdate update, bool interpolate) {
+ interp.SetLocation(update, interpolate);
+ }
+
+ public override void Tick(double delta) {
+ CheckSkin();
+ tickCount++;
+ interp.AdvanceState();
+ anim.UpdateAnimState(interp.prev.Pos, interp.next.Pos, delta);
+ }
+
+ bool shouldRender = false;
+ public override void RenderModel(double deltaTime, float t) {
+ Position = Vector3.Lerp(interp.prev.Pos, interp.next.Pos, t);
+ interp.LerpAngles(t);
+
+ anim.GetCurrentAnimState(t);
+ shouldRender = IModel.ShouldRender(this, game.Culling);
+ if (shouldRender) Model.Render(this);
+ }
+
+ public override void RenderName() {
+ if (!shouldRender) return;
+ float dist = IModel.RenderDistance(this, game.CurrentCameraPos);
+ float threshold = game.Entities.NamesMode == NameMode.AllUnscaled ? 8192 * 8192 : 32 * 32;
+ if (dist <= threshold) DrawName();
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Entities/Player.cs b/ClassicalSharp/ClassicalSharp/Entities/Player.cs
similarity index 100%
rename from ClassicalSharp/Entities/Player.cs
rename to ClassicalSharp/ClassicalSharp/Entities/Player.cs
diff --git a/ClassicalSharp/Entities/TabList.cs b/ClassicalSharp/ClassicalSharp/Entities/TabList.cs
similarity index 97%
rename from ClassicalSharp/Entities/TabList.cs
rename to ClassicalSharp/ClassicalSharp/Entities/TabList.cs
index a32501c0f..7171010d1 100644
--- a/ClassicalSharp/Entities/TabList.cs
+++ b/ClassicalSharp/ClassicalSharp/Entities/TabList.cs
@@ -1,41 +1,41 @@
-using System;
-
-namespace ClassicalSharp.Entities {
-
- public sealed class TabList : IGameComponent {
- public static TabListEntry[] Entries = new TabListEntry[256];
-
- void IGameComponent.Init(Game game) { }
- void IGameComponent.Ready(Game game) { }
- void IGameComponent.OnNewMapLoaded(Game game) { }
- void IDisposable.Dispose() { }
- void IGameComponent.OnNewMap(Game game) { }
-
- void IGameComponent.Reset(Game game) {
- for (int i = 0; i < Entries.Length; i++)
- Entries[i] = null;
- }
- }
-
- public sealed class TabListEntry {
- /// Plain name of the player for autocompletion, etc.
- public string PlayerName;
- /// Formatted name for display in the player list.
- public string ListName;
- public string ListNameColourless;
- /// Name of the group this player is in.
- public string Group;
- /// Player's rank within the group. (0 is highest)
- /// Multiple players can share the same rank, so this is not a unique identifier.
- public byte GroupRank;
-
- public TabListEntry(string playerName, string listName,
- string groupName, byte groupRank) {
- PlayerName = Utils.StripColours(playerName);
- ListName = listName;
- ListNameColourless = Utils.StripColours(listName);
- Group = groupName;
- GroupRank = groupRank;
- }
- }
-}
+using System;
+
+namespace ClassicalSharp.Entities {
+
+ public sealed class TabList : IGameComponent {
+ public static TabListEntry[] Entries = new TabListEntry[256];
+
+ void IGameComponent.Init(Game game) { }
+ void IGameComponent.Ready(Game game) { }
+ void IGameComponent.OnNewMapLoaded(Game game) { }
+ void IDisposable.Dispose() { }
+ void IGameComponent.OnNewMap(Game game) { }
+
+ void IGameComponent.Reset(Game game) {
+ for (int i = 0; i < Entries.Length; i++)
+ Entries[i] = null;
+ }
+ }
+
+ public sealed class TabListEntry {
+ /// Plain name of the player for autocompletion, etc.
+ public string PlayerName;
+ /// Formatted name for display in the player list.
+ public string ListName;
+ public string ListNameColourless;
+ /// Name of the group this player is in.
+ public string Group;
+ /// Player's rank within the group. (0 is highest)
+ /// Multiple players can share the same rank, so this is not a unique identifier.
+ public byte GroupRank;
+
+ public TabListEntry(string playerName, string listName,
+ string groupName, byte groupRank) {
+ PlayerName = Utils.StripColours(playerName);
+ ListName = listName;
+ ListNameColourless = Utils.StripColours(listName);
+ Group = groupName;
+ GroupRank = groupRank;
+ }
+ }
+}
diff --git a/ClassicalSharp/Game/ChatLog.cs b/ClassicalSharp/ClassicalSharp/Game/ChatLog.cs
similarity index 100%
rename from ClassicalSharp/Game/ChatLog.cs
rename to ClassicalSharp/ClassicalSharp/Game/ChatLog.cs
diff --git a/ClassicalSharp/Game/Events.cs b/ClassicalSharp/ClassicalSharp/Game/Events.cs
similarity index 100%
rename from ClassicalSharp/Game/Events.cs
rename to ClassicalSharp/ClassicalSharp/Game/Events.cs
diff --git a/ClassicalSharp/Game/Game.Init.cs b/ClassicalSharp/ClassicalSharp/Game/Game.Init.cs
similarity index 100%
rename from ClassicalSharp/Game/Game.Init.cs
rename to ClassicalSharp/ClassicalSharp/Game/Game.Init.cs
diff --git a/ClassicalSharp/Game/Game.Properties.cs b/ClassicalSharp/ClassicalSharp/Game/Game.Properties.cs
similarity index 100%
rename from ClassicalSharp/Game/Game.Properties.cs
rename to ClassicalSharp/ClassicalSharp/Game/Game.Properties.cs
diff --git a/ClassicalSharp/Game/Game.cs b/ClassicalSharp/ClassicalSharp/Game/Game.cs
similarity index 100%
rename from ClassicalSharp/Game/Game.cs
rename to ClassicalSharp/ClassicalSharp/Game/Game.cs
diff --git a/ClassicalSharp/Game/GuiInterface.cs b/ClassicalSharp/ClassicalSharp/Game/GuiInterface.cs
similarity index 100%
rename from ClassicalSharp/Game/GuiInterface.cs
rename to ClassicalSharp/ClassicalSharp/Game/GuiInterface.cs
diff --git a/ClassicalSharp/Game/InputHandler.cs b/ClassicalSharp/ClassicalSharp/Game/InputHandler.cs
similarity index 100%
rename from ClassicalSharp/Game/InputHandler.cs
rename to ClassicalSharp/ClassicalSharp/Game/InputHandler.cs
diff --git a/ClassicalSharp/Game/Inventory.cs b/ClassicalSharp/ClassicalSharp/Game/Inventory.cs
similarity index 100%
rename from ClassicalSharp/Game/Inventory.cs
rename to ClassicalSharp/ClassicalSharp/Game/Inventory.cs
diff --git a/ClassicalSharp/Game/KeyMap.cs b/ClassicalSharp/ClassicalSharp/Game/KeyMap.cs
similarity index 100%
rename from ClassicalSharp/Game/KeyMap.cs
rename to ClassicalSharp/ClassicalSharp/Game/KeyMap.cs
diff --git a/ClassicalSharp/Game/PickingHandler.cs b/ClassicalSharp/ClassicalSharp/Game/PickingHandler.cs
similarity index 100%
rename from ClassicalSharp/Game/PickingHandler.cs
rename to ClassicalSharp/ClassicalSharp/Game/PickingHandler.cs
diff --git a/ClassicalSharp/Game/Plugin.cs b/ClassicalSharp/ClassicalSharp/Game/Plugin.cs
similarity index 100%
rename from ClassicalSharp/Game/Plugin.cs
rename to ClassicalSharp/ClassicalSharp/Game/Plugin.cs
diff --git a/ClassicalSharp/Generator/FlatGrassGenerator.cs b/ClassicalSharp/ClassicalSharp/Generator/FlatGrassGenerator.cs
similarity index 96%
rename from ClassicalSharp/Generator/FlatGrassGenerator.cs
rename to ClassicalSharp/ClassicalSharp/Generator/FlatGrassGenerator.cs
index cc5c334f0..09e630e55 100644
--- a/ClassicalSharp/Generator/FlatGrassGenerator.cs
+++ b/ClassicalSharp/ClassicalSharp/Generator/FlatGrassGenerator.cs
@@ -1,36 +1,36 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using OpenTK;
-using BlockRaw = System.Byte;
-
-namespace ClassicalSharp.Generator {
-
- public unsafe sealed class FlatGrassGenerator : IMapGenerator {
-
- public override string GeneratorName { get { return "Flatgrass"; } }
-
- public override BlockRaw[] Generate() {
- BlockRaw[] map = new BlockRaw[Width * Height * Length];
-
- fixed (BlockRaw* ptr = map) {
- CurrentState = "Setting dirt blocks";
- MapSet(ptr, 0, Height / 2 - 2, Block.Dirt);
-
- CurrentState = "Setting grass blocks";
- MapSet(ptr, Height / 2 - 1, Height / 2 - 1, Block.Grass);
- }
- return map;
- }
-
- unsafe void MapSet(BlockRaw* ptr, int yStart, int yEnd, BlockRaw block) {
- yStart = Math.Max(yStart, 0); yEnd = Math.Max(yEnd, 0);
- int oneY = Width * Length, yHeight = (yEnd - yStart) + 1;
-
- CurrentProgress = 0;
- for (int y = yStart; y <= yEnd; y++) {
- MemUtils.memset((IntPtr)ptr, block, y * oneY, oneY);
- CurrentProgress = (float)(y - yStart) / yHeight;
- }
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using OpenTK;
+using BlockRaw = System.Byte;
+
+namespace ClassicalSharp.Generator {
+
+ public unsafe sealed class FlatGrassGenerator : IMapGenerator {
+
+ public override string GeneratorName { get { return "Flatgrass"; } }
+
+ public override BlockRaw[] Generate() {
+ BlockRaw[] map = new BlockRaw[Width * Height * Length];
+
+ fixed (BlockRaw* ptr = map) {
+ CurrentState = "Setting dirt blocks";
+ MapSet(ptr, 0, Height / 2 - 2, Block.Dirt);
+
+ CurrentState = "Setting grass blocks";
+ MapSet(ptr, Height / 2 - 1, Height / 2 - 1, Block.Grass);
+ }
+ return map;
+ }
+
+ unsafe void MapSet(BlockRaw* ptr, int yStart, int yEnd, BlockRaw block) {
+ yStart = Math.Max(yStart, 0); yEnd = Math.Max(yEnd, 0);
+ int oneY = Width * Length, yHeight = (yEnd - yStart) + 1;
+
+ CurrentProgress = 0;
+ for (int y = yStart; y <= yEnd; y++) {
+ MemUtils.memset((IntPtr)ptr, block, y * oneY, oneY);
+ CurrentProgress = (float)(y - yStart) / yHeight;
+ }
+ }
+ }
+}
diff --git a/ClassicalSharp/Generator/IMapGenerator.cs b/ClassicalSharp/ClassicalSharp/Generator/IMapGenerator.cs
similarity index 95%
rename from ClassicalSharp/Generator/IMapGenerator.cs
rename to ClassicalSharp/ClassicalSharp/Generator/IMapGenerator.cs
index d2766a899..7017d6fc3 100644
--- a/ClassicalSharp/Generator/IMapGenerator.cs
+++ b/ClassicalSharp/ClassicalSharp/Generator/IMapGenerator.cs
@@ -1,44 +1,44 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.Threading;
-using ClassicalSharp.Map;
-using ClassicalSharp.Singleplayer;
-using BlockRaw = System.Byte;
-
-namespace ClassicalSharp.Generator {
-
- public abstract class IMapGenerator {
-
- public abstract string GeneratorName { get; }
-
- public abstract BlockRaw[] Generate();
-
- public virtual void ApplyEnv(World world) { }
-
- public string CurrentState;
-
- public float CurrentProgress;
-
- public bool Done = false;
-
- public volatile BlockRaw[] Blocks;
-
- public int Width, Height, Length, Seed;
-
- public void GenerateAsync(Game game) {
- Thread thread = new Thread(DoGenerate);
- thread.IsBackground = true;
- thread.Name = "IMapGenerator.GenAsync()";
- thread.Start();
- }
-
- void DoGenerate() {
- try {
- Blocks = Generate();
- } catch (Exception ex) {
- ErrorHandler.LogError("IMapGenerator.RunAsync", ex);
- }
- Done = true;
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.Threading;
+using ClassicalSharp.Map;
+using ClassicalSharp.Singleplayer;
+using BlockRaw = System.Byte;
+
+namespace ClassicalSharp.Generator {
+
+ public abstract class IMapGenerator {
+
+ public abstract string GeneratorName { get; }
+
+ public abstract BlockRaw[] Generate();
+
+ public virtual void ApplyEnv(World world) { }
+
+ public string CurrentState;
+
+ public float CurrentProgress;
+
+ public bool Done = false;
+
+ public volatile BlockRaw[] Blocks;
+
+ public int Width, Height, Length, Seed;
+
+ public void GenerateAsync(Game game) {
+ Thread thread = new Thread(DoGenerate);
+ thread.IsBackground = true;
+ thread.Name = "IMapGenerator.GenAsync()";
+ thread.Start();
+ }
+
+ void DoGenerate() {
+ try {
+ Blocks = Generate();
+ } catch (Exception ex) {
+ ErrorHandler.LogError("IMapGenerator.RunAsync", ex);
+ }
+ Done = true;
+ }
+ }
+}
diff --git a/ClassicalSharp/Generator/Noise.cs b/ClassicalSharp/ClassicalSharp/Generator/Noise.cs
similarity index 97%
rename from ClassicalSharp/Generator/Noise.cs
rename to ClassicalSharp/ClassicalSharp/Generator/Noise.cs
index 2d73d9bcb..b552ed58e 100644
--- a/ClassicalSharp/Generator/Noise.cs
+++ b/ClassicalSharp/ClassicalSharp/Generator/Noise.cs
@@ -1,92 +1,92 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-// Source from http://mrl.nyu.edu/~perlin/noise/
-// Optimised form as we can always treat Z as being = 0.
-// Octave and combined noise based on:
-// https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-map-generation-algorithm
-using System;
-
-namespace ClassicalSharp.Generator {
-
- public sealed class ImprovedNoise {
-
- public ImprovedNoise(JavaRandom rnd) {
- // shuffle randomly using fisher-yates
- for (int i = 0; i < 256; i++)
- p[i] = (byte)i;
-
- for (int i = 0; i < 256; i++) {
- int j = rnd.Next(i, 256);
- byte temp = p[i]; p[i] = p[j]; p[j] = temp;
- }
- for (int i = 0; i < 256; i++)
- p[i + 256] = p[i];
- }
-
- public double Compute(double x, double y) {
- int xFloor = x >= 0 ? (int)x : (int)x - 1;
- int yFloor = y >= 0 ? (int)y : (int)y - 1;
- int X = xFloor & 0xFF, Y = yFloor & 0xFF;
- x -= xFloor; y -= yFloor;
-
- double u = x * x * x * (x * (x * 6 - 15) + 10); // Fade(x)
- double v = y * y * y * (y * (y * 6 - 15) + 10); // Fade(y)
- int A = p[X] + Y, B = p[X + 1] + Y;
-
- // Normally, calculating Grad involves a function call. However, we can directly pack this table
- // (since each value indicates either -1, 0 1) into a set of bit flags. This way we avoid needing
- // to call another function that performs branching
- const int xFlags = 0x46552222, yFlags = 0x2222550A;
-
- int hash = (p[p[A]] & 0xF) << 1;
- double g22 = (((xFlags >> hash) & 3) - 1) * x + (((yFlags >> hash) & 3) - 1) * y; // Grad(p[p[A], x, y)
- hash = (p[p[B]] & 0xF) << 1;
- double g12 = (((xFlags >> hash) & 3) - 1) * (x - 1) + (((yFlags >> hash) & 3) - 1) * y; // Grad(p[p[B], x - 1, y)
- double c1 = g22 + u * (g12 - g22);
-
- hash = (p[p[A + 1]] & 0xF) << 1;
- double g21 = (((xFlags >> hash) & 3) - 1) * x + (((yFlags >> hash) & 3) - 1) * (y - 1); // Grad(p[p[A + 1], x, y - 1)
- hash = (p[p[B + 1]] & 0xF) << 1;
- double g11 = (((xFlags >> hash) & 3) - 1) * (x - 1) + (((yFlags >> hash) & 3) - 1) * (y - 1); // Grad(p[p[B + 1], x - 1, y - 1)
- double c2 = g21 + u * (g11 - g21);
-
- return c1 + v * (c2 - c1);
- }
-
- byte[] p = new byte[512];
- }
-
- public sealed class OctaveNoise {
-
- readonly ImprovedNoise[] baseNoise;
- public OctaveNoise(int octaves, JavaRandom rnd) {
- baseNoise = new ImprovedNoise[octaves];
- for (int i = 0; i < octaves; i++)
- baseNoise[i] = new ImprovedNoise(rnd);
- }
-
- public double Compute(double x, double y) {
- double amplitude = 1, frequency = 1;
- double sum = 0;
- for (int i = 0; i < baseNoise.Length; i++) {
- sum += baseNoise[i].Compute(x * frequency, y * frequency) * amplitude;
- amplitude *= 2.0;
- frequency *= 0.5;
- }
- return sum;
- }
- }
-
- public sealed class CombinedNoise {
-
- readonly OctaveNoise noise1, noise2;
- public CombinedNoise(OctaveNoise noise1, OctaveNoise noise2) {
- this.noise1 = noise1;
- this.noise2 = noise2;
- }
-
- public double Compute(double x, double y) {
- double offset = noise2.Compute(x, y);
- return noise1.Compute(x + offset, y);
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+// Source from http://mrl.nyu.edu/~perlin/noise/
+// Optimised form as we can always treat Z as being = 0.
+// Octave and combined noise based on:
+// https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-map-generation-algorithm
+using System;
+
+namespace ClassicalSharp.Generator {
+
+ public sealed class ImprovedNoise {
+
+ public ImprovedNoise(JavaRandom rnd) {
+ // shuffle randomly using fisher-yates
+ for (int i = 0; i < 256; i++)
+ p[i] = (byte)i;
+
+ for (int i = 0; i < 256; i++) {
+ int j = rnd.Next(i, 256);
+ byte temp = p[i]; p[i] = p[j]; p[j] = temp;
+ }
+ for (int i = 0; i < 256; i++)
+ p[i + 256] = p[i];
+ }
+
+ public double Compute(double x, double y) {
+ int xFloor = x >= 0 ? (int)x : (int)x - 1;
+ int yFloor = y >= 0 ? (int)y : (int)y - 1;
+ int X = xFloor & 0xFF, Y = yFloor & 0xFF;
+ x -= xFloor; y -= yFloor;
+
+ double u = x * x * x * (x * (x * 6 - 15) + 10); // Fade(x)
+ double v = y * y * y * (y * (y * 6 - 15) + 10); // Fade(y)
+ int A = p[X] + Y, B = p[X + 1] + Y;
+
+ // Normally, calculating Grad involves a function call. However, we can directly pack this table
+ // (since each value indicates either -1, 0 1) into a set of bit flags. This way we avoid needing
+ // to call another function that performs branching
+ const int xFlags = 0x46552222, yFlags = 0x2222550A;
+
+ int hash = (p[p[A]] & 0xF) << 1;
+ double g22 = (((xFlags >> hash) & 3) - 1) * x + (((yFlags >> hash) & 3) - 1) * y; // Grad(p[p[A], x, y)
+ hash = (p[p[B]] & 0xF) << 1;
+ double g12 = (((xFlags >> hash) & 3) - 1) * (x - 1) + (((yFlags >> hash) & 3) - 1) * y; // Grad(p[p[B], x - 1, y)
+ double c1 = g22 + u * (g12 - g22);
+
+ hash = (p[p[A + 1]] & 0xF) << 1;
+ double g21 = (((xFlags >> hash) & 3) - 1) * x + (((yFlags >> hash) & 3) - 1) * (y - 1); // Grad(p[p[A + 1], x, y - 1)
+ hash = (p[p[B + 1]] & 0xF) << 1;
+ double g11 = (((xFlags >> hash) & 3) - 1) * (x - 1) + (((yFlags >> hash) & 3) - 1) * (y - 1); // Grad(p[p[B + 1], x - 1, y - 1)
+ double c2 = g21 + u * (g11 - g21);
+
+ return c1 + v * (c2 - c1);
+ }
+
+ byte[] p = new byte[512];
+ }
+
+ public sealed class OctaveNoise {
+
+ readonly ImprovedNoise[] baseNoise;
+ public OctaveNoise(int octaves, JavaRandom rnd) {
+ baseNoise = new ImprovedNoise[octaves];
+ for (int i = 0; i < octaves; i++)
+ baseNoise[i] = new ImprovedNoise(rnd);
+ }
+
+ public double Compute(double x, double y) {
+ double amplitude = 1, frequency = 1;
+ double sum = 0;
+ for (int i = 0; i < baseNoise.Length; i++) {
+ sum += baseNoise[i].Compute(x * frequency, y * frequency) * amplitude;
+ amplitude *= 2.0;
+ frequency *= 0.5;
+ }
+ return sum;
+ }
+ }
+
+ public sealed class CombinedNoise {
+
+ readonly OctaveNoise noise1, noise2;
+ public CombinedNoise(OctaveNoise noise1, OctaveNoise noise2) {
+ this.noise1 = noise1;
+ this.noise2 = noise2;
+ }
+
+ public double Compute(double x, double y) {
+ double offset = noise2.Compute(x, y);
+ return noise1.Compute(x + offset, y);
+ }
+ }
+}
diff --git a/ClassicalSharp/Generator/NotchyGenerator.Utils.cs b/ClassicalSharp/ClassicalSharp/Generator/NotchyGenerator.Utils.cs
similarity index 96%
rename from ClassicalSharp/Generator/NotchyGenerator.Utils.cs
rename to ClassicalSharp/ClassicalSharp/Generator/NotchyGenerator.Utils.cs
index 5a48d9eb1..6160d3886 100644
--- a/ClassicalSharp/Generator/NotchyGenerator.Utils.cs
+++ b/ClassicalSharp/ClassicalSharp/Generator/NotchyGenerator.Utils.cs
@@ -1,118 +1,118 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-// Based on:
-// https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-map-generation-algorithm
-// Thanks to Jerralish for originally reverse engineering classic's algorithm, then preparing a high level overview of the algorithm.
-// I believe this process adheres to clean room reverse engineering.
-using System;
-using System.Collections.Generic;
-using BlockRaw = System.Byte;
-
-namespace ClassicalSharp.Generator {
-
- public sealed partial class NotchyGenerator {
-
- void FillOblateSpheroid(int x, int y, int z, float radius, BlockRaw block) {
- int xStart = Utils.Floor(Math.Max(x - radius, 0));
- int xEnd = Utils.Floor(Math.Min(x + radius, Width - 1));
- int yStart = Utils.Floor(Math.Max(y - radius, 0));
- int yEnd = Utils.Floor(Math.Min(y + radius, Height - 1));
- int zStart = Utils.Floor(Math.Max(z - radius, 0));
- int zEnd = Utils.Floor(Math.Min(z + radius, Length - 1));
- float radiusSq = radius * radius;
-
- for (int yy = yStart; yy <= yEnd; yy++)
- for (int zz = zStart; zz <= zEnd; zz++)
- for (int xx = xStart; xx <= xEnd; xx++)
- {
- int dx = xx - x, dy = yy - y, dz = zz - z;
- if ((dx * dx + 2 * dy * dy + dz * dz) < radiusSq) {
- int index = (yy * Length + zz) * Width + xx;
- if (blocks[index] == Block.Stone)
- blocks[index] = block;
- }
- }
- }
-
- void FloodFill(int startIndex, BlockRaw block) {
- if (startIndex < 0) return; // y below map, immediately ignore
- FastIntStack stack = new FastIntStack(4);
- stack.Push(startIndex);
-
- while (stack.Size > 0) {
- int index = stack.Pop();
- if (blocks[index] != Block.Air) continue;
- blocks[index] = block;
-
- int x = index % Width;
- int y = index / oneY;
- int z = (index / Width) % Length;
-
- if (x > 0) stack.Push(index - 1);
- if (x < Width - 1) stack.Push(index + 1);
- if (z > 0) stack.Push(index - Width);
- if (z < Length - 1) stack.Push(index + Width);
- if (y > 0) stack.Push(index - oneY);
- }
- }
-
- sealed class FastIntStack {
- public int[] Values;
- public int Size;
-
- public FastIntStack(int capacity) {
- Values = new int[capacity];
- Size = 0;
- }
-
- public int Pop() {
- return Values[--Size];
- }
-
- public void Push(int item) {
- if (Size == Values.Length) {
- int[] array = new int[Values.Length * 2];
- Buffer.BlockCopy(Values, 0, array, 0, Size * sizeof(int));
- Values = array;
- }
- Values[Size++] = item;
- }
- }
- }
-
- // Based on https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
- public sealed class JavaRandom {
-
- long seed;
- const long value = 0x5DEECE66DL;
- const long mask = (1L << 48) - 1;
-
- public JavaRandom(int seed) { SetSeed(seed); }
- public void SetSeed(int seed) {
- this.seed = (seed ^ value) & mask;
- }
-
- public int Next(int min, int max) { return min + Next(max - min); }
-
- public int Next(int n) {
- if ((n & -n) == n) { // i.e., n is a power of 2
- seed = (seed * value + 0xBL) & mask;
- long raw = (long)((ulong)seed >> (48 - 31));
- return (int)((n * raw) >> 31);
- }
-
- int bits, val;
- do {
- seed = (seed * value + 0xBL) & mask;
- bits = (int)((ulong)seed >> (48 - 31));
- val = bits % n;
- } while (bits - val + (n - 1) < 0);
- return val;
- }
-
- public float NextFloat() {
- seed = (seed * value + 0xBL) & mask;
- int raw = (int)((ulong)seed >> (48 - 24));
- return raw / ((float)(1 << 24));
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+// Based on:
+// https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-map-generation-algorithm
+// Thanks to Jerralish for originally reverse engineering classic's algorithm, then preparing a high level overview of the algorithm.
+// I believe this process adheres to clean room reverse engineering.
+using System;
+using System.Collections.Generic;
+using BlockRaw = System.Byte;
+
+namespace ClassicalSharp.Generator {
+
+ public sealed partial class NotchyGenerator {
+
+ void FillOblateSpheroid(int x, int y, int z, float radius, BlockRaw block) {
+ int xStart = Utils.Floor(Math.Max(x - radius, 0));
+ int xEnd = Utils.Floor(Math.Min(x + radius, Width - 1));
+ int yStart = Utils.Floor(Math.Max(y - radius, 0));
+ int yEnd = Utils.Floor(Math.Min(y + radius, Height - 1));
+ int zStart = Utils.Floor(Math.Max(z - radius, 0));
+ int zEnd = Utils.Floor(Math.Min(z + radius, Length - 1));
+ float radiusSq = radius * radius;
+
+ for (int yy = yStart; yy <= yEnd; yy++)
+ for (int zz = zStart; zz <= zEnd; zz++)
+ for (int xx = xStart; xx <= xEnd; xx++)
+ {
+ int dx = xx - x, dy = yy - y, dz = zz - z;
+ if ((dx * dx + 2 * dy * dy + dz * dz) < radiusSq) {
+ int index = (yy * Length + zz) * Width + xx;
+ if (blocks[index] == Block.Stone)
+ blocks[index] = block;
+ }
+ }
+ }
+
+ void FloodFill(int startIndex, BlockRaw block) {
+ if (startIndex < 0) return; // y below map, immediately ignore
+ FastIntStack stack = new FastIntStack(4);
+ stack.Push(startIndex);
+
+ while (stack.Size > 0) {
+ int index = stack.Pop();
+ if (blocks[index] != Block.Air) continue;
+ blocks[index] = block;
+
+ int x = index % Width;
+ int y = index / oneY;
+ int z = (index / Width) % Length;
+
+ if (x > 0) stack.Push(index - 1);
+ if (x < Width - 1) stack.Push(index + 1);
+ if (z > 0) stack.Push(index - Width);
+ if (z < Length - 1) stack.Push(index + Width);
+ if (y > 0) stack.Push(index - oneY);
+ }
+ }
+
+ sealed class FastIntStack {
+ public int[] Values;
+ public int Size;
+
+ public FastIntStack(int capacity) {
+ Values = new int[capacity];
+ Size = 0;
+ }
+
+ public int Pop() {
+ return Values[--Size];
+ }
+
+ public void Push(int item) {
+ if (Size == Values.Length) {
+ int[] array = new int[Values.Length * 2];
+ Buffer.BlockCopy(Values, 0, array, 0, Size * sizeof(int));
+ Values = array;
+ }
+ Values[Size++] = item;
+ }
+ }
+ }
+
+ // Based on https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
+ public sealed class JavaRandom {
+
+ long seed;
+ const long value = 0x5DEECE66DL;
+ const long mask = (1L << 48) - 1;
+
+ public JavaRandom(int seed) { SetSeed(seed); }
+ public void SetSeed(int seed) {
+ this.seed = (seed ^ value) & mask;
+ }
+
+ public int Next(int min, int max) { return min + Next(max - min); }
+
+ public int Next(int n) {
+ if ((n & -n) == n) { // i.e., n is a power of 2
+ seed = (seed * value + 0xBL) & mask;
+ long raw = (long)((ulong)seed >> (48 - 31));
+ return (int)((n * raw) >> 31);
+ }
+
+ int bits, val;
+ do {
+ seed = (seed * value + 0xBL) & mask;
+ bits = (int)((ulong)seed >> (48 - 31));
+ val = bits % n;
+ } while (bits - val + (n - 1) < 0);
+ return val;
+ }
+
+ public float NextFloat() {
+ seed = (seed * value + 0xBL) & mask;
+ int raw = (int)((ulong)seed >> (48 - 24));
+ return raw / ((float)(1 << 24));
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Generator/NotchyGenerator.cs b/ClassicalSharp/ClassicalSharp/Generator/NotchyGenerator.cs
similarity index 100%
rename from ClassicalSharp/Generator/NotchyGenerator.cs
rename to ClassicalSharp/ClassicalSharp/Generator/NotchyGenerator.cs
diff --git a/ClassicalSharp/GraphicsAPI/D3D9.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/D3D9.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/D3D9.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/D3D9.cs
diff --git a/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/Direct3D9Api.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs
diff --git a/ClassicalSharp/GraphicsAPI/GL.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/GL.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/GL.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/GL.cs
diff --git a/ClassicalSharp/GraphicsAPI/IGraphicsAPI.Core.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/IGraphicsAPI.Core.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/IGraphicsAPI.Core.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/IGraphicsAPI.Core.cs
diff --git a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/IGraphicsApi.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs
diff --git a/ClassicalSharp/GraphicsAPI/Interop.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/Interop.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/Interop.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/Interop.cs
diff --git a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/OpenGLApi.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/OpenGLApi.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/OpenGLApi.cs
diff --git a/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/OpenGLESApi.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs
diff --git a/ClassicalSharp/GraphicsAPI/VertexFormats.cs b/ClassicalSharp/ClassicalSharp/GraphicsAPI/VertexFormats.cs
similarity index 100%
rename from ClassicalSharp/GraphicsAPI/VertexFormats.cs
rename to ClassicalSharp/ClassicalSharp/GraphicsAPI/VertexFormats.cs
diff --git a/ClassicalSharp/Hotkeys/HotkeyList.cs b/ClassicalSharp/ClassicalSharp/Hotkeys/HotkeyList.cs
similarity index 100%
rename from ClassicalSharp/Hotkeys/HotkeyList.cs
rename to ClassicalSharp/ClassicalSharp/Hotkeys/HotkeyList.cs
diff --git a/ClassicalSharp/Hotkeys/LwjglToKey.cs b/ClassicalSharp/ClassicalSharp/Hotkeys/LwjglToKey.cs
similarity index 96%
rename from ClassicalSharp/Hotkeys/LwjglToKey.cs
rename to ClassicalSharp/ClassicalSharp/Hotkeys/LwjglToKey.cs
index eb2187131..59f0fe575 100644
--- a/ClassicalSharp/Hotkeys/LwjglToKey.cs
+++ b/ClassicalSharp/ClassicalSharp/Hotkeys/LwjglToKey.cs
@@ -1,74 +1,74 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using OpenTK.Input;
-
-namespace ClassicalSharp.Hotkeys {
-
- /// Maps LWJGL keycodes to OpenTK keys.
- public static class LwjglToKey {
-
- public static Key[] Map = new Key[256];
-
- static int curIndex = 0;
- static void Add(Key key) {
- Map[curIndex++] = key;
- }
-
- static void Add(string value) {
- for (int i = 0; i < value.Length; i++) {
- Add((Key)(value[i] - 'A' + (int)Key.A));
- }
- }
-
- static void Skip(int amount) {
- curIndex += amount;
- }
-
- static LwjglToKey() {
- Add(Key.None); Add(Key.Escape);
- for (int i = 0; i < 9; i++)
- Add((Key)(i + Key.Number1));
- Add(Key.Number0); Add(Key.Minus);
- Add(Key.Plus); Add(Key.BackSpace);
- Add(Key.Tab); Add("QWERTYUIOP");
- Add(Key.BracketLeft); Add(Key.BracketRight);
- Add(Key.Enter); Add(Key.ControlLeft);
- Add("ASDFGHJKL"); Add(Key.Semicolon);
- Add(Key.Quote); Add(Key.Tilde);
- Add(Key.ShiftLeft); Add(Key.BackSlash);
- Add("ZXCVBNM"); Add(Key.Comma);
- Add(Key.Period); Add(Key.Slash);
- Add(Key.ShiftRight); Skip(1); // TODO: multiply
- Add(Key.AltLeft); Add(Key.Space);
- Add(Key.CapsLock);
- for (int i = 0; i < 10; i++)
- Add((Key)(i + Key.F1));
- Add(Key.NumLock); Add(Key.ScrollLock);
- Add(Key.Keypad7); Add(Key.Keypad8);
- Add(Key.Keypad9); Add(Key.KeypadSubtract);
- Add(Key.Keypad4); Add(Key.Keypad5);
- Add(Key.Keypad6); Add(Key.KeypadAdd);
- Add(Key.Keypad1); Add(Key.Keypad2);
- Add(Key.Keypad3); Add(Key.Keypad0);
- Add(Key.KeypadDecimal); Skip(3);
- Add(Key.F11); Add(Key.F12);
- Skip(11);
- for (int i = 0; i < 6; i++)
- Add((Key)(i + Key.F13));
- Skip(35); Add(Key.KeypadAdd);
- Skip(14); Add(Key.KeypadEnter);
- Add(Key.ControlRight); Skip(23);
- Add(Key.KeypadDivide); Skip(2);
- Add(Key.AltRight); Skip(12);
- Add(Key.Pause); Skip(1);
- Add(Key.Home); Add(Key.Up);
- Add(Key.PageUp); Skip(1);
- Add(Key.Left); Skip(1);
- Add(Key.Right); Skip(1);
- Add(Key.End); Add(Key.Down);
- Add(Key.PageDown); Add(Key.Insert);
- Add(Key.Delete); Skip(7);
- Add(Key.WinLeft); Add(Key.WinRight);
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using OpenTK.Input;
+
+namespace ClassicalSharp.Hotkeys {
+
+ /// Maps LWJGL keycodes to OpenTK keys.
+ public static class LwjglToKey {
+
+ public static Key[] Map = new Key[256];
+
+ static int curIndex = 0;
+ static void Add(Key key) {
+ Map[curIndex++] = key;
+ }
+
+ static void Add(string value) {
+ for (int i = 0; i < value.Length; i++) {
+ Add((Key)(value[i] - 'A' + (int)Key.A));
+ }
+ }
+
+ static void Skip(int amount) {
+ curIndex += amount;
+ }
+
+ static LwjglToKey() {
+ Add(Key.None); Add(Key.Escape);
+ for (int i = 0; i < 9; i++)
+ Add((Key)(i + Key.Number1));
+ Add(Key.Number0); Add(Key.Minus);
+ Add(Key.Plus); Add(Key.BackSpace);
+ Add(Key.Tab); Add("QWERTYUIOP");
+ Add(Key.BracketLeft); Add(Key.BracketRight);
+ Add(Key.Enter); Add(Key.ControlLeft);
+ Add("ASDFGHJKL"); Add(Key.Semicolon);
+ Add(Key.Quote); Add(Key.Tilde);
+ Add(Key.ShiftLeft); Add(Key.BackSlash);
+ Add("ZXCVBNM"); Add(Key.Comma);
+ Add(Key.Period); Add(Key.Slash);
+ Add(Key.ShiftRight); Skip(1); // TODO: multiply
+ Add(Key.AltLeft); Add(Key.Space);
+ Add(Key.CapsLock);
+ for (int i = 0; i < 10; i++)
+ Add((Key)(i + Key.F1));
+ Add(Key.NumLock); Add(Key.ScrollLock);
+ Add(Key.Keypad7); Add(Key.Keypad8);
+ Add(Key.Keypad9); Add(Key.KeypadSubtract);
+ Add(Key.Keypad4); Add(Key.Keypad5);
+ Add(Key.Keypad6); Add(Key.KeypadAdd);
+ Add(Key.Keypad1); Add(Key.Keypad2);
+ Add(Key.Keypad3); Add(Key.Keypad0);
+ Add(Key.KeypadDecimal); Skip(3);
+ Add(Key.F11); Add(Key.F12);
+ Skip(11);
+ for (int i = 0; i < 6; i++)
+ Add((Key)(i + Key.F13));
+ Skip(35); Add(Key.KeypadAdd);
+ Skip(14); Add(Key.KeypadEnter);
+ Add(Key.ControlRight); Skip(23);
+ Add(Key.KeypadDivide); Skip(2);
+ Add(Key.AltRight); Skip(12);
+ Add(Key.Pause); Skip(1);
+ Add(Key.Home); Add(Key.Up);
+ Add(Key.PageUp); Skip(1);
+ Add(Key.Left); Skip(1);
+ Add(Key.Right); Skip(1);
+ Add(Key.End); Add(Key.Down);
+ Add(Key.PageDown); Add(Key.Insert);
+ Add(Key.Delete); Skip(7);
+ Add(Key.WinLeft); Add(Key.WinRight);
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Ionic.Zlib/DeflateStream.cs b/ClassicalSharp/ClassicalSharp/Ionic.Zlib/DeflateStream.cs
similarity index 100%
rename from ClassicalSharp/Ionic.Zlib/DeflateStream.cs
rename to ClassicalSharp/ClassicalSharp/Ionic.Zlib/DeflateStream.cs
diff --git a/ClassicalSharp/Ionic.Zlib/InfTree.cs b/ClassicalSharp/ClassicalSharp/Ionic.Zlib/InfTree.cs
similarity index 100%
rename from ClassicalSharp/Ionic.Zlib/InfTree.cs
rename to ClassicalSharp/ClassicalSharp/Ionic.Zlib/InfTree.cs
diff --git a/ClassicalSharp/Ionic.Zlib/Inflate.cs b/ClassicalSharp/ClassicalSharp/Ionic.Zlib/Inflate.cs
similarity index 100%
rename from ClassicalSharp/Ionic.Zlib/Inflate.cs
rename to ClassicalSharp/ClassicalSharp/Ionic.Zlib/Inflate.cs
diff --git a/ClassicalSharp/Map/Formats/IMapFormat.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/IMapFormat.cs
similarity index 97%
rename from ClassicalSharp/Map/Formats/IMapFormat.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/IMapFormat.cs
index 2493c2f27..6fe075d3f 100644
--- a/ClassicalSharp/Map/Formats/IMapFormat.cs
+++ b/ClassicalSharp/ClassicalSharp/Map/Formats/IMapFormat.cs
@@ -1,22 +1,22 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.IO;
-
-namespace ClassicalSharp.Map {
-
- /// Imports a world and metadata associated
- /// with it from a particular file format.
- public interface IMapFormatImporter {
-
- /// Replaces the current world from a stream that contains a world in this format.
- byte[] Load(Stream stream, Game game, out int width, out int height, out int length);
- }
-
- /// Exports the current world and metadata associated
- /// with it to a particular file format.
- public interface IMapFormatExporter {
-
- /// Exports the current world to a file in this format.
- void Save(Stream stream, Game game);
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.IO;
+
+namespace ClassicalSharp.Map {
+
+ /// Imports a world and metadata associated
+ /// with it from a particular file format.
+ public interface IMapFormatImporter {
+
+ /// Replaces the current world from a stream that contains a world in this format.
+ byte[] Load(Stream stream, Game game, out int width, out int height, out int length);
+ }
+
+ /// Exports the current world and metadata associated
+ /// with it to a particular file format.
+ public interface IMapFormatExporter {
+
+ /// Exports the current world to a file in this format.
+ void Save(Stream stream, Game game);
+ }
+}
diff --git a/ClassicalSharp/Map/Formats/MapCw.Exporter.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapCw.Exporter.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapCw.Exporter.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapCw.Exporter.cs
diff --git a/ClassicalSharp/Map/Formats/MapCw.Importer.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapCw.Importer.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapCw.Importer.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapCw.Importer.cs
diff --git a/ClassicalSharp/Map/Formats/MapDat.Importer.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapDat.Importer.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapDat.Importer.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapDat.Importer.cs
diff --git a/ClassicalSharp/Map/Formats/MapDat2.Importer.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapDat2.Importer.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapDat2.Importer.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapDat2.Importer.cs
diff --git a/ClassicalSharp/Map/Formats/MapFcm3.Importer.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapFcm3.Importer.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapFcm3.Importer.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapFcm3.Importer.cs
diff --git a/ClassicalSharp/Map/Formats/MapLvl.Importer.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapLvl.Importer.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapLvl.Importer.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapLvl.Importer.cs
diff --git a/ClassicalSharp/Map/Formats/MapSchematic.Exporter.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/MapSchematic.Exporter.cs
similarity index 100%
rename from ClassicalSharp/Map/Formats/MapSchematic.Exporter.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/MapSchematic.Exporter.cs
diff --git a/ClassicalSharp/Map/Formats/NbtFile.cs b/ClassicalSharp/ClassicalSharp/Map/Formats/NbtFile.cs
similarity index 96%
rename from ClassicalSharp/Map/Formats/NbtFile.cs
rename to ClassicalSharp/ClassicalSharp/Map/Formats/NbtFile.cs
index b89a7f0e8..86ba3f74d 100644
--- a/ClassicalSharp/Map/Formats/NbtFile.cs
+++ b/ClassicalSharp/ClassicalSharp/Map/Formats/NbtFile.cs
@@ -1,138 +1,138 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Text;
-
-namespace ClassicalSharp.Map {
-
- public struct NbtTag {
- public string Name;
- public object Value;
- public NbtTagType TagId;
- }
-
- public class NbtList {
- public NbtTagType ChildTagId;
- public object[] ChildrenValues;
- }
-
- public enum NbtTagType : byte {
- End, Int8, Int16, Int32, Int64,
- Real32, Real64, Int8Array, String,
- List, Compound, Int32Array,
- }
-
- public sealed class NbtFile {
-
- readonly BinaryReader reader;
- readonly BinaryWriter writer;
-
- public NbtFile(BinaryReader reader) {
- this.reader = reader;
- }
-
- public NbtFile(BinaryWriter writer) {
- this.writer = writer;
- }
-
-
- public void Write(NbtTagType v) { writer.Write((byte)v); }
-
- public void Write(NbtTagType v, string name) { writer.Write((byte)v); Write(name); }
-
- public void WriteInt32(int v) { writer.Write(IPAddress.HostToNetworkOrder(v)); }
-
- public void WriteInt16(short v) { writer.Write(IPAddress.HostToNetworkOrder(v)); }
-
- public void WriteUInt8(int v) { writer.Write((byte)v); }
-
- public void WriteUInt8(byte v) { writer.Write(v); }
-
- public void WriteBytes(byte[] v) { writer.Write(v); }
-
- public void WriteBytes(byte[] v, int index, int count) { writer.Write(v, index, count); }
-
- public void Write(string value) {
- byte[] data = Encoding.UTF8.GetBytes(value);
- WriteInt16((short)data.Length);
- writer.Write(data);
- }
-
- public void WriteCpeExtCompound(string name, int version) {
- Write(NbtTagType.Compound, name);
- Write(NbtTagType.Int32, "ExtensionVersion");
- WriteInt32(version);
- }
-
-
- public long ReadInt64() { return IPAddress.HostToNetworkOrder(reader.ReadInt64()); }
-
- public int ReadInt32() { return IPAddress.HostToNetworkOrder(reader.ReadInt32()); }
-
- public short ReadInt16() { return IPAddress.HostToNetworkOrder(reader.ReadInt16()); }
-
- public string ReadString() {
- int len = (ushort)ReadInt16();
- byte[] data = reader.ReadBytes(len);
- return Encoding.UTF8.GetString(data);
- }
-
- public unsafe NbtTag ReadTag(byte typeId, bool readTagName) {
- NbtTag tag = default(NbtTag);
- if (typeId == 0) return tag;
-
- tag.Name = readTagName ? ReadString() : null;
- tag.TagId = (NbtTagType)typeId;
- switch ((NbtTagType)typeId) {
- case NbtTagType.Int8:
- tag.Value = reader.ReadByte(); break;
- case NbtTagType.Int16:
- tag.Value = ReadInt16(); break;
- case NbtTagType.Int32:
- tag.Value = ReadInt32(); break;
- case NbtTagType.Int64:
- tag.Value = ReadInt64(); break;
- case NbtTagType.Real32:
- int temp32 = ReadInt32();
- tag.Value = *((float*)&temp32); break;
- case NbtTagType.Real64:
- long temp64 = ReadInt64();
- tag.Value = *((double*)&temp64); break;
- case NbtTagType.Int8Array:
- tag.Value = reader.ReadBytes(ReadInt32()); break;
- case NbtTagType.String:
- tag.Value = ReadString(); break;
-
- case NbtTagType.List:
- NbtList list = new NbtList();
- list.ChildTagId = (NbtTagType)reader.ReadByte();
- list.ChildrenValues = new object[ReadInt32()];
- for (int i = 0; i < list.ChildrenValues.Length; i++) {
- list.ChildrenValues[i] = ReadTag((byte)list.ChildTagId, false).Value;
- }
- tag.Value = list; break;
-
- case NbtTagType.Compound:
- byte childTagId;
- Dictionary children = new Dictionary();
- while ((childTagId = reader.ReadByte()) != (byte)NbtTagType.End) {
- NbtTag child = ReadTag(childTagId, true); children[child.Name] = child;
- }
- tag.Value = children; break;
-
- case NbtTagType.Int32Array:
- int[] array = new int[ReadInt32()];
- for (int i = 0; i < array.Length; i++) {
- array[i] = ReadInt32();
- }
- tag.Value = array; break;
-
- default:
- throw new InvalidDataException("Unrecognised tag id: " + typeId);
- }
- return tag;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Text;
+
+namespace ClassicalSharp.Map {
+
+ public struct NbtTag {
+ public string Name;
+ public object Value;
+ public NbtTagType TagId;
+ }
+
+ public class NbtList {
+ public NbtTagType ChildTagId;
+ public object[] ChildrenValues;
+ }
+
+ public enum NbtTagType : byte {
+ End, Int8, Int16, Int32, Int64,
+ Real32, Real64, Int8Array, String,
+ List, Compound, Int32Array,
+ }
+
+ public sealed class NbtFile {
+
+ readonly BinaryReader reader;
+ readonly BinaryWriter writer;
+
+ public NbtFile(BinaryReader reader) {
+ this.reader = reader;
+ }
+
+ public NbtFile(BinaryWriter writer) {
+ this.writer = writer;
+ }
+
+
+ public void Write(NbtTagType v) { writer.Write((byte)v); }
+
+ public void Write(NbtTagType v, string name) { writer.Write((byte)v); Write(name); }
+
+ public void WriteInt32(int v) { writer.Write(IPAddress.HostToNetworkOrder(v)); }
+
+ public void WriteInt16(short v) { writer.Write(IPAddress.HostToNetworkOrder(v)); }
+
+ public void WriteUInt8(int v) { writer.Write((byte)v); }
+
+ public void WriteUInt8(byte v) { writer.Write(v); }
+
+ public void WriteBytes(byte[] v) { writer.Write(v); }
+
+ public void WriteBytes(byte[] v, int index, int count) { writer.Write(v, index, count); }
+
+ public void Write(string value) {
+ byte[] data = Encoding.UTF8.GetBytes(value);
+ WriteInt16((short)data.Length);
+ writer.Write(data);
+ }
+
+ public void WriteCpeExtCompound(string name, int version) {
+ Write(NbtTagType.Compound, name);
+ Write(NbtTagType.Int32, "ExtensionVersion");
+ WriteInt32(version);
+ }
+
+
+ public long ReadInt64() { return IPAddress.HostToNetworkOrder(reader.ReadInt64()); }
+
+ public int ReadInt32() { return IPAddress.HostToNetworkOrder(reader.ReadInt32()); }
+
+ public short ReadInt16() { return IPAddress.HostToNetworkOrder(reader.ReadInt16()); }
+
+ public string ReadString() {
+ int len = (ushort)ReadInt16();
+ byte[] data = reader.ReadBytes(len);
+ return Encoding.UTF8.GetString(data);
+ }
+
+ public unsafe NbtTag ReadTag(byte typeId, bool readTagName) {
+ NbtTag tag = default(NbtTag);
+ if (typeId == 0) return tag;
+
+ tag.Name = readTagName ? ReadString() : null;
+ tag.TagId = (NbtTagType)typeId;
+ switch ((NbtTagType)typeId) {
+ case NbtTagType.Int8:
+ tag.Value = reader.ReadByte(); break;
+ case NbtTagType.Int16:
+ tag.Value = ReadInt16(); break;
+ case NbtTagType.Int32:
+ tag.Value = ReadInt32(); break;
+ case NbtTagType.Int64:
+ tag.Value = ReadInt64(); break;
+ case NbtTagType.Real32:
+ int temp32 = ReadInt32();
+ tag.Value = *((float*)&temp32); break;
+ case NbtTagType.Real64:
+ long temp64 = ReadInt64();
+ tag.Value = *((double*)&temp64); break;
+ case NbtTagType.Int8Array:
+ tag.Value = reader.ReadBytes(ReadInt32()); break;
+ case NbtTagType.String:
+ tag.Value = ReadString(); break;
+
+ case NbtTagType.List:
+ NbtList list = new NbtList();
+ list.ChildTagId = (NbtTagType)reader.ReadByte();
+ list.ChildrenValues = new object[ReadInt32()];
+ for (int i = 0; i < list.ChildrenValues.Length; i++) {
+ list.ChildrenValues[i] = ReadTag((byte)list.ChildTagId, false).Value;
+ }
+ tag.Value = list; break;
+
+ case NbtTagType.Compound:
+ byte childTagId;
+ Dictionary children = new Dictionary();
+ while ((childTagId = reader.ReadByte()) != (byte)NbtTagType.End) {
+ NbtTag child = ReadTag(childTagId, true); children[child.Name] = child;
+ }
+ tag.Value = children; break;
+
+ case NbtTagType.Int32Array:
+ int[] array = new int[ReadInt32()];
+ for (int i = 0; i < array.Length; i++) {
+ array[i] = ReadInt32();
+ }
+ tag.Value = array; break;
+
+ default:
+ throw new InvalidDataException("Unrecognised tag id: " + typeId);
+ }
+ return tag;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Map/Lighting/BasicLighting.Heightmap.cs b/ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.Heightmap.cs
similarity index 100%
rename from ClassicalSharp/Map/Lighting/BasicLighting.Heightmap.cs
rename to ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.Heightmap.cs
diff --git a/ClassicalSharp/Map/Lighting/BasicLighting.Updater.cs b/ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.Updater.cs
similarity index 100%
rename from ClassicalSharp/Map/Lighting/BasicLighting.Updater.cs
rename to ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.Updater.cs
diff --git a/ClassicalSharp/Map/Lighting/BasicLighting.cs b/ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.cs
similarity index 100%
rename from ClassicalSharp/Map/Lighting/BasicLighting.cs
rename to ClassicalSharp/ClassicalSharp/Map/Lighting/BasicLighting.cs
diff --git a/ClassicalSharp/Map/Lighting/IWorldLighting.cs b/ClassicalSharp/ClassicalSharp/Map/Lighting/IWorldLighting.cs
similarity index 100%
rename from ClassicalSharp/Map/Lighting/IWorldLighting.cs
rename to ClassicalSharp/ClassicalSharp/Map/Lighting/IWorldLighting.cs
diff --git a/ClassicalSharp/Map/World.cs b/ClassicalSharp/ClassicalSharp/Map/World.cs
similarity index 100%
rename from ClassicalSharp/Map/World.cs
rename to ClassicalSharp/ClassicalSharp/Map/World.cs
diff --git a/ClassicalSharp/Map/WorldEnv.cs b/ClassicalSharp/ClassicalSharp/Map/WorldEnv.cs
similarity index 100%
rename from ClassicalSharp/Map/WorldEnv.cs
rename to ClassicalSharp/ClassicalSharp/Map/WorldEnv.cs
diff --git a/ClassicalSharp/Math/Matrix4.cs b/ClassicalSharp/ClassicalSharp/Math/Matrix4.cs
similarity index 100%
rename from ClassicalSharp/Math/Matrix4.cs
rename to ClassicalSharp/ClassicalSharp/Math/Matrix4.cs
diff --git a/ClassicalSharp/Math/Physics/AABB.cs b/ClassicalSharp/ClassicalSharp/Math/Physics/AABB.cs
similarity index 96%
rename from ClassicalSharp/Math/Physics/AABB.cs
rename to ClassicalSharp/ClassicalSharp/Math/Physics/AABB.cs
index 52d85605f..85ff32cfe 100644
--- a/ClassicalSharp/Math/Physics/AABB.cs
+++ b/ClassicalSharp/ClassicalSharp/Math/Physics/AABB.cs
@@ -1,67 +1,67 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using OpenTK;
-
-namespace ClassicalSharp.Physics {
-
- public struct AABB {
-
- public Vector3 Min;
- public Vector3 Max;
-
- public float Width { get { return Max.X - Min.X; } }
- public float Height { get { return Max.Y - Min.Y; } }
- public float Length { get { return Max.Z - Min.Z; } }
-
- public AABB(float x1, float y1, float z1, float x2, float y2, float z2) {
- Min.X = x1; Min.Y = y1; Min.Z = z1;
- Max.X = x2; Max.Y = y2; Max.Z = z2;
- }
-
- public AABB(Vector3 min, Vector3 max) {
- Min = min;
- Max = max;
- }
-
- public static AABB Make(Vector3 pos, Vector3 size) {
- return new AABB(pos.X - size.X / 2, pos.Y, pos.Z - size.Z / 2,
- pos.X + size.X / 2, pos.Y + size.Y, pos.Z + size.Z / 2);
- }
-
- /// Returns a new bounding box, with the minimum and maximum coordinates
- /// of the original bounding box translated by the given vector.
- public AABB Offset(Vector3 amount) {
- return new AABB(Min + amount, Max + amount);
- }
-
- /// Determines whether this bounding box intersects
- /// the given bounding box on any axes.
- public bool Intersects(AABB other) {
- if (Max.X >= other.Min.X && Min.X <= other.Max.X) {
- if (Max.Y < other.Min.Y || Min.Y > other.Max.Y) {
- return false;
- }
- return Max.Z >= other.Min.Z && Min.Z <= other.Max.Z;
- }
- return false;
- }
-
- /// Determines whether this bounding box entirely contains
- /// the given bounding box on all axes.
- public bool Contains(AABB other) {
- return other.Min.X >= Min.X && other.Min.Y >= Min.Y && other.Min.Z >= Min.Z &&
- other.Max.X <= Max.X && other.Max.Y <= Max.Y && other.Max.Z <= Max.Z;
- }
-
- /// Determines whether this bounding box entirely contains
- /// the coordinates on all axes.
- public bool Contains(Vector3 P) {
- return P.X >= Min.X && P.Y >= Min.Y && P.Z >= Min.Z &&
- P.X <= Max.X && P.Y <= Max.Y && P.Z <= Max.Z;
- }
-
- public override string ToString() {
- return Min + " : " + Max;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using OpenTK;
+
+namespace ClassicalSharp.Physics {
+
+ public struct AABB {
+
+ public Vector3 Min;
+ public Vector3 Max;
+
+ public float Width { get { return Max.X - Min.X; } }
+ public float Height { get { return Max.Y - Min.Y; } }
+ public float Length { get { return Max.Z - Min.Z; } }
+
+ public AABB(float x1, float y1, float z1, float x2, float y2, float z2) {
+ Min.X = x1; Min.Y = y1; Min.Z = z1;
+ Max.X = x2; Max.Y = y2; Max.Z = z2;
+ }
+
+ public AABB(Vector3 min, Vector3 max) {
+ Min = min;
+ Max = max;
+ }
+
+ public static AABB Make(Vector3 pos, Vector3 size) {
+ return new AABB(pos.X - size.X / 2, pos.Y, pos.Z - size.Z / 2,
+ pos.X + size.X / 2, pos.Y + size.Y, pos.Z + size.Z / 2);
+ }
+
+ /// Returns a new bounding box, with the minimum and maximum coordinates
+ /// of the original bounding box translated by the given vector.
+ public AABB Offset(Vector3 amount) {
+ return new AABB(Min + amount, Max + amount);
+ }
+
+ /// Determines whether this bounding box intersects
+ /// the given bounding box on any axes.
+ public bool Intersects(AABB other) {
+ if (Max.X >= other.Min.X && Min.X <= other.Max.X) {
+ if (Max.Y < other.Min.Y || Min.Y > other.Max.Y) {
+ return false;
+ }
+ return Max.Z >= other.Min.Z && Min.Z <= other.Max.Z;
+ }
+ return false;
+ }
+
+ /// Determines whether this bounding box entirely contains
+ /// the given bounding box on all axes.
+ public bool Contains(AABB other) {
+ return other.Min.X >= Min.X && other.Min.Y >= Min.Y && other.Min.Z >= Min.Z &&
+ other.Max.X <= Max.X && other.Max.Y <= Max.Y && other.Max.Z <= Max.Z;
+ }
+
+ /// Determines whether this bounding box entirely contains
+ /// the coordinates on all axes.
+ public bool Contains(Vector3 P) {
+ return P.X >= Min.X && P.Y >= Min.Y && P.Z >= Min.Z &&
+ P.X <= Max.X && P.Y <= Max.Y && P.Z <= Max.Z;
+ }
+
+ public override string ToString() {
+ return Min + " : " + Max;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Math/Physics/IntersectionUtils.cs b/ClassicalSharp/ClassicalSharp/Math/Physics/IntersectionUtils.cs
similarity index 100%
rename from ClassicalSharp/Math/Physics/IntersectionUtils.cs
rename to ClassicalSharp/ClassicalSharp/Math/Physics/IntersectionUtils.cs
diff --git a/ClassicalSharp/Math/Physics/Searcher.cs b/ClassicalSharp/ClassicalSharp/Math/Physics/Searcher.cs
similarity index 100%
rename from ClassicalSharp/Math/Physics/Searcher.cs
rename to ClassicalSharp/ClassicalSharp/Math/Physics/Searcher.cs
diff --git a/ClassicalSharp/Math/PickedPos.cs b/ClassicalSharp/ClassicalSharp/Math/PickedPos.cs
similarity index 97%
rename from ClassicalSharp/Math/PickedPos.cs
rename to ClassicalSharp/ClassicalSharp/Math/PickedPos.cs
index 617380460..da9066b45 100644
--- a/ClassicalSharp/Math/PickedPos.cs
+++ b/ClassicalSharp/ClassicalSharp/Math/PickedPos.cs
@@ -1,80 +1,80 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using OpenTK;
-using BlockID = System.UInt16;
-
-namespace ClassicalSharp {
-
- /// Describes the picked/selected block by the user and its position.
- public class PickedPos {
-
- /// Minimum world coordinates of the block's bounding box.
- public Vector3 Min;
-
- /// Maximum world coordinates of the block's bounding box.
- public Vector3 Max;
-
- /// Exact world coordinates at which the ray intersected this block.
- public Vector3 Intersect;
-
- /// Integer world coordinates of the block.
- public Vector3I BlockPos;
-
- /// Integer world coordinates of the neighbouring block that is closest to the player.
- public Vector3I TranslatedPos;
-
- /// Whether this instance actually has a selected block currently.
- public bool Valid = true;
-
- /// Face of the picked block that is closet to the player.
- public BlockFace Face;
-
- /// Block ID of the picked block.
- public BlockID Block;
-
- /// Mark this as having a selected block, and
- /// calculates the closest face of the selected block's position.
- public void SetAsValid(int x, int y, int z, Vector3 min, Vector3 max,
- BlockID block, Vector3 intersect) {
- Vector3I pos = new Vector3I(x, y, z);
- Valid = true;
- BlockPos = pos;
- Block = block;
- Min = min; Max = max;
- Intersect = intersect;
-
- float dist = float.PositiveInfinity;
- TestAxis(intersect.X - Min.X, ref dist, BlockFace.XMin);
- TestAxis(intersect.X - Max.X, ref dist, BlockFace.XMax);
- TestAxis(intersect.Y - Min.Y, ref dist, BlockFace.YMin);
- TestAxis(intersect.Y - Max.Y, ref dist, BlockFace.YMax);
- TestAxis(intersect.Z - Min.Z, ref dist, BlockFace.ZMin);
- TestAxis(intersect.Z - Max.Z, ref dist, BlockFace.ZMax);
-
- switch (Face) {
- case BlockFace.XMin: pos.X--; break;
- case BlockFace.XMax: pos.X++; break;
- case BlockFace.YMin: pos.Y--; break;
- case BlockFace.YMax: pos.Y++; break;
- case BlockFace.ZMin: pos.Z--; break;
- case BlockFace.ZMax: pos.Z++; break;
- }
- TranslatedPos = pos;
- }
-
- /// Mark this as not having a selected block.
- public void SetAsInvalid() {
- Valid = false;
- BlockPos = Vector3I.MinusOne;
- Block = 0;
- TranslatedPos = Vector3I.MinusOne;
- Face = (BlockFace)6;
- }
-
- void TestAxis(float dAxis, ref float dist, BlockFace fAxis) {
- dAxis = Math.Abs(dAxis);
- if (dAxis >= dist) return;
- dist = dAxis; Face = fAxis;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using OpenTK;
+using BlockID = System.UInt16;
+
+namespace ClassicalSharp {
+
+ /// Describes the picked/selected block by the user and its position.
+ public class PickedPos {
+
+ /// Minimum world coordinates of the block's bounding box.
+ public Vector3 Min;
+
+ /// Maximum world coordinates of the block's bounding box.
+ public Vector3 Max;
+
+ /// Exact world coordinates at which the ray intersected this block.
+ public Vector3 Intersect;
+
+ /// Integer world coordinates of the block.
+ public Vector3I BlockPos;
+
+ /// Integer world coordinates of the neighbouring block that is closest to the player.
+ public Vector3I TranslatedPos;
+
+ /// Whether this instance actually has a selected block currently.
+ public bool Valid = true;
+
+ /// Face of the picked block that is closet to the player.
+ public BlockFace Face;
+
+ /// Block ID of the picked block.
+ public BlockID Block;
+
+ /// Mark this as having a selected block, and
+ /// calculates the closest face of the selected block's position.
+ public void SetAsValid(int x, int y, int z, Vector3 min, Vector3 max,
+ BlockID block, Vector3 intersect) {
+ Vector3I pos = new Vector3I(x, y, z);
+ Valid = true;
+ BlockPos = pos;
+ Block = block;
+ Min = min; Max = max;
+ Intersect = intersect;
+
+ float dist = float.PositiveInfinity;
+ TestAxis(intersect.X - Min.X, ref dist, BlockFace.XMin);
+ TestAxis(intersect.X - Max.X, ref dist, BlockFace.XMax);
+ TestAxis(intersect.Y - Min.Y, ref dist, BlockFace.YMin);
+ TestAxis(intersect.Y - Max.Y, ref dist, BlockFace.YMax);
+ TestAxis(intersect.Z - Min.Z, ref dist, BlockFace.ZMin);
+ TestAxis(intersect.Z - Max.Z, ref dist, BlockFace.ZMax);
+
+ switch (Face) {
+ case BlockFace.XMin: pos.X--; break;
+ case BlockFace.XMax: pos.X++; break;
+ case BlockFace.YMin: pos.Y--; break;
+ case BlockFace.YMax: pos.Y++; break;
+ case BlockFace.ZMin: pos.Z--; break;
+ case BlockFace.ZMax: pos.Z++; break;
+ }
+ TranslatedPos = pos;
+ }
+
+ /// Mark this as not having a selected block.
+ public void SetAsInvalid() {
+ Valid = false;
+ BlockPos = Vector3I.MinusOne;
+ Block = 0;
+ TranslatedPos = Vector3I.MinusOne;
+ Face = (BlockFace)6;
+ }
+
+ void TestAxis(float dAxis, ref float dist, BlockFace fAxis) {
+ dAxis = Math.Abs(dAxis);
+ if (dAxis >= dist) return;
+ dist = dAxis; Face = fAxis;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Math/Picking.cs b/ClassicalSharp/ClassicalSharp/Math/Picking.cs
similarity index 100%
rename from ClassicalSharp/Math/Picking.cs
rename to ClassicalSharp/ClassicalSharp/Math/Picking.cs
diff --git a/ClassicalSharp/Math/RayTracer.cs b/ClassicalSharp/ClassicalSharp/Math/RayTracer.cs
similarity index 97%
rename from ClassicalSharp/Math/RayTracer.cs
rename to ClassicalSharp/ClassicalSharp/Math/RayTracer.cs
index 6297bad80..2f5f685de 100644
--- a/ClassicalSharp/Math/RayTracer.cs
+++ b/ClassicalSharp/ClassicalSharp/Math/RayTracer.cs
@@ -1,79 +1,79 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using ClassicalSharp.Map;
-using OpenTK;
-using BlockID = System.UInt16;
-
-namespace ClassicalSharp {
-
- // http://www.xnawiki.com/index.php/Voxel_traversal
- // https://web.archive.org/web/20120113051728/http://www.xnawiki.com/index.php?title=Voxel_traversal
-
- // Implementation based on: "A Fast Voxel Traversal Algorithm for Ray Tracing"
- // John Amanatides, Andrew Woo
- // http://www.cse.yorku.ca/~amana/research/grid.pdf
- // http://www.devmaster.net/articles/raytracing_series/A%20faster%20voxel%20traversal%20algorithm%20for%20ray%20tracing.pdf
- public sealed class RayTracer {
-
- public int X, Y, Z;
- public Vector3 Origin, Dir;
- // Block data
- public Vector3 Min, Max;
- public BlockID Block;
-
- Vector3I step;
- Vector3 tMax, tDelta;
-
- public void SetVectors(Vector3 origin, Vector3 dir) {
- Origin = origin; Dir = dir;
-
- Vector3I start = Vector3I.Floor(origin); // Rounds the position's X, Y and Z down to the nearest integer values.
- // The cell in which the ray starts.
- X = start.X; Y = start.Y; Z = start.Z;
-
- // Determine which way we go.
- step.X = Math.Sign(dir.X); step.Y = Math.Sign(dir.Y); step.Z = Math.Sign(dir.Z);
- // Calculate cell boundaries. When the step (i.e. direction sign) is positive,
- // the next boundary is AFTER our current position, meaning that we have to add 1.
- // Otherwise, it is BEFORE our current position, in which case we add nothing.
- Vector3I cellBoundary;
- cellBoundary.X = start.X + (step.X > 0 ? 1 : 0);
- cellBoundary.Y = start.Y + (step.Y > 0 ? 1 : 0);
- cellBoundary.Z = start.Z + (step.Z > 0 ? 1 : 0);
-
- // NOTE: we want it so if dir.x = 0, tmax.x = positive infinity
- // Determine how far we can travel along the ray before we hit a voxel boundary.
- tMax = new Vector3(
- (cellBoundary.X - origin.X) / dir.X, // Boundary is a plane on the YZ axis.
- (cellBoundary.Y - origin.Y) / dir.Y, // Boundary is a plane on the XZ axis.
- (cellBoundary.Z - origin.Z) / dir.Z); // Boundary is a plane on the XY axis.
- if (Single.IsNaN(tMax.X) || Single.IsInfinity(tMax.X)) tMax.X = Single.PositiveInfinity;
- if (Single.IsNaN(tMax.Y) || Single.IsInfinity(tMax.Y)) tMax.Y = Single.PositiveInfinity;
- if (Single.IsNaN(tMax.Z) || Single.IsInfinity(tMax.Z)) tMax.Z = Single.PositiveInfinity;
-
- // Determine how far we must travel along the ray before we have crossed a gridcell.
- tDelta = new Vector3(step.X / dir.X, step.Y / dir.Y, step.Z / dir.Z);
- if (Single.IsNaN(tDelta.X)) tDelta.X = Single.PositiveInfinity;
- if (Single.IsNaN(tDelta.Y)) tDelta.Y = Single.PositiveInfinity;
- if (Single.IsNaN(tDelta.Z)) tDelta.Z = Single.PositiveInfinity;
- }
-
- public void Step() {
- // For each step, determine which distance to the next voxel boundary is lowest (i.e.
- // which voxel boundary is nearest) and walk that way.
- if (tMax.X < tMax.Y && tMax.X < tMax.Z) {
- // tMax.X is the lowest, an YZ cell boundary plane is nearest.
- X += step.X;
- tMax.X += tDelta.X;
- } else if (tMax.Y < tMax.Z) {
- // tMax.Y is the lowest, an XZ cell boundary plane is nearest.
- Y += step.Y;
- tMax.Y += tDelta.Y;
- } else {
- // tMax.Z is the lowest, an XY cell boundary plane is nearest.
- Z += step.Z;
- tMax.Z += tDelta.Z;
- }
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using ClassicalSharp.Map;
+using OpenTK;
+using BlockID = System.UInt16;
+
+namespace ClassicalSharp {
+
+ // http://www.xnawiki.com/index.php/Voxel_traversal
+ // https://web.archive.org/web/20120113051728/http://www.xnawiki.com/index.php?title=Voxel_traversal
+
+ // Implementation based on: "A Fast Voxel Traversal Algorithm for Ray Tracing"
+ // John Amanatides, Andrew Woo
+ // http://www.cse.yorku.ca/~amana/research/grid.pdf
+ // http://www.devmaster.net/articles/raytracing_series/A%20faster%20voxel%20traversal%20algorithm%20for%20ray%20tracing.pdf
+ public sealed class RayTracer {
+
+ public int X, Y, Z;
+ public Vector3 Origin, Dir;
+ // Block data
+ public Vector3 Min, Max;
+ public BlockID Block;
+
+ Vector3I step;
+ Vector3 tMax, tDelta;
+
+ public void SetVectors(Vector3 origin, Vector3 dir) {
+ Origin = origin; Dir = dir;
+
+ Vector3I start = Vector3I.Floor(origin); // Rounds the position's X, Y and Z down to the nearest integer values.
+ // The cell in which the ray starts.
+ X = start.X; Y = start.Y; Z = start.Z;
+
+ // Determine which way we go.
+ step.X = Math.Sign(dir.X); step.Y = Math.Sign(dir.Y); step.Z = Math.Sign(dir.Z);
+ // Calculate cell boundaries. When the step (i.e. direction sign) is positive,
+ // the next boundary is AFTER our current position, meaning that we have to add 1.
+ // Otherwise, it is BEFORE our current position, in which case we add nothing.
+ Vector3I cellBoundary;
+ cellBoundary.X = start.X + (step.X > 0 ? 1 : 0);
+ cellBoundary.Y = start.Y + (step.Y > 0 ? 1 : 0);
+ cellBoundary.Z = start.Z + (step.Z > 0 ? 1 : 0);
+
+ // NOTE: we want it so if dir.x = 0, tmax.x = positive infinity
+ // Determine how far we can travel along the ray before we hit a voxel boundary.
+ tMax = new Vector3(
+ (cellBoundary.X - origin.X) / dir.X, // Boundary is a plane on the YZ axis.
+ (cellBoundary.Y - origin.Y) / dir.Y, // Boundary is a plane on the XZ axis.
+ (cellBoundary.Z - origin.Z) / dir.Z); // Boundary is a plane on the XY axis.
+ if (Single.IsNaN(tMax.X) || Single.IsInfinity(tMax.X)) tMax.X = Single.PositiveInfinity;
+ if (Single.IsNaN(tMax.Y) || Single.IsInfinity(tMax.Y)) tMax.Y = Single.PositiveInfinity;
+ if (Single.IsNaN(tMax.Z) || Single.IsInfinity(tMax.Z)) tMax.Z = Single.PositiveInfinity;
+
+ // Determine how far we must travel along the ray before we have crossed a gridcell.
+ tDelta = new Vector3(step.X / dir.X, step.Y / dir.Y, step.Z / dir.Z);
+ if (Single.IsNaN(tDelta.X)) tDelta.X = Single.PositiveInfinity;
+ if (Single.IsNaN(tDelta.Y)) tDelta.Y = Single.PositiveInfinity;
+ if (Single.IsNaN(tDelta.Z)) tDelta.Z = Single.PositiveInfinity;
+ }
+
+ public void Step() {
+ // For each step, determine which distance to the next voxel boundary is lowest (i.e.
+ // which voxel boundary is nearest) and walk that way.
+ if (tMax.X < tMax.Y && tMax.X < tMax.Z) {
+ // tMax.X is the lowest, an YZ cell boundary plane is nearest.
+ X += step.X;
+ tMax.X += tDelta.X;
+ } else if (tMax.Y < tMax.Z) {
+ // tMax.Y is the lowest, an XZ cell boundary plane is nearest.
+ Y += step.Y;
+ tMax.Y += tDelta.Y;
+ } else {
+ // tMax.Z is the lowest, an XY cell boundary plane is nearest.
+ Z += step.Z;
+ tMax.Z += tDelta.Z;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Math/Vector3.cs b/ClassicalSharp/ClassicalSharp/Math/Vector3.cs
similarity index 100%
rename from ClassicalSharp/Math/Vector3.cs
rename to ClassicalSharp/ClassicalSharp/Math/Vector3.cs
diff --git a/ClassicalSharp/Math/Vector4.cs b/ClassicalSharp/ClassicalSharp/Math/Vector4.cs
similarity index 100%
rename from ClassicalSharp/Math/Vector4.cs
rename to ClassicalSharp/ClassicalSharp/Math/Vector4.cs
diff --git a/ClassicalSharp/MeshBuilder/AdvLightingBuilder.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/AdvLightingBuilder.cs
similarity index 100%
rename from ClassicalSharp/MeshBuilder/AdvLightingBuilder.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/AdvLightingBuilder.cs
diff --git a/ClassicalSharp/MeshBuilder/Builder.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/Builder.cs
similarity index 100%
rename from ClassicalSharp/MeshBuilder/Builder.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/Builder.cs
diff --git a/ClassicalSharp/MeshBuilder/CuboidDrawer.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/CuboidDrawer.cs
similarity index 100%
rename from ClassicalSharp/MeshBuilder/CuboidDrawer.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/CuboidDrawer.cs
diff --git a/ClassicalSharp/MeshBuilder/FloodFill.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/FloodFill.cs
similarity index 96%
rename from ClassicalSharp/MeshBuilder/FloodFill.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/FloodFill.cs
index f09c7f8b3..63d9c8842 100644
--- a/ClassicalSharp/MeshBuilder/FloodFill.cs
+++ b/ClassicalSharp/ClassicalSharp/MeshBuilder/FloodFill.cs
@@ -1,97 +1,97 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-#if OCCLUSION
-using System;
-using ClassicalSharp.GraphicsAPI;
-
-namespace ClassicalSharp {
-
- public partial class ChunkMeshBuilder {
-
- unsafe int ComputeOcclusion() {
- int* didFlags = stackalloc int[chunkSize2];
- OpenTK.MemUtils.memset((IntPtr)didFlags, 0x00, 0, chunkSize2 * sizeof(int));
- int* stack = stackalloc int[chunkSize3 * 4];
-
- int i = 0;
- bool solidX = true, solidY = true, solidZ = true;
- for (int y = 0; y < 16; y++) {
- for (int z = 0; z < 16; z++) {
- int flagIndex = (y << 4) | z;
- int chunkIndex = (y + 1) * extChunkSize2 + (z + 1) * extChunkSize + (0 + 1);
- for (int x = 0; x < 16; x++) {
- BlockID block = chunk[chunkIndex];
- if (BlockInfo.FullOpaque[block]) {
- didFlags[flagIndex] |= (1 << x);
- } else if ((didFlags[flagIndex] & (1 << x)) == 0) {
- FloodFill(didFlags, stack, i, ref solidX, ref solidY, ref solidZ);
- }
-
- i++;
- chunkIndex++;
- }
- }
- }
- return (solidX ? 0x1 : 0) | (solidZ ? 0x2 : 0) | (solidY ? 0x4 : 0);
- }
-
- unsafe void FloodFill(int* didFlags, int* stack, int startIndex,
- ref bool solidX, ref bool solidY, ref bool solidZ) {
- int index = 0;
- stack[index++] = startIndex;
- bool tX0 = false, tX1 = false, tY0 = false,
- tY1 = false, tZ0 = false, tZ1 = false;
-
- while (index > 0) {
- int bIndex = stack[--index];
- int x = (bIndex & 0xF);
- int z = ((bIndex >> 4) & 0xF);
- int y = ((bIndex >> 8) & 0xF);
- int flagIndex = (y << 4) | z;
- didFlags[flagIndex] |= (1 << x);
-
- int chunkIndex = (y + 1) * extChunkSize2 + (z + 1) * extChunkSize + (x + 1);
- BlockID block = chunk[chunkIndex];
- if (BlockInfo.Draw[block] != DrawType.Opaque) {
- if (x == 0)
- tX0 = true;
- else if ((didFlags[flagIndex] & (1 << (x - 1))) == 0)
- stack[index++] = bIndex - 1;
-
- if (x == 15)
- tX1 = true;
- else if ((didFlags[flagIndex] & (1 << (x + 1))) == 0)
- stack[index++] = bIndex + 1;
-
- if (z == 0)
- tZ0 = true;
- else if ((didFlags[flagIndex - 1] & (1 << x)) == 0)
- stack[index++] = bIndex - 16;
-
- if (z == 15)
- tZ1 = true;
- else if ((didFlags[flagIndex + 1] & (1 << x)) == 0)
- stack[index++] = bIndex + 16;
- }
-
- if (!BlockInfo.IsOpaqueY[block]) {
- if (y == 0)
- tY0 = true;
- else if ((didFlags[flagIndex - 16] & (1 << x)) == 0
- && !BlockInfo.IsOpaqueY[chunk[chunkIndex - extChunkSize2]])
- stack[index++] = bIndex - 256;
-
- if (y == 15)
- tY1 = true;
- else if ((didFlags[flagIndex + 16] & (1 << x)) == 0
- && !BlockInfo.IsOpaqueY[chunk[chunkIndex + extChunkSize2]])
- stack[index++] = bIndex + 256;
- }
- }
-
- if (tX0 && tX1) solidX = false;
- if (tY0 && tY1) solidY = false;
- if (tZ0 && tZ1) solidZ = false;
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+#if OCCLUSION
+using System;
+using ClassicalSharp.GraphicsAPI;
+
+namespace ClassicalSharp {
+
+ public partial class ChunkMeshBuilder {
+
+ unsafe int ComputeOcclusion() {
+ int* didFlags = stackalloc int[chunkSize2];
+ OpenTK.MemUtils.memset((IntPtr)didFlags, 0x00, 0, chunkSize2 * sizeof(int));
+ int* stack = stackalloc int[chunkSize3 * 4];
+
+ int i = 0;
+ bool solidX = true, solidY = true, solidZ = true;
+ for (int y = 0; y < 16; y++) {
+ for (int z = 0; z < 16; z++) {
+ int flagIndex = (y << 4) | z;
+ int chunkIndex = (y + 1) * extChunkSize2 + (z + 1) * extChunkSize + (0 + 1);
+ for (int x = 0; x < 16; x++) {
+ BlockID block = chunk[chunkIndex];
+ if (BlockInfo.FullOpaque[block]) {
+ didFlags[flagIndex] |= (1 << x);
+ } else if ((didFlags[flagIndex] & (1 << x)) == 0) {
+ FloodFill(didFlags, stack, i, ref solidX, ref solidY, ref solidZ);
+ }
+
+ i++;
+ chunkIndex++;
+ }
+ }
+ }
+ return (solidX ? 0x1 : 0) | (solidZ ? 0x2 : 0) | (solidY ? 0x4 : 0);
+ }
+
+ unsafe void FloodFill(int* didFlags, int* stack, int startIndex,
+ ref bool solidX, ref bool solidY, ref bool solidZ) {
+ int index = 0;
+ stack[index++] = startIndex;
+ bool tX0 = false, tX1 = false, tY0 = false,
+ tY1 = false, tZ0 = false, tZ1 = false;
+
+ while (index > 0) {
+ int bIndex = stack[--index];
+ int x = (bIndex & 0xF);
+ int z = ((bIndex >> 4) & 0xF);
+ int y = ((bIndex >> 8) & 0xF);
+ int flagIndex = (y << 4) | z;
+ didFlags[flagIndex] |= (1 << x);
+
+ int chunkIndex = (y + 1) * extChunkSize2 + (z + 1) * extChunkSize + (x + 1);
+ BlockID block = chunk[chunkIndex];
+ if (BlockInfo.Draw[block] != DrawType.Opaque) {
+ if (x == 0)
+ tX0 = true;
+ else if ((didFlags[flagIndex] & (1 << (x - 1))) == 0)
+ stack[index++] = bIndex - 1;
+
+ if (x == 15)
+ tX1 = true;
+ else if ((didFlags[flagIndex] & (1 << (x + 1))) == 0)
+ stack[index++] = bIndex + 1;
+
+ if (z == 0)
+ tZ0 = true;
+ else if ((didFlags[flagIndex - 1] & (1 << x)) == 0)
+ stack[index++] = bIndex - 16;
+
+ if (z == 15)
+ tZ1 = true;
+ else if ((didFlags[flagIndex + 1] & (1 << x)) == 0)
+ stack[index++] = bIndex + 16;
+ }
+
+ if (!BlockInfo.IsOpaqueY[block]) {
+ if (y == 0)
+ tY0 = true;
+ else if ((didFlags[flagIndex - 16] & (1 << x)) == 0
+ && !BlockInfo.IsOpaqueY[chunk[chunkIndex - extChunkSize2]])
+ stack[index++] = bIndex - 256;
+
+ if (y == 15)
+ tY1 = true;
+ else if ((didFlags[flagIndex + 16] & (1 << x)) == 0
+ && !BlockInfo.IsOpaqueY[chunk[chunkIndex + extChunkSize2]])
+ stack[index++] = bIndex + 256;
+ }
+ }
+
+ if (tX0 && tX1) solidX = false;
+ if (tY0 && tY1) solidY = false;
+ if (tZ0 && tZ1) solidZ = false;
+ }
+ }
+}
#endif
\ No newline at end of file
diff --git a/ClassicalSharp/MeshBuilder/NormalBuilder.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/NormalBuilder.cs
similarity index 100%
rename from ClassicalSharp/MeshBuilder/NormalBuilder.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/NormalBuilder.cs
diff --git a/ClassicalSharp/MeshBuilder/TileDrawer.cs b/ClassicalSharp/ClassicalSharp/MeshBuilder/TileDrawer.cs
similarity index 100%
rename from ClassicalSharp/MeshBuilder/TileDrawer.cs
rename to ClassicalSharp/ClassicalSharp/MeshBuilder/TileDrawer.cs
diff --git a/ClassicalSharp/Mode/Survival.cs b/ClassicalSharp/ClassicalSharp/Mode/Survival.cs
similarity index 100%
rename from ClassicalSharp/Mode/Survival.cs
rename to ClassicalSharp/ClassicalSharp/Mode/Survival.cs
diff --git a/ClassicalSharp/Network/CPESupport.cs b/ClassicalSharp/ClassicalSharp/Network/CPESupport.cs
similarity index 100%
rename from ClassicalSharp/Network/CPESupport.cs
rename to ClassicalSharp/ClassicalSharp/Network/CPESupport.cs
diff --git a/ClassicalSharp/Network/Enums.cs b/ClassicalSharp/ClassicalSharp/Network/Enums.cs
similarity index 100%
rename from ClassicalSharp/Network/Enums.cs
rename to ClassicalSharp/ClassicalSharp/Network/Enums.cs
diff --git a/ClassicalSharp/Network/IServerConnection.cs b/ClassicalSharp/ClassicalSharp/Network/IServerConnection.cs
similarity index 100%
rename from ClassicalSharp/Network/IServerConnection.cs
rename to ClassicalSharp/ClassicalSharp/Network/IServerConnection.cs
diff --git a/ClassicalSharp/Network/NetworkProcessor.cs b/ClassicalSharp/ClassicalSharp/Network/NetworkProcessor.cs
similarity index 100%
rename from ClassicalSharp/Network/NetworkProcessor.cs
rename to ClassicalSharp/ClassicalSharp/Network/NetworkProcessor.cs
diff --git a/ClassicalSharp/Network/Protocols/BlockDefs.cs b/ClassicalSharp/ClassicalSharp/Network/Protocols/BlockDefs.cs
similarity index 100%
rename from ClassicalSharp/Network/Protocols/BlockDefs.cs
rename to ClassicalSharp/ClassicalSharp/Network/Protocols/BlockDefs.cs
diff --git a/ClassicalSharp/Network/Protocols/CPE.cs b/ClassicalSharp/ClassicalSharp/Network/Protocols/CPE.cs
similarity index 100%
rename from ClassicalSharp/Network/Protocols/CPE.cs
rename to ClassicalSharp/ClassicalSharp/Network/Protocols/CPE.cs
diff --git a/ClassicalSharp/Network/Protocols/Classic.cs b/ClassicalSharp/ClassicalSharp/Network/Protocols/Classic.cs
similarity index 100%
rename from ClassicalSharp/Network/Protocols/Classic.cs
rename to ClassicalSharp/ClassicalSharp/Network/Protocols/Classic.cs
diff --git a/ClassicalSharp/Network/Protocols/IProtocol.cs b/ClassicalSharp/ClassicalSharp/Network/Protocols/IProtocol.cs
similarity index 100%
rename from ClassicalSharp/Network/Protocols/IProtocol.cs
rename to ClassicalSharp/ClassicalSharp/Network/Protocols/IProtocol.cs
diff --git a/ClassicalSharp/Network/Protocols/WoM.cs b/ClassicalSharp/ClassicalSharp/Network/Protocols/WoM.cs
similarity index 100%
rename from ClassicalSharp/Network/Protocols/WoM.cs
rename to ClassicalSharp/ClassicalSharp/Network/Protocols/WoM.cs
diff --git a/ClassicalSharp/Network/Utils/AsyncDownloader.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/AsyncDownloader.cs
similarity index 100%
rename from ClassicalSharp/Network/Utils/AsyncDownloader.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/AsyncDownloader.cs
diff --git a/ClassicalSharp/Network/Utils/FixedBufferStream.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/FixedBufferStream.cs
similarity index 96%
rename from ClassicalSharp/Network/Utils/FixedBufferStream.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/FixedBufferStream.cs
index 22f558685..8963197a5 100644
--- a/ClassicalSharp/Network/Utils/FixedBufferStream.cs
+++ b/ClassicalSharp/ClassicalSharp/Network/Utils/FixedBufferStream.cs
@@ -1,37 +1,37 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.IO;
-
-namespace ClassicalSharp.Network {
-
- /// Similar to a memory stream except that its underlying array
- /// cannot be resized and this class performs minimal validation checks.
- internal class FixedBufferStream : ReadOnlyStream {
-
- public byte[] _buffer;
- public int pos, len, bufferPos;
-
- public FixedBufferStream(byte[] buffer) {
- _buffer = buffer;
- }
-
- public override void Flush() { }
-
- public override int Read(byte[] buffer, int offset, int count) {
- int numBytes = len - pos;
- if (numBytes > count) numBytes = count;
- if (numBytes <= 0) return 0;
-
- Buffer.BlockCopy(_buffer, bufferPos + pos, buffer, offset, numBytes);
- pos += numBytes;
- return numBytes;
- }
-
- public override int ReadByte() {
- if (pos >= len) return -1;
- byte value = _buffer[bufferPos + pos];
- pos++;
- return value;
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.IO;
+
+namespace ClassicalSharp.Network {
+
+ /// Similar to a memory stream except that its underlying array
+ /// cannot be resized and this class performs minimal validation checks.
+ internal class FixedBufferStream : ReadOnlyStream {
+
+ public byte[] _buffer;
+ public int pos, len, bufferPos;
+
+ public FixedBufferStream(byte[] buffer) {
+ _buffer = buffer;
+ }
+
+ public override void Flush() { }
+
+ public override int Read(byte[] buffer, int offset, int count) {
+ int numBytes = len - pos;
+ if (numBytes > count) numBytes = count;
+ if (numBytes <= 0) return 0;
+
+ Buffer.BlockCopy(_buffer, bufferPos + pos, buffer, offset, numBytes);
+ pos += numBytes;
+ return numBytes;
+ }
+
+ public override int ReadByte() {
+ if (pos >= len) return -1;
+ byte value = _buffer[bufferPos + pos];
+ pos++;
+ return value;
+ }
+ }
+}
diff --git a/ClassicalSharp/Network/Utils/GZipHeaderReader.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/GZipHeaderReader.cs
similarity index 96%
rename from ClassicalSharp/Network/Utils/GZipHeaderReader.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/GZipHeaderReader.cs
index e46925c16..3b2a8ec5f 100644
--- a/ClassicalSharp/Network/Utils/GZipHeaderReader.cs
+++ b/ClassicalSharp/ClassicalSharp/Network/Utils/GZipHeaderReader.cs
@@ -1,108 +1,108 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.IO;
-
-namespace ClassicalSharp.Network {
-
- internal class GZipHeaderReader {
-
- enum State {
- Header1, Header2, CompressionMethod, Flags,
- LastModifiedTime, CompressionFlags, OperatingSystem,
- HeaderChecksum, Filename, Comment, Done,
- }
-
- State state = State.Header1;
- public bool done;
- int flags;
- int partsRead;
-
- public bool ReadHeader(Stream s) {
- int temp;
- switch (state) {
-
- case State.Header1:
- if (!ReadHeaderByte(s, out temp)) return false;
- if (temp != 0x1F) { throw new NotSupportedException("Byte 1 of GZIP header must be 1F"); }
- goto case State.Header2;
-
- case State.Header2:
- if (!ReadHeaderByte(s, out temp)) return false;
- if (temp != 0x8B) { throw new NotSupportedException("Byte 2 of GZIP header must be 8B"); }
- goto case State.CompressionMethod;
-
- case State.CompressionMethod:
- if (!ReadHeaderByte(s, out temp)) return false;
- if (temp != 0x08) { throw new NotSupportedException("Only DEFLATE compression supported"); }
- goto case State.Flags;
-
- case State.Flags:
- if (!ReadHeaderByte(s, out flags)) return false;
- if ((flags & 0x04) != 0) { throw new NotSupportedException("Unsupported gzip flags"); }
- goto case State.LastModifiedTime;
-
- case State.LastModifiedTime:
- for (; partsRead < 4; partsRead++) {
- int part = s.ReadByte();
- if (part == -1)
- return false;
- }
- partsRead = 0;
- state = State.CompressionFlags;
- goto case State.CompressionFlags;
-
- case State.CompressionFlags:
- if (!ReadHeaderByte(s, out temp)) return false;
- goto case State.OperatingSystem;
-
- case State.OperatingSystem:
- if (!ReadHeaderByte(s, out temp)) return false;
- goto case State.Filename;
-
- case State.Filename:
- if ((flags & 0x08) != 0) {
- for (; ;) {
- int part = s.ReadByte();
- if (part == -1) return false;
- if (part == 0) break;
- }
- }
- state = State.Comment;
- goto case State.Comment;
-
- case State.Comment:
- if ((flags & 0x10) != 0) {
- for (; ;) {
- int part = s.ReadByte();
- if (part == -1) return false;
- if (part == 0) break;
- }
- }
- state = State.HeaderChecksum;
- goto case State.HeaderChecksum;
-
- case State.HeaderChecksum:
- if ((flags & 0x02) != 0) {
- for (; partsRead < 2; partsRead++) {
- int part = s.ReadByte();
- if (part == -1)
- return false;
- }
- }
- partsRead = 0;
- state = State.Done;
- done = true;
- return true;
- }
- return true;
- }
-
- bool ReadHeaderByte(Stream s, out int value) {
- value = s.ReadByte();
- if (value == -1) return false;
-
- state++;
- return true;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.IO;
+
+namespace ClassicalSharp.Network {
+
+ internal class GZipHeaderReader {
+
+ enum State {
+ Header1, Header2, CompressionMethod, Flags,
+ LastModifiedTime, CompressionFlags, OperatingSystem,
+ HeaderChecksum, Filename, Comment, Done,
+ }
+
+ State state = State.Header1;
+ public bool done;
+ int flags;
+ int partsRead;
+
+ public bool ReadHeader(Stream s) {
+ int temp;
+ switch (state) {
+
+ case State.Header1:
+ if (!ReadHeaderByte(s, out temp)) return false;
+ if (temp != 0x1F) { throw new NotSupportedException("Byte 1 of GZIP header must be 1F"); }
+ goto case State.Header2;
+
+ case State.Header2:
+ if (!ReadHeaderByte(s, out temp)) return false;
+ if (temp != 0x8B) { throw new NotSupportedException("Byte 2 of GZIP header must be 8B"); }
+ goto case State.CompressionMethod;
+
+ case State.CompressionMethod:
+ if (!ReadHeaderByte(s, out temp)) return false;
+ if (temp != 0x08) { throw new NotSupportedException("Only DEFLATE compression supported"); }
+ goto case State.Flags;
+
+ case State.Flags:
+ if (!ReadHeaderByte(s, out flags)) return false;
+ if ((flags & 0x04) != 0) { throw new NotSupportedException("Unsupported gzip flags"); }
+ goto case State.LastModifiedTime;
+
+ case State.LastModifiedTime:
+ for (; partsRead < 4; partsRead++) {
+ int part = s.ReadByte();
+ if (part == -1)
+ return false;
+ }
+ partsRead = 0;
+ state = State.CompressionFlags;
+ goto case State.CompressionFlags;
+
+ case State.CompressionFlags:
+ if (!ReadHeaderByte(s, out temp)) return false;
+ goto case State.OperatingSystem;
+
+ case State.OperatingSystem:
+ if (!ReadHeaderByte(s, out temp)) return false;
+ goto case State.Filename;
+
+ case State.Filename:
+ if ((flags & 0x08) != 0) {
+ for (; ;) {
+ int part = s.ReadByte();
+ if (part == -1) return false;
+ if (part == 0) break;
+ }
+ }
+ state = State.Comment;
+ goto case State.Comment;
+
+ case State.Comment:
+ if ((flags & 0x10) != 0) {
+ for (; ;) {
+ int part = s.ReadByte();
+ if (part == -1) return false;
+ if (part == 0) break;
+ }
+ }
+ state = State.HeaderChecksum;
+ goto case State.HeaderChecksum;
+
+ case State.HeaderChecksum:
+ if ((flags & 0x02) != 0) {
+ for (; partsRead < 2; partsRead++) {
+ int part = s.ReadByte();
+ if (part == -1)
+ return false;
+ }
+ }
+ partsRead = 0;
+ state = State.Done;
+ done = true;
+ return true;
+ }
+ return true;
+ }
+
+ bool ReadHeaderByte(Stream s, out int value) {
+ value = s.ReadByte();
+ if (value == -1) return false;
+
+ state++;
+ return true;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Network/Utils/NetReader.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/NetReader.cs
similarity index 96%
rename from ClassicalSharp/Network/Utils/NetReader.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/NetReader.cs
index 9a17e9e86..c934ae2e7 100644
--- a/ClassicalSharp/Network/Utils/NetReader.cs
+++ b/ClassicalSharp/ClassicalSharp/Network/Utils/NetReader.cs
@@ -1,130 +1,130 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.Net.Sockets;
-using ClassicalSharp.Entities;
-using OpenTK;
-using BlockID = System.UInt16;
-
-namespace ClassicalSharp.Network {
-
- public class NetReader {
-
- public byte[] buffer = new byte[4096 * 5];
- public int index = 0, size = 0;
- public bool ExtendedPositions, ExtendedBlocks;
- Socket socket;
-
- public NetReader(Socket socket) {
- this.socket = socket;
- }
-
- public void ReadPendingData() {
- if (socket.Available == 0) return;
- // NOTE: Always using a read call that is a multiple of 4096
- // (appears to?) improve read performance.
- int recv = socket.Receive(buffer, size, 4096 * 4, SocketFlags.None);
- size += recv;
- }
-
- public void Skip(int byteCount) {
- index += byteCount;
- }
-
- public void RemoveProcessed() {
- size -= index;
- if (size > 0) // only copy left over bytes
- Buffer.BlockCopy(buffer, index, buffer, 0, size);
- index = 0;
- // We don't need to zero the old bytes, since they will be overwritten when ReadData() is called.
- }
-
- public byte ReadUInt8() { return buffer[index++]; }
-
- public sbyte ReadInt8() { return (sbyte)buffer[index++]; }
-
- public ushort ReadUInt16() {
- ushort value = (ushort)(buffer[index] << 8 | buffer[index + 1]);
- index += 2;
- return value;
- }
-
- public short ReadInt16() {
- short value = (short)(buffer[index] << 8 | buffer[index + 1]);
- index += 2;
- return value;
- }
-
- public int ReadInt32() {
- int value = buffer[index] << 24 | buffer[index + 1] << 16 |
- buffer[index + 2] << 8 | buffer[index + 3];
- index += 4;
- return value;
- }
-
- public string ReadString() {
- int length = GetString(Utils.StringLength);
- return new String(characters, 0, length);
- }
-
- public byte[] ReadBytes(int length) {
- byte[] data = new byte[length];
- Buffer.BlockCopy(buffer, index, data, 0, length);
- index += length;
- return data;
- }
-
- public Vector3 ReadPosition(byte id) {
- int x = 0, y = 0, z = 0;
- if (ExtendedPositions) {
- x = ReadInt32(); y = ReadInt32(); z = ReadInt32();
- } else {
- x = ReadInt16(); y = ReadInt16(); z = ReadInt16();
- }
-
- float yAdj = (y - 51) / 32f; // We have to do this.
- if (id == EntityList.SelfID) yAdj += 22/32f;
- return new Vector3(x / 32f, yAdj, z / 32f);
- }
-
- public BlockID ReadBlock() {
- if (ExtendedBlocks) return ReadUInt16();
- return buffer[index++];
- }
-
- internal string ReadChatString(ref byte messageType) {
- int length = GetString(Utils.StringLength);
-
- int offset = 0;
- if (length >= womDetail.Length && IsWomDetailString()) {
- length -= womDetail.Length;
- offset = womDetail.Length;
- messageType = (byte)MessageType.Status3;
- }
- return new String(characters, offset, length);
- }
-
- static char[] characters = new char[Utils.StringLength];
- const string womDetail = "^detail.user=";
- static bool IsWomDetailString() {
- for (int i = 0; i < womDetail.Length; i++) {
- if (characters[i] != womDetail[i])
- return false;
- }
- return true;
- }
-
- int GetString(int maxLength) {
- int length = 0;
-
- for (int i = maxLength - 1; i >= 0; i--) {
- byte code = buffer[index + i];
- if (length == 0 && !(code == 0 || code == 0x20))
- length = i + 1;
-
- characters[i] = Utils.CP437ToUnicode(code);
- }
- index += maxLength;
- return length;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.Net.Sockets;
+using ClassicalSharp.Entities;
+using OpenTK;
+using BlockID = System.UInt16;
+
+namespace ClassicalSharp.Network {
+
+ public class NetReader {
+
+ public byte[] buffer = new byte[4096 * 5];
+ public int index = 0, size = 0;
+ public bool ExtendedPositions, ExtendedBlocks;
+ Socket socket;
+
+ public NetReader(Socket socket) {
+ this.socket = socket;
+ }
+
+ public void ReadPendingData() {
+ if (socket.Available == 0) return;
+ // NOTE: Always using a read call that is a multiple of 4096
+ // (appears to?) improve read performance.
+ int recv = socket.Receive(buffer, size, 4096 * 4, SocketFlags.None);
+ size += recv;
+ }
+
+ public void Skip(int byteCount) {
+ index += byteCount;
+ }
+
+ public void RemoveProcessed() {
+ size -= index;
+ if (size > 0) // only copy left over bytes
+ Buffer.BlockCopy(buffer, index, buffer, 0, size);
+ index = 0;
+ // We don't need to zero the old bytes, since they will be overwritten when ReadData() is called.
+ }
+
+ public byte ReadUInt8() { return buffer[index++]; }
+
+ public sbyte ReadInt8() { return (sbyte)buffer[index++]; }
+
+ public ushort ReadUInt16() {
+ ushort value = (ushort)(buffer[index] << 8 | buffer[index + 1]);
+ index += 2;
+ return value;
+ }
+
+ public short ReadInt16() {
+ short value = (short)(buffer[index] << 8 | buffer[index + 1]);
+ index += 2;
+ return value;
+ }
+
+ public int ReadInt32() {
+ int value = buffer[index] << 24 | buffer[index + 1] << 16 |
+ buffer[index + 2] << 8 | buffer[index + 3];
+ index += 4;
+ return value;
+ }
+
+ public string ReadString() {
+ int length = GetString(Utils.StringLength);
+ return new String(characters, 0, length);
+ }
+
+ public byte[] ReadBytes(int length) {
+ byte[] data = new byte[length];
+ Buffer.BlockCopy(buffer, index, data, 0, length);
+ index += length;
+ return data;
+ }
+
+ public Vector3 ReadPosition(byte id) {
+ int x = 0, y = 0, z = 0;
+ if (ExtendedPositions) {
+ x = ReadInt32(); y = ReadInt32(); z = ReadInt32();
+ } else {
+ x = ReadInt16(); y = ReadInt16(); z = ReadInt16();
+ }
+
+ float yAdj = (y - 51) / 32f; // We have to do this.
+ if (id == EntityList.SelfID) yAdj += 22/32f;
+ return new Vector3(x / 32f, yAdj, z / 32f);
+ }
+
+ public BlockID ReadBlock() {
+ if (ExtendedBlocks) return ReadUInt16();
+ return buffer[index++];
+ }
+
+ internal string ReadChatString(ref byte messageType) {
+ int length = GetString(Utils.StringLength);
+
+ int offset = 0;
+ if (length >= womDetail.Length && IsWomDetailString()) {
+ length -= womDetail.Length;
+ offset = womDetail.Length;
+ messageType = (byte)MessageType.Status3;
+ }
+ return new String(characters, offset, length);
+ }
+
+ static char[] characters = new char[Utils.StringLength];
+ const string womDetail = "^detail.user=";
+ static bool IsWomDetailString() {
+ for (int i = 0; i < womDetail.Length; i++) {
+ if (characters[i] != womDetail[i])
+ return false;
+ }
+ return true;
+ }
+
+ int GetString(int maxLength) {
+ int length = 0;
+
+ for (int i = maxLength - 1; i >= 0; i--) {
+ byte code = buffer[index + i];
+ if (length == 0 && !(code == 0 || code == 0x20))
+ length = i + 1;
+
+ characters[i] = Utils.CP437ToUnicode(code);
+ }
+ index += maxLength;
+ return length;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Network/Utils/NetWriter.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/NetWriter.cs
similarity index 96%
rename from ClassicalSharp/Network/Utils/NetWriter.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/NetWriter.cs
index 7a0ef6c8f..d55a2ec16 100644
--- a/ClassicalSharp/Network/Utils/NetWriter.cs
+++ b/ClassicalSharp/ClassicalSharp/Network/Utils/NetWriter.cs
@@ -1,72 +1,72 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.Net.Sockets;
-using OpenTK;
-using BlockID = System.UInt16;
-
-namespace ClassicalSharp.Network {
-
- public class NetWriter {
-
- public byte[] buffer = new byte[131];
- public int index = 0;
- public bool ExtendedPositions, ExtendedBlocks;
- Socket socket;
-
- public NetWriter(Socket socket) {
- this.socket = socket;
- }
-
- public void Send() {
- int offset = 0;
- while (offset < index) {
- offset += socket.Send(buffer, offset, index - offset, SocketFlags.None);
- }
- index = 0;
- }
-
- public void WriteUInt8(byte value) { buffer[index++] = value; }
-
- public void WriteInt16(short value) {
- buffer[index++] = (byte)(value >> 8);
- buffer[index++] = (byte)(value);
- }
-
- public void WriteInt32(int value) {
- buffer[index++] = (byte)(value >> 24);
- buffer[index++] = (byte)(value >> 16);
- buffer[index++] = (byte)(value >> 8);
- buffer[index++] = (byte)(value);
- }
-
- public void WriteString(string value) {
- int count = Math.Min(value.Length, Utils.StringLength);
- for (int i = 0; i < count; i++) {
- char c = value[i];
- if (c == '&') c = '%'; // escape colour codes
- buffer[index + i] = Utils.UnicodeToCP437(c);
- }
-
- for (int i = value.Length; i < Utils.StringLength; i++)
- buffer[index + i] = (byte)' ';
- index += Utils.StringLength;
- }
-
- public void WritePosition(Vector3 pos) {
- if (ExtendedPositions) {
- WriteInt32((int)(pos.X * 32));
- WriteInt32((int)((int)(pos.Y * 32) + 51));
- WriteInt32((int)(pos.Z * 32));
- } else {
- WriteInt16((short)(pos.X * 32));
- WriteInt16((short)((int)(pos.Y * 32) + 51));
- WriteInt16((short)(pos.Z * 32));
- }
- }
-
- public void WriteBlock(BlockID value) {
- if (ExtendedBlocks) { buffer[index++] = (byte)(value >> 8); }
- buffer[index++] = (byte)value;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.Net.Sockets;
+using OpenTK;
+using BlockID = System.UInt16;
+
+namespace ClassicalSharp.Network {
+
+ public class NetWriter {
+
+ public byte[] buffer = new byte[131];
+ public int index = 0;
+ public bool ExtendedPositions, ExtendedBlocks;
+ Socket socket;
+
+ public NetWriter(Socket socket) {
+ this.socket = socket;
+ }
+
+ public void Send() {
+ int offset = 0;
+ while (offset < index) {
+ offset += socket.Send(buffer, offset, index - offset, SocketFlags.None);
+ }
+ index = 0;
+ }
+
+ public void WriteUInt8(byte value) { buffer[index++] = value; }
+
+ public void WriteInt16(short value) {
+ buffer[index++] = (byte)(value >> 8);
+ buffer[index++] = (byte)(value);
+ }
+
+ public void WriteInt32(int value) {
+ buffer[index++] = (byte)(value >> 24);
+ buffer[index++] = (byte)(value >> 16);
+ buffer[index++] = (byte)(value >> 8);
+ buffer[index++] = (byte)(value);
+ }
+
+ public void WriteString(string value) {
+ int count = Math.Min(value.Length, Utils.StringLength);
+ for (int i = 0; i < count; i++) {
+ char c = value[i];
+ if (c == '&') c = '%'; // escape colour codes
+ buffer[index + i] = Utils.UnicodeToCP437(c);
+ }
+
+ for (int i = value.Length; i < Utils.StringLength; i++)
+ buffer[index + i] = (byte)' ';
+ index += Utils.StringLength;
+ }
+
+ public void WritePosition(Vector3 pos) {
+ if (ExtendedPositions) {
+ WriteInt32((int)(pos.X * 32));
+ WriteInt32((int)((int)(pos.Y * 32) + 51));
+ WriteInt32((int)(pos.Z * 32));
+ } else {
+ WriteInt16((short)(pos.X * 32));
+ WriteInt16((short)((int)(pos.Y * 32) + 51));
+ WriteInt16((short)(pos.Z * 32));
+ }
+ }
+
+ public void WriteBlock(BlockID value) {
+ if (ExtendedBlocks) { buffer[index++] = (byte)(value >> 8); }
+ buffer[index++] = (byte)value;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Network/Utils/PingList.cs b/ClassicalSharp/ClassicalSharp/Network/Utils/PingList.cs
similarity index 96%
rename from ClassicalSharp/Network/Utils/PingList.cs
rename to ClassicalSharp/ClassicalSharp/Network/Utils/PingList.cs
index d57d5cdaf..1c137f142 100644
--- a/ClassicalSharp/Network/Utils/PingList.cs
+++ b/ClassicalSharp/ClassicalSharp/Network/Utils/PingList.cs
@@ -1,62 +1,62 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-
-namespace ClassicalSharp.Network {
- public static class PingList {
-
- struct PingEntry {
- public DateTime TimeSent, TimeReceived;
- public ushort Data;
- public double Latency { get {
- // Half, because received->reply time is actually twice time it takes to send data
- return (TimeReceived - TimeSent).TotalMilliseconds * 0.5;
- } }
- }
- static PingEntry[] Entries = new PingEntry[10];
-
-
- public static ushort NextTwoWayPingData() {
- // Find free ping slot
- for (int i = 0; i < Entries.Length; i++) {
- if (Entries[i].TimeSent.Ticks != 0) continue;
-
- ushort prev = i > 0 ? Entries[i - 1].Data : (ushort)0;
- return SetTwoWayPing(i, prev);
- }
-
- // Remove oldest ping slot
- for (int i = 0; i < Entries.Length - 1; i++) {
- Entries[i] = Entries[i + 1];
- }
- int j = Entries.Length - 1;
- return SetTwoWayPing(j, Entries[j].Data);
- }
-
- static ushort SetTwoWayPing(int i, ushort prev) {
- Entries[i].Data = (ushort)(prev + 1);
- Entries[i].TimeSent = DateTime.UtcNow;
- Entries[i].TimeReceived = default(DateTime);
- return (ushort)(prev + 1);
- }
-
- public static void Update(ushort data) {
- for (int i = 0; i < Entries.Length; i++ ) {
- if (Entries[i].Data != data) continue;
- Entries[i].TimeReceived = DateTime.UtcNow;
- return;
- }
- }
-
- /// Gets average ping in milliseconds, or 0 if no ping measures.
- public static int AveragePingMilliseconds() {
- double totalMs = 0;
- int measures = 0;
- for (int i = 0; i < Entries.Length; i++) {
- PingEntry ping = Entries[i];
- if (ping.TimeSent.Ticks == 0 || ping.TimeReceived.Ticks == 0) continue;
- totalMs += ping.Latency; measures++;
- }
- return measures == 0 ? 0 : (int)(totalMs / measures);
- }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+
+namespace ClassicalSharp.Network {
+ public static class PingList {
+
+ struct PingEntry {
+ public DateTime TimeSent, TimeReceived;
+ public ushort Data;
+ public double Latency { get {
+ // Half, because received->reply time is actually twice time it takes to send data
+ return (TimeReceived - TimeSent).TotalMilliseconds * 0.5;
+ } }
+ }
+ static PingEntry[] Entries = new PingEntry[10];
+
+
+ public static ushort NextTwoWayPingData() {
+ // Find free ping slot
+ for (int i = 0; i < Entries.Length; i++) {
+ if (Entries[i].TimeSent.Ticks != 0) continue;
+
+ ushort prev = i > 0 ? Entries[i - 1].Data : (ushort)0;
+ return SetTwoWayPing(i, prev);
+ }
+
+ // Remove oldest ping slot
+ for (int i = 0; i < Entries.Length - 1; i++) {
+ Entries[i] = Entries[i + 1];
+ }
+ int j = Entries.Length - 1;
+ return SetTwoWayPing(j, Entries[j].Data);
+ }
+
+ static ushort SetTwoWayPing(int i, ushort prev) {
+ Entries[i].Data = (ushort)(prev + 1);
+ Entries[i].TimeSent = DateTime.UtcNow;
+ Entries[i].TimeReceived = default(DateTime);
+ return (ushort)(prev + 1);
+ }
+
+ public static void Update(ushort data) {
+ for (int i = 0; i < Entries.Length; i++ ) {
+ if (Entries[i].Data != data) continue;
+ Entries[i].TimeReceived = DateTime.UtcNow;
+ return;
+ }
+ }
+
+ /// Gets average ping in milliseconds, or 0 if no ping measures.
+ public static int AveragePingMilliseconds() {
+ double totalMs = 0;
+ int measures = 0;
+ for (int i = 0; i < Entries.Length; i++) {
+ PingEntry ping = Entries[i];
+ if (ping.TimeSent.Ticks == 0 || ping.TimeReceived.Ticks == 0) continue;
+ totalMs += ping.Latency; measures++;
+ }
+ return measures == 0 ? 0 : (int)(totalMs / measures);
+ }
+ }
+}
diff --git a/ClassicalSharp/Particles/Particle.cs b/ClassicalSharp/ClassicalSharp/Particles/Particle.cs
similarity index 100%
rename from ClassicalSharp/Particles/Particle.cs
rename to ClassicalSharp/ClassicalSharp/Particles/Particle.cs
diff --git a/ClassicalSharp/Particles/ParticleManager.cs b/ClassicalSharp/ClassicalSharp/Particles/ParticleManager.cs
similarity index 100%
rename from ClassicalSharp/Particles/ParticleManager.cs
rename to ClassicalSharp/ClassicalSharp/Particles/ParticleManager.cs
diff --git a/ClassicalSharp/Platform/Platform.cs b/ClassicalSharp/ClassicalSharp/Platform/Platform.cs
similarity index 100%
rename from ClassicalSharp/Platform/Platform.cs
rename to ClassicalSharp/ClassicalSharp/Platform/Platform.cs
diff --git a/ClassicalSharp/Program.cs b/ClassicalSharp/ClassicalSharp/Program.cs
similarity index 100%
rename from ClassicalSharp/Program.cs
rename to ClassicalSharp/ClassicalSharp/Program.cs
diff --git a/ClassicalSharp/Properties/AssemblyInfo.cs b/ClassicalSharp/ClassicalSharp/Properties/AssemblyInfo.cs
similarity index 100%
rename from ClassicalSharp/Properties/AssemblyInfo.cs
rename to ClassicalSharp/ClassicalSharp/Properties/AssemblyInfo.cs
diff --git a/ClassicalSharp/Rendering/ChunkUpdater.cs b/ClassicalSharp/ClassicalSharp/Rendering/ChunkUpdater.cs
similarity index 100%
rename from ClassicalSharp/Rendering/ChunkUpdater.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/ChunkUpdater.cs
diff --git a/ClassicalSharp/Rendering/Env/EnvRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/Env/EnvRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/Env/EnvRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/Env/EnvRenderer.cs
diff --git a/ClassicalSharp/Rendering/Env/MapBordersRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/Env/MapBordersRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/Env/MapBordersRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/Env/MapBordersRenderer.cs
diff --git a/ClassicalSharp/Rendering/Env/SkyboxRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/Env/SkyboxRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/Env/SkyboxRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/Env/SkyboxRenderer.cs
diff --git a/ClassicalSharp/Rendering/Env/WeatherRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/Env/WeatherRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/Env/WeatherRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/Env/WeatherRenderer.cs
diff --git a/ClassicalSharp/Rendering/FrustumCulling.cs b/ClassicalSharp/ClassicalSharp/Rendering/FrustumCulling.cs
similarity index 97%
rename from ClassicalSharp/Rendering/FrustumCulling.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/FrustumCulling.cs
index 9339a8ce0..f31b32581 100644
--- a/ClassicalSharp/Rendering/FrustumCulling.cs
+++ b/ClassicalSharp/ClassicalSharp/Rendering/FrustumCulling.cs
@@ -1,87 +1,87 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using OpenTK;
-
-namespace ClassicalSharp {
-
- // http://www.crownandcutlass.com/features/technicaldetails/frustum.html
- public class FrustumCulling {
-
- float frustum00, frustum01, frustum02, frustum03,
- frustum10, frustum11, frustum12, frustum13,
- frustum20, frustum21, frustum22, frustum23,
- frustum30, frustum31, frustum32, frustum33,
- frustum40, frustum41, frustum42, frustum43;
-
- public bool SphereInFrustum(float x, float y, float z, float radius) {
- float d = frustum00 * x + frustum01 * y + frustum02 * z + frustum03;
- if (d <= -radius) return false;
-
- d = frustum10 * x + frustum11 * y + frustum12 * z + frustum13;
- if (d <= -radius) return false;
-
- d = frustum20 * x + frustum21 * y + frustum22 * z + frustum23;
- if (d <= -radius) return false;
-
- d = frustum30 * x + frustum31 * y + frustum32 * z + frustum33;
- if (d <= -radius) return false;
-
- d = frustum40 * x + frustum41 * y + frustum42 * z + frustum43;
- if (d <= -radius) return false;
- // Don't test NEAR plane, it's pointless
- return true;
- }
-
- public unsafe void CalcFrustumEquations(ref Matrix4 projection, ref Matrix4 modelView) {
- Matrix4 clipMatrix;
- Matrix4.Mult(out clipMatrix, ref modelView, ref projection);
-
- float* clip = (float*)&clipMatrix;
- // Extract the numbers for the RIGHT plane
- frustum00 = clip[3] - clip[0];
- frustum01 = clip[7] - clip[4];
- frustum02 = clip[11] - clip[8];
- frustum03 = clip[15] - clip[12];
- Normalise(ref frustum00, ref frustum01, ref frustum02, ref frustum03);
-
- // Extract the numbers for the LEFT plane
- frustum10 = clip[3] + clip[0];
- frustum11 = clip[7] + clip[4];
- frustum12 = clip[11] + clip[8];
- frustum13 = clip[15] + clip[12];
- Normalise(ref frustum10, ref frustum11, ref frustum12, ref frustum13);
-
- // Extract the BOTTOM plane
- frustum20 = clip[3] + clip[1];
- frustum21 = clip[7] + clip[5];
- frustum22 = clip[11] + clip[ 9];
- frustum23 = clip[15] + clip[13];
- Normalise(ref frustum20, ref frustum21, ref frustum22, ref frustum23);
-
- // Extract the TOP plane
- frustum30 = clip[3] - clip[1];
- frustum31 = clip[7] - clip[5];
- frustum32 = clip[11] - clip[9];
- frustum33 = clip[15] - clip[13];
- Normalise(ref frustum30, ref frustum31, ref frustum32, ref frustum33);
-
- // Extract the FAR plane
- frustum40 = clip[3] - clip[2];
- frustum41 = clip[7] - clip[6];
- frustum42 = clip[11] - clip[10];
- frustum43 = clip[15] - clip[14];
- Normalise(ref frustum40, ref frustum41, ref frustum42, ref frustum43);
- }
-
- void Normalise(ref float plane0, ref float plane1, ref float plane2, ref float plane3) {
- float val1 = plane0;
- float val2 = plane1;
- float val3 = plane2;
- float t = (float)Math.Sqrt(val1 * val1 + val2 * val2 + val3 * val3);
- plane0 /= t;
- plane1 /= t;
- plane2 /= t;
- plane3 /= t;
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using OpenTK;
+
+namespace ClassicalSharp {
+
+ // http://www.crownandcutlass.com/features/technicaldetails/frustum.html
+ public class FrustumCulling {
+
+ float frustum00, frustum01, frustum02, frustum03,
+ frustum10, frustum11, frustum12, frustum13,
+ frustum20, frustum21, frustum22, frustum23,
+ frustum30, frustum31, frustum32, frustum33,
+ frustum40, frustum41, frustum42, frustum43;
+
+ public bool SphereInFrustum(float x, float y, float z, float radius) {
+ float d = frustum00 * x + frustum01 * y + frustum02 * z + frustum03;
+ if (d <= -radius) return false;
+
+ d = frustum10 * x + frustum11 * y + frustum12 * z + frustum13;
+ if (d <= -radius) return false;
+
+ d = frustum20 * x + frustum21 * y + frustum22 * z + frustum23;
+ if (d <= -radius) return false;
+
+ d = frustum30 * x + frustum31 * y + frustum32 * z + frustum33;
+ if (d <= -radius) return false;
+
+ d = frustum40 * x + frustum41 * y + frustum42 * z + frustum43;
+ if (d <= -radius) return false;
+ // Don't test NEAR plane, it's pointless
+ return true;
+ }
+
+ public unsafe void CalcFrustumEquations(ref Matrix4 projection, ref Matrix4 modelView) {
+ Matrix4 clipMatrix;
+ Matrix4.Mult(out clipMatrix, ref modelView, ref projection);
+
+ float* clip = (float*)&clipMatrix;
+ // Extract the numbers for the RIGHT plane
+ frustum00 = clip[3] - clip[0];
+ frustum01 = clip[7] - clip[4];
+ frustum02 = clip[11] - clip[8];
+ frustum03 = clip[15] - clip[12];
+ Normalise(ref frustum00, ref frustum01, ref frustum02, ref frustum03);
+
+ // Extract the numbers for the LEFT plane
+ frustum10 = clip[3] + clip[0];
+ frustum11 = clip[7] + clip[4];
+ frustum12 = clip[11] + clip[8];
+ frustum13 = clip[15] + clip[12];
+ Normalise(ref frustum10, ref frustum11, ref frustum12, ref frustum13);
+
+ // Extract the BOTTOM plane
+ frustum20 = clip[3] + clip[1];
+ frustum21 = clip[7] + clip[5];
+ frustum22 = clip[11] + clip[ 9];
+ frustum23 = clip[15] + clip[13];
+ Normalise(ref frustum20, ref frustum21, ref frustum22, ref frustum23);
+
+ // Extract the TOP plane
+ frustum30 = clip[3] - clip[1];
+ frustum31 = clip[7] - clip[5];
+ frustum32 = clip[11] - clip[9];
+ frustum33 = clip[15] - clip[13];
+ Normalise(ref frustum30, ref frustum31, ref frustum32, ref frustum33);
+
+ // Extract the FAR plane
+ frustum40 = clip[3] - clip[2];
+ frustum41 = clip[7] - clip[6];
+ frustum42 = clip[11] - clip[10];
+ frustum43 = clip[15] - clip[14];
+ Normalise(ref frustum40, ref frustum41, ref frustum42, ref frustum43);
+ }
+
+ void Normalise(ref float plane0, ref float plane1, ref float plane2, ref float plane3) {
+ float val1 = plane0;
+ float val2 = plane1;
+ float val3 = plane2;
+ float t = (float)Math.Sqrt(val1 * val1 + val2 * val2 + val3 * val3);
+ plane0 /= t;
+ plane1 /= t;
+ plane2 /= t;
+ plane3 /= t;
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Rendering/HeldBlockRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/HeldBlockRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/HeldBlockRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/HeldBlockRenderer.cs
diff --git a/ClassicalSharp/Rendering/MapRenderer.Occlusion.cs b/ClassicalSharp/ClassicalSharp/Rendering/MapRenderer.Occlusion.cs
similarity index 100%
rename from ClassicalSharp/Rendering/MapRenderer.Occlusion.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/MapRenderer.Occlusion.cs
diff --git a/ClassicalSharp/Rendering/MapRenderer.cs b/ClassicalSharp/ClassicalSharp/Rendering/MapRenderer.cs
similarity index 100%
rename from ClassicalSharp/Rendering/MapRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Rendering/MapRenderer.cs
diff --git a/ClassicalSharp/Selections/AxisLinesRenderer.cs b/ClassicalSharp/ClassicalSharp/Selections/AxisLinesRenderer.cs
similarity index 100%
rename from ClassicalSharp/Selections/AxisLinesRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Selections/AxisLinesRenderer.cs
diff --git a/ClassicalSharp/Selections/PickedPosRenderer.cs b/ClassicalSharp/ClassicalSharp/Selections/PickedPosRenderer.cs
similarity index 100%
rename from ClassicalSharp/Selections/PickedPosRenderer.cs
rename to ClassicalSharp/ClassicalSharp/Selections/PickedPosRenderer.cs
diff --git a/ClassicalSharp/Selections/SelectionBox.cs b/ClassicalSharp/ClassicalSharp/Selections/SelectionBox.cs
similarity index 100%
rename from ClassicalSharp/Selections/SelectionBox.cs
rename to ClassicalSharp/ClassicalSharp/Selections/SelectionBox.cs
diff --git a/ClassicalSharp/Selections/SelectionManager.cs b/ClassicalSharp/ClassicalSharp/Selections/SelectionManager.cs
similarity index 100%
rename from ClassicalSharp/Selections/SelectionManager.cs
rename to ClassicalSharp/ClassicalSharp/Selections/SelectionManager.cs
diff --git a/ClassicalSharp/SharpWave.dll b/ClassicalSharp/ClassicalSharp/SharpWave.dll
similarity index 100%
rename from ClassicalSharp/SharpWave.dll
rename to ClassicalSharp/ClassicalSharp/SharpWave.dll
diff --git a/ClassicalSharp/SharpWave.dll.config b/ClassicalSharp/ClassicalSharp/SharpWave.dll.config
similarity index 100%
rename from ClassicalSharp/SharpWave.dll.config
rename to ClassicalSharp/ClassicalSharp/SharpWave.dll.config
diff --git a/ClassicalSharp/Singleplayer/FallingPhysics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/FallingPhysics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/FallingPhysics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/FallingPhysics.cs
diff --git a/ClassicalSharp/Singleplayer/FoliagePhysics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/FoliagePhysics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/FoliagePhysics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/FoliagePhysics.cs
diff --git a/ClassicalSharp/Singleplayer/LiquidPhysics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/LiquidPhysics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/LiquidPhysics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/LiquidPhysics.cs
diff --git a/ClassicalSharp/Singleplayer/OtherPhysics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/OtherPhysics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/OtherPhysics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/OtherPhysics.cs
diff --git a/ClassicalSharp/Singleplayer/Physics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/Physics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/Physics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/Physics.cs
diff --git a/ClassicalSharp/Singleplayer/Server.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/Server.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/Server.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/Server.cs
diff --git a/ClassicalSharp/Singleplayer/TNTPhysics.cs b/ClassicalSharp/ClassicalSharp/Singleplayer/TNTPhysics.cs
similarity index 100%
rename from ClassicalSharp/Singleplayer/TNTPhysics.cs
rename to ClassicalSharp/ClassicalSharp/Singleplayer/TNTPhysics.cs
diff --git a/ClassicalSharp/TexturePack/Animations.cs b/ClassicalSharp/ClassicalSharp/TexturePack/Animations.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/Animations.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/Animations.cs
diff --git a/ClassicalSharp/TexturePack/EntryList.cs b/ClassicalSharp/ClassicalSharp/TexturePack/EntryList.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/EntryList.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/EntryList.cs
diff --git a/ClassicalSharp/TexturePack/LiquidAnimations.cs b/ClassicalSharp/ClassicalSharp/TexturePack/LiquidAnimations.cs
similarity index 96%
rename from ClassicalSharp/TexturePack/LiquidAnimations.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/LiquidAnimations.cs
index cabf47f5c..672d13276 100644
--- a/ClassicalSharp/TexturePack/LiquidAnimations.cs
+++ b/ClassicalSharp/ClassicalSharp/TexturePack/LiquidAnimations.cs
@@ -1,122 +1,122 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-// Based off the incredible work from https://dl.dropboxusercontent.com/u/12694594/lava.txt
-// mirroed at https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-lava-animation-algorithm.
-using System;
-using ClassicalSharp.Generator;
-
-namespace ClassicalSharp {
-
- public abstract class LiquidAnimation {
- protected float[] flameHeat, potHeat, soupHeat;
- protected JavaRandom rnd;
-
- protected int CheckSize(int size) {
- if (potHeat == null || potHeat.Length < size * size) {
- flameHeat = new float[size * size];
- potHeat = new float[size * size];
- soupHeat = new float[size * size];
- }
- return Utils.Log2(size);
- }
- }
-
- public unsafe class LavaAnimation : LiquidAnimation {
-
- public void Tick(int* ptr, int size) {
- if (rnd == null)
- rnd = new JavaRandom(new Random().Next());
- int mask = size - 1, shift = CheckSize(size);
-
- int i = 0;
- for (int y = 0; y < size; y++)
- for (int x = 0; x < size; x++)
- {
- // Calculate the colour at this coordinate in the heatmap
-
- int xx = x + (int)(1.2 * Math.Sin(y * 22.5 * Utils.Deg2Rad));
- int yy = y + (int)(1.2 * Math.Sin(x * 22.5 * Utils.Deg2Rad));
- float lSoupHeat =
- soupHeat[((yy - 1) & mask) << shift | ((xx - 1) & mask)] +
- soupHeat[((yy - 1) & mask) << shift | (xx & mask) ] +
- soupHeat[((yy - 1) & mask) << shift | ((xx + 1) & mask)] +
-
- soupHeat[(yy & mask) << shift | ((xx - 1) & mask)] +
- soupHeat[(yy & mask) << shift | (xx & mask) ] +
- soupHeat[(yy & mask) << shift | ((xx + 1) & mask)] +
-
- soupHeat[((yy + 1) & mask) << shift | ((xx - 1) & mask)] +
- soupHeat[((yy + 1) & mask) << shift | (xx & mask) ] +
- soupHeat[((yy + 1) & mask) << shift | ((xx + 1) & mask)];
-
- float lPotHeat =
- potHeat[i] + // x , y
- potHeat[y << shift | ((x + 1) & mask)] + // x + 1, y
- potHeat[((y + 1) & mask) << shift | x] + // x , y + 1
- potHeat[((y + 1) & mask) << shift | ((x + 1) & mask)];// x + 1, y + 1
-
- soupHeat[i] = lSoupHeat * 0.1f + lPotHeat * 0.2f;
-
- potHeat[i] += flameHeat[i];
- if (potHeat[i] < 0) potHeat[i] = 0;
-
- flameHeat[i] -= 0.06f * 0.01f;
- if (rnd.NextFloat() <= 0.005f) flameHeat[i] = 1.5f * 0.01f;
-
- // Output the pixel
- float col = 2 * soupHeat[i];
- col = col < 0 ? 0 : col;
- col = col > 1 ? 1 : col;
-
- float r = col * 100 + 155;
- float g = col * col * 255;
- float b = col * col * col * col * 128;
- *ptr = 255 << 24 | (byte)r << 16 | (byte)g << 8 | (byte)b;
-
- ptr++; i++;
- }
- }
- }
-
- // Written by cybertoon, big thanks!
- public unsafe class WaterAnimation : LiquidAnimation {
-
- public void Tick(int* ptr, int size) {
- if (rnd == null)
- rnd = new JavaRandom(new Random().Next());
- int mask = size - 1, shift = CheckSize(size);
-
- int i = 0;
- for (int y = 0; y < size; y++)
- for (int x = 0; x < size; x++)
- {
- // Calculate the colour at this coordinate in the heatmap
- float lSoupHeat =
- soupHeat[y << shift | ((x - 1) & mask)] +
- soupHeat[y << shift | x ] +
- soupHeat[y << shift | ((x + 1) & mask)];
-
- soupHeat[i] = lSoupHeat / 3.3f + potHeat[i] * 0.8f;
-
- potHeat[i] += flameHeat[i];
- if (potHeat[i] < 0) potHeat[i] = 0;
-
- flameHeat[i] -= 0.1f * 0.05f;
- if (rnd.NextFloat() <= 0.05f) flameHeat[i] = 0.5f * 0.05f;
-
- // Output the pixel
- float col = soupHeat[i];
- col = col < 0 ? 0 : col;
- col = col > 1 ? 1 : col;
- col = col * col;
-
- float r = 32 + col * 32;
- float g = 50 + col * 64;
- float a = 146 + col * 50;
-
- *ptr = (byte)a << 24 | (byte)r << 16 | (byte)g << 8 | 255;
-
- ptr++; i++;
- }
- }
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+// Based off the incredible work from https://dl.dropboxusercontent.com/u/12694594/lava.txt
+// mirroed at https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-lava-animation-algorithm.
+using System;
+using ClassicalSharp.Generator;
+
+namespace ClassicalSharp {
+
+ public abstract class LiquidAnimation {
+ protected float[] flameHeat, potHeat, soupHeat;
+ protected JavaRandom rnd;
+
+ protected int CheckSize(int size) {
+ if (potHeat == null || potHeat.Length < size * size) {
+ flameHeat = new float[size * size];
+ potHeat = new float[size * size];
+ soupHeat = new float[size * size];
+ }
+ return Utils.Log2(size);
+ }
+ }
+
+ public unsafe class LavaAnimation : LiquidAnimation {
+
+ public void Tick(int* ptr, int size) {
+ if (rnd == null)
+ rnd = new JavaRandom(new Random().Next());
+ int mask = size - 1, shift = CheckSize(size);
+
+ int i = 0;
+ for (int y = 0; y < size; y++)
+ for (int x = 0; x < size; x++)
+ {
+ // Calculate the colour at this coordinate in the heatmap
+
+ int xx = x + (int)(1.2 * Math.Sin(y * 22.5 * Utils.Deg2Rad));
+ int yy = y + (int)(1.2 * Math.Sin(x * 22.5 * Utils.Deg2Rad));
+ float lSoupHeat =
+ soupHeat[((yy - 1) & mask) << shift | ((xx - 1) & mask)] +
+ soupHeat[((yy - 1) & mask) << shift | (xx & mask) ] +
+ soupHeat[((yy - 1) & mask) << shift | ((xx + 1) & mask)] +
+
+ soupHeat[(yy & mask) << shift | ((xx - 1) & mask)] +
+ soupHeat[(yy & mask) << shift | (xx & mask) ] +
+ soupHeat[(yy & mask) << shift | ((xx + 1) & mask)] +
+
+ soupHeat[((yy + 1) & mask) << shift | ((xx - 1) & mask)] +
+ soupHeat[((yy + 1) & mask) << shift | (xx & mask) ] +
+ soupHeat[((yy + 1) & mask) << shift | ((xx + 1) & mask)];
+
+ float lPotHeat =
+ potHeat[i] + // x , y
+ potHeat[y << shift | ((x + 1) & mask)] + // x + 1, y
+ potHeat[((y + 1) & mask) << shift | x] + // x , y + 1
+ potHeat[((y + 1) & mask) << shift | ((x + 1) & mask)];// x + 1, y + 1
+
+ soupHeat[i] = lSoupHeat * 0.1f + lPotHeat * 0.2f;
+
+ potHeat[i] += flameHeat[i];
+ if (potHeat[i] < 0) potHeat[i] = 0;
+
+ flameHeat[i] -= 0.06f * 0.01f;
+ if (rnd.NextFloat() <= 0.005f) flameHeat[i] = 1.5f * 0.01f;
+
+ // Output the pixel
+ float col = 2 * soupHeat[i];
+ col = col < 0 ? 0 : col;
+ col = col > 1 ? 1 : col;
+
+ float r = col * 100 + 155;
+ float g = col * col * 255;
+ float b = col * col * col * col * 128;
+ *ptr = 255 << 24 | (byte)r << 16 | (byte)g << 8 | (byte)b;
+
+ ptr++; i++;
+ }
+ }
+ }
+
+ // Written by cybertoon, big thanks!
+ public unsafe class WaterAnimation : LiquidAnimation {
+
+ public void Tick(int* ptr, int size) {
+ if (rnd == null)
+ rnd = new JavaRandom(new Random().Next());
+ int mask = size - 1, shift = CheckSize(size);
+
+ int i = 0;
+ for (int y = 0; y < size; y++)
+ for (int x = 0; x < size; x++)
+ {
+ // Calculate the colour at this coordinate in the heatmap
+ float lSoupHeat =
+ soupHeat[y << shift | ((x - 1) & mask)] +
+ soupHeat[y << shift | x ] +
+ soupHeat[y << shift | ((x + 1) & mask)];
+
+ soupHeat[i] = lSoupHeat / 3.3f + potHeat[i] * 0.8f;
+
+ potHeat[i] += flameHeat[i];
+ if (potHeat[i] < 0) potHeat[i] = 0;
+
+ flameHeat[i] -= 0.1f * 0.05f;
+ if (rnd.NextFloat() <= 0.05f) flameHeat[i] = 0.5f * 0.05f;
+
+ // Output the pixel
+ float col = soupHeat[i];
+ col = col < 0 ? 0 : col;
+ col = col > 1 ? 1 : col;
+ col = col * col;
+
+ float r = 32 + col * 32;
+ float g = 50 + col * 64;
+ float a = 146 + col * 50;
+
+ *ptr = (byte)a << 24 | (byte)r << 16 | (byte)g << 8 | 255;
+
+ ptr++; i++;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/TexturePack/Side.cs b/ClassicalSharp/ClassicalSharp/TexturePack/Side.cs
similarity index 96%
rename from ClassicalSharp/TexturePack/Side.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/Side.cs
index 535c7eada..10ce669e0 100644
--- a/ClassicalSharp/TexturePack/Side.cs
+++ b/ClassicalSharp/ClassicalSharp/TexturePack/Side.cs
@@ -1,23 +1,23 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-
-namespace ClassicalSharp {
-
- /// Integer constants for the six sides of a block.
- public static class Side {
- /// Face X = 0.
- public const int Left = 0;
- /// Face X = 1.
- public const int Right = 1;
- /// Face Z = 0.
- public const int Front = 2;
- /// Face Z = 1.
- public const int Back = 3;
- /// Face Y = 0.
- public const int Bottom = 4;
- /// Face Y = 1.
- public const int Top = 5;
- /// Number of sides on a cube.
- public const int Sides = 6;
- }
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+
+namespace ClassicalSharp {
+
+ /// Integer constants for the six sides of a block.
+ public static class Side {
+ /// Face X = 0.
+ public const int Left = 0;
+ /// Face X = 1.
+ public const int Right = 1;
+ /// Face Z = 0.
+ public const int Front = 2;
+ /// Face Z = 1.
+ public const int Back = 3;
+ /// Face Y = 0.
+ public const int Bottom = 4;
+ /// Face Y = 1.
+ public const int Top = 5;
+ /// Number of sides on a cube.
+ public const int Sides = 6;
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/TexturePack/TerrainAtlas.cs b/ClassicalSharp/ClassicalSharp/TexturePack/TerrainAtlas.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/TerrainAtlas.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/TerrainAtlas.cs
diff --git a/ClassicalSharp/TexturePack/TextureCache.cs b/ClassicalSharp/ClassicalSharp/TexturePack/TextureCache.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/TextureCache.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/TextureCache.cs
diff --git a/ClassicalSharp/TexturePack/TexturePack.cs b/ClassicalSharp/ClassicalSharp/TexturePack/TexturePack.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/TexturePack.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/TexturePack.cs
diff --git a/ClassicalSharp/TexturePack/ZipReader.cs b/ClassicalSharp/ClassicalSharp/TexturePack/ZipReader.cs
similarity index 100%
rename from ClassicalSharp/TexturePack/ZipReader.cs
rename to ClassicalSharp/ClassicalSharp/TexturePack/ZipReader.cs
diff --git a/ClassicalSharp/Utils/Camera.cs b/ClassicalSharp/ClassicalSharp/Utils/Camera.cs
similarity index 100%
rename from ClassicalSharp/Utils/Camera.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Camera.cs
diff --git a/ClassicalSharp/Utils/ErrorHandler.cs b/ClassicalSharp/ClassicalSharp/Utils/ErrorHandler.cs
similarity index 100%
rename from ClassicalSharp/Utils/ErrorHandler.cs
rename to ClassicalSharp/ClassicalSharp/Utils/ErrorHandler.cs
diff --git a/ClassicalSharp/Utils/MathUtils.cs b/ClassicalSharp/ClassicalSharp/Utils/MathUtils.cs
similarity index 97%
rename from ClassicalSharp/Utils/MathUtils.cs
rename to ClassicalSharp/ClassicalSharp/Utils/MathUtils.cs
index 49f6d6277..3021d47fb 100644
--- a/ClassicalSharp/Utils/MathUtils.cs
+++ b/ClassicalSharp/ClassicalSharp/Utils/MathUtils.cs
@@ -1,155 +1,155 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Drawing;
-using ClassicalSharp.Model;
-using OpenTK;
-using OpenTK.Input;
-
-namespace ClassicalSharp {
-
- public static class MathUtils {
-
- /// Creates a vector with all components at 1E25.
- public static Vector3 MaxPos() { return new Vector3( 1E25f, 1E25f, 1E25f ); }
-
- /// Clamps that specified value such that min ≤ value ≤ max
- public static void Clamp( ref float value, float min, float max ) {
- if( value < min ) value = min;
- if( value > max ) value = max;
- }
-
- /// Clamps that specified value such that min ≤ value ≤ max
- public static void Clamp( ref int value, int min, int max ) {
- if( value < min ) value = min;
- if( value > max ) value = max;
- }
-
- public static Vector3 Mul( Vector3 a, Vector3 scale ) {
- a.X *= scale.X; a.Y *= scale.Y; a.Z *= scale.Z;
- return a;
- }
-
- /// Returns the next highest power of 2 that is ≥ to the given value.
- public static int NextPowerOf2( int value ) {
- int next = 1;
- while( value > next )
- next <<= 1;
- return next;
- }
-
- /// Returns whether the given value is a power of 2.
- public static bool IsPowerOf2( int value ) {
- return value != 0 && (value & (value - 1)) == 0;
- }
-
- /// Multiply a value in degrees by this to get its value in radians.
- public const float Deg2Rad = (float)(Math.PI / 180);
- /// Multiply a value in radians by this to get its value in degrees.
- public const float Rad2Deg = (float)(180 / Math.PI);
-
- public static int DegreesToPacked( double degrees, int period ) {
- return (int)(degrees * period / 360.0) % period;
- }
-
- public static int DegreesToPacked( double degrees ) {
- return (int)(degrees * 256 / 360.0) & 0xFF;
- }
-
- public static double PackedToDegrees( byte packed ) {
- return packed * 360.0 / 256.0;
- }
-
- /// Rotates the given 3D coordinates around the y axis.
- public static Vector3 RotateY( Vector3 v, float angle ) {
- float cosA = (float)Math.Cos( angle );
- float sinA = (float)Math.Sin( angle );
- return new Vector3( cosA * v.X - sinA * v.Z, v.Y, sinA * v.X + cosA * v.Z );
- }
-
- /// Rotates the given 3D coordinates around the y axis.
- public static Vector3 RotateY( float x, float y, float z, float angle ) {
- float cosA = (float)Math.Cos( angle );
- float sinA = (float)Math.Sin( angle );
- return new Vector3( cosA * x - sinA * z, y, sinA * x + cosA * z );
- }
-
- /// Rotates the given 3D coordinates around the x axis.
- public static void RotateX( ref float y, ref float z, float cosA, float sinA ) {
- float y2 = cosA * y + sinA * z; z = -sinA * y + cosA * z; y = y2;
- }
-
- /// Rotates the given 3D coordinates around the y axis.
- public static void RotateY( ref float x, ref float z, float cosA, float sinA ) {
- float x2 = cosA * x - sinA * z; z = sinA * x + cosA * z; x = x2;
- }
-
- /// Rotates the given 3D coordinates around the z axis.
- public static void RotateZ( ref float x, ref float y, float cosA, float sinA ) {
- float x2 = cosA * x + sinA * y; y = -sinA * x + cosA * y; x = x2;
- }
-
- /// Returns the square of the euclidean distance between two points.
- public static float DistanceSquared( Vector3 p1, Vector3 p2 ) {
- float dx = p2.X - p1.X;
- float dy = p2.Y - p1.Y;
- float dz = p2.Z - p1.Z;
- return dx * dx + dy * dy + dz * dz;
- }
-
- /// Returns the square of the euclidean distance between two points.
- public static float DistanceSquared( float x1, float y1, float z1, float x2, float y2, float z2 ) {
- float dx = x2 - x1;
- float dy = y2 - y1;
- float dz = z2 - z1;
- return dx * dx + dy * dy + dz * dz;
- }
-
- /// Returns the square of the euclidean distance between two points.
- public static int DistanceSquared( int x1, int y1, int z1, int x2, int y2, int z2 ) {
- int dx = x2 - x1;
- int dy = y2 - y1;
- int dz = z2 - z1;
- return dx * dx + dy * dy + dz * dz;
- }
-
- /// Returns a normalised vector that faces in the direction
- /// described by the given yaw and pitch.
- public static Vector3 GetDirVector( double yawRad, double pitchRad ) {
- double x = -Math.Cos( pitchRad ) * -Math.Sin( yawRad );
- double y = -Math.Sin( pitchRad );
- double z = -Math.Cos( pitchRad ) * Math.Cos( yawRad );
- return new Vector3( (float)x, (float)y, (float)z );
- }
-
- public static void GetHeading( Vector3 dir, out double yawRad, out double pitchRad ) {
- pitchRad = Math.Asin( -dir.Y );
- yawRad = Math.Atan2( dir.Z, dir.X );
- }
-
- // http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/
- public static void CalcBillboardPoints( Vector2 size, Vector3 position, ref Matrix4 view, out Vector3 p111,
- out Vector3 p121, out Vector3 p212, out Vector3 p222 ) {
- Vector3 centre = position; centre.Y += size.Y / 2;
- Vector3 a = new Vector3( view.Row0.X * size.X, view.Row1.X * size.X, view.Row2.X * size.X ); // right * size.X
- Vector3 b = new Vector3( view.Row0.Y * size.Y, view.Row1.Y * size.Y, view.Row2.Y * size.Y ); // up * size.Y
-
- p111 = centre + a * -0.5f + b * -0.5f;
- p121 = centre + a * -0.5f + b * 0.5f;
- p212 = centre + a * 0.5f + b * -0.5f;
- p222 = centre + a * 0.5f + b * 0.5f;
- }
-
- /// Linearly interpolates between a given angle range, adjusting if necessary.
- public static float LerpAngle( float leftAngle, float rightAngle, float t ) {
- // we have to cheat a bit for angles here.
- // Consider 350* --> 0*, we only want to travel 10*,
- // but without adjusting for this case, we would interpolate back the whole 350* degrees.
- bool invertLeft = leftAngle > 270 && rightAngle < 90;
- bool invertRight = rightAngle > 270 && leftAngle < 90;
- if( invertLeft ) leftAngle = leftAngle - 360;
- if( invertRight ) rightAngle = rightAngle - 360;
-
- return Utils.Lerp( leftAngle, rightAngle, t );
- }
- }
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Drawing;
+using ClassicalSharp.Model;
+using OpenTK;
+using OpenTK.Input;
+
+namespace ClassicalSharp {
+
+ public static class MathUtils {
+
+ /// Creates a vector with all components at 1E25.
+ public static Vector3 MaxPos() { return new Vector3( 1E25f, 1E25f, 1E25f ); }
+
+ /// Clamps that specified value such that min ≤ value ≤ max
+ public static void Clamp( ref float value, float min, float max ) {
+ if( value < min ) value = min;
+ if( value > max ) value = max;
+ }
+
+ /// Clamps that specified value such that min ≤ value ≤ max
+ public static void Clamp( ref int value, int min, int max ) {
+ if( value < min ) value = min;
+ if( value > max ) value = max;
+ }
+
+ public static Vector3 Mul( Vector3 a, Vector3 scale ) {
+ a.X *= scale.X; a.Y *= scale.Y; a.Z *= scale.Z;
+ return a;
+ }
+
+ /// Returns the next highest power of 2 that is ≥ to the given value.
+ public static int NextPowerOf2( int value ) {
+ int next = 1;
+ while( value > next )
+ next <<= 1;
+ return next;
+ }
+
+ /// Returns whether the given value is a power of 2.
+ public static bool IsPowerOf2( int value ) {
+ return value != 0 && (value & (value - 1)) == 0;
+ }
+
+ /// Multiply a value in degrees by this to get its value in radians.
+ public const float Deg2Rad = (float)(Math.PI / 180);
+ /// Multiply a value in radians by this to get its value in degrees.
+ public const float Rad2Deg = (float)(180 / Math.PI);
+
+ public static int DegreesToPacked( double degrees, int period ) {
+ return (int)(degrees * period / 360.0) % period;
+ }
+
+ public static int DegreesToPacked( double degrees ) {
+ return (int)(degrees * 256 / 360.0) & 0xFF;
+ }
+
+ public static double PackedToDegrees( byte packed ) {
+ return packed * 360.0 / 256.0;
+ }
+
+ /// Rotates the given 3D coordinates around the y axis.
+ public static Vector3 RotateY( Vector3 v, float angle ) {
+ float cosA = (float)Math.Cos( angle );
+ float sinA = (float)Math.Sin( angle );
+ return new Vector3( cosA * v.X - sinA * v.Z, v.Y, sinA * v.X + cosA * v.Z );
+ }
+
+ /// Rotates the given 3D coordinates around the y axis.
+ public static Vector3 RotateY( float x, float y, float z, float angle ) {
+ float cosA = (float)Math.Cos( angle );
+ float sinA = (float)Math.Sin( angle );
+ return new Vector3( cosA * x - sinA * z, y, sinA * x + cosA * z );
+ }
+
+ /// Rotates the given 3D coordinates around the x axis.
+ public static void RotateX( ref float y, ref float z, float cosA, float sinA ) {
+ float y2 = cosA * y + sinA * z; z = -sinA * y + cosA * z; y = y2;
+ }
+
+ /// Rotates the given 3D coordinates around the y axis.
+ public static void RotateY( ref float x, ref float z, float cosA, float sinA ) {
+ float x2 = cosA * x - sinA * z; z = sinA * x + cosA * z; x = x2;
+ }
+
+ /// Rotates the given 3D coordinates around the z axis.
+ public static void RotateZ( ref float x, ref float y, float cosA, float sinA ) {
+ float x2 = cosA * x + sinA * y; y = -sinA * x + cosA * y; x = x2;
+ }
+
+ /// Returns the square of the euclidean distance between two points.
+ public static float DistanceSquared( Vector3 p1, Vector3 p2 ) {
+ float dx = p2.X - p1.X;
+ float dy = p2.Y - p1.Y;
+ float dz = p2.Z - p1.Z;
+ return dx * dx + dy * dy + dz * dz;
+ }
+
+ /// Returns the square of the euclidean distance between two points.
+ public static float DistanceSquared( float x1, float y1, float z1, float x2, float y2, float z2 ) {
+ float dx = x2 - x1;
+ float dy = y2 - y1;
+ float dz = z2 - z1;
+ return dx * dx + dy * dy + dz * dz;
+ }
+
+ /// Returns the square of the euclidean distance between two points.
+ public static int DistanceSquared( int x1, int y1, int z1, int x2, int y2, int z2 ) {
+ int dx = x2 - x1;
+ int dy = y2 - y1;
+ int dz = z2 - z1;
+ return dx * dx + dy * dy + dz * dz;
+ }
+
+ /// Returns a normalised vector that faces in the direction
+ /// described by the given yaw and pitch.
+ public static Vector3 GetDirVector( double yawRad, double pitchRad ) {
+ double x = -Math.Cos( pitchRad ) * -Math.Sin( yawRad );
+ double y = -Math.Sin( pitchRad );
+ double z = -Math.Cos( pitchRad ) * Math.Cos( yawRad );
+ return new Vector3( (float)x, (float)y, (float)z );
+ }
+
+ public static void GetHeading( Vector3 dir, out double yawRad, out double pitchRad ) {
+ pitchRad = Math.Asin( -dir.Y );
+ yawRad = Math.Atan2( dir.Z, dir.X );
+ }
+
+ // http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/
+ public static void CalcBillboardPoints( Vector2 size, Vector3 position, ref Matrix4 view, out Vector3 p111,
+ out Vector3 p121, out Vector3 p212, out Vector3 p222 ) {
+ Vector3 centre = position; centre.Y += size.Y / 2;
+ Vector3 a = new Vector3( view.Row0.X * size.X, view.Row1.X * size.X, view.Row2.X * size.X ); // right * size.X
+ Vector3 b = new Vector3( view.Row0.Y * size.Y, view.Row1.Y * size.Y, view.Row2.Y * size.Y ); // up * size.Y
+
+ p111 = centre + a * -0.5f + b * -0.5f;
+ p121 = centre + a * -0.5f + b * 0.5f;
+ p212 = centre + a * 0.5f + b * -0.5f;
+ p222 = centre + a * 0.5f + b * 0.5f;
+ }
+
+ /// Linearly interpolates between a given angle range, adjusting if necessary.
+ public static float LerpAngle( float leftAngle, float rightAngle, float t ) {
+ // we have to cheat a bit for angles here.
+ // Consider 350* --> 0*, we only want to travel 10*,
+ // but without adjusting for this case, we would interpolate back the whole 350* degrees.
+ bool invertLeft = leftAngle > 270 && rightAngle < 90;
+ bool invertRight = rightAngle > 270 && leftAngle < 90;
+ if( invertLeft ) leftAngle = leftAngle - 360;
+ if( invertRight ) rightAngle = rightAngle - 360;
+
+ return Utils.Lerp( leftAngle, rightAngle, t );
+ }
+ }
}
\ No newline at end of file
diff --git a/ClassicalSharp/Utils/Options.cs b/ClassicalSharp/ClassicalSharp/Utils/Options.cs
similarity index 100%
rename from ClassicalSharp/Utils/Options.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Options.cs
diff --git a/ClassicalSharp/Utils/ReadOnlyStream.cs b/ClassicalSharp/ClassicalSharp/Utils/ReadOnlyStream.cs
similarity index 96%
rename from ClassicalSharp/Utils/ReadOnlyStream.cs
rename to ClassicalSharp/ClassicalSharp/Utils/ReadOnlyStream.cs
index 0a0683e1f..49c00ebcf 100644
--- a/ClassicalSharp/Utils/ReadOnlyStream.cs
+++ b/ClassicalSharp/ClassicalSharp/Utils/ReadOnlyStream.cs
@@ -1,28 +1,28 @@
-// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
-using System;
-using System.IO;
-
-namespace ClassicalSharp {
-
- /// Implements a non-seekable stream that can only be read from.
- internal abstract class ReadOnlyStream : Stream {
-
- static NotSupportedException ex = new NotSupportedException("Writing/Seeking not supported");
-
- public override bool CanRead { get { return true; } }
-
- public override bool CanSeek { get { return false; } }
-
- public override bool CanWrite { get { return false; } }
-
- public override long Length { get { throw ex; } }
-
- public override long Position { get { throw ex; } set { throw ex; } }
-
- public override long Seek(long offset, SeekOrigin origin) { throw ex; }
-
- public override void SetLength(long value) { throw ex; }
-
- public override void Write(byte[] buffer, int offset, int count) { throw ex; }
- }
-}
+// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
+using System;
+using System.IO;
+
+namespace ClassicalSharp {
+
+ /// Implements a non-seekable stream that can only be read from.
+ internal abstract class ReadOnlyStream : Stream {
+
+ static NotSupportedException ex = new NotSupportedException("Writing/Seeking not supported");
+
+ public override bool CanRead { get { return true; } }
+
+ public override bool CanSeek { get { return false; } }
+
+ public override bool CanWrite { get { return false; } }
+
+ public override long Length { get { throw ex; } }
+
+ public override long Position { get { throw ex; } set { throw ex; } }
+
+ public override long Seek(long offset, SeekOrigin origin) { throw ex; }
+
+ public override void SetLength(long value) { throw ex; }
+
+ public override void Write(byte[] buffer, int offset, int count) { throw ex; }
+ }
+}
diff --git a/ClassicalSharp/Utils/Respawn.cs b/ClassicalSharp/ClassicalSharp/Utils/Respawn.cs
similarity index 100%
rename from ClassicalSharp/Utils/Respawn.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Respawn.cs
diff --git a/ClassicalSharp/Utils/StringBuffer.cs b/ClassicalSharp/ClassicalSharp/Utils/StringBuffer.cs
similarity index 100%
rename from ClassicalSharp/Utils/StringBuffer.cs
rename to ClassicalSharp/ClassicalSharp/Utils/StringBuffer.cs
diff --git a/ClassicalSharp/Utils/Utils.Math.cs b/ClassicalSharp/ClassicalSharp/Utils/Utils.Math.cs
similarity index 100%
rename from ClassicalSharp/Utils/Utils.Math.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Utils.Math.cs
diff --git a/ClassicalSharp/Utils/Utils.cs b/ClassicalSharp/ClassicalSharp/Utils/Utils.cs
similarity index 100%
rename from ClassicalSharp/Utils/Utils.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Utils.cs
diff --git a/ClassicalSharp/Utils/Vector3I.cs b/ClassicalSharp/ClassicalSharp/Utils/Vector3I.cs
similarity index 100%
rename from ClassicalSharp/Utils/Vector3I.cs
rename to ClassicalSharp/ClassicalSharp/Utils/Vector3I.cs
diff --git a/InteropPatcher/InteropPatcher.csproj b/ClassicalSharp/InteropPatcher/InteropPatcher.csproj
similarity index 100%
rename from InteropPatcher/InteropPatcher.csproj
rename to ClassicalSharp/InteropPatcher/InteropPatcher.csproj
diff --git a/InteropPatcher/Mono.Cecil.Mdb.dll b/ClassicalSharp/InteropPatcher/Mono.Cecil.Mdb.dll
similarity index 100%
rename from InteropPatcher/Mono.Cecil.Mdb.dll
rename to ClassicalSharp/InteropPatcher/Mono.Cecil.Mdb.dll
diff --git a/InteropPatcher/Mono.Cecil.Pdb.dll b/ClassicalSharp/InteropPatcher/Mono.Cecil.Pdb.dll
similarity index 100%
rename from InteropPatcher/Mono.Cecil.Pdb.dll
rename to ClassicalSharp/InteropPatcher/Mono.Cecil.Pdb.dll
diff --git a/InteropPatcher/Mono.Cecil.dll b/ClassicalSharp/InteropPatcher/Mono.Cecil.dll
similarity index 100%
rename from InteropPatcher/Mono.Cecil.dll
rename to ClassicalSharp/InteropPatcher/Mono.Cecil.dll
diff --git a/InteropPatcher/Program.cs b/ClassicalSharp/InteropPatcher/Program.cs
similarity index 100%
rename from InteropPatcher/Program.cs
rename to ClassicalSharp/InteropPatcher/Program.cs
diff --git a/InteropPatcher/Properties/AssemblyInfo.cs b/ClassicalSharp/InteropPatcher/Properties/AssemblyInfo.cs
similarity index 97%
rename from InteropPatcher/Properties/AssemblyInfo.cs
rename to ClassicalSharp/InteropPatcher/Properties/AssemblyInfo.cs
index 3afff3999..a6570ddab 100644
--- a/InteropPatcher/Properties/AssemblyInfo.cs
+++ b/ClassicalSharp/InteropPatcher/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
-#region Using directives
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-#endregion
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("SharpCLI")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("SharpCLI")]
-[assembly: AssemblyCopyright("Copyright 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// This sets the default COM visibility of types in the assembly to invisible.
-// If you need to expose a type to COM, use [ComVisible(true)] on that type.
-[assembly: ComVisible(false)]
-
-// The assembly version has following format :
-//
-// Major.Minor.Build.Revision
-//
-// You can specify all the values or you can use the default the Revision and
-// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.*")]
+#region Using directives
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+#endregion
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SharpCLI")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SharpCLI")]
+[assembly: AssemblyCopyright("Copyright 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all the values or you can use the default the Revision and
+// Build Numbers by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/Launcher2/Drawing/BitmapDrawer.cs b/ClassicalSharp/Launcher2/Drawing/BitmapDrawer.cs
similarity index 100%
rename from Launcher2/Drawing/BitmapDrawer.cs
rename to ClassicalSharp/Launcher2/Drawing/BitmapDrawer.cs
diff --git a/Launcher2/Drawing/Drawer2DExt.cs b/ClassicalSharp/Launcher2/Drawing/Drawer2DExt.cs
similarity index 100%
rename from Launcher2/Drawing/Drawer2DExt.cs
rename to ClassicalSharp/Launcher2/Drawing/Drawer2DExt.cs
diff --git a/Launcher2/Drawing/Gradient.cs b/ClassicalSharp/Launcher2/Drawing/Gradient.cs
similarity index 100%
rename from Launcher2/Drawing/Gradient.cs
rename to ClassicalSharp/Launcher2/Drawing/Gradient.cs
diff --git a/Launcher2/Drawing/Platform/OSXDrawer.cs b/ClassicalSharp/Launcher2/Drawing/Platform/OSXDrawer.cs
similarity index 100%
rename from Launcher2/Drawing/Platform/OSXDrawer.cs
rename to ClassicalSharp/Launcher2/Drawing/Platform/OSXDrawer.cs
diff --git a/Launcher2/Drawing/Platform/PlatformDrawer.cs b/ClassicalSharp/Launcher2/Drawing/Platform/PlatformDrawer.cs
similarity index 100%
rename from Launcher2/Drawing/Platform/PlatformDrawer.cs
rename to ClassicalSharp/Launcher2/Drawing/Platform/PlatformDrawer.cs
diff --git a/Launcher2/Drawing/Platform/WindowsDrawer.cs b/ClassicalSharp/Launcher2/Drawing/Platform/WindowsDrawer.cs
similarity index 100%
rename from Launcher2/Drawing/Platform/WindowsDrawer.cs
rename to ClassicalSharp/Launcher2/Drawing/Platform/WindowsDrawer.cs
diff --git a/Launcher2/Drawing/Platform/X11Drawer.cs b/ClassicalSharp/Launcher2/Drawing/Platform/X11Drawer.cs
similarity index 100%
rename from Launcher2/Drawing/Platform/X11Drawer.cs
rename to ClassicalSharp/Launcher2/Drawing/Platform/X11Drawer.cs
diff --git a/Launcher2/Gui/Screens/ChooseModeScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/ChooseModeScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/ChooseModeScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/ChooseModeScreen.cs
diff --git a/Launcher2/Gui/Screens/ColoursScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/ColoursScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/ColoursScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/ColoursScreen.cs
diff --git a/Launcher2/Gui/Screens/DirectConnectScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/DirectConnectScreen.cs
similarity index 96%
rename from Launcher2/Gui/Screens/DirectConnectScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/DirectConnectScreen.cs
index cbfe1ed54..5d1bcae8e 100644
--- a/Launcher2/Gui/Screens/DirectConnectScreen.cs
+++ b/ClassicalSharp/Launcher2/Gui/Screens/DirectConnectScreen.cs
@@ -1,172 +1,172 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Net;
-using ClassicalSharp;
-using Launcher.Gui.Views;
-using Launcher.Gui.Widgets;
-
-namespace Launcher.Gui.Screens {
- public sealed class DirectConnectScreen : InputScreen {
-
- DirectConnectView view;
- public DirectConnectScreen(LauncherWindow game) : base(game) {
- enterIndex = 3;
- view = new DirectConnectView(game);
- widgets = view.widgets;
- }
-
- public override void Init() {
- base.Init();
- view.Init();
- SetWidgetHandlers();
- Resize();
- }
-
- public override void Resize() {
- view.DrawAll();
- game.Dirty = true;
- }
-
- void SetWidgetHandlers() {
- widgets[view.backIndex].OnClick = SwitchToMain;
- widgets[view.connectIndex].OnClick = StartClient;
- widgets[view.ccSkinsIndex].OnClick = UseClassicubeSkinsClick;
- SetupInputHandlers();
- LoadSavedInfo();
- }
-
- void SwitchToMain(int x, int y) { game.SetScreen(new MainScreen(game)); }
-
- void SetStatus(string text) {
- LabelWidget widget = (LabelWidget)widgets[view.statusIndex];
- game.ResetArea(widget.X, widget.Y, widget.Width, widget.Height);
- widget.SetDrawData(drawer, text);
- RedrawWidget(widget);
- }
-
- void UseClassicubeSkinsClick(int mouseX, int mouseY) {
- CheckboxWidget widget = (CheckboxWidget)widgets[view.ccSkinsIndex];
- widget.Value = !widget.Value;
- RedrawWidget(widget);
- }
-
- public override void Dispose() {
- StoreFields();
- base.Dispose();
- }
-
- static string cachedUser, cachedAddress, cachedMppass;
- static bool cachedSkins;
-
- void LoadSavedInfo() {
- // restore what user last typed into the various fields
- if (cachedUser != null) {
- SetText(0, cachedUser);
- SetText(1, cachedAddress);
- SetText(2, cachedMppass);
- SetBool(cachedSkins);
- } else {
- LoadFromOptions();
- }
- }
-
- void StoreFields() {
- cachedUser = Get(0);
- cachedAddress = Get(1);
- cachedMppass = Get(2);
- cachedSkins = ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value;
- }
-
- void LoadFromOptions() {
- if (!Options.Load()) return;
-
- string user = Options.Get("launcher-dc-username", "");
- string ip = Options.Get("launcher-dc-ip", "127.0.0.1");
- string port = Options.Get("launcher-dc-port", "25565");
- bool ccSkins = Options.GetBool("launcher-dc-ccskins", true);
-
- IPAddress address;
- if (!IPAddress.TryParse(ip, out address)) ip = "127.0.0.1";
- ushort portNum;
- if (!UInt16.TryParse(port, out portNum)) port = "25565";
-
- string mppass = Options.Get("launcher-dc-mppass", null);
- mppass = Secure.Decode(mppass, user);
-
- SetText(0, user);
- SetText(1, ip + ":" + port);
- SetText(2, mppass);
- SetBool(ccSkins);
- }
-
- void SaveToOptions(ClientStartData data, bool ccSkins) {
- if (!Options.Load())
- return;
-
- Options.Set("launcher-dc-username", data.Username);
- Options.Set("launcher-dc-ip", data.Ip);
- Options.Set("launcher-dc-port", data.Port);
- Options.Set("launcher-dc-mppass", Secure.Encode(data.Mppass, data.Username));
- Options.Set("launcher-dc-ccskins", ccSkins);
- Options.Save();
- }
-
- void SetText(int index, string text) {
- ((InputWidget)widgets[index]).SetDrawData(drawer, text);
- }
-
- void SetBool(bool value) {
- ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value = value;
- }
-
- void StartClient(int mouseX, int mouseY) {
- string address = Get(1);
- int index = address.LastIndexOf(':');
- if (index <= 0 || index == address.Length - 1) {
- SetStatus("&eInvalid address"); return;
- }
-
- string ipPart = address.Substring(0, index);
- string portPart = address.Substring(index + 1, address.Length - index - 1);
- ClientStartData data = GetStartData(Get(0), Get(2), ipPart, portPart);
- if (data == null) return;
-
- bool ccSkins = ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value;
- SaveToOptions(data, ccSkins);
- Client.Start(data, ccSkins, ref game.ShouldExit);
- }
-
- static Random rnd = new Random();
- static byte[] rndBytes = new byte[8];
- ClientStartData GetStartData(string user, string mppass, string ip, string port) {
- SetStatus("");
-
- if (String.IsNullOrEmpty(user)) {
- SetStatus("&eUsername required"); return null;
- }
-
- IPAddress realIp;
- if (!IPAddress.TryParse(ip, out realIp) && ip != "localhost") {
- SetStatus("&eInvalid ip"); return null;
- }
- if (ip == "localhost") ip = "127.0.0.1";
-
- ushort realPort;
- if (!UInt16.TryParse(port, out realPort)) {
- SetStatus("&eInvalid port"); return null;
- }
-
- if (String.IsNullOrEmpty(mppass))
- mppass = "(none)";
-
- ClientStartData data = new ClientStartData(user, mppass, ip, port, "");
- if (Utils.CaselessEquals(user, "rand()") || Utils.CaselessEquals(user, "random()")) {
- rnd.NextBytes(rndBytes);
- data.Username = Convert.ToBase64String(rndBytes).TrimEnd('=');
- }
- return data;
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Net;
+using ClassicalSharp;
+using Launcher.Gui.Views;
+using Launcher.Gui.Widgets;
+
+namespace Launcher.Gui.Screens {
+ public sealed class DirectConnectScreen : InputScreen {
+
+ DirectConnectView view;
+ public DirectConnectScreen(LauncherWindow game) : base(game) {
+ enterIndex = 3;
+ view = new DirectConnectView(game);
+ widgets = view.widgets;
+ }
+
+ public override void Init() {
+ base.Init();
+ view.Init();
+ SetWidgetHandlers();
+ Resize();
+ }
+
+ public override void Resize() {
+ view.DrawAll();
+ game.Dirty = true;
+ }
+
+ void SetWidgetHandlers() {
+ widgets[view.backIndex].OnClick = SwitchToMain;
+ widgets[view.connectIndex].OnClick = StartClient;
+ widgets[view.ccSkinsIndex].OnClick = UseClassicubeSkinsClick;
+ SetupInputHandlers();
+ LoadSavedInfo();
+ }
+
+ void SwitchToMain(int x, int y) { game.SetScreen(new MainScreen(game)); }
+
+ void SetStatus(string text) {
+ LabelWidget widget = (LabelWidget)widgets[view.statusIndex];
+ game.ResetArea(widget.X, widget.Y, widget.Width, widget.Height);
+ widget.SetDrawData(drawer, text);
+ RedrawWidget(widget);
+ }
+
+ void UseClassicubeSkinsClick(int mouseX, int mouseY) {
+ CheckboxWidget widget = (CheckboxWidget)widgets[view.ccSkinsIndex];
+ widget.Value = !widget.Value;
+ RedrawWidget(widget);
+ }
+
+ public override void Dispose() {
+ StoreFields();
+ base.Dispose();
+ }
+
+ static string cachedUser, cachedAddress, cachedMppass;
+ static bool cachedSkins;
+
+ void LoadSavedInfo() {
+ // restore what user last typed into the various fields
+ if (cachedUser != null) {
+ SetText(0, cachedUser);
+ SetText(1, cachedAddress);
+ SetText(2, cachedMppass);
+ SetBool(cachedSkins);
+ } else {
+ LoadFromOptions();
+ }
+ }
+
+ void StoreFields() {
+ cachedUser = Get(0);
+ cachedAddress = Get(1);
+ cachedMppass = Get(2);
+ cachedSkins = ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value;
+ }
+
+ void LoadFromOptions() {
+ if (!Options.Load()) return;
+
+ string user = Options.Get("launcher-dc-username", "");
+ string ip = Options.Get("launcher-dc-ip", "127.0.0.1");
+ string port = Options.Get("launcher-dc-port", "25565");
+ bool ccSkins = Options.GetBool("launcher-dc-ccskins", true);
+
+ IPAddress address;
+ if (!IPAddress.TryParse(ip, out address)) ip = "127.0.0.1";
+ ushort portNum;
+ if (!UInt16.TryParse(port, out portNum)) port = "25565";
+
+ string mppass = Options.Get("launcher-dc-mppass", null);
+ mppass = Secure.Decode(mppass, user);
+
+ SetText(0, user);
+ SetText(1, ip + ":" + port);
+ SetText(2, mppass);
+ SetBool(ccSkins);
+ }
+
+ void SaveToOptions(ClientStartData data, bool ccSkins) {
+ if (!Options.Load())
+ return;
+
+ Options.Set("launcher-dc-username", data.Username);
+ Options.Set("launcher-dc-ip", data.Ip);
+ Options.Set("launcher-dc-port", data.Port);
+ Options.Set("launcher-dc-mppass", Secure.Encode(data.Mppass, data.Username));
+ Options.Set("launcher-dc-ccskins", ccSkins);
+ Options.Save();
+ }
+
+ void SetText(int index, string text) {
+ ((InputWidget)widgets[index]).SetDrawData(drawer, text);
+ }
+
+ void SetBool(bool value) {
+ ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value = value;
+ }
+
+ void StartClient(int mouseX, int mouseY) {
+ string address = Get(1);
+ int index = address.LastIndexOf(':');
+ if (index <= 0 || index == address.Length - 1) {
+ SetStatus("&eInvalid address"); return;
+ }
+
+ string ipPart = address.Substring(0, index);
+ string portPart = address.Substring(index + 1, address.Length - index - 1);
+ ClientStartData data = GetStartData(Get(0), Get(2), ipPart, portPart);
+ if (data == null) return;
+
+ bool ccSkins = ((CheckboxWidget)widgets[view.ccSkinsIndex]).Value;
+ SaveToOptions(data, ccSkins);
+ Client.Start(data, ccSkins, ref game.ShouldExit);
+ }
+
+ static Random rnd = new Random();
+ static byte[] rndBytes = new byte[8];
+ ClientStartData GetStartData(string user, string mppass, string ip, string port) {
+ SetStatus("");
+
+ if (String.IsNullOrEmpty(user)) {
+ SetStatus("&eUsername required"); return null;
+ }
+
+ IPAddress realIp;
+ if (!IPAddress.TryParse(ip, out realIp) && ip != "localhost") {
+ SetStatus("&eInvalid ip"); return null;
+ }
+ if (ip == "localhost") ip = "127.0.0.1";
+
+ ushort realPort;
+ if (!UInt16.TryParse(port, out realPort)) {
+ SetStatus("&eInvalid port"); return null;
+ }
+
+ if (String.IsNullOrEmpty(mppass))
+ mppass = "(none)";
+
+ ClientStartData data = new ClientStartData(user, mppass, ip, port, "");
+ if (Utils.CaselessEquals(user, "rand()") || Utils.CaselessEquals(user, "random()")) {
+ rnd.NextBytes(rndBytes);
+ data.Username = Convert.ToBase64String(rndBytes).TrimEnd('=');
+ }
+ return data;
+ }
+ }
+}
diff --git a/Launcher2/Gui/Screens/InputScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/InputScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/InputScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/InputScreen.cs
diff --git a/Launcher2/Gui/Screens/MainScreen.Classicube.cs b/ClassicalSharp/Launcher2/Gui/Screens/MainScreen.Classicube.cs
similarity index 100%
rename from Launcher2/Gui/Screens/MainScreen.Classicube.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/MainScreen.Classicube.cs
diff --git a/Launcher2/Gui/Screens/MainScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/MainScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/MainScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/MainScreen.cs
diff --git a/Launcher2/Gui/Screens/ResourcesScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/ResourcesScreen.cs
similarity index 95%
rename from Launcher2/Gui/Screens/ResourcesScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/ResourcesScreen.cs
index c4d29f72b..cac6828ac 100644
--- a/Launcher2/Gui/Screens/ResourcesScreen.cs
+++ b/ClassicalSharp/Launcher2/Gui/Screens/ResourcesScreen.cs
@@ -1,111 +1,111 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using ClassicalSharp;
-using ClassicalSharp.Network;
-using Launcher.Gui.Views;
-using Launcher.Patcher;
-
-namespace Launcher.Gui.Screens {
- public sealed class ResourcesScreen : Screen {
-
- ResourceFetcher fetcher;
- ResourcesView view;
- int lastProgress = int.MinValue;
-
- public ResourcesScreen(LauncherWindow game) : base(game) {
- view = new ResourcesView(game);
- widgets = view.widgets;
- }
-
- public override void Init() {
- base.Init();
- view.Init();
-
- SetWidgetHandlers();
- Resize();
- }
-
- void SetWidgetHandlers() {
- widgets[view.yesIndex].OnClick = DownloadResources;
- widgets[view.noIndex].OnClick = GotoNextMenu;
- widgets[view.cancelIndex].OnClick = GotoNextMenu;
- }
-
- bool failed;
- public override void Tick() {
- if (fetcher == null || failed) return;
- CheckCurrentProgress();
-
- if (!fetcher.Check(SetStatus))
- failed = true;
-
- if (!fetcher.Done) return;
- if (ResourceList.GetFetchFlags() != 0) {
- ResourcePatcher patcher = new ResourcePatcher(fetcher, drawer);
- patcher.Run();
- }
-
- fetcher = null;
- GC.Collect();
- game.TryLoadTexturePack();
- GotoNextMenu(0, 0);
- }
-
- public override void Resize() {
- view.DrawAll();
- game.Dirty = true;
- }
-
- void CheckCurrentProgress() {
- Request item = fetcher.downloader.CurrentItem;
- if (item == null) { lastProgress = int.MinValue; return; }
-
- int progress = fetcher.downloader.CurrentItemProgress;
- if (progress == lastProgress) return;
- lastProgress = progress;
- SetFetchStatus(progress);
- }
-
- void SetFetchStatus(int progress) {
- if (progress >= 0 && progress <= 100) {
- view.DrawProgressBox(progress);
- game.Dirty = true;
- }
- }
-
- void DownloadResources(int mouseX, int mouseY) {
- if (fetcher != null) return;
-
- fetcher = game.fetcher;
- fetcher.DownloadItems(game.Downloader, SetStatus);
- selectedWidget = null;
-
- widgets[view.yesIndex].Visible = false;
- widgets[view.noIndex].Visible = false;
- widgets[view.textIndex].Visible = false;
- widgets[view.cancelIndex].Visible = true;
- widgets[view.sliderIndex].Visible = true;
- Resize();
- }
-
- void GotoNextMenu(int x, int y) {
- game.Downloader.Clear();
- if (Platform.FileExists("options.txt")) {
- game.SetScreen(new MainScreen(game));
- } else {
- game.SetScreen(new ChooseModeScreen(game, true));
- }
- }
-
- void SetStatus(string text) {
- view.downloadingItems = true;
- view.RedrawStatus(text);
- game.Dirty = true;
- }
-
- public override void Dispose() {
- base.Dispose();
- view.Dispose();
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using ClassicalSharp;
+using ClassicalSharp.Network;
+using Launcher.Gui.Views;
+using Launcher.Patcher;
+
+namespace Launcher.Gui.Screens {
+ public sealed class ResourcesScreen : Screen {
+
+ ResourceFetcher fetcher;
+ ResourcesView view;
+ int lastProgress = int.MinValue;
+
+ public ResourcesScreen(LauncherWindow game) : base(game) {
+ view = new ResourcesView(game);
+ widgets = view.widgets;
+ }
+
+ public override void Init() {
+ base.Init();
+ view.Init();
+
+ SetWidgetHandlers();
+ Resize();
+ }
+
+ void SetWidgetHandlers() {
+ widgets[view.yesIndex].OnClick = DownloadResources;
+ widgets[view.noIndex].OnClick = GotoNextMenu;
+ widgets[view.cancelIndex].OnClick = GotoNextMenu;
+ }
+
+ bool failed;
+ public override void Tick() {
+ if (fetcher == null || failed) return;
+ CheckCurrentProgress();
+
+ if (!fetcher.Check(SetStatus))
+ failed = true;
+
+ if (!fetcher.Done) return;
+ if (ResourceList.GetFetchFlags() != 0) {
+ ResourcePatcher patcher = new ResourcePatcher(fetcher, drawer);
+ patcher.Run();
+ }
+
+ fetcher = null;
+ GC.Collect();
+ game.TryLoadTexturePack();
+ GotoNextMenu(0, 0);
+ }
+
+ public override void Resize() {
+ view.DrawAll();
+ game.Dirty = true;
+ }
+
+ void CheckCurrentProgress() {
+ Request item = fetcher.downloader.CurrentItem;
+ if (item == null) { lastProgress = int.MinValue; return; }
+
+ int progress = fetcher.downloader.CurrentItemProgress;
+ if (progress == lastProgress) return;
+ lastProgress = progress;
+ SetFetchStatus(progress);
+ }
+
+ void SetFetchStatus(int progress) {
+ if (progress >= 0 && progress <= 100) {
+ view.DrawProgressBox(progress);
+ game.Dirty = true;
+ }
+ }
+
+ void DownloadResources(int mouseX, int mouseY) {
+ if (fetcher != null) return;
+
+ fetcher = game.fetcher;
+ fetcher.DownloadItems(game.Downloader, SetStatus);
+ selectedWidget = null;
+
+ widgets[view.yesIndex].Visible = false;
+ widgets[view.noIndex].Visible = false;
+ widgets[view.textIndex].Visible = false;
+ widgets[view.cancelIndex].Visible = true;
+ widgets[view.sliderIndex].Visible = true;
+ Resize();
+ }
+
+ void GotoNextMenu(int x, int y) {
+ game.Downloader.Clear();
+ if (Platform.FileExists("options.txt")) {
+ game.SetScreen(new MainScreen(game));
+ } else {
+ game.SetScreen(new ChooseModeScreen(game, true));
+ }
+ }
+
+ void SetStatus(string text) {
+ view.downloadingItems = true;
+ view.RedrawStatus(text);
+ game.Dirty = true;
+ }
+
+ public override void Dispose() {
+ base.Dispose();
+ view.Dispose();
+ }
+ }
+}
diff --git a/Launcher2/Gui/Screens/Screen.cs b/ClassicalSharp/Launcher2/Gui/Screens/Screen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/Screen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/Screen.cs
diff --git a/Launcher2/Gui/Screens/ServersScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/ServersScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/ServersScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/ServersScreen.cs
diff --git a/Launcher2/Gui/Screens/SettingsScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/SettingsScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/SettingsScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/SettingsScreen.cs
diff --git a/Launcher2/Gui/Screens/UpdatesScreen.cs b/ClassicalSharp/Launcher2/Gui/Screens/UpdatesScreen.cs
similarity index 100%
rename from Launcher2/Gui/Screens/UpdatesScreen.cs
rename to ClassicalSharp/Launcher2/Gui/Screens/UpdatesScreen.cs
diff --git a/Launcher2/Gui/TableWidget/Comparers.cs b/ClassicalSharp/Launcher2/Gui/TableWidget/Comparers.cs
similarity index 96%
rename from Launcher2/Gui/TableWidget/Comparers.cs
rename to ClassicalSharp/Launcher2/Gui/TableWidget/Comparers.cs
index 2eda2a3e3..a855e754b 100644
--- a/Launcher2/Gui/TableWidget/Comparers.cs
+++ b/ClassicalSharp/Launcher2/Gui/TableWidget/Comparers.cs
@@ -1,65 +1,65 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Collections.Generic;
-
-namespace Launcher.Gui.Widgets {
-
- abstract class TableEntryComparer : IComparer {
-
- public bool Invert = true;
-
- public abstract int Compare(TableEntry a, TableEntry b);
- }
-
- sealed class DefaultComparer : TableEntryComparer {
-
- public override int Compare(TableEntry a, TableEntry b) {
- long valX = Int64.Parse(a.Players.Substring(0, a.Players.IndexOf('/')));
- long valY = Int64.Parse(b.Players.Substring(0, b.Players.IndexOf('/')));
- int value = valY.CompareTo(valX);
- if (value != 0) return value;
-
- long timeX = Int64.Parse(a.RawUptime);
- long timeY = Int64.Parse(b.RawUptime);
- return timeY.CompareTo(timeX);
- }
- }
-
- sealed class NameComparer : TableEntryComparer {
-
- public override int Compare(TableEntry a, TableEntry b) {
- StringComparison comparison = StringComparison.CurrentCultureIgnoreCase;
- int value = String.Compare(a.Name, b.Name, comparison);
- return Invert ? -value : value;
- }
- }
-
- sealed class PlayersComparer : TableEntryComparer {
-
- public override int Compare(TableEntry a, TableEntry b) {
- long valX = Int64.Parse(a.Players.Substring(0, a.Players.IndexOf('/')));
- long valY = Int64.Parse(b.Players.Substring(0, b.Players.IndexOf('/')));
- int value = valX.CompareTo(valY);
- return Invert ? -value : value;
- }
- }
-
- sealed class UptimeComparer : TableEntryComparer {
-
- public override int Compare(TableEntry a, TableEntry b) {
- long timeX = Int64.Parse(a.RawUptime);
- long timeY = Int64.Parse(b.RawUptime);
- int value = timeX.CompareTo(timeY);
- return Invert ? -value : value;
- }
- }
-
- sealed class SoftwareComparer : TableEntryComparer {
-
- public override int Compare(TableEntry a, TableEntry b) {
- StringComparison comparison = StringComparison.CurrentCultureIgnoreCase;
- int value = String.Compare(a.Software, b.Software, comparison);
- return Invert ? -value : value;
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Collections.Generic;
+
+namespace Launcher.Gui.Widgets {
+
+ abstract class TableEntryComparer : IComparer {
+
+ public bool Invert = true;
+
+ public abstract int Compare(TableEntry a, TableEntry b);
+ }
+
+ sealed class DefaultComparer : TableEntryComparer {
+
+ public override int Compare(TableEntry a, TableEntry b) {
+ long valX = Int64.Parse(a.Players.Substring(0, a.Players.IndexOf('/')));
+ long valY = Int64.Parse(b.Players.Substring(0, b.Players.IndexOf('/')));
+ int value = valY.CompareTo(valX);
+ if (value != 0) return value;
+
+ long timeX = Int64.Parse(a.RawUptime);
+ long timeY = Int64.Parse(b.RawUptime);
+ return timeY.CompareTo(timeX);
+ }
+ }
+
+ sealed class NameComparer : TableEntryComparer {
+
+ public override int Compare(TableEntry a, TableEntry b) {
+ StringComparison comparison = StringComparison.CurrentCultureIgnoreCase;
+ int value = String.Compare(a.Name, b.Name, comparison);
+ return Invert ? -value : value;
+ }
+ }
+
+ sealed class PlayersComparer : TableEntryComparer {
+
+ public override int Compare(TableEntry a, TableEntry b) {
+ long valX = Int64.Parse(a.Players.Substring(0, a.Players.IndexOf('/')));
+ long valY = Int64.Parse(b.Players.Substring(0, b.Players.IndexOf('/')));
+ int value = valX.CompareTo(valY);
+ return Invert ? -value : value;
+ }
+ }
+
+ sealed class UptimeComparer : TableEntryComparer {
+
+ public override int Compare(TableEntry a, TableEntry b) {
+ long timeX = Int64.Parse(a.RawUptime);
+ long timeY = Int64.Parse(b.RawUptime);
+ int value = timeX.CompareTo(timeY);
+ return Invert ? -value : value;
+ }
+ }
+
+ sealed class SoftwareComparer : TableEntryComparer {
+
+ public override int Compare(TableEntry a, TableEntry b) {
+ StringComparison comparison = StringComparison.CurrentCultureIgnoreCase;
+ int value = String.Compare(a.Software, b.Software, comparison);
+ return Invert ? -value : value;
+ }
+ }
+}
diff --git a/Launcher2/Gui/TableWidget/TableView.cs b/ClassicalSharp/Launcher2/Gui/TableWidget/TableView.cs
similarity index 100%
rename from Launcher2/Gui/TableWidget/TableView.cs
rename to ClassicalSharp/Launcher2/Gui/TableWidget/TableView.cs
diff --git a/Launcher2/Gui/TableWidget/TableWidget.cs b/ClassicalSharp/Launcher2/Gui/TableWidget/TableWidget.cs
similarity index 96%
rename from Launcher2/Gui/TableWidget/TableWidget.cs
rename to ClassicalSharp/Launcher2/Gui/TableWidget/TableWidget.cs
index 25def26b2..4ca8ff3c2 100644
--- a/Launcher2/Gui/TableWidget/TableWidget.cs
+++ b/ClassicalSharp/Launcher2/Gui/TableWidget/TableWidget.cs
@@ -1,280 +1,280 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using ClassicalSharp;
-using Launcher.Web;
-
-namespace Launcher.Gui.Widgets {
-
- internal struct TableEntry {
- public string Hash, Name, Players, Uptime, Software, RawUptime, Flag;
- public int Y, Height;
- public bool Featured;
- }
-
- public delegate void TableNeedsRedrawHandler();
-
- public partial class TableWidget : Widget {
-
- TableView view;
- public TableWidget(LauncherWindow window) : base(window) {
- OnClick = HandleOnClick;
- view = new TableView();
- view.Init(window, this);
- }
-
- public TableNeedsRedrawHandler NeedRedraw;
- public Action SelectedChanged;
- public int SelectedIndex = -1;
- public string SelectedHash = "";
- public int CurrentIndex, Count;
-
- internal TableEntry[] entries;
- internal int[] order;
- internal List servers;
- internal TableEntry Get(int i) { return entries[order[i]]; }
-
- public void SetEntries(List servers) {
- entries = new TableEntry[servers.Count];
- order = new int[servers.Count];
- this.servers = servers;
-
- for (int i = 0; i < servers.Count; i++) {
- ServerListEntry e = servers[i];
- TableEntry tableEntry = default(TableEntry);
- tableEntry.Hash = e.Hash;
- tableEntry.Name = e.Name;
- tableEntry.Players = e.Players + "/" + e.MaxPlayers;
- tableEntry.Software = e.Software;
- tableEntry.Uptime = MakeUptime(e.Uptime);
- tableEntry.RawUptime = e.Uptime;
- tableEntry.Featured = e.Featured;
- tableEntry.Flag = e.Flag;
-
- entries[i] = tableEntry;
- order[i] = i;
- }
- Count = entries.Length;
- }
-
- string curFilter;
- public void FilterEntries(string filter) {
- curFilter = filter;
- Count = 0;
- for (int i = 0; i < entries.Length; i++) {
- TableEntry entry = entries[i];
- if (entry.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) {
- order[Count++] = i;
- }
- }
- for (int i = Count; i < entries.Length; i++) {
- order[i] = -100000;
- }
- }
-
- internal void GetScrollbarCoords(out int y, out int height) {
- if (Count == 0) { y = 0; height = 0; return; }
-
- float scale = Height / (float)Count;
- y = (int)Math.Ceiling(CurrentIndex * scale);
- height = (int)Math.Ceiling((view.maxIndex - CurrentIndex) * scale);
- height = Math.Min(y + height, Height) - y;
- }
-
- public void SetSelected(int index) {
- if (index >= view.maxIndex) CurrentIndex = index + 1 - view.numEntries;
- if (index < CurrentIndex) CurrentIndex = index;
- if (index >= Count) index = Count - 1;
- if (index < 0) index = 0;
-
- SelectedHash = "";
- SelectedIndex = index;
- lastIndex = index;
- ClampIndex();
-
- if (Count > 0) {
- TableEntry entry = Get(index);
- SelectedChanged(entry.Hash);
- SelectedHash = entry.Hash;
- }
- }
-
- public void SetSelected(string hash) {
- SelectedIndex = -1;
- for (int i = 0; i < Count; i++) {
- if (Get(i).Hash != hash) continue;
- SetSelected(i);
- return;
- }
- }
-
- public void ClampIndex() {
- if (CurrentIndex > Count - view.numEntries)
- CurrentIndex = Count - view.numEntries;
- if (CurrentIndex < 0)
- CurrentIndex = 0;
- }
-
- string MakeUptime(string rawSeconds) {
- TimeSpan t = TimeSpan.FromSeconds(Double.Parse(rawSeconds));
- if (t.TotalHours >= 24 * 7)
- return (int)t.TotalDays + "d";
- if (t.TotalHours >= 1)
- return (int)t.TotalHours + "h";
- if (t.TotalMinutes >= 1)
- return (int)t.TotalMinutes + "m";
- return (int)t.TotalSeconds + "s";
- }
-
-
- public int[] ColumnWidths = new int[] { 320, 65, 65, 140 };
- public int[] DesiredColumnWidths = new int[] { 320, 65, 65, 140 };
-
- public void SetDrawData(IDrawer2D drawer, Font font, Font titleFont,
- Anchor horAnchor, Anchor verAnchor, int x, int y) {
- SetLocation(horAnchor, verAnchor, x, y);
- view.SetDrawData(drawer, font, titleFont);
- }
-
- public void RecalculateDrawData() { view.RecalculateDrawData(); }
- public void RedrawData(IDrawer2D drawer) { view.RedrawData(drawer); }
- public void RedrawFlags() { view.DrawFlags(); }
-
- public override void Redraw(IDrawer2D drawer) {
- RecalculateDrawData();
- RedrawData(drawer);
- }
-
-
- DefaultComparer defComp = new DefaultComparer();
- NameComparer nameComp = new NameComparer();
- PlayersComparer playerComp = new PlayersComparer();
- UptimeComparer uptimeComp = new UptimeComparer();
- SoftwareComparer softwareComp = new SoftwareComparer();
- internal int DraggingColumn = -1;
- internal bool DraggingScrollbar = false;
- internal int mouseOffset;
-
- public void SortDefault() {
- SortEntries(defComp, true);
- }
-
- void SelectHeader(int mouseX, int mouseY) {
- int x = X + 15;
- for (int i = 0; i < ColumnWidths.Length; i++) {
- x += ColumnWidths[i] + 10;
- if (mouseX >= x - 8 && mouseX < x + 8) {
- DraggingColumn = i;
- lastIndex = -10; return;
- }
- }
- TrySortColumns(mouseX);
- }
-
- void TrySortColumns(int mouseX) {
- int x = X + TableView.flagPadding;
- if (mouseX >= x && mouseX < x + ColumnWidths[0]) {
- SortEntries(nameComp, false); return;
- }
-
- x += ColumnWidths[0] + 10;
- if (mouseX >= x && mouseX < x + ColumnWidths[1]) {
- SortEntries(playerComp, false); return;
- }
-
- x += ColumnWidths[1] + 10;
- if (mouseX >= x && mouseX < x + ColumnWidths[2]) {
- SortEntries(uptimeComp, false); return;
- }
-
- x += ColumnWidths[2] + 10;
- if (mouseX >= x) {
- SortEntries(softwareComp, false); return;
- }
- }
-
- void SortEntries(TableEntryComparer comparer, bool noRedraw) {
- Array.Sort(entries, 0, entries.Length, comparer);
- lastIndex = -10;
- if (curFilter != null && curFilter.Length > 0) {
- FilterEntries(curFilter);
- }
-
- if (noRedraw) return;
- comparer.Invert = !comparer.Invert;
- SetSelected(SelectedHash);
- NeedRedraw();
- }
-
- void GetSelectedServer(int mouseX, int mouseY) {
- for (int i = 0; i < Count; i++) {
- TableEntry entry = Get(i);
- if (mouseY < entry.Y || mouseY >= entry.Y + entry.Height + 2) continue;
-
- if (lastIndex == i && (DateTime.UtcNow - lastPress).TotalSeconds < 1) {
- Window.ConnectToServer(servers, entry.Hash);
- lastPress = DateTime.MinValue;
- return;
- }
-
- SetSelected(i);
- NeedRedraw();
- break;
- }
- }
-
- void HandleOnClick(int mouseX, int mouseY) {
- if (mouseX >= Window.Width - 10) {
- ScrollbarClick(mouseY);
- DraggingScrollbar = true;
- lastIndex = -10; return;
- }
-
- if (mouseY >= view.headerStartY && mouseY < view.headerEndY) {
- SelectHeader(mouseX, mouseY);
- } else {
- GetSelectedServer(mouseX, mouseY);
- }
- lastPress = DateTime.UtcNow;
- }
-
- int lastIndex = -10;
- DateTime lastPress;
- public void MouseMove(int x, int y, int deltaX, int deltaY) {
- if (DraggingScrollbar) {
- y -= Y;
- float scale = Height / (float)Count;
- CurrentIndex = (int)((y - mouseOffset) / scale);
- ClampIndex();
- NeedRedraw();
- } else if (DraggingColumn >= 0) {
- if (x >= Window.Width - 20) return;
- int col = DraggingColumn;
- ColumnWidths[col] += deltaX;
- Utils.Clamp(ref ColumnWidths[col], 20, Window.Width - 20);
- DesiredColumnWidths[col] = ColumnWidths[col];
- NeedRedraw();
- }
-
- }
-
- void ScrollbarClick(int mouseY) {
- mouseY -= Y;
- int y, height;
- GetScrollbarCoords(out y, out height);
- int delta = (view.maxIndex - CurrentIndex);
-
- if (mouseY < y) {
- CurrentIndex -= delta;
- } else if (mouseY >= y + height) {
- CurrentIndex += delta;
- } else {
- DraggingScrollbar = true;
- mouseOffset = mouseY - y;
- }
- ClampIndex();
- NeedRedraw();
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using ClassicalSharp;
+using Launcher.Web;
+
+namespace Launcher.Gui.Widgets {
+
+ internal struct TableEntry {
+ public string Hash, Name, Players, Uptime, Software, RawUptime, Flag;
+ public int Y, Height;
+ public bool Featured;
+ }
+
+ public delegate void TableNeedsRedrawHandler();
+
+ public partial class TableWidget : Widget {
+
+ TableView view;
+ public TableWidget(LauncherWindow window) : base(window) {
+ OnClick = HandleOnClick;
+ view = new TableView();
+ view.Init(window, this);
+ }
+
+ public TableNeedsRedrawHandler NeedRedraw;
+ public Action SelectedChanged;
+ public int SelectedIndex = -1;
+ public string SelectedHash = "";
+ public int CurrentIndex, Count;
+
+ internal TableEntry[] entries;
+ internal int[] order;
+ internal List servers;
+ internal TableEntry Get(int i) { return entries[order[i]]; }
+
+ public void SetEntries(List servers) {
+ entries = new TableEntry[servers.Count];
+ order = new int[servers.Count];
+ this.servers = servers;
+
+ for (int i = 0; i < servers.Count; i++) {
+ ServerListEntry e = servers[i];
+ TableEntry tableEntry = default(TableEntry);
+ tableEntry.Hash = e.Hash;
+ tableEntry.Name = e.Name;
+ tableEntry.Players = e.Players + "/" + e.MaxPlayers;
+ tableEntry.Software = e.Software;
+ tableEntry.Uptime = MakeUptime(e.Uptime);
+ tableEntry.RawUptime = e.Uptime;
+ tableEntry.Featured = e.Featured;
+ tableEntry.Flag = e.Flag;
+
+ entries[i] = tableEntry;
+ order[i] = i;
+ }
+ Count = entries.Length;
+ }
+
+ string curFilter;
+ public void FilterEntries(string filter) {
+ curFilter = filter;
+ Count = 0;
+ for (int i = 0; i < entries.Length; i++) {
+ TableEntry entry = entries[i];
+ if (entry.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) {
+ order[Count++] = i;
+ }
+ }
+ for (int i = Count; i < entries.Length; i++) {
+ order[i] = -100000;
+ }
+ }
+
+ internal void GetScrollbarCoords(out int y, out int height) {
+ if (Count == 0) { y = 0; height = 0; return; }
+
+ float scale = Height / (float)Count;
+ y = (int)Math.Ceiling(CurrentIndex * scale);
+ height = (int)Math.Ceiling((view.maxIndex - CurrentIndex) * scale);
+ height = Math.Min(y + height, Height) - y;
+ }
+
+ public void SetSelected(int index) {
+ if (index >= view.maxIndex) CurrentIndex = index + 1 - view.numEntries;
+ if (index < CurrentIndex) CurrentIndex = index;
+ if (index >= Count) index = Count - 1;
+ if (index < 0) index = 0;
+
+ SelectedHash = "";
+ SelectedIndex = index;
+ lastIndex = index;
+ ClampIndex();
+
+ if (Count > 0) {
+ TableEntry entry = Get(index);
+ SelectedChanged(entry.Hash);
+ SelectedHash = entry.Hash;
+ }
+ }
+
+ public void SetSelected(string hash) {
+ SelectedIndex = -1;
+ for (int i = 0; i < Count; i++) {
+ if (Get(i).Hash != hash) continue;
+ SetSelected(i);
+ return;
+ }
+ }
+
+ public void ClampIndex() {
+ if (CurrentIndex > Count - view.numEntries)
+ CurrentIndex = Count - view.numEntries;
+ if (CurrentIndex < 0)
+ CurrentIndex = 0;
+ }
+
+ string MakeUptime(string rawSeconds) {
+ TimeSpan t = TimeSpan.FromSeconds(Double.Parse(rawSeconds));
+ if (t.TotalHours >= 24 * 7)
+ return (int)t.TotalDays + "d";
+ if (t.TotalHours >= 1)
+ return (int)t.TotalHours + "h";
+ if (t.TotalMinutes >= 1)
+ return (int)t.TotalMinutes + "m";
+ return (int)t.TotalSeconds + "s";
+ }
+
+
+ public int[] ColumnWidths = new int[] { 320, 65, 65, 140 };
+ public int[] DesiredColumnWidths = new int[] { 320, 65, 65, 140 };
+
+ public void SetDrawData(IDrawer2D drawer, Font font, Font titleFont,
+ Anchor horAnchor, Anchor verAnchor, int x, int y) {
+ SetLocation(horAnchor, verAnchor, x, y);
+ view.SetDrawData(drawer, font, titleFont);
+ }
+
+ public void RecalculateDrawData() { view.RecalculateDrawData(); }
+ public void RedrawData(IDrawer2D drawer) { view.RedrawData(drawer); }
+ public void RedrawFlags() { view.DrawFlags(); }
+
+ public override void Redraw(IDrawer2D drawer) {
+ RecalculateDrawData();
+ RedrawData(drawer);
+ }
+
+
+ DefaultComparer defComp = new DefaultComparer();
+ NameComparer nameComp = new NameComparer();
+ PlayersComparer playerComp = new PlayersComparer();
+ UptimeComparer uptimeComp = new UptimeComparer();
+ SoftwareComparer softwareComp = new SoftwareComparer();
+ internal int DraggingColumn = -1;
+ internal bool DraggingScrollbar = false;
+ internal int mouseOffset;
+
+ public void SortDefault() {
+ SortEntries(defComp, true);
+ }
+
+ void SelectHeader(int mouseX, int mouseY) {
+ int x = X + 15;
+ for (int i = 0; i < ColumnWidths.Length; i++) {
+ x += ColumnWidths[i] + 10;
+ if (mouseX >= x - 8 && mouseX < x + 8) {
+ DraggingColumn = i;
+ lastIndex = -10; return;
+ }
+ }
+ TrySortColumns(mouseX);
+ }
+
+ void TrySortColumns(int mouseX) {
+ int x = X + TableView.flagPadding;
+ if (mouseX >= x && mouseX < x + ColumnWidths[0]) {
+ SortEntries(nameComp, false); return;
+ }
+
+ x += ColumnWidths[0] + 10;
+ if (mouseX >= x && mouseX < x + ColumnWidths[1]) {
+ SortEntries(playerComp, false); return;
+ }
+
+ x += ColumnWidths[1] + 10;
+ if (mouseX >= x && mouseX < x + ColumnWidths[2]) {
+ SortEntries(uptimeComp, false); return;
+ }
+
+ x += ColumnWidths[2] + 10;
+ if (mouseX >= x) {
+ SortEntries(softwareComp, false); return;
+ }
+ }
+
+ void SortEntries(TableEntryComparer comparer, bool noRedraw) {
+ Array.Sort(entries, 0, entries.Length, comparer);
+ lastIndex = -10;
+ if (curFilter != null && curFilter.Length > 0) {
+ FilterEntries(curFilter);
+ }
+
+ if (noRedraw) return;
+ comparer.Invert = !comparer.Invert;
+ SetSelected(SelectedHash);
+ NeedRedraw();
+ }
+
+ void GetSelectedServer(int mouseX, int mouseY) {
+ for (int i = 0; i < Count; i++) {
+ TableEntry entry = Get(i);
+ if (mouseY < entry.Y || mouseY >= entry.Y + entry.Height + 2) continue;
+
+ if (lastIndex == i && (DateTime.UtcNow - lastPress).TotalSeconds < 1) {
+ Window.ConnectToServer(servers, entry.Hash);
+ lastPress = DateTime.MinValue;
+ return;
+ }
+
+ SetSelected(i);
+ NeedRedraw();
+ break;
+ }
+ }
+
+ void HandleOnClick(int mouseX, int mouseY) {
+ if (mouseX >= Window.Width - 10) {
+ ScrollbarClick(mouseY);
+ DraggingScrollbar = true;
+ lastIndex = -10; return;
+ }
+
+ if (mouseY >= view.headerStartY && mouseY < view.headerEndY) {
+ SelectHeader(mouseX, mouseY);
+ } else {
+ GetSelectedServer(mouseX, mouseY);
+ }
+ lastPress = DateTime.UtcNow;
+ }
+
+ int lastIndex = -10;
+ DateTime lastPress;
+ public void MouseMove(int x, int y, int deltaX, int deltaY) {
+ if (DraggingScrollbar) {
+ y -= Y;
+ float scale = Height / (float)Count;
+ CurrentIndex = (int)((y - mouseOffset) / scale);
+ ClampIndex();
+ NeedRedraw();
+ } else if (DraggingColumn >= 0) {
+ if (x >= Window.Width - 20) return;
+ int col = DraggingColumn;
+ ColumnWidths[col] += deltaX;
+ Utils.Clamp(ref ColumnWidths[col], 20, Window.Width - 20);
+ DesiredColumnWidths[col] = ColumnWidths[col];
+ NeedRedraw();
+ }
+
+ }
+
+ void ScrollbarClick(int mouseY) {
+ mouseY -= Y;
+ int y, height;
+ GetScrollbarCoords(out y, out height);
+ int delta = (view.maxIndex - CurrentIndex);
+
+ if (mouseY < y) {
+ CurrentIndex -= delta;
+ } else if (mouseY >= y + height) {
+ CurrentIndex += delta;
+ } else {
+ DraggingScrollbar = true;
+ mouseOffset = mouseY - y;
+ }
+ ClampIndex();
+ NeedRedraw();
+ }
+ }
+}
diff --git a/Launcher2/Gui/Views/ChooseModeView.cs b/ClassicalSharp/Launcher2/Gui/Views/ChooseModeView.cs
similarity index 100%
rename from Launcher2/Gui/Views/ChooseModeView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/ChooseModeView.cs
diff --git a/Launcher2/Gui/Views/ColoursView.cs b/ClassicalSharp/Launcher2/Gui/Views/ColoursView.cs
similarity index 100%
rename from Launcher2/Gui/Views/ColoursView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/ColoursView.cs
diff --git a/Launcher2/Gui/Views/DirectConnectView.cs b/ClassicalSharp/Launcher2/Gui/Views/DirectConnectView.cs
similarity index 97%
rename from Launcher2/Gui/Views/DirectConnectView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/DirectConnectView.cs
index 0d2259046..da52b2718 100644
--- a/Launcher2/Gui/Views/DirectConnectView.cs
+++ b/ClassicalSharp/Launcher2/Gui/Views/DirectConnectView.cs
@@ -1,57 +1,57 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Drawing;
-using ClassicalSharp;
-using Launcher.Gui.Widgets;
-
-namespace Launcher.Gui.Views {
- public sealed class DirectConnectView : IView {
-
- internal int connectIndex, backIndex, ccSkinsIndex, statusIndex;
-
- public DirectConnectView(LauncherWindow game) : base(game) {
- widgets = new Widget[8];
- }
-
- public override void Init() {
- titleFont = new Font(game.FontName, 15, FontStyle.Bold);
- textFont = new Font(game.FontName, 14, FontStyle.Regular);
- inputHintFont = new Font(game.FontName, 12, FontStyle.Italic);
- MakeWidgets();
- }
-
- string Get(int index) {
- Widget widget = widgets[index];
- return widget == null ? "" : widget.Text;
- }
-
-
- protected override void MakeWidgets() {
- widgetIndex = 0;
-
- MakeInput(Get(0), 330, false, 32, "&gUsername..")
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -120);
- MakeInput(Get(1), 330, false, 64, "&gIP address:Port number..")
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75);
- MakeInput(Get(2), 330, false, 32, "&gMppass..")
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -30);
-
- connectIndex = widgetIndex;
- Makers.Button(this, "Connect", 110, 35, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, -110, 20);
- backIndex = widgetIndex;
- Makers.Button(this, "Back", 80, 35, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 125, 20);
-
- statusIndex = widgetIndex;
- Makers.Label(this, "", textFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 70);
- Makers.Label(this, "Use classicube.net for skins", textFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 30, 100);
-
- ccSkinsIndex = widgetIndex;
- Makers.Checkbox(this, true, 24)
- .SetLocation(Anchor.Centre, Anchor.Centre, -110, 100);
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Drawing;
+using ClassicalSharp;
+using Launcher.Gui.Widgets;
+
+namespace Launcher.Gui.Views {
+ public sealed class DirectConnectView : IView {
+
+ internal int connectIndex, backIndex, ccSkinsIndex, statusIndex;
+
+ public DirectConnectView(LauncherWindow game) : base(game) {
+ widgets = new Widget[8];
+ }
+
+ public override void Init() {
+ titleFont = new Font(game.FontName, 15, FontStyle.Bold);
+ textFont = new Font(game.FontName, 14, FontStyle.Regular);
+ inputHintFont = new Font(game.FontName, 12, FontStyle.Italic);
+ MakeWidgets();
+ }
+
+ string Get(int index) {
+ Widget widget = widgets[index];
+ return widget == null ? "" : widget.Text;
+ }
+
+
+ protected override void MakeWidgets() {
+ widgetIndex = 0;
+
+ MakeInput(Get(0), 330, false, 32, "&gUsername..")
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -120);
+ MakeInput(Get(1), 330, false, 64, "&gIP address:Port number..")
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75);
+ MakeInput(Get(2), 330, false, 32, "&gMppass..")
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -30);
+
+ connectIndex = widgetIndex;
+ Makers.Button(this, "Connect", 110, 35, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, -110, 20);
+ backIndex = widgetIndex;
+ Makers.Button(this, "Back", 80, 35, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 125, 20);
+
+ statusIndex = widgetIndex;
+ Makers.Label(this, "", textFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 70);
+ Makers.Label(this, "Use classicube.net for skins", textFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 30, 100);
+
+ ccSkinsIndex = widgetIndex;
+ Makers.Checkbox(this, true, 24)
+ .SetLocation(Anchor.Centre, Anchor.Centre, -110, 100);
+ }
+ }
+}
diff --git a/Launcher2/Gui/Views/IView.cs b/ClassicalSharp/Launcher2/Gui/Views/IView.cs
similarity index 96%
rename from Launcher2/Gui/Views/IView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/IView.cs
index b87be8efc..1fcbce856 100644
--- a/Launcher2/Gui/Views/IView.cs
+++ b/ClassicalSharp/Launcher2/Gui/Views/IView.cs
@@ -1,75 +1,75 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Drawing;
-using ClassicalSharp;
-using Launcher.Gui.Widgets;
-using OpenTK.Input;
-
-namespace Launcher.Gui.Views {
- public abstract class IView {
- protected internal LauncherWindow game;
- protected internal IDrawer2D drawer;
-
- internal int widgetIndex;
- internal Widget[] widgets;
- protected Font titleFont, textFont, inputHintFont;
-
- public IView(LauncherWindow game) {
- this.game = game;
- drawer = game.Drawer;
- }
-
- /// Function called to setup the widgets and other data for this view.
- public abstract void Init();
-
- /// Function called to redraw all widgets in this view.
- public virtual void DrawAll() {
- MakeWidgets();
- RedrawAllButtonBackgrounds();
-
- using (drawer) {
- drawer.SetBitmap(game.Framebuffer);
- RedrawAll();
- }
- }
-
- /// Cleans up all native resources held by this view.
- public virtual void Dispose() {
- if (titleFont != null) titleFont.Dispose();
- if (textFont != null) textFont.Dispose();
- if (inputHintFont != null) inputHintFont.Dispose();
- }
-
- /// Creates or updates all the widgets for this view.
- protected abstract void MakeWidgets();
-
- protected void RedrawAllButtonBackgrounds() {
- int buttons = 0;
- for (int i = 0; i < widgets.Length; i++) {
- if (!(widgets[i] is ButtonWidget)) continue;
- buttons++;
- }
- if (buttons == 0) return;
-
- using (FastBitmap bmp = game.LockBits()) {
- for (int i = 0; i < widgets.Length; i++) {
- ButtonWidget button = widgets[i] as ButtonWidget;
- if (button != null)
- button.RedrawBackground(bmp);
- }
- }
- }
-
- protected void RedrawAll() {
- for (int i = 0; i < widgets.Length; i++) {
- widgets[i].Redraw(drawer);
- }
- }
-
- protected Widget MakeInput(string text, int width,
- bool password, int maxChars, string hint) {
- return Makers.Input(this, text, width, textFont,
- inputHintFont, password, maxChars, hint);
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Drawing;
+using ClassicalSharp;
+using Launcher.Gui.Widgets;
+using OpenTK.Input;
+
+namespace Launcher.Gui.Views {
+ public abstract class IView {
+ protected internal LauncherWindow game;
+ protected internal IDrawer2D drawer;
+
+ internal int widgetIndex;
+ internal Widget[] widgets;
+ protected Font titleFont, textFont, inputHintFont;
+
+ public IView(LauncherWindow game) {
+ this.game = game;
+ drawer = game.Drawer;
+ }
+
+ /// Function called to setup the widgets and other data for this view.
+ public abstract void Init();
+
+ /// Function called to redraw all widgets in this view.
+ public virtual void DrawAll() {
+ MakeWidgets();
+ RedrawAllButtonBackgrounds();
+
+ using (drawer) {
+ drawer.SetBitmap(game.Framebuffer);
+ RedrawAll();
+ }
+ }
+
+ /// Cleans up all native resources held by this view.
+ public virtual void Dispose() {
+ if (titleFont != null) titleFont.Dispose();
+ if (textFont != null) textFont.Dispose();
+ if (inputHintFont != null) inputHintFont.Dispose();
+ }
+
+ /// Creates or updates all the widgets for this view.
+ protected abstract void MakeWidgets();
+
+ protected void RedrawAllButtonBackgrounds() {
+ int buttons = 0;
+ for (int i = 0; i < widgets.Length; i++) {
+ if (!(widgets[i] is ButtonWidget)) continue;
+ buttons++;
+ }
+ if (buttons == 0) return;
+
+ using (FastBitmap bmp = game.LockBits()) {
+ for (int i = 0; i < widgets.Length; i++) {
+ ButtonWidget button = widgets[i] as ButtonWidget;
+ if (button != null)
+ button.RedrawBackground(bmp);
+ }
+ }
+ }
+
+ protected void RedrawAll() {
+ for (int i = 0; i < widgets.Length; i++) {
+ widgets[i].Redraw(drawer);
+ }
+ }
+
+ protected Widget MakeInput(string text, int width,
+ bool password, int maxChars, string hint) {
+ return Makers.Input(this, text, width, textFont,
+ inputHintFont, password, maxChars, hint);
+ }
+ }
+}
diff --git a/Launcher2/Gui/Views/MainView.cs b/ClassicalSharp/Launcher2/Gui/Views/MainView.cs
similarity index 97%
rename from Launcher2/Gui/Views/MainView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/MainView.cs
index b70a65a6f..6d8118b35 100644
--- a/Launcher2/Gui/Views/MainView.cs
+++ b/ClassicalSharp/Launcher2/Gui/Views/MainView.cs
@@ -1,75 +1,75 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Drawing;
-using ClassicalSharp;
-using Launcher.Gui.Widgets;
-
-namespace Launcher.Gui.Views {
- public sealed class MainView : IView {
-
- internal int loginIndex, resIndex, dcIndex, spIndex, statusIndex, usernameIndex;
- internal int sslIndex, settingsIndex;
- const int buttonWidth = 220, buttonHeight = 35, sideButtonWidth = 150;
-
- public MainView(LauncherWindow game) : base(game) {
- widgets = new Widget[11];
- }
-
- public override void Init() {
- titleFont = new Font(game.FontName, 16, FontStyle.Bold);
- textFont = new Font(game.FontName, 14, FontStyle.Regular);
- inputHintFont = new Font(game.FontName, 12, FontStyle.Italic);
- MakeWidgets();
- }
-
- string Get(int index) {
- Widget widget = widgets[index];
- return widget == null ? "" : widget.Text;
- }
-
-
- internal string updateText = "&eChecking..";
- protected override void MakeWidgets() {
- widgetIndex = 0;
- usernameIndex = widgetIndex;
- MakeInput(Get(0), 280, false, 16, "&gUsername..")
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -120);
- MakeInput(Get(1), 280, true, 64, "&gPassword..")
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75);
-
- loginIndex = widgetIndex;
- Makers.Button(this, "Sign in", 100, buttonHeight, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, -90, -25);
- statusIndex = widgetIndex;
- Makers.Label(this, Get(statusIndex), textFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 20);
-
-
- resIndex = widgetIndex;
- Makers.Button(this, "Resume", 100, buttonHeight, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 90, -25);
- dcIndex = widgetIndex;
- Makers.Button(this, "Direct connect", 200, buttonHeight, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 60);
- spIndex = widgetIndex;
- Makers.Button(this, "Singleplayer", 200, buttonHeight, titleFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 0, 110);
-
- sslIndex = widgetIndex;
- bool sslVisible = widgets[sslIndex] != null && widgets[sslIndex].Visible;
- Makers.Checkbox(this, true, 30)
- .SetLocation(Anchor.Centre, Anchor.Centre, 160, -20);
- Makers.Label(this, "Skip SSL check", textFont)
- .SetLocation(Anchor.Centre, Anchor.Centre, 250, -20);
- widgets[sslIndex].Visible = sslVisible;
- widgets[sslIndex + 1].Visible = sslVisible;
-
- Makers.Label(this, updateText, inputHintFont)
- .SetLocation(Anchor.Max, Anchor.Max, -10, -45);
-
- settingsIndex = widgetIndex;
- Makers.Button(this, "Options", 100, buttonHeight, titleFont)
- .SetLocation(Anchor.Max, Anchor.Max, -6, -6);
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Drawing;
+using ClassicalSharp;
+using Launcher.Gui.Widgets;
+
+namespace Launcher.Gui.Views {
+ public sealed class MainView : IView {
+
+ internal int loginIndex, resIndex, dcIndex, spIndex, statusIndex, usernameIndex;
+ internal int sslIndex, settingsIndex;
+ const int buttonWidth = 220, buttonHeight = 35, sideButtonWidth = 150;
+
+ public MainView(LauncherWindow game) : base(game) {
+ widgets = new Widget[11];
+ }
+
+ public override void Init() {
+ titleFont = new Font(game.FontName, 16, FontStyle.Bold);
+ textFont = new Font(game.FontName, 14, FontStyle.Regular);
+ inputHintFont = new Font(game.FontName, 12, FontStyle.Italic);
+ MakeWidgets();
+ }
+
+ string Get(int index) {
+ Widget widget = widgets[index];
+ return widget == null ? "" : widget.Text;
+ }
+
+
+ internal string updateText = "&eChecking..";
+ protected override void MakeWidgets() {
+ widgetIndex = 0;
+ usernameIndex = widgetIndex;
+ MakeInput(Get(0), 280, false, 16, "&gUsername..")
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -120);
+ MakeInput(Get(1), 280, true, 64, "&gPassword..")
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, -75);
+
+ loginIndex = widgetIndex;
+ Makers.Button(this, "Sign in", 100, buttonHeight, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, -90, -25);
+ statusIndex = widgetIndex;
+ Makers.Label(this, Get(statusIndex), textFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 20);
+
+
+ resIndex = widgetIndex;
+ Makers.Button(this, "Resume", 100, buttonHeight, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 90, -25);
+ dcIndex = widgetIndex;
+ Makers.Button(this, "Direct connect", 200, buttonHeight, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 60);
+ spIndex = widgetIndex;
+ Makers.Button(this, "Singleplayer", 200, buttonHeight, titleFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 0, 110);
+
+ sslIndex = widgetIndex;
+ bool sslVisible = widgets[sslIndex] != null && widgets[sslIndex].Visible;
+ Makers.Checkbox(this, true, 30)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 160, -20);
+ Makers.Label(this, "Skip SSL check", textFont)
+ .SetLocation(Anchor.Centre, Anchor.Centre, 250, -20);
+ widgets[sslIndex].Visible = sslVisible;
+ widgets[sslIndex + 1].Visible = sslVisible;
+
+ Makers.Label(this, updateText, inputHintFont)
+ .SetLocation(Anchor.Max, Anchor.Max, -10, -45);
+
+ settingsIndex = widgetIndex;
+ Makers.Button(this, "Options", 100, buttonHeight, titleFont)
+ .SetLocation(Anchor.Max, Anchor.Max, -6, -6);
+ }
+ }
+}
diff --git a/Launcher2/Gui/Views/ResourcesView.cs b/ClassicalSharp/Launcher2/Gui/Views/ResourcesView.cs
similarity index 100%
rename from Launcher2/Gui/Views/ResourcesView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/ResourcesView.cs
diff --git a/Launcher2/Gui/Views/ServersView.cs b/ClassicalSharp/Launcher2/Gui/Views/ServersView.cs
similarity index 100%
rename from Launcher2/Gui/Views/ServersView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/ServersView.cs
diff --git a/Launcher2/Gui/Views/SettingsView.cs b/ClassicalSharp/Launcher2/Gui/Views/SettingsView.cs
similarity index 100%
rename from Launcher2/Gui/Views/SettingsView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/SettingsView.cs
diff --git a/Launcher2/Gui/Views/UpdatesView.cs b/ClassicalSharp/Launcher2/Gui/Views/UpdatesView.cs
similarity index 100%
rename from Launcher2/Gui/Views/UpdatesView.cs
rename to ClassicalSharp/Launcher2/Gui/Views/UpdatesView.cs
diff --git a/Launcher2/Gui/Widgets/BitmapWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/BitmapWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/BitmapWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/BitmapWidget.cs
diff --git a/Launcher2/Gui/Widgets/ButtonWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/ButtonWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/ButtonWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/ButtonWidget.cs
diff --git a/Launcher2/Gui/Widgets/CheckboxWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/CheckboxWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/CheckboxWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/CheckboxWidget.cs
diff --git a/Launcher2/Gui/Widgets/InputText.cs b/ClassicalSharp/Launcher2/Gui/Widgets/InputText.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/InputText.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/InputText.cs
diff --git a/Launcher2/Gui/Widgets/InputWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/InputWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/InputWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/InputWidget.cs
diff --git a/Launcher2/Gui/Widgets/LabelWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/LabelWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/LabelWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/LabelWidget.cs
diff --git a/Launcher2/Gui/Widgets/Makers.cs b/ClassicalSharp/Launcher2/Gui/Widgets/Makers.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/Makers.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/Makers.cs
diff --git a/Launcher2/Gui/Widgets/SliderWidget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/SliderWidget.cs
similarity index 100%
rename from Launcher2/Gui/Widgets/SliderWidget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/SliderWidget.cs
diff --git a/Launcher2/Gui/Widgets/Widget.cs b/ClassicalSharp/Launcher2/Gui/Widgets/Widget.cs
similarity index 97%
rename from Launcher2/Gui/Widgets/Widget.cs
rename to ClassicalSharp/Launcher2/Gui/Widgets/Widget.cs
index 90f0ae00f..9f68f5741 100644
--- a/Launcher2/Gui/Widgets/Widget.cs
+++ b/ClassicalSharp/Launcher2/Gui/Widgets/Widget.cs
@@ -1,71 +1,71 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using ClassicalSharp;
-
-namespace Launcher.Gui.Widgets {
-
- public delegate void WidgetClickHandler(int mouseX, int mouseY);
-
- /// Represents a graphical element/control.
- public abstract class Widget {
-
- public int X, Y, Width, Height;
- public LauncherWindow Window;
-
- /// The text associated with this widget.
- public string Text;
-
- /// Specifies the horizontal reference point for when the widget is resized.
- public Anchor HorizontalAnchor;
-
- /// Specifies the vertical reference point for when the widget is resized.
- public Anchor VerticalAnchor;
-
- /// Horizontal offset from the reference point in pixels.
- public int XOffset;
-
- /// Vertical offset from the reference point in pixels.
- public int YOffset;
-
- /// Whether this widget should be rendered and interactable with.
- public bool Visible = true;
-
- /// Whether this widget is the active widget selected by the user.
- public bool Active;
-
- /// Whether this widget can be selected via pressing tab.
- public bool TabSelectable;
-
- public WidgetClickHandler OnClick;
-
- public Widget(LauncherWindow window) {
- Window = window;
- }
-
- /// Redraws the contents of this widget.
- public abstract void Redraw(IDrawer2D drawer);
-
-
- /// Sets the reference points for when this widget is resized,
- /// and the offsets from the reference points (anchors) in pixels.
- /// Updates the position of the widget.
- public void SetLocation(Anchor horAnchor, Anchor verAnchor, int xOffset, int yOffset) {
- HorizontalAnchor = horAnchor; VerticalAnchor = verAnchor;
- XOffset = xOffset; YOffset = yOffset;
- CalculatePosition();
- }
-
- /// Calculates the position of this widget in the window,
- /// based on its anchor points and offset from the anchor points.
- public void CalculatePosition() {
- X = CalcPos(HorizontalAnchor, XOffset, Width, Window.Width);
- Y = CalcPos(VerticalAnchor, YOffset, Height, Window.Height);
- }
-
- static int CalcPos(Anchor anchor, int offset, int size, int axisLen) {
- if (anchor == Anchor.Min) return offset;
- if (anchor == Anchor.Max) return offset + axisLen - size;
- return offset + axisLen / 2 - size / 2;
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using ClassicalSharp;
+
+namespace Launcher.Gui.Widgets {
+
+ public delegate void WidgetClickHandler(int mouseX, int mouseY);
+
+ /// Represents a graphical element/control.
+ public abstract class Widget {
+
+ public int X, Y, Width, Height;
+ public LauncherWindow Window;
+
+ /// The text associated with this widget.
+ public string Text;
+
+ /// Specifies the horizontal reference point for when the widget is resized.
+ public Anchor HorizontalAnchor;
+
+ /// Specifies the vertical reference point for when the widget is resized.
+ public Anchor VerticalAnchor;
+
+ /// Horizontal offset from the reference point in pixels.
+ public int XOffset;
+
+ /// Vertical offset from the reference point in pixels.
+ public int YOffset;
+
+ /// Whether this widget should be rendered and interactable with.
+ public bool Visible = true;
+
+ /// Whether this widget is the active widget selected by the user.
+ public bool Active;
+
+ /// Whether this widget can be selected via pressing tab.
+ public bool TabSelectable;
+
+ public WidgetClickHandler OnClick;
+
+ public Widget(LauncherWindow window) {
+ Window = window;
+ }
+
+ /// Redraws the contents of this widget.
+ public abstract void Redraw(IDrawer2D drawer);
+
+
+ /// Sets the reference points for when this widget is resized,
+ /// and the offsets from the reference points (anchors) in pixels.
+ /// Updates the position of the widget.
+ public void SetLocation(Anchor horAnchor, Anchor verAnchor, int xOffset, int yOffset) {
+ HorizontalAnchor = horAnchor; VerticalAnchor = verAnchor;
+ XOffset = xOffset; YOffset = yOffset;
+ CalculatePosition();
+ }
+
+ /// Calculates the position of this widget in the window,
+ /// based on its anchor points and offset from the anchor points.
+ public void CalculatePosition() {
+ X = CalcPos(HorizontalAnchor, XOffset, Width, Window.Width);
+ Y = CalcPos(VerticalAnchor, YOffset, Height, Window.Height);
+ }
+
+ static int CalcPos(Anchor anchor, int offset, int size, int axisLen) {
+ if (anchor == Anchor.Min) return offset;
+ if (anchor == Anchor.Max) return offset + axisLen - size;
+ return offset + axisLen / 2 - size / 2;
+ }
+ }
+}
diff --git a/Launcher2/Launcher2.csproj b/ClassicalSharp/Launcher2/Launcher2.csproj
similarity index 100%
rename from Launcher2/Launcher2.csproj
rename to ClassicalSharp/Launcher2/Launcher2.csproj
diff --git a/Launcher2/LauncherWindow.Background.cs b/ClassicalSharp/Launcher2/LauncherWindow.Background.cs
similarity index 100%
rename from Launcher2/LauncherWindow.Background.cs
rename to ClassicalSharp/Launcher2/LauncherWindow.Background.cs
diff --git a/Launcher2/LauncherWindow.cs b/ClassicalSharp/Launcher2/LauncherWindow.cs
similarity index 100%
rename from Launcher2/LauncherWindow.cs
rename to ClassicalSharp/Launcher2/LauncherWindow.cs
diff --git a/Launcher2/Patcher/ResourceChecker.cs b/ClassicalSharp/Launcher2/Patcher/ResourceChecker.cs
similarity index 100%
rename from Launcher2/Patcher/ResourceChecker.cs
rename to ClassicalSharp/Launcher2/Patcher/ResourceChecker.cs
diff --git a/Launcher2/Patcher/ResourceFetcher.cs b/ClassicalSharp/Launcher2/Patcher/ResourceFetcher.cs
similarity index 100%
rename from Launcher2/Patcher/ResourceFetcher.cs
rename to ClassicalSharp/Launcher2/Patcher/ResourceFetcher.cs
diff --git a/Launcher2/Patcher/ResourcePatcher.cs b/ClassicalSharp/Launcher2/Patcher/ResourcePatcher.cs
similarity index 100%
rename from Launcher2/Patcher/ResourcePatcher.cs
rename to ClassicalSharp/Launcher2/Patcher/ResourcePatcher.cs
diff --git a/Launcher2/Patcher/ResourcesList.cs b/ClassicalSharp/Launcher2/Patcher/ResourcesList.cs
similarity index 100%
rename from Launcher2/Patcher/ResourcesList.cs
rename to ClassicalSharp/Launcher2/Patcher/ResourcesList.cs
diff --git a/Launcher2/Patcher/SoundPatcher.cs b/ClassicalSharp/Launcher2/Patcher/SoundPatcher.cs
similarity index 100%
rename from Launcher2/Patcher/SoundPatcher.cs
rename to ClassicalSharp/Launcher2/Patcher/SoundPatcher.cs
diff --git a/Launcher2/Patcher/ZipWriter.cs b/ClassicalSharp/Launcher2/Patcher/ZipWriter.cs
similarity index 100%
rename from Launcher2/Patcher/ZipWriter.cs
rename to ClassicalSharp/Launcher2/Patcher/ZipWriter.cs
diff --git a/Launcher2/Program.cs b/ClassicalSharp/Launcher2/Program.cs
similarity index 100%
rename from Launcher2/Program.cs
rename to ClassicalSharp/Launcher2/Program.cs
diff --git a/Launcher2/Properties/AssemblyInfo.cs b/ClassicalSharp/Launcher2/Properties/AssemblyInfo.cs
similarity index 100%
rename from Launcher2/Properties/AssemblyInfo.cs
rename to ClassicalSharp/Launcher2/Properties/AssemblyInfo.cs
diff --git a/Launcher2/Updater/Applier.cs b/ClassicalSharp/Launcher2/Updater/Applier.cs
similarity index 100%
rename from Launcher2/Updater/Applier.cs
rename to ClassicalSharp/Launcher2/Updater/Applier.cs
diff --git a/Launcher2/Updater/Scripts.cs b/ClassicalSharp/Launcher2/Updater/Scripts.cs
similarity index 94%
rename from Launcher2/Updater/Scripts.cs
rename to ClassicalSharp/Launcher2/Updater/Scripts.cs
index 9bffe9008..4397ed1c4 100644
--- a/Launcher2/Updater/Scripts.cs
+++ b/ClassicalSharp/Launcher2/Updater/Scripts.cs
@@ -1,67 +1,67 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-
-namespace Launcher.Updater {
-
- public static class Scripts {
-
- public const string BatchFile =
- @"@echo off
-echo Waiting for launcher to exit..
-echo 5..
-ping 127.0.0.1 -n 2 > nul
-echo 4..
-ping 127.0.0.1 -n 2 > nul
-echo 3..
-ping 127.0.0.1 -n 2 > nul
-echo 2..
-ping 127.0.0.1 -n 2 > nul
-echo 1..
-ping 127.0.0.1 -n 2 > nul
-
-set root=%CD%
-echo Extracting files from CS_Update folder
-for /f %%f in ('dir /b ""%root%\CS_Update""') do move ""%root%\CS_Update\%%f"" ""%root%\%%f""
-rmdir ""%root%\CS_Update""
-
-echo Starting launcher again
-if exist Launcher.exe (
-start Launcher.exe
-) else (
-start Launcher2.exe
-)
-exit";
-
- public const string BashFile =
- @"#!/bin/bash
-echo Waiting for launcher to exit..
-echo 5..
-sleep 1
-echo 4..
-sleep 1
-echo 3..
-sleep 1
-echo 2..
-sleep 1
-echo 1..
-sleep 1
-
-echo Extracting files from CS_Update folder
-TARGETDIR=""`pwd`""
-UPDATEDIR=""`pwd`/CS_Update/""
-
-for FILE in ""$UPDATEDIR""*.* ;do
- mv ""$FILE"" ""$TARGETDIR""
-done
-
-rm -r ""$UPDATEDIR""
-echo Starting launcher again
-if [ -f ""Launcher.exe"" ];
-then
-mono Launcher.exe
-else
-mono Launcher2.exe
-fi
-";
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+
+namespace Launcher.Updater {
+
+ public static class Scripts {
+
+ public const string BatchFile =
+ @"@echo off
+echo Waiting for launcher to exit..
+echo 5..
+ping 127.0.0.1 -n 2 > nul
+echo 4..
+ping 127.0.0.1 -n 2 > nul
+echo 3..
+ping 127.0.0.1 -n 2 > nul
+echo 2..
+ping 127.0.0.1 -n 2 > nul
+echo 1..
+ping 127.0.0.1 -n 2 > nul
+
+set root=%CD%
+echo Extracting files from CS_Update folder
+for /f %%f in ('dir /b ""%root%\CS_Update""') do move ""%root%\CS_Update\%%f"" ""%root%\%%f""
+rmdir ""%root%\CS_Update""
+
+echo Starting launcher again
+if exist Launcher.exe (
+start Launcher.exe
+) else (
+start Launcher2.exe
+)
+exit";
+
+ public const string BashFile =
+ @"#!/bin/bash
+echo Waiting for launcher to exit..
+echo 5..
+sleep 1
+echo 4..
+sleep 1
+echo 3..
+sleep 1
+echo 2..
+sleep 1
+echo 1..
+sleep 1
+
+echo Extracting files from CS_Update folder
+TARGETDIR=""`pwd`""
+UPDATEDIR=""`pwd`/CS_Update/""
+
+for FILE in ""$UPDATEDIR""*.* ;do
+ mv ""$FILE"" ""$TARGETDIR""
+done
+
+rm -r ""$UPDATEDIR""
+echo Starting launcher again
+if [ -f ""Launcher.exe"" ];
+then
+mono Launcher.exe
+else
+mono Launcher2.exe
+fi
+";
+ }
+}
diff --git a/Launcher2/Utils/Client.cs b/ClassicalSharp/Launcher2/Utils/Client.cs
similarity index 100%
rename from Launcher2/Utils/Client.cs
rename to ClassicalSharp/Launcher2/Utils/Client.cs
diff --git a/Launcher2/Utils/JSON.cs b/ClassicalSharp/Launcher2/Utils/JSON.cs
similarity index 100%
rename from Launcher2/Utils/JSON.cs
rename to ClassicalSharp/Launcher2/Utils/JSON.cs
diff --git a/Launcher2/Utils/LauncherSkin.cs b/ClassicalSharp/Launcher2/Utils/LauncherSkin.cs
similarity index 100%
rename from Launcher2/Utils/LauncherSkin.cs
rename to ClassicalSharp/Launcher2/Utils/LauncherSkin.cs
diff --git a/Launcher2/Utils/Secure.cs b/ClassicalSharp/Launcher2/Utils/Secure.cs
similarity index 96%
rename from Launcher2/Utils/Secure.cs
rename to ClassicalSharp/Launcher2/Utils/Secure.cs
index 9f4368104..b4e413f75 100644
--- a/Launcher2/Utils/Secure.cs
+++ b/ClassicalSharp/Launcher2/Utils/Secure.cs
@@ -1,53 +1,53 @@
-// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
-using System;
-using System.Security.Cryptography;
-
-namespace Launcher {
-
- public static class Secure {
-
- public static string Encode(string decoded, string key) {
- if (String.IsNullOrEmpty(decoded) || String.IsNullOrEmpty(key)) return "";
-
- byte[] data = new byte[decoded.Length];
- for (int i = 0; i < decoded.Length; i++)
- data[i] = (byte)decoded[i];
-
- try {
- byte[] v2 = ProtectedData.Protect(data, null, DataProtectionScope.CurrentUser);
- return Convert.ToBase64String(v2);
- } catch {
- // XORs data. *NOT* very secure, only designed to prevent reading from options.txt.
- for (int i = 0; i < data.Length; i++)
- data[i] = (byte)(data[i] ^ key[i % key.Length] ^ 0x43);
- return Convert.ToBase64String(data);
- }
- }
-
- public static string Decode(string encoded, string key) {
- if (String.IsNullOrEmpty(encoded) || String.IsNullOrEmpty(key)) return "";
-
- byte[] data;
- try {
- data = Convert.FromBase64String(encoded);
- } catch (FormatException) {
- return "";
- }
-
- try {
- data = ProtectedData.Unprotect(data, null, DataProtectionScope.CurrentUser);
- char[] c = new char[data.Length];
- for (int i = 0; i < c.Length; i++)
- c[i] = (char)data[i];
- return new String(c);
- } catch {
- if (encoded.Length > 64 || data.Length > 64) return "";
-
- char[] c = new char[data.Length];
- for (int i = 0; i < c.Length; i++)
- c[i] = (char)(data[i] ^ key[i % key.Length] ^ 0x43);
- return new String(c);
- }
- }
- }
-}
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using System.Security.Cryptography;
+
+namespace Launcher {
+
+ public static class Secure {
+
+ public static string Encode(string decoded, string key) {
+ if (String.IsNullOrEmpty(decoded) || String.IsNullOrEmpty(key)) return "";
+
+ byte[] data = new byte[decoded.Length];
+ for (int i = 0; i < decoded.Length; i++)
+ data[i] = (byte)decoded[i];
+
+ try {
+ byte[] v2 = ProtectedData.Protect(data, null, DataProtectionScope.CurrentUser);
+ return Convert.ToBase64String(v2);
+ } catch {
+ // XORs data. *NOT* very secure, only designed to prevent reading from options.txt.
+ for (int i = 0; i < data.Length; i++)
+ data[i] = (byte)(data[i] ^ key[i % key.Length] ^ 0x43);
+ return Convert.ToBase64String(data);
+ }
+ }
+
+ public static string Decode(string encoded, string key) {
+ if (String.IsNullOrEmpty(encoded) || String.IsNullOrEmpty(key)) return "";
+
+ byte[] data;
+ try {
+ data = Convert.FromBase64String(encoded);
+ } catch (FormatException) {
+ return "";
+ }
+
+ try {
+ data = ProtectedData.Unprotect(data, null, DataProtectionScope.CurrentUser);
+ char[] c = new char[data.Length];
+ for (int i = 0; i < c.Length; i++)
+ c[i] = (char)data[i];
+ return new String(c);
+ } catch {
+ if (encoded.Length > 64 || data.Length > 64) return "";
+
+ char[] c = new char[data.Length];
+ for (int i = 0; i < c.Length; i++)
+ c[i] = (char)(data[i] ^ key[i % key.Length] ^ 0x43);
+ return new String(c);
+ }
+ }
+ }
+}
diff --git a/Launcher2/WebTasks.cs b/ClassicalSharp/Launcher2/WebTasks.cs
similarity index 100%
rename from Launcher2/WebTasks.cs
rename to ClassicalSharp/Launcher2/WebTasks.cs
diff --git a/Launcher2/icon.ico b/ClassicalSharp/Launcher2/icon.ico
similarity index 100%
rename from Launcher2/icon.ico
rename to ClassicalSharp/Launcher2/icon.ico
diff --git a/OpenTK/AutoGeneratedAttribute.cs b/ClassicalSharp/OpenTK/AutoGeneratedAttribute.cs
similarity index 97%
rename from OpenTK/AutoGeneratedAttribute.cs
rename to ClassicalSharp/OpenTK/AutoGeneratedAttribute.cs
index cbd6b49d8..cf8e40110 100644
--- a/OpenTK/AutoGeneratedAttribute.cs
+++ b/ClassicalSharp/OpenTK/AutoGeneratedAttribute.cs
@@ -1,61 +1,61 @@
-#region License
-//
-// The Open Toolkit Library License
-//
-// Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights to
-// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-// the Software, and to permit persons to whom the Software is furnished to do
-// so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenTK
-{
- ///
- /// Indicates that this function is generated automatically by a tool.
- ///
- public sealed class AutoGeneratedAttribute : Attribute
- {
- ///
- /// Specifies the category of this OpenGL function.
- ///
- public string Category;
-
- ///
- /// Specifies the version of this OpenGL function.
- ///
- public string Version;
-
- ///
- /// Specifies the entry point of the OpenGL function.
- ///
- public string EntryPoint;
-
- ///
- /// Constructs a new AutoGeneratedAttribute instance.
- ///
- public AutoGeneratedAttribute()
- {
- }
- }
-}
+#region License
+//
+// The Open Toolkit Library License
+//
+// Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights to
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+// the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenTK
+{
+ ///
+ /// Indicates that this function is generated automatically by a tool.
+ ///
+ public sealed class AutoGeneratedAttribute : Attribute
+ {
+ ///
+ /// Specifies the category of this OpenGL function.
+ ///
+ public string Category;
+
+ ///
+ /// Specifies the version of this OpenGL function.
+ ///
+ public string Version;
+
+ ///
+ /// Specifies the entry point of the OpenGL function.
+ ///
+ public string EntryPoint;
+
+ ///
+ /// Constructs a new AutoGeneratedAttribute instance.
+ ///
+ public AutoGeneratedAttribute()
+ {
+ }
+ }
+}
diff --git a/OpenTK/DisplayDevice.cs b/ClassicalSharp/OpenTK/DisplayDevice.cs
similarity index 100%
rename from OpenTK/DisplayDevice.cs
rename to ClassicalSharp/OpenTK/DisplayDevice.cs
diff --git a/OpenTK/Graphics/ColorFormat.cs b/ClassicalSharp/OpenTK/Graphics/ColorFormat.cs
similarity index 100%
rename from OpenTK/Graphics/ColorFormat.cs
rename to ClassicalSharp/OpenTK/Graphics/ColorFormat.cs
diff --git a/OpenTK/Graphics/GraphicsExceptions.cs b/ClassicalSharp/OpenTK/Graphics/GraphicsExceptions.cs
similarity index 97%
rename from OpenTK/Graphics/GraphicsExceptions.cs
rename to ClassicalSharp/OpenTK/Graphics/GraphicsExceptions.cs
index f53062b6d..8502fdf14 100644
--- a/OpenTK/Graphics/GraphicsExceptions.cs
+++ b/ClassicalSharp/OpenTK/Graphics/GraphicsExceptions.cs
@@ -1,24 +1,24 @@
-#region --- License ---
-/* Licensed under the MIT/X11 license.
- * Copyright (c) 2006-2008 the OpenTK team.
- * This notice may not be removed.
- * See license.txt for licensing detailed licensing details.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenTK
-{
- /// Represents errors related to Graphics operations.
- public class GraphicsException : Exception
- {
- /// Constructs a new GraphicsException.
- public GraphicsException() : base() { }
- /// Constructs a new GraphicsException with the specified excpetion message.
- ///
- public GraphicsException(string message) : base(message) { }
- }
-}
+#region --- License ---
+/* Licensed under the MIT/X11 license.
+ * Copyright (c) 2006-2008 the OpenTK team.
+ * This notice may not be removed.
+ * See license.txt for licensing detailed licensing details.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenTK
+{
+ /// Represents errors related to Graphics operations.
+ public class GraphicsException : Exception
+ {
+ /// Constructs a new GraphicsException.
+ public GraphicsException() : base() { }
+ /// Constructs a new GraphicsException with the specified excpetion message.
+ ///
+ public GraphicsException(string message) : base(message) { }
+ }
+}
diff --git a/OpenTK/Graphics/GraphicsMode.cs b/ClassicalSharp/OpenTK/Graphics/GraphicsMode.cs
similarity index 100%
rename from OpenTK/Graphics/GraphicsMode.cs
rename to ClassicalSharp/OpenTK/Graphics/GraphicsMode.cs
diff --git a/OpenTK/Graphics/IGraphicsContext.cs b/ClassicalSharp/OpenTK/Graphics/IGraphicsContext.cs
similarity index 100%
rename from OpenTK/Graphics/IGraphicsContext.cs
rename to ClassicalSharp/OpenTK/Graphics/IGraphicsContext.cs
diff --git a/OpenTK/INativeWindow.cs b/ClassicalSharp/OpenTK/INativeWindow.cs
similarity index 100%
rename from OpenTK/INativeWindow.cs
rename to ClassicalSharp/OpenTK/INativeWindow.cs
diff --git a/OpenTK/Keyboard.cs b/ClassicalSharp/OpenTK/Keyboard.cs
similarity index 100%
rename from OpenTK/Keyboard.cs
rename to ClassicalSharp/OpenTK/Keyboard.cs
diff --git a/OpenTK/Mouse.cs b/ClassicalSharp/OpenTK/Mouse.cs
similarity index 100%
rename from OpenTK/Mouse.cs
rename to ClassicalSharp/OpenTK/Mouse.cs
diff --git a/OpenTK/OpenTK.csproj b/ClassicalSharp/OpenTK/OpenTK.csproj
similarity index 100%
rename from OpenTK/OpenTK.csproj
rename to ClassicalSharp/OpenTK/OpenTK.csproj
diff --git a/OpenTK/Platform/Configuration.cs b/ClassicalSharp/OpenTK/Platform/Configuration.cs
similarity index 100%
rename from OpenTK/Platform/Configuration.cs
rename to ClassicalSharp/OpenTK/Platform/Configuration.cs
diff --git a/OpenTK/Platform/IPlatformFactory.cs b/ClassicalSharp/OpenTK/Platform/IPlatformFactory.cs
similarity index 100%
rename from OpenTK/Platform/IPlatformFactory.cs
rename to ClassicalSharp/OpenTK/Platform/IPlatformFactory.cs
diff --git a/OpenTK/Platform/MacOS/AglContext.cs b/ClassicalSharp/OpenTK/Platform/MacOS/AglContext.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/AglContext.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/AglContext.cs
diff --git a/OpenTK/Platform/MacOS/Application.cs b/ClassicalSharp/OpenTK/Platform/MacOS/Application.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/Application.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/Application.cs
diff --git a/OpenTK/Platform/MacOS/CarbonBindings/API.cs b/ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/API.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/CarbonBindings/API.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/API.cs
diff --git a/OpenTK/Platform/MacOS/CarbonBindings/Agl.cs b/ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/Agl.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/CarbonBindings/Agl.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/Agl.cs
diff --git a/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs b/ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs
diff --git a/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs b/ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs
diff --git a/OpenTK/Platform/MacOS/CarbonWindow.cs b/ClassicalSharp/OpenTK/Platform/MacOS/CarbonWindow.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/CarbonWindow.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/CarbonWindow.cs
diff --git a/OpenTK/Platform/MacOS/MacOSException.cs b/ClassicalSharp/OpenTK/Platform/MacOS/MacOSException.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/MacOSException.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/MacOSException.cs
diff --git a/OpenTK/Platform/MacOS/MacOSKeyMap.cs b/ClassicalSharp/OpenTK/Platform/MacOS/MacOSKeyMap.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/MacOSKeyMap.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/MacOSKeyMap.cs
diff --git a/OpenTK/Platform/MacOS/QuartzDisplayDevice.cs b/ClassicalSharp/OpenTK/Platform/MacOS/QuartzDisplayDevice.cs
similarity index 100%
rename from OpenTK/Platform/MacOS/QuartzDisplayDevice.cs
rename to ClassicalSharp/OpenTK/Platform/MacOS/QuartzDisplayDevice.cs
diff --git a/OpenTK/Platform/Windows/API.cs b/ClassicalSharp/OpenTK/Platform/Windows/API.cs
similarity index 100%
rename from OpenTK/Platform/Windows/API.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/API.cs
diff --git a/OpenTK/Platform/Windows/Wgl.cs b/ClassicalSharp/OpenTK/Platform/Windows/Wgl.cs
similarity index 100%
rename from OpenTK/Platform/Windows/Wgl.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/Wgl.cs
diff --git a/OpenTK/Platform/Windows/WinDisplayDevice.cs b/ClassicalSharp/OpenTK/Platform/Windows/WinDisplayDevice.cs
similarity index 100%
rename from OpenTK/Platform/Windows/WinDisplayDevice.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/WinDisplayDevice.cs
diff --git a/OpenTK/Platform/Windows/WinGLContext.cs b/ClassicalSharp/OpenTK/Platform/Windows/WinGLContext.cs
similarity index 100%
rename from OpenTK/Platform/Windows/WinGLContext.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/WinGLContext.cs
diff --git a/OpenTK/Platform/Windows/WinKeyMap.cs b/ClassicalSharp/OpenTK/Platform/Windows/WinKeyMap.cs
similarity index 100%
rename from OpenTK/Platform/Windows/WinKeyMap.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/WinKeyMap.cs
diff --git a/OpenTK/Platform/Windows/WinWindow.cs b/ClassicalSharp/OpenTK/Platform/Windows/WinWindow.cs
similarity index 100%
rename from OpenTK/Platform/Windows/WinWindow.cs
rename to ClassicalSharp/OpenTK/Platform/Windows/WinWindow.cs
diff --git a/OpenTK/Platform/X11/API.cs b/ClassicalSharp/OpenTK/Platform/X11/API.cs
similarity index 100%
rename from OpenTK/Platform/X11/API.cs
rename to ClassicalSharp/OpenTK/Platform/X11/API.cs
diff --git a/OpenTK/Platform/X11/Glx.cs b/ClassicalSharp/OpenTK/Platform/X11/Glx.cs
similarity index 100%
rename from OpenTK/Platform/X11/Glx.cs
rename to ClassicalSharp/OpenTK/Platform/X11/Glx.cs
diff --git a/OpenTK/Platform/X11/Structs.cs b/ClassicalSharp/OpenTK/Platform/X11/Structs.cs
similarity index 100%
rename from OpenTK/Platform/X11/Structs.cs
rename to ClassicalSharp/OpenTK/Platform/X11/Structs.cs
diff --git a/OpenTK/Platform/X11/X11DisplayDevice.cs b/ClassicalSharp/OpenTK/Platform/X11/X11DisplayDevice.cs
similarity index 100%
rename from OpenTK/Platform/X11/X11DisplayDevice.cs
rename to ClassicalSharp/OpenTK/Platform/X11/X11DisplayDevice.cs
diff --git a/OpenTK/Platform/X11/X11GLContext.cs b/ClassicalSharp/OpenTK/Platform/X11/X11GLContext.cs
similarity index 100%
rename from OpenTK/Platform/X11/X11GLContext.cs
rename to ClassicalSharp/OpenTK/Platform/X11/X11GLContext.cs
diff --git a/OpenTK/Platform/X11/X11KeyMap.cs b/ClassicalSharp/OpenTK/Platform/X11/X11KeyMap.cs
similarity index 100%
rename from OpenTK/Platform/X11/X11KeyMap.cs
rename to ClassicalSharp/OpenTK/Platform/X11/X11KeyMap.cs
diff --git a/OpenTK/Platform/X11/X11Window.cs b/ClassicalSharp/OpenTK/Platform/X11/X11Window.cs
similarity index 100%
rename from OpenTK/Platform/X11/X11Window.cs
rename to ClassicalSharp/OpenTK/Platform/X11/X11Window.cs
diff --git a/OpenTK/Properties/AssemblyInfo.cs b/ClassicalSharp/OpenTK/Properties/AssemblyInfo.cs
similarity index 98%
rename from OpenTK/Properties/AssemblyInfo.cs
rename to ClassicalSharp/OpenTK/Properties/AssemblyInfo.cs
index 1c769043e..da51df9b8 100644
--- a/OpenTK/Properties/AssemblyInfo.cs
+++ b/ClassicalSharp/OpenTK/Properties/AssemblyInfo.cs
@@ -1,11 +1,11 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("OpenTK")]
-[assembly: AssemblyDescription("Open source game development toolkit for .Net/Mono.")]
-[assembly: AssemblyCompany("The Open Toolkit Library")]
-[assembly: AssemblyProduct("The Open Toolkit Library")]
-[assembly: AssemblyCopyright("Copyright © 2006 - 2010 the Open Toolkit Library")]
-[assembly: AssemblyTrademark("OpenTK")]
-[assembly: ComVisible(false)]
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("OpenTK")]
+[assembly: AssemblyDescription("Open source game development toolkit for .Net/Mono.")]
+[assembly: AssemblyCompany("The Open Toolkit Library")]
+[assembly: AssemblyProduct("The Open Toolkit Library")]
+[assembly: AssemblyCopyright("Copyright © 2006 - 2010 the Open Toolkit Library")]
+[assembly: AssemblyTrademark("OpenTK")]
+[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.99.9.4")]
\ No newline at end of file
diff --git a/OpenTK/Utils.cs b/ClassicalSharp/OpenTK/Utils.cs
similarity index 100%
rename from OpenTK/Utils.cs
rename to ClassicalSharp/OpenTK/Utils.cs
diff --git a/SharpWave/Backends/AL.cs b/ClassicalSharp/SharpWave/Backends/AL.cs
similarity index 100%
rename from SharpWave/Backends/AL.cs
rename to ClassicalSharp/SharpWave/Backends/AL.cs
diff --git a/SharpWave/Backends/IAudioOutput.cs b/ClassicalSharp/SharpWave/Backends/IAudioOutput.cs
similarity index 100%
rename from SharpWave/Backends/IAudioOutput.cs
rename to ClassicalSharp/SharpWave/Backends/IAudioOutput.cs
diff --git a/SharpWave/Backends/OpenALOut.cs b/ClassicalSharp/SharpWave/Backends/OpenALOut.cs
similarity index 100%
rename from SharpWave/Backends/OpenALOut.cs
rename to ClassicalSharp/SharpWave/Backends/OpenALOut.cs
diff --git a/SharpWave/Backends/WinMM.cs b/ClassicalSharp/SharpWave/Backends/WinMM.cs
similarity index 100%
rename from SharpWave/Backends/WinMM.cs
rename to ClassicalSharp/SharpWave/Backends/WinMM.cs
diff --git a/SharpWave/Backends/WinMmOut.cs b/ClassicalSharp/SharpWave/Backends/WinMmOut.cs
similarity index 100%
rename from SharpWave/Backends/WinMmOut.cs
rename to ClassicalSharp/SharpWave/Backends/WinMmOut.cs
diff --git a/SharpWave/Properties/AssemblyInfo.cs b/ClassicalSharp/SharpWave/Properties/AssemblyInfo.cs
similarity index 100%
rename from SharpWave/Properties/AssemblyInfo.cs
rename to ClassicalSharp/SharpWave/Properties/AssemblyInfo.cs
diff --git a/SharpWave/SharpWave.csproj b/ClassicalSharp/SharpWave/SharpWave.csproj
similarity index 100%
rename from SharpWave/SharpWave.csproj
rename to ClassicalSharp/SharpWave/SharpWave.csproj
diff --git a/SharpWave/SharpWave.dll.config b/ClassicalSharp/SharpWave/SharpWave.dll.config
similarity index 100%
rename from SharpWave/SharpWave.dll.config
rename to ClassicalSharp/SharpWave/SharpWave.dll.config
diff --git a/SharpWave/Utils.cs b/ClassicalSharp/SharpWave/Utils.cs
similarity index 100%
rename from SharpWave/Utils.cs
rename to ClassicalSharp/SharpWave/Utils.cs
diff --git a/SharpWave/csvorbis/Block.cs b/ClassicalSharp/SharpWave/csvorbis/Block.cs
similarity index 100%
rename from SharpWave/csvorbis/Block.cs
rename to ClassicalSharp/SharpWave/csvorbis/Block.cs
diff --git a/SharpWave/csvorbis/CodeBook.cs b/ClassicalSharp/SharpWave/csvorbis/CodeBook.cs
similarity index 100%
rename from SharpWave/csvorbis/CodeBook.cs
rename to ClassicalSharp/SharpWave/csvorbis/CodeBook.cs
diff --git a/SharpWave/csvorbis/Comment.cs b/ClassicalSharp/SharpWave/csvorbis/Comment.cs
similarity index 100%
rename from SharpWave/csvorbis/Comment.cs
rename to ClassicalSharp/SharpWave/csvorbis/Comment.cs
diff --git a/SharpWave/csvorbis/DspState.cs b/ClassicalSharp/SharpWave/csvorbis/DspState.cs
similarity index 100%
rename from SharpWave/csvorbis/DspState.cs
rename to ClassicalSharp/SharpWave/csvorbis/DspState.cs
diff --git a/SharpWave/csvorbis/FuncFloor.cs b/ClassicalSharp/SharpWave/csvorbis/FuncFloor.cs
similarity index 100%
rename from SharpWave/csvorbis/FuncFloor.cs
rename to ClassicalSharp/SharpWave/csvorbis/FuncFloor.cs
diff --git a/SharpWave/csvorbis/FuncMapping.cs b/ClassicalSharp/SharpWave/csvorbis/FuncMapping.cs
similarity index 100%
rename from SharpWave/csvorbis/FuncMapping.cs
rename to ClassicalSharp/SharpWave/csvorbis/FuncMapping.cs
diff --git a/SharpWave/csvorbis/FuncResidue.cs b/ClassicalSharp/SharpWave/csvorbis/FuncResidue.cs
similarity index 100%
rename from SharpWave/csvorbis/FuncResidue.cs
rename to ClassicalSharp/SharpWave/csvorbis/FuncResidue.cs
diff --git a/SharpWave/csvorbis/Info.cs b/ClassicalSharp/SharpWave/csvorbis/Info.cs
similarity index 100%
rename from SharpWave/csvorbis/Info.cs
rename to ClassicalSharp/SharpWave/csvorbis/Info.cs
diff --git a/SharpWave/csvorbis/Mdct.cs b/ClassicalSharp/SharpWave/csvorbis/Mdct.cs
similarity index 100%
rename from SharpWave/csvorbis/Mdct.cs
rename to ClassicalSharp/SharpWave/csvorbis/Mdct.cs
diff --git a/SharpWave/csvorbis/Ogg/Buffer.cs b/ClassicalSharp/SharpWave/csvorbis/Ogg/Buffer.cs
similarity index 100%
rename from SharpWave/csvorbis/Ogg/Buffer.cs
rename to ClassicalSharp/SharpWave/csvorbis/Ogg/Buffer.cs
diff --git a/SharpWave/csvorbis/Ogg/Packet.cs b/ClassicalSharp/SharpWave/csvorbis/Ogg/Packet.cs
similarity index 100%
rename from SharpWave/csvorbis/Ogg/Packet.cs
rename to ClassicalSharp/SharpWave/csvorbis/Ogg/Packet.cs
diff --git a/SharpWave/csvorbis/Ogg/Page.cs b/ClassicalSharp/SharpWave/csvorbis/Ogg/Page.cs
similarity index 100%
rename from SharpWave/csvorbis/Ogg/Page.cs
rename to ClassicalSharp/SharpWave/csvorbis/Ogg/Page.cs
diff --git a/SharpWave/csvorbis/Ogg/StreamState.cs b/ClassicalSharp/SharpWave/csvorbis/Ogg/StreamState.cs
similarity index 100%
rename from SharpWave/csvorbis/Ogg/StreamState.cs
rename to ClassicalSharp/SharpWave/csvorbis/Ogg/StreamState.cs
diff --git a/SharpWave/csvorbis/Ogg/SyncState.cs b/ClassicalSharp/SharpWave/csvorbis/Ogg/SyncState.cs
similarity index 100%
rename from SharpWave/csvorbis/Ogg/SyncState.cs
rename to ClassicalSharp/SharpWave/csvorbis/Ogg/SyncState.cs
diff --git a/SharpWave/csvorbis/StaticCodeBook.cs b/ClassicalSharp/SharpWave/csvorbis/StaticCodeBook.cs
similarity index 100%
rename from SharpWave/csvorbis/StaticCodeBook.cs
rename to ClassicalSharp/SharpWave/csvorbis/StaticCodeBook.cs
diff --git a/SharpWave/csvorbis/VUtils.cs b/ClassicalSharp/SharpWave/csvorbis/VUtils.cs
similarity index 100%
rename from SharpWave/csvorbis/VUtils.cs
rename to ClassicalSharp/SharpWave/csvorbis/VUtils.cs
diff --git a/SharpWave/csvorbis/VorbisCodec.cs b/ClassicalSharp/SharpWave/csvorbis/VorbisCodec.cs
similarity index 100%
rename from SharpWave/csvorbis/VorbisCodec.cs
rename to ClassicalSharp/SharpWave/csvorbis/VorbisCodec.cs
diff --git a/SharpWave/csvorbis/csorbisException.cs b/ClassicalSharp/SharpWave/csvorbis/csorbisException.cs
similarity index 100%
rename from SharpWave/csvorbis/csorbisException.cs
rename to ClassicalSharp/SharpWave/csvorbis/csorbisException.cs
diff --git a/ClassicalSharp/license.txt b/ClassicalSharp/license.txt
new file mode 100644
index 000000000..227e68dc6
--- /dev/null
+++ b/ClassicalSharp/license.txt
@@ -0,0 +1,866 @@
+Copyright (c) 2014 - 2015, UnknownShadow200
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+3. Neither the name of ClassicalSharp nor the names of its contributors may be
+used to endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Other function licenses
+=======================
+
+Ray-box intersection algorithm comes from:
+"An efficient and robust ray-box intersection algorithm", Williams, Barrus, Morley & Shirley, Journal of Graphics Tools, 2005"
+C++ source at http://www.cs.utah.edu/~awilliam/box/ does not appear to have an attached license.
+
+
+Cell traversal of rays based on code I found that was in turn from http://www.xnawiki.com/index.php/Voxel_traversal
+The archived about page (http://web.archive.org/web/20090412065116/http://www.xnawiki.com/index.php/XNAWiki:About) states
+that "All code found on the wiki is considered public domain".
+
+
+Frustum culling was based on the code from http://www.crownandcutlass.com/features/technicaldetails/frustum.html,
+which is in turn archived from (now defunct) http://www.markmorley.com/
+"This page and its contents are Copyright 2000 by Mark Morley
+Unless otherwise noted, you may use any and all code examples provided herein in any way you want."
+
+
+OpenTK license
+===============
+Copyright (c) 2006 - 2010 The Open Toolkit library.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+OpenTK.Platform.Windows and OpenTK.Platform.X11 include portions of the Mono class library.
+These portions are covered by the following license:
+
+Copyright (c) 2004 Novell, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+SharpDX license
+===============
+Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Ionic.Zlib license
+==================
+Microsoft Public License (Ms-PL)
+
+This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software.
+
+1. Definitions
+
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
+
+A "contribution" is the original software, or any additions or changes to the software.
+
+A "contributor" is any person that distributes its contribution under this license.
+
+"Licensed patents" are a contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+
+(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
+
+(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+
+(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+
+(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
+
+(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
+
+(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
+
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
+
+The following licenses govern use of the accompanying software, the
+DotNetZip library ("the software"). If you use the software, you accept
+these licenses. If you do not accept the license, do not use the software.
+
+The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is
+modified code, based on jzlib.
+
+
+
+The following notice applies to jzlib:
+-----------------------------------------------------------------------
+
+Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+3. The names of the authors may not be used to endorse or promote products
+derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-----------------------------------------------------------------------
+
+jzlib is based on zlib-1.1.3.
+
+The following notice applies to zlib:
+
+-----------------------------------------------------------------------
+
+Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
+
+ The ZLIB software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly jloup@gzip.org
+ Mark Adler madler@alumni.caltech.edu
+
+
+-----------------------------------------------------------------------
+
+FreeType license
+==================
+ The FreeType Project LICENSE
+ ----------------------------
+
+ 2006-Jan-27
+
+ Copyright 1996-2002, 2006 by
+ David Turner, Robert Wilhelm, and Werner Lemberg
+
+
+
+Introduction
+============
+
+ The FreeType Project is distributed in several archive packages;
+ some of them may contain, in addition to the FreeType font engine,
+ various tools and contributions which rely on, or relate to, the
+ FreeType Project.
+
+ This license applies to all files found in such packages, and
+ which do not fall under their own explicit license. The license
+ affects thus the FreeType font engine, the test programs,
+ documentation and makefiles, at the very least.
+
+ This license was inspired by the BSD, Artistic, and IJG
+ (Independent JPEG Group) licenses, which all encourage inclusion
+ and use of free software in commercial and freeware products
+ alike. As a consequence, its main points are that:
+
+ o We don't promise that this software works. However, we will be
+ interested in any kind of bug reports. (`as is' distribution)
+
+ o You can use this software for whatever you want, in parts or
+ full form, without having to pay us. (`royalty-free' usage)
+
+ o You may not pretend that you wrote this software. If you use
+ it, or only parts of it, in a program, you must acknowledge
+ somewhere in your documentation that you have used the
+ FreeType code. (`credits')
+
+ We specifically permit and encourage the inclusion of this
+ software, with or without modifications, in commercial products.
+ We disclaim all warranties covering The FreeType Project and
+ assume no liability related to The FreeType Project.
+
+
+ Finally, many people asked us for a preferred form for a
+ credit/disclaimer to use in compliance with this license. We thus
+ encourage you to use the following text:
+
+ """
+ Portions of this software are copyright © The FreeType
+ Project (www.freetype.org). All rights reserved.
+ """
+
+ Please replace with the value from the FreeType version you
+ actually use.
+
+
+Legal Terms
+===========
+
+0. Definitions
+--------------
+
+ Throughout this license, the terms `package', `FreeType Project',
+ and `FreeType archive' refer to the set of files originally
+ distributed by the authors (David Turner, Robert Wilhelm, and
+ Werner Lemberg) as the `FreeType Project', be they named as alpha,
+ beta or final release.
+
+ `You' refers to the licensee, or person using the project, where
+ `using' is a generic term including compiling the project's source
+ code as well as linking it to form a `program' or `executable'.
+ This program is referred to as `a program using the FreeType
+ engine'.
+
+ This license applies to all files distributed in the original
+ FreeType Project, including all source code, binaries and
+ documentation, unless otherwise stated in the file in its
+ original, unmodified form as distributed in the original archive.
+ If you are unsure whether or not a particular file is covered by
+ this license, you must contact us to verify this.
+
+ The FreeType Project is copyright (C) 1996-2000 by David Turner,
+ Robert Wilhelm, and Werner Lemberg. All rights reserved except as
+ specified below.
+
+1. No Warranty
+--------------
+
+ THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
+ USE, OF THE FREETYPE PROJECT.
+
+2. Redistribution
+-----------------
+
+ This license grants a worldwide, royalty-free, perpetual and
+ irrevocable right and license to use, execute, perform, compile,
+ display, copy, create derivative works of, distribute and
+ sublicense the FreeType Project (in both source and object code
+ forms) and derivative works thereof for any purpose; and to
+ authorize others to exercise some or all of the rights granted
+ herein, subject to the following conditions:
+
+ o Redistribution of source code must retain this license file
+ (`FTL.TXT') unaltered; any additions, deletions or changes to
+ the original files must be clearly indicated in accompanying
+ documentation. The copyright notices of the unaltered,
+ original files must be preserved in all copies of source
+ files.
+
+ o Redistribution in binary form must provide a disclaimer that
+ states that the software is based in part of the work of the
+ FreeType Team, in the distribution documentation. We also
+ encourage you to put an URL to the FreeType web page in your
+ documentation, though this isn't mandatory.
+
+ These conditions apply to any software derived from or based on
+ the FreeType Project, not just the unmodified files. If you use
+ our work, you must acknowledge us. However, no fee need be paid
+ to us.
+
+3. Advertising
+--------------
+
+ Neither the FreeType authors and contributors nor you shall use
+ the name of the other for commercial, advertising, or promotional
+ purposes without specific prior written permission.
+
+ We suggest, but do not require, that you use one or more of the
+ following phrases to refer to this software in your documentation
+ or advertising materials: `FreeType Project', `FreeType Engine',
+ `FreeType library', or `FreeType Distribution'.
+
+ As you have not signed this license, you are not required to
+ accept it. However, as the FreeType Project is copyrighted
+ material, only this license, or another one contracted with the
+ authors, grants you the right to use, distribute, and modify it.
+ Therefore, by using, distributing, or modifying the FreeType
+ Project, you indicate that you understand and accept all the terms
+ of this license.
+
+4. Contacts
+-----------
+
+ There are two mailing lists related to FreeType:
+
+ o freetype@nongnu.org
+
+ Discusses general use and applications of FreeType, as well as
+ future and wanted additions to the library and distribution.
+ If you are looking for support, start in this list if you
+ haven't found anything to help you in the documentation.
+
+ o freetype-devel@nongnu.org
+
+ Discusses bugs, as well as engine internals, design issues,
+ specific licenses, porting, etc.
+
+ Our home page can be found at
+
+ https://www.freetype.org
+
+
+--- end of FTL.TXT ---
+
+
+SharpWave license
+=================
+Although SharpWave itself is licensed under BSD-3, it includes a modified version of csvorbis,
+which is licensed under LGPL. Thus, this means that as long as csvorbis is included with the source code of SharpWave,
+the entirety of SharpWave must also be treated as if it was licensed under LGPL.
+If you wish to use SharpWave under a different license, you must remove csvorbis from the project.
+
+Copyright (c) 2013-2015, UnknownShadow200
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SharpWave nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+csvorbis license
+=================
+The vorbis codec is modified from csvorbis
+which is available from https://github.com/mono/csvorbis
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
diff --git a/credits.txt b/credits.txt
index 38b056188..23a4d40e2 100644
--- a/credits.txt
+++ b/credits.txt
@@ -1,13 +1,15 @@
-* 123DMWM - many suggestions, and assistance in identifying bugs and their causes.
* Goodlyay - many suggestions, and being a great second pairs of eyes for issues and
- improvements with character modelling, animating, and view bobbing.
+ improvements with character modelling, animating, and view bobbing. Also designed the icons.
* AndrewPH - Advice on how to improve ui of both client and launcher, multiple
suggestions, and hosting the automatic build bot for ClassicalSharp.
-* Cheesse - multiple suggestions, testing ClassicalSharp on AMD graphics cards.
-* Hemsindor - testing ClassicalSharp on OSX.
-* FabTheZen - suggestions about how to improve user experience, testing.
+* 123DMWM - many suggestions, and assistance in identifying bugs and their causes.
+* video_error - Allowing remote use of an OSX machine, pointing out many flaws in the plugin API.
+ The OSX port would not have been possible without you, thanks!
* Jerralish - reverse engineering and documenting the original classic map generation algorithm.
* Cybertoon - Adding water animation, better metal step/dig sounds, identifying multiple flaws
+* FabTheZen - suggestions about how to improve user experience, testing.
+* Cheesse - multiple suggestions, testing ClassicalSharp on AMD graphics cards.
+* Hemsindor - testing ClassicalSharp on OSX.
And a big thanks to everyone else in the ClassiCube community (who I didn't mention here),
who in the past have provided many suggestions and assisted in identifying bugs.
diff --git a/license.txt b/license.txt
index 227e68dc6..d426ab12a 100644
--- a/license.txt
+++ b/license.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2014 - 2015, UnknownShadow200
+Copyright (c) 2014 - 2019, UnknownShadow200
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -90,132 +90,6 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-SharpDX license
-===============
-Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-Ionic.Zlib license
-==================
-Microsoft Public License (Ms-PL)
-
-This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software.
-
-1. Definitions
-
-The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
-
-A "contribution" is the original software, or any additions or changes to the software.
-
-A "contributor" is any person that distributes its contribution under this license.
-
-"Licensed patents" are a contributor's patent claims that read directly on its contribution.
-
-2. Grant of Rights
-
-(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
-
-(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
-
-3. Conditions and Limitations
-
-(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
-
-(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
-
-(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
-
-(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
-
-(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
-
-The following licenses govern use of the accompanying software, the
-DotNetZip library ("the software"). If you use the software, you accept
-these licenses. If you do not accept the license, do not use the software.
-
-The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is
-modified code, based on jzlib.
-
-
-
-The following notice applies to jzlib:
------------------------------------------------------------------------
-
-Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-3. The names of the authors may not be used to endorse or promote products
-derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
-INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
------------------------------------------------------------------------
-
-jzlib is based on zlib-1.1.3.
-
-The following notice applies to zlib:
-
------------------------------------------------------------------------
-
-Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
-
- The ZLIB software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly jloup@gzip.org
- Mark Adler madler@alumni.caltech.edu
-
-
------------------------------------------------------------------------
-
FreeType license
==================
The FreeType Project LICENSE