Fix sounds playing even when not intersecting boundingbox (Thanks Empy), fix vertical sampling for non-fully high blocks being in the wrong location (Thanks goodlyay), fix not being able to use function keys in menu (Thanks WolfGangNS)

This commit is contained in:
UnknownShadow200 2016-01-02 21:08:50 +11:00
parent c0645695e2
commit 3a91e4c993
8 changed files with 20 additions and 19 deletions

View File

@ -77,7 +77,7 @@ namespace ClassicalSharp {
}
curWidget = null;
}
return true;
return key < Key.F1 || key > Key.F35;
}
public override void Dispose() {

View File

@ -42,7 +42,7 @@ namespace ClassicalSharp {
game.SetNewScreen( null );
return true;
}
return selectedWidget == null ? true :
return selectedWidget == null ? (key < Key.F1 || key > Key.F35) :
selectedWidget.HandlesKeyDown( key );
}

View File

@ -45,7 +45,8 @@ namespace ClassicalSharp {
ChangeSetting();
return true;
}
if( inputWidget == null ) return true;
if( inputWidget == null )
return key < Key.F1 || key > Key.F35;
return inputWidget.HandlesKeyDown( key );
}

View File

@ -80,7 +80,7 @@ namespace ClassicalSharp {
public override bool HandlesKeyDown( Key key ) {
if( key == Key.Escape )
game.SetNewScreen( null );
return true;
return key < Key.F1 || key > Key.F35;
}
public override void Dispose() {

View File

@ -135,7 +135,7 @@ namespace ClassicalSharp {
graphicsApi.DeleteTexture( ref chatInputTexture );
SetText( chatInputText.ToString() );
}
return true;
return key < Key.F1 || key > Key.F35;
}
public override bool HandlesKeyUp( Key key ) {

View File

@ -91,13 +91,12 @@ namespace ClassicalSharp {
{
if( !game.Map.IsValidPos( x, y, z ) ) continue;
byte block = game.Map.GetBlock( x, y, z );
if( condition( block ) ) {
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block];
BoundingBox blockBB = new BoundingBox( min, max );
if( blockBB.Intersects( bounds ) ) return true;
}
if( !blockBB.Intersects( bounds ) ) continue;
if( condition( block ) ) return true;
}
return false;
}

View File

@ -137,6 +137,7 @@ namespace ClassicalSharp {
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
this.minBB = min; this.maxBB = max;
minBB.Y = 1 - minBB.Y; maxBB.Y = 1 - maxBB.Y;
fullBright = info.FullBright[tile];
isTranslucent = info.IsTranslucent[tile];

View File

@ -168,8 +168,8 @@ namespace ClassicalSharp {
int offset = (lightFlags >> TileSide.Left) & 1;
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
float v1 = vOrigin + minBB.Y * invVerElementSize;
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
float v1 = vOrigin + maxBB.Y * invVerElementSize;
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
FastColour col = fullBright ? FastColour.White :
X >= offset ? (Y > map.heightmap[(Z * width) + (X - offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide;
@ -187,8 +187,8 @@ namespace ClassicalSharp {
int offset = (lightFlags >> TileSide.Right) & 1;
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
float v1 = vOrigin + minBB.Y * invVerElementSize;
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
float v1 = vOrigin + maxBB.Y * invVerElementSize;
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
FastColour col = fullBright ? FastColour.White :
X <= (maxX - offset) ? (Y > map.heightmap[(Z * width) + (X + offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide;
@ -206,8 +206,8 @@ namespace ClassicalSharp {
int offset = (lightFlags >> TileSide.Front) & 1;
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
float v1 = vOrigin + minBB.Y * invVerElementSize;
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
float v1 = vOrigin + maxBB.Y * invVerElementSize;
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
FastColour col = fullBright ? FastColour.White :
Z >= offset ? (Y > map.heightmap[((Z - offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;
@ -225,8 +225,8 @@ namespace ClassicalSharp {
int offset = (lightFlags >> TileSide.Back) & 1;
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
float v1 = vOrigin + minBB.Y * invVerElementSize;
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
float v1 = vOrigin + maxBB.Y * invVerElementSize;
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
FastColour col = fullBright ? FastColour.White :
Z <= (maxZ - offset) ? (Y > map.heightmap[((Z + offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;