mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
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:
parent
c0645695e2
commit
3a91e4c993
@ -77,7 +77,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
curWidget = null;
|
curWidget = null;
|
||||||
}
|
}
|
||||||
return true;
|
return key < Key.F1 || key > Key.F35;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
|
@ -42,7 +42,7 @@ namespace ClassicalSharp {
|
|||||||
game.SetNewScreen( null );
|
game.SetNewScreen( null );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return selectedWidget == null ? true :
|
return selectedWidget == null ? (key < Key.F1 || key > Key.F35) :
|
||||||
selectedWidget.HandlesKeyDown( key );
|
selectedWidget.HandlesKeyDown( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ namespace ClassicalSharp {
|
|||||||
ChangeSetting();
|
ChangeSetting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( inputWidget == null ) return true;
|
if( inputWidget == null )
|
||||||
|
return key < Key.F1 || key > Key.F35;
|
||||||
return inputWidget.HandlesKeyDown( key );
|
return inputWidget.HandlesKeyDown( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace ClassicalSharp {
|
|||||||
public override bool HandlesKeyDown( Key key ) {
|
public override bool HandlesKeyDown( Key key ) {
|
||||||
if( key == Key.Escape )
|
if( key == Key.Escape )
|
||||||
game.SetNewScreen( null );
|
game.SetNewScreen( null );
|
||||||
return true;
|
return key < Key.F1 || key > Key.F35;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
|
@ -135,7 +135,7 @@ namespace ClassicalSharp {
|
|||||||
graphicsApi.DeleteTexture( ref chatInputTexture );
|
graphicsApi.DeleteTexture( ref chatInputTexture );
|
||||||
SetText( chatInputText.ToString() );
|
SetText( chatInputText.ToString() );
|
||||||
}
|
}
|
||||||
return true;
|
return key < Key.F1 || key > Key.F35;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandlesKeyUp( Key key ) {
|
public override bool HandlesKeyUp( Key key ) {
|
||||||
|
@ -91,13 +91,12 @@ namespace ClassicalSharp {
|
|||||||
{
|
{
|
||||||
if( !game.Map.IsValidPos( x, y, z ) ) continue;
|
if( !game.Map.IsValidPos( x, y, z ) ) continue;
|
||||||
byte block = game.Map.GetBlock( x, y, z );
|
byte block = game.Map.GetBlock( x, y, z );
|
||||||
|
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
|
||||||
|
Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block];
|
||||||
|
|
||||||
if( condition( block ) ) {
|
BoundingBox blockBB = new BoundingBox( min, max );
|
||||||
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
|
if( !blockBB.Intersects( bounds ) ) continue;
|
||||||
Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block];
|
if( condition( block ) ) return true;
|
||||||
BoundingBox blockBB = new BoundingBox( min, max );
|
|
||||||
if( blockBB.Intersects( bounds ) ) return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@ namespace ClassicalSharp {
|
|||||||
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
|
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
|
||||||
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
|
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
|
||||||
this.minBB = min; this.maxBB = max;
|
this.minBB = min; this.maxBB = max;
|
||||||
|
minBB.Y = 1 - minBB.Y; maxBB.Y = 1 - maxBB.Y;
|
||||||
|
|
||||||
fullBright = info.FullBright[tile];
|
fullBright = info.FullBright[tile];
|
||||||
isTranslucent = info.IsTranslucent[tile];
|
isTranslucent = info.IsTranslucent[tile];
|
||||||
|
@ -168,8 +168,8 @@ namespace ClassicalSharp {
|
|||||||
int offset = (lightFlags >> TileSide.Left) & 1;
|
int offset = (lightFlags >> TileSide.Left) & 1;
|
||||||
|
|
||||||
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
|
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
|
||||||
float v1 = vOrigin + minBB.Y * invVerElementSize;
|
float v1 = vOrigin + maxBB.Y * invVerElementSize;
|
||||||
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
|
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
|
||||||
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
||||||
FastColour col = fullBright ? FastColour.White :
|
FastColour col = fullBright ? FastColour.White :
|
||||||
X >= offset ? (Y > map.heightmap[(Z * width) + (X - offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide;
|
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;
|
int offset = (lightFlags >> TileSide.Right) & 1;
|
||||||
|
|
||||||
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
|
float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f;
|
||||||
float v1 = vOrigin + minBB.Y * invVerElementSize;
|
float v1 = vOrigin + maxBB.Y * invVerElementSize;
|
||||||
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
|
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
|
||||||
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
||||||
FastColour col = fullBright ? FastColour.White :
|
FastColour col = fullBright ? FastColour.White :
|
||||||
X <= (maxX - offset) ? (Y > map.heightmap[(Z * width) + (X + offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide;
|
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;
|
int offset = (lightFlags >> TileSide.Front) & 1;
|
||||||
|
|
||||||
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
|
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
|
||||||
float v1 = vOrigin + minBB.Y * invVerElementSize;
|
float v1 = vOrigin + maxBB.Y * invVerElementSize;
|
||||||
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
|
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
|
||||||
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
||||||
FastColour col = fullBright ? FastColour.White :
|
FastColour col = fullBright ? FastColour.White :
|
||||||
Z >= offset ? (Y > map.heightmap[((Z - offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;
|
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;
|
int offset = (lightFlags >> TileSide.Back) & 1;
|
||||||
|
|
||||||
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
|
float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f;
|
||||||
float v1 = vOrigin + minBB.Y * invVerElementSize;
|
float v1 = vOrigin + maxBB.Y * invVerElementSize;
|
||||||
float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f;
|
float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f;
|
||||||
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
|
||||||
FastColour col = fullBright ? FastColour.White :
|
FastColour col = fullBright ? FastColour.White :
|
||||||
Z <= (maxZ - offset) ? (Y > map.heightmap[((Z + offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;
|
Z <= (maxZ - offset) ? (Y > map.heightmap[((Z + offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user