From b1ba2c02079e4743d442e5673ab1775acbf3d470 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 1 Jul 2015 11:15:53 +1000 Subject: [PATCH] Fix clouds not moving when using Direct3D 9 build, remove somestuff from todo.txt and replace them with actual TODO comments in source code. Redesigned readme to use markdown and look nicer. --- GraphicsAPI/DirectXApi.cs | 21 ++++++++++----- Selections/SelectionManager.cs | 2 +- readme.md | 44 +++++++++++++++++++++++++++++++ readme.txt | 47 ---------------------------------- todo.txt | 3 --- 5 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 readme.md delete mode 100644 readme.txt diff --git a/GraphicsAPI/DirectXApi.cs b/GraphicsAPI/DirectXApi.cs index d86cd7fc8..ee17552b3 100644 --- a/GraphicsAPI/DirectXApi.cs +++ b/GraphicsAPI/DirectXApi.cs @@ -14,6 +14,7 @@ using System.Reflection; namespace ClassicalSharp.GraphicsAPI { + // TODO: Should we use a native form wrapper instead of wrapping over OpenTK? public class DirectXApi : IGraphicsApi { public Device device; @@ -53,7 +54,7 @@ namespace ClassicalSharp.GraphicsAPI { caps = device.DeviceCaps; viewStack = new MatrixStack( 32, device, TransformType.View ); projStack = new MatrixStack( 4, device, TransformType.Projection ); - texStack = new MatrixStack( 4, device, TransformType.Texture1 ); // TODO: Texture0? + texStack = new MatrixStack( 4, device, TransformType.Texture0 ); device.SetRenderState( RenderStates.FillMode, (int)FillMode.Solid ); FaceCulling = false; @@ -113,7 +114,7 @@ namespace ClassicalSharp.GraphicsAPI { FogMode[] modes = { FogMode.Linear, FogMode.Exp, FogMode.Exp2 }; public override void SetFogMode( Fog mode ) { device.SetRenderState( RenderStates.FogTableMode, (int)modes[(int)mode] ); - } + } public override bool FaceCulling { set { @@ -307,12 +308,19 @@ namespace ClassicalSharp.GraphicsAPI { public unsafe override void LoadMatrix( ref Matrix4 matrix ) { Matrix4 transposed = matrix; Matrix dxMatrix = *(Matrix*)&transposed; + if( curStack == texStack ) { + dxMatrix.M31 = dxMatrix.M41; // NOTE: this hack fixes the texture movements. + device.SetTextureStageState( 0, TextureStageStates.TextureTransform, (int)TextureTransform.Count2 ); + } curStack.SetTop( ref dxMatrix ); } Matrix identity = Matrix.Identity; public override void LoadIdentityMatrix() { - curStack.SetTop( ref identity ); + if( curStack == texStack ) { + device.SetTextureStageState( 0, TextureStageStates.TextureTransform, (int)TextureTransform.Disable ); + } + curStack.SetTop( ref identity ); } public override void PushMatrix() { @@ -387,15 +395,16 @@ namespace ClassicalSharp.GraphicsAPI { unsafe void memcpy( IntPtr sourcePtr, IntPtr destPtr, int bytes ) { byte* src = (byte*)sourcePtr; byte* dst = (byte*)destPtr; - // TODO: check memcpy actually works and doesn't explode. + int* srcInt = (int*)src; + int* dstInt = (int*)dst; while( bytes >= 4 ) { - *( (int*)dst ) = *( (int*)src ); + *dstInt++ = *srcInt++; dst += 4; src += 4; bytes -= 4; } - // Handle non-aligned last 1-3 bytes. + // Handle non-aligned last few bytes. for( int i = 0; i < bytes; i++ ) { *dst++ = *src++; } diff --git a/Selections/SelectionManager.cs b/Selections/SelectionManager.cs index 86c10632f..43ee27f10 100644 --- a/Selections/SelectionManager.cs +++ b/Selections/SelectionManager.cs @@ -40,7 +40,7 @@ namespace ClassicalSharp.Selections { pos = player.Position; if( selections.Count == 0 ) return; // TODO: Proper selection box sorting. But this is very difficult because - // we can have boxes within boxes, intersecting boxes, etc.. + // we can have boxes within boxes, intersecting boxes, etc. Probably not worth it. comparer.pos = pos; selections.Sort( comparer ); diff --git a/readme.md b/readme.md new file mode 100644 index 000000000..5f7ac70a3 --- /dev/null +++ b/readme.md @@ -0,0 +1,44 @@ +ClassicalSharp is a custom Minecraft Classic client written in C# that works on Windows and Linux. +**It is not affiliated with (or supported by) Mojang AB, Minecraft, or Microsoft in any way.** + +You can get the latest binaries [here](https://github.com/UnknownShadow200/ClassicalSharp/releases). + +#### What ClassicalSharp is +* Works with both minecraft.net and classicube.net accounts. +* Lightweight, minimal memory usage compared to the standard client. +* Works with effectively all graphics cards that support OpenGL. + +**It does not:** +* Work with 'modern/premium' Minecraft servers. +* Provide single-player support. + +#### Requirements +* Windows: The .NET framework 2.0 or Mono. (Vista and later have .NET framework 2.0 built in) +* Linux: Mono. +* Mac OS X: Mono. (Not tested at all yet - likely just crashes) + +*When building from source and targeting Mono, you must either use the Mono compiler or +define `__MonoCS__` when building, otherwise you will get runtime errors when decompressing the map with Mono.* + +#### Instructions +The simple way to use ClassicalSharp is to use the launcher application. You can connect to LAN/locally hosted servers, minecraft.net servers, and classicube.net servers through the launcher. + +Note that the first time you run the launcher, a dialog box will pop up saying: "Some required resources weren't found. Would you like to download them now?" Just click OK. +(This is necessary because I cannot legally redistribute the assets of Minecraft Classic with the application) + +*Alternatively, you can pass command line arguments directly to the client. The client expects these arguments to be in the form: ` `, where skin server is optional.* + +#### Key combinations +* Press escape (after joining a world) to switch to the pause menu. +* The pause menu lists all of the key combinations used by the client. + These key combinations can be reassigned by clicking on a key combination. +* Press escape or click "Back to game" to return to the game. + +Some points to note: +* If the server has disabled hacks, some of the key combinations such as fly, speed etc will not do anything. +* Pressing F6 to change view distance can improve performance by limiting the number of visible chunks. +* Pressing F7 to toggle VSync on or off. On minimises CPU usage, whereas off maximises chunk loading speed. + +#### Client commands +* To see a list of all built in commands, type `/client commands`. +* To see help for a given built in command, type `/client help `. \ No newline at end of file diff --git a/readme.txt b/readme.txt deleted file mode 100644 index affb50099..000000000 --- a/readme.txt +++ /dev/null @@ -1,47 +0,0 @@ -ClassicalSharp is a custom MineCraft Classic client written in C# that works with Windows and Linux. -It is not affiliated with (or supported by) Mojang AB, MineCraft, or Microsoft in any way. - -You can get the latest binaries from github.com/UnknownShadow200/ClassicalSharp/releases - -=== What ClassicalSharp is === -* Works with both MineCraft.net and ClassiCube.net -* Lightweight, minimal memory usage compared to standard client. -* Should work with effectively all graphics cards that support OpenGL. - -It does not: -* Work with 'modern/premium' MineCraft servers. -* Provide single-player support. - -=== Requirements === -* Windows: The .NET framework 2.0 or Mono. (Vista and later have .NET framework 2.0 built in) -* Linux: Mono. (Not completely tested, but does work) -* Mac OS X: Mono. (Not tested at all yet - may just crash) - -* When building from source and targeting Mono, you must either use the Mono compiler or -define '__MonoCS__' when building, otherwise you will get runtime errors when decompressing the map. - -=== Instructions === -To use ClassicalSharp, you can either -A) Use the launcher -B) Pass command line arguments directly to classicalsharp.exe - -* Note that the first time you run the launcher, a dialog box will pop up with the message -"Some required resources weren't found." Just click OK. (This is because I cannot redistribute -the assets of Minecraft Classic with the application as they are the copyrighted property of Mojang) - -The launcher interface should be straightforward. If you are confused about how to use the launcher, -please read "launcher instructions.txt" - -=== Key combinations === -Press escape (after joining the first world) to switch to the pause menu. -The pause menu lists all of the key combinations used by the client. -Key combinations can be reassigned in the pause menu by clicking on a key combination. -Press escape or click "Back to game" to return to the game. - -* Note that if the server has disabled hacks, some of the key combinations will have no affect. -* Pressing F6 to change view distance can improve performance by limiting the number of visible chunks. -* Pressing F7 to toggle VSync on or off. On minimises CPU usage, whereas off maximises chunk loading speed. - -=== Client commands === -ClassicalSharp comes with a number of built in commands. You can see a list of them by typing /client commands, -and you can see help for a given command for typing /client help [command name]. \ No newline at end of file diff --git a/todo.txt b/todo.txt index f8b29d209..7ab3df70e 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,4 @@ * Texture animations. -* Proper SelectionBox sorting. -* DirectX API support. -* Some of the remaining CPE extensions. * Test that Mojang Accounts work properly. * Fix issues with framerate limiting not working properly on same cards. (will require 'sleeping'of main thread) \ No newline at end of file