Play sounds of gas/liquid blocks intersecting with before solid blocks underneath (Thanks 123DontMessWitMe), don't italic classical in the launcher.

This commit is contained in:
UnknownShadow200 2015-12-27 21:12:02 +11:00
parent c32891d868
commit bb69f628da
3 changed files with 29 additions and 21 deletions

View File

@ -115,7 +115,7 @@ namespace ClassicalSharp {
Vector3 soundPos = nextPos;
bool anyNonAir = false;
SoundType type = GetSoundUnder( ref anyNonAir );
SoundType type = GetSound( ref anyNonAir );
if( !anyNonAir ) soundPos = new Vector3( -100000 );
if( onGround && (DoPlaySound( soundPos ) || !wasOnGround) ) {
@ -126,24 +126,37 @@ namespace ClassicalSharp {
bool DoPlaySound( Vector3 soundPos ) {
float distSq = (lastSoundPos - soundPos).LengthSquared;
bool enoughDist = distSq > 1.75f * 1.75f;
// just play every certain block interval when not animating
if( curSwing < 0.999f )
return distSq > 1.75f * 1.75f;
if( curSwing < 0.999f ) return enoughDist;
// have our legs just crossed over the '0' point?
float oldLegRot = (float)Math.Sin( walkTimeO );
float newLegRot = (float)Math.Sin( walkTimeN );
return Math.Sign( oldLegRot ) != Math.Sign( newLegRot );
return (Math.Sign( oldLegRot ) != Math.Sign( newLegRot ));
}
SoundType GetSoundUnder( ref bool anyNonAir ) {
Vector3 pos = new Vector3( nextPos.X, nextPos.Y - 0.01f, nextPos.Z );
Vector3 size = CollisionSize;
SoundType GetSound( ref bool anyNonAir ) {
Vector3 pos = nextPos, size = CollisionSize;
BoundingBox bounds = new BoundingBox( pos - size / 2, pos + size / 2);
bounds.Max.Y = bounds.Min.Y = pos.Y;
SoundType type = SoundType.None;
bool nonAir = false;
// first check surrounding liquids/gas for sounds
TouchesAny( bounds, b => {
SoundType newType = game.BlockInfo.StepSounds[b];
BlockCollideType collide = game.BlockInfo.CollideType[b];
if( newType != SoundType.None && collide != BlockCollideType.Solid)
type = newType;
if( b != 0 ) nonAir = true;
return false;
});
if( type != SoundType.None )
return type;
// then check soliod blocks below
pos.Y -= 0.01f;
bounds.Max.Y = bounds.Min.Y = pos.Y;
TouchesAny( bounds, b => {
SoundType newType = game.BlockInfo.StepSounds[b];
if( newType != SoundType.None ) type = newType;

View File

@ -53,9 +53,9 @@ namespace Launcher2 {
int* row = dst.GetRowPtr( dstY + yy );
for( int xx = 0; xx < dstWidth; xx++ ) {
float n = Noise( dstX + xx, dstY + yy );
int r = col.R + (int)(5 * n); Utils.Clamp( ref r, 0, 255 );
int g = col.G + (int)(5 * n); Utils.Clamp( ref g, 0, 255 );
int b = col.B + (int)(5 * n); Utils.Clamp( ref b, 0, 255 );
int r = col.R + (int)(n * 6); Utils.Clamp( ref r, 0, 255 );
int g = col.G + (int)(n * 6); Utils.Clamp( ref g, 0, 255 );
int b = col.B + (int)(n * 6); Utils.Clamp( ref b, 0, 255 );
row[dstX + xx] = alpha | (r << 16) | (g << 8) | b;
}
}

View File

@ -43,15 +43,10 @@ namespace Launcher2 {
drawer.SetBitmap( Framebuffer );
ClearArea( 0, 0, Width, Height );
DrawTextArgs args1 = new DrawTextArgs( "&eClassical", logoItalicFont, true );
Size size1 = drawer.MeasureChatSize( ref args1 );
DrawTextArgs args2 = new DrawTextArgs( "&fSharp", logoFont, true );
Size size2 = drawer.MeasureChatSize( ref args2 );
int adjust = Drawer.UseBitmappedChat ? -8 : 2;
int xStart = Width / 2 - (size1.Width + size2.Width) / 2;
drawer.DrawChatText( ref args1, xStart, 20 + (size2.Height - size1.Height - 1) );
drawer.DrawChatText( ref args2, xStart + size1.Width + adjust, 20 );
DrawTextArgs args = new DrawTextArgs( "&eClassical&fSharp", logoFont, true );
Size size = drawer.MeasureChatSize( ref args );
int xStart = Width / 2 - size.Width / 2;
drawer.DrawChatText( ref args, xStart, 20 );
}
Dirty = true;
}