Minor cleanups here and there.

This commit is contained in:
UnknownShadow200 2015-01-22 08:47:58 +11:00
parent 1ae63a0fee
commit 359060889f
5 changed files with 14 additions and 18 deletions

View File

@ -97,7 +97,6 @@ namespace ClassicalSharp {
textInput.Dispose();
status.Dispose();
bottomRight.Dispose();
status.Dispose();
GraphicsApi.DeleteTexture( ref pageTexture );
GraphicsApi.DeleteTexture( ref announcementTexture );
Window.ChatReceived -= ChatReceived;

View File

@ -86,6 +86,7 @@ namespace ClassicalSharp {
GraphicsApi.DeleteTexture( ref info[i].Texture );
}
Window.CpeListInfoAdded -= PlayerListInfoAdded;
Window.CpeListInfoChanged -= PlayerListInfoChanged;
Window.CpeListInfoRemoved -= PlayerListInfoRemoved;
}

View File

@ -43,6 +43,14 @@ namespace ClassicalSharp {
B = c.B;
}
public static FastColour Scale( FastColour value, float t ) {
FastColour result = value;
result.R = (byte)( value.R * t );
result.G = (byte)( value.G * t );
result.B = (byte)( value.B * t );
return result;
}
public Color ToColor() {
return Color.FromArgb( A, R, G, B );
}

View File

@ -91,9 +91,7 @@ namespace Launcher {
}
static void HtmlDecode( string value, StringBuilder output ) {
int length = value.Length;
for( int i = 0; i < length; i++ ) {
for( int i = 0; i < value.Length; i++ ) {
char token = value[i];
if( token != '&' ) {
output.Append( token );
@ -122,7 +120,6 @@ namespace Launcher {
i = entityEnd;
char decodedEntity;
if( Lookup( entity, out decodedEntity ) ) {
token = decodedEntity;
output.Append( decodedEntity );
} else { // Invalid token.
output.Append( '&' );

15
Map.cs
View File

@ -1,5 +1,4 @@
using System;
using EnvDefault = ClassicalSharp.Renderers.EnvRenderer;
namespace ClassicalSharp {
@ -134,17 +133,9 @@ namespace ClassicalSharp {
}
void AdjustLight( FastColour normal, ref FastColour xSide, ref FastColour zSide, ref FastColour yBottom ) {
xSide = Scale( normal, 0.6f );
zSide = Scale( normal, 0.8f );
yBottom = Scale( normal, 0.5f );
}
static FastColour Scale( FastColour value, float t ) {
FastColour result = value;
result.R = (byte)( value.R * t );
result.G = (byte)( value.G * t );
result.B = (byte)( value.B * t );
return result;
xSide = FastColour.Scale( normal, 0.6f );
zSide = FastColour.Scale( normal, 0.8f );
yBottom = FastColour.Scale( normal, 0.5f );
}
public void UseRawMap( byte[] map, int width, int height, int length ) {