Less code duplication in Chibi model.

This commit is contained in:
UnknownShadow200 2016-09-06 11:57:08 +10:00
parent 43b3d5e921
commit 899b705e54
4 changed files with 13 additions and 21 deletions

View File

@ -10,19 +10,14 @@ namespace ClassicalSharp.Model {
public ChibiModel( Game window ) : base( window ) { }
const float size = 0.5f;
protected override void MakeDescriptions() {
base.MakeDescriptions();
head = MakeBoxBounds( -4, 12, -4, 4, 20, 4 ).RotOrigin( 0, 13, 0 );
torso = MakeBoxBounds( -4, -6, -2, 4, 6, 2 )
.SetModelBounds( -2, 6, -1, 2, 12, 1 );
lLeg = MakeBoxBounds( -2, -6, -2, 2, 6, 2 ).RotOrigin( 0, 6, 0 )
.SetModelBounds( -2, 0, -1, 0, 6, 1 );
rLeg = MakeBoxBounds( -2, -6, -2, 2, 6, 2 ).RotOrigin( 0, 6, 0 )
.SetModelBounds( 0, 0, -1, 2, 6, 1 );
lArm = MakeBoxBounds( -2, -6, -2, 2, 6, 2 ).RotOrigin( -3, 11, 0 )
.SetModelBounds( -4, 6, -1, -2, 12, 1 );
rArm = MakeBoxBounds( -2, -6, -2, 2, 6, 2 ).RotOrigin( 3, 11, 0 )
.SetModelBounds( 2, 6, -1, 4, 12, 1 );
offset = 0.5f * 0.5f;
torso = torso.Scale( size );
lLeg = lLeg.Scale( size ); rLeg = rLeg.Scale( size );
lArm = lArm.Scale( size ); rArm = rArm.Scale( size );
offset = 0.5f * size;
}
public override float MaxScale { get { return 3; } }

View File

@ -87,11 +87,11 @@ namespace ClassicalSharp.Generator {
blocks[mapIndex] = Block.Lava;
mapIndex += oneY;
for( int y = 1; y < height; y++ ) {
byte type = 0;
if( y <= stoneHeight ) type = Block.Stone;
else if( y <= dirtHeight ) type = Block.Dirt;
byte block = 0;
if( y <= stoneHeight ) block = Block.Stone;
else if( y <= dirtHeight ) block = Block.Dirt;
blocks[mapIndex] = type;
blocks[mapIndex] = block;
mapIndex += oneY;
}
}

View File

@ -234,8 +234,7 @@ namespace ClassicalSharp.Network {
}
Bitmap oldBmp = oldItem.Data as Bitmap;
if( oldBmp != null )
oldBmp.Dispose();
if( oldBmp != null ) oldBmp.Dispose();
}
downloaded[request.Identifier] = newItem;
}

View File

@ -97,8 +97,7 @@ namespace ClassicalSharp {
public bool Empty {
get {
for( int i = 0; i < Capacity; i++ ) {
if( value[i] != '\0' )
return false;
if( value[i] != '\0' ) return false;
}
return true;
}
@ -108,8 +107,7 @@ namespace ClassicalSharp {
get {
int len = Capacity;
for( int i = Capacity - 1; i >= 0; i-- ) {
if( value[i] != '\0' )
break;
if( value[i] != '\0' ) break;
len--;
}
return len;