From f7e8e413468d01b7caa663d33bf0a0961e727beb Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 21 Jan 2016 00:40:02 +1100 Subject: [PATCH] Fix coordinates not being converted into tile coordinates properly in launcher. --- ClassicalSharp/Game/Game.cs | 2 +- Launcher2/Gui/Drawer2DExt.cs | 10 ++++------ Launcher2/Gui/Screens/MainScreen.cs | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ClassicalSharp/Game/Game.cs b/ClassicalSharp/Game/Game.cs index 519fa739b..32e4ea9bd 100644 --- a/ClassicalSharp/Game/Game.cs +++ b/ClassicalSharp/Game/Game.cs @@ -128,7 +128,7 @@ namespace ClassicalSharp { Graphics.DepthTestFunc( CompareFunc.LessEqual ); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha ); - Graphics.AlphaTestFunc( CompareFunc.Greater, 0.1f ); + Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f ); fpsScreen = new FpsScreen( this ); fpsScreen.Init(); hudScreen = new HudScreen( this ); diff --git a/Launcher2/Gui/Drawer2DExt.cs b/Launcher2/Gui/Drawer2DExt.cs index 856385647..ef5c0de3d 100644 --- a/Launcher2/Gui/Drawer2DExt.cs +++ b/Launcher2/Gui/Drawer2DExt.cs @@ -13,22 +13,20 @@ namespace Launcher2 { int srcX = srcRect.X, dstX = dstRect.X; int srcY = srcRect.Y, dstY = dstRect.Y; int scaleWidth = scale.Width, scaleHeight = scale.Height; - int offsetX = dstRect.X * srcRect.Width / scaleWidth; - int offsetY = dstRect.Y * srcRect.Height / scaleHeight; if( dstX >= dst.Width || dstY >= dst.Height ) return; dstWidth = Math.Min( dstX + dstWidth, dst.Width ) - dstX; dstHeight = Math.Min( dstY + dstHeight, dst.Height ) - dstY; for( int yy = 0; yy < dstHeight; yy++ ) { - int scaledY = yy * srcHeight / scaleHeight; - int* srcRow = src.GetRowPtr( srcY + (scaledY + offsetY) % srcHeight ); + int scaledY = (yy + dstRect.Y) * srcHeight / scaleHeight; + int* srcRow = src.GetRowPtr( srcY + (scaledY % srcHeight) ); int* dstRow = dst.GetRowPtr( dstY + yy ); byte rgbScale = (byte)Utils.Lerp( scaleA, scaleB, (float)yy / dstHeight ); for( int xx = 0; xx < dstWidth; xx++ ) { - int scaledX = xx * srcWidth / scaleWidth; - int pixel = srcRow[srcX + (scaledX + offsetX) % srcWidth]; + int scaledX = (xx + dstRect.X) * srcWidth / scaleWidth; + int pixel = srcRow[srcX + (scaledX % srcWidth)]; int col = pixel & ~0xFFFFFF; // keep a, but clear rgb col |= ((pixel & 0xFF) * rgbScale / 255); diff --git a/Launcher2/Gui/Screens/MainScreen.cs b/Launcher2/Gui/Screens/MainScreen.cs index 681827a69..8f19d6b44 100644 --- a/Launcher2/Gui/Screens/MainScreen.cs +++ b/Launcher2/Gui/Screens/MainScreen.cs @@ -94,8 +94,6 @@ namespace Launcher2 { Options.Set( "nostalgia-usecpe", !game.ClassicMode ); Options.Set( "nostalgia-servertextures", !game.ClassicMode ); Options.Set( "nostalgia-classictablist", game.ClassicMode ); - Options.Set( "mode-classic", !game.ClassicMode ); - Options.Set( "mode-classic", !game.ClassicMode ); Options.Set( "hacksenabled", !game.ClassicMode ); Options.Set( "doublejump", false ); Options.Save();