Inventory menu should use classic background colour when in classic mode, also bedrock should not be shown when in classic mode but hax is disabled. (Thanks FrostFox)

This commit is contained in:
UnknownShadow200 2016-04-05 18:35:40 +10:00
parent 15d73ab7ac
commit 867e204825
3 changed files with 15 additions and 20 deletions

View file

@ -26,8 +26,10 @@ namespace ClassicalSharp.Gui {
int TableWidth { get { return blocksPerRow * blockSize + 10 + 10; } }
int TableHeight { get { return Math.Min( rows, maxRows ) * blockSize + 10 + 30; } }
static FastColour backCol = new FastColour( 30, 30, 30, 200 );
static FastColour normBackCol = new FastColour( 30, 30, 30, 200 );
static FastColour classicBackCol = new FastColour( 48, 48, 96, 192 );
public override void Render( double delta ) {
FastColour backCol = game.ClassicMode ? classicBackCol : normBackCol;
api.Draw2DQuad( TableX, TableY, TableWidth, TableHeight, backCol );
if( rows > maxRows )
DrawScrollbar();
@ -220,7 +222,9 @@ namespace ClassicalSharp.Gui {
}
bool ShowTile( int tile ) {
if( game.ClassicMode && (tile >= (byte)Block.Water && tile <= (byte)Block.StillLava) )
bool hackBlocks = !game.ClassicMode || game.ClassicHacks;
if( !hackBlocks && (tile == (byte)Block.Bedrock ||
tile >= (byte)Block.Water && tile <= (byte)Block.StillLava) )
return false;
return tile < BlockInfo.CpeBlocksCount || game.BlockInfo.Name[tile] != "Invalid";
}

View file

@ -36,13 +36,14 @@ namespace Launcher {
public unsafe static void DrawTiledPixels( FastBitmap src, FastBitmap dst,
Rectangle srcRect, Rectangle dstRect ) {
int srcWidth = srcRect.Width, dstWidth = dstRect.Width;
int srcHeight = srcRect.Height, dstHeight = dstRect.Height;
int srcX = srcRect.X, dstX = dstRect.X;
int srcY = srcRect.Y, dstY = dstRect.Y;
int srcX = srcRect.X, srcWidth = srcRect.Width, srcHeight = srcRect.Height;
int dstX, dstY, dstWidth, dstHeight;
if( !CheckCoords( dst, dstRect, out dstX, out dstY, out dstWidth, out dstHeight ) )
return;
for( int yy = 0; yy < dstHeight; yy++ ) {
int* srcRow = src.GetRowPtr( srcY + ((yy + dstY) % srcHeight) );
// srcY is always 0 so we don't need to add
int* srcRow = src.GetRowPtr( ((yy + dstY) % srcHeight) );
int* dstRow = dst.GetRowPtr( dstY + yy );
for( int xx = 0; xx < dstWidth; xx++ )
@ -100,11 +101,5 @@ namespace Launcher {
if( dstWidth < 0 || dstHeight < 0 ) return false;
return true;
}
static float Noise( int x, int y ) {
int n = x + y * 57;
n = (n << 13) ^ n;
return 1f - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824f;
}
}
}

View file

@ -120,13 +120,9 @@ namespace Launcher {
}
void ClearTile( int x, int y, int width, int height, int srcX, FastBitmap dst ) {
if( x >= Width || y >= Height ) return;
Rectangle srcRect = new Rectangle( srcX, 0, tileSize, tileSize );
Size size = new Size( tileSize, tileSize );
Rectangle area = new Rectangle( x, y, width, height );
area.Width = Math.Min( area.X + area.Width, dst.Width ) - area.X;
area.Height = Math.Min( area.Y + area.Height, dst.Height ) - area.Y;
Drawer2DExt.DrawTiledPixels( terrainPixels, dst, srcRect, area );
Rectangle srcRect = new Rectangle( srcX, 0, tileSize, tileSize );
Drawer2DExt.DrawTiledPixels( terrainPixels, dst, srcRect,
new Rectangle( x, y, width, height ) );
}
}
}