mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
Fix coordinates not being converted into tile coordinates properly in launcher.
This commit is contained in:
parent
272b12f00a
commit
f7e8e41346
@ -128,7 +128,7 @@ namespace ClassicalSharp {
|
|||||||
Graphics.DepthTestFunc( CompareFunc.LessEqual );
|
Graphics.DepthTestFunc( CompareFunc.LessEqual );
|
||||||
//Graphics.DepthWrite = true;
|
//Graphics.DepthWrite = true;
|
||||||
Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha );
|
Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha );
|
||||||
Graphics.AlphaTestFunc( CompareFunc.Greater, 0.1f );
|
Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f );
|
||||||
fpsScreen = new FpsScreen( this );
|
fpsScreen = new FpsScreen( this );
|
||||||
fpsScreen.Init();
|
fpsScreen.Init();
|
||||||
hudScreen = new HudScreen( this );
|
hudScreen = new HudScreen( this );
|
||||||
|
@ -13,22 +13,20 @@ namespace Launcher2 {
|
|||||||
int srcX = srcRect.X, dstX = dstRect.X;
|
int srcX = srcRect.X, dstX = dstRect.X;
|
||||||
int srcY = srcRect.Y, dstY = dstRect.Y;
|
int srcY = srcRect.Y, dstY = dstRect.Y;
|
||||||
int scaleWidth = scale.Width, scaleHeight = scale.Height;
|
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;
|
if( dstX >= dst.Width || dstY >= dst.Height ) return;
|
||||||
dstWidth = Math.Min( dstX + dstWidth, dst.Width ) - dstX;
|
dstWidth = Math.Min( dstX + dstWidth, dst.Width ) - dstX;
|
||||||
dstHeight = Math.Min( dstY + dstHeight, dst.Height ) - dstY;
|
dstHeight = Math.Min( dstY + dstHeight, dst.Height ) - dstY;
|
||||||
|
|
||||||
for( int yy = 0; yy < dstHeight; yy++ ) {
|
for( int yy = 0; yy < dstHeight; yy++ ) {
|
||||||
int scaledY = yy * srcHeight / scaleHeight;
|
int scaledY = (yy + dstRect.Y) * srcHeight / scaleHeight;
|
||||||
int* srcRow = src.GetRowPtr( srcY + (scaledY + offsetY) % srcHeight );
|
int* srcRow = src.GetRowPtr( srcY + (scaledY % srcHeight) );
|
||||||
int* dstRow = dst.GetRowPtr( dstY + yy );
|
int* dstRow = dst.GetRowPtr( dstY + yy );
|
||||||
byte rgbScale = (byte)Utils.Lerp( scaleA, scaleB, (float)yy / dstHeight );
|
byte rgbScale = (byte)Utils.Lerp( scaleA, scaleB, (float)yy / dstHeight );
|
||||||
|
|
||||||
for( int xx = 0; xx < dstWidth; xx++ ) {
|
for( int xx = 0; xx < dstWidth; xx++ ) {
|
||||||
int scaledX = xx * srcWidth / scaleWidth;
|
int scaledX = (xx + dstRect.X) * srcWidth / scaleWidth;
|
||||||
int pixel = srcRow[srcX + (scaledX + offsetX) % srcWidth];
|
int pixel = srcRow[srcX + (scaledX % srcWidth)];
|
||||||
|
|
||||||
int col = pixel & ~0xFFFFFF; // keep a, but clear rgb
|
int col = pixel & ~0xFFFFFF; // keep a, but clear rgb
|
||||||
col |= ((pixel & 0xFF) * rgbScale / 255);
|
col |= ((pixel & 0xFF) * rgbScale / 255);
|
||||||
|
@ -94,8 +94,6 @@ namespace Launcher2 {
|
|||||||
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
||||||
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
||||||
Options.Set( "nostalgia-classictablist", 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( "hacksenabled", !game.ClassicMode );
|
||||||
Options.Set( "doublejump", false );
|
Options.Set( "doublejump", false );
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user