mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-29 08:32:46 -04:00
Less code duplication in Chibi model.
This commit is contained in:
parent
43b3d5e921
commit
899b705e54
@ -10,19 +10,14 @@ namespace ClassicalSharp.Model {
|
|||||||
|
|
||||||
public ChibiModel( Game window ) : base( window ) { }
|
public ChibiModel( Game window ) : base( window ) { }
|
||||||
|
|
||||||
|
const float size = 0.5f;
|
||||||
protected override void MakeDescriptions() {
|
protected override void MakeDescriptions() {
|
||||||
|
base.MakeDescriptions();
|
||||||
head = MakeBoxBounds( -4, 12, -4, 4, 20, 4 ).RotOrigin( 0, 13, 0 );
|
head = MakeBoxBounds( -4, 12, -4, 4, 20, 4 ).RotOrigin( 0, 13, 0 );
|
||||||
torso = MakeBoxBounds( -4, -6, -2, 4, 6, 2 )
|
torso = torso.Scale( size );
|
||||||
.SetModelBounds( -2, 6, -1, 2, 12, 1 );
|
lLeg = lLeg.Scale( size ); rLeg = rLeg.Scale( size );
|
||||||
lLeg = MakeBoxBounds( -2, -6, -2, 2, 6, 2 ).RotOrigin( 0, 6, 0 )
|
lArm = lArm.Scale( size ); rArm = rArm.Scale( size );
|
||||||
.SetModelBounds( -2, 0, -1, 0, 6, 1 );
|
offset = 0.5f * size;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float MaxScale { get { return 3; } }
|
public override float MaxScale { get { return 3; } }
|
||||||
|
@ -87,11 +87,11 @@ namespace ClassicalSharp.Generator {
|
|||||||
blocks[mapIndex] = Block.Lava;
|
blocks[mapIndex] = Block.Lava;
|
||||||
mapIndex += oneY;
|
mapIndex += oneY;
|
||||||
for( int y = 1; y < height; y++ ) {
|
for( int y = 1; y < height; y++ ) {
|
||||||
byte type = 0;
|
byte block = 0;
|
||||||
if( y <= stoneHeight ) type = Block.Stone;
|
if( y <= stoneHeight ) block = Block.Stone;
|
||||||
else if( y <= dirtHeight ) type = Block.Dirt;
|
else if( y <= dirtHeight ) block = Block.Dirt;
|
||||||
|
|
||||||
blocks[mapIndex] = type;
|
blocks[mapIndex] = block;
|
||||||
mapIndex += oneY;
|
mapIndex += oneY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,7 @@ namespace ClassicalSharp.Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bitmap oldBmp = oldItem.Data as Bitmap;
|
Bitmap oldBmp = oldItem.Data as Bitmap;
|
||||||
if( oldBmp != null )
|
if( oldBmp != null ) oldBmp.Dispose();
|
||||||
oldBmp.Dispose();
|
|
||||||
}
|
}
|
||||||
downloaded[request.Identifier] = newItem;
|
downloaded[request.Identifier] = newItem;
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,7 @@ namespace ClassicalSharp {
|
|||||||
public bool Empty {
|
public bool Empty {
|
||||||
get {
|
get {
|
||||||
for( int i = 0; i < Capacity; i++ ) {
|
for( int i = 0; i < Capacity; i++ ) {
|
||||||
if( value[i] != '\0' )
|
if( value[i] != '\0' ) return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -108,8 +107,7 @@ namespace ClassicalSharp {
|
|||||||
get {
|
get {
|
||||||
int len = Capacity;
|
int len = Capacity;
|
||||||
for( int i = Capacity - 1; i >= 0; i-- ) {
|
for( int i = Capacity - 1; i >= 0; i-- ) {
|
||||||
if( value[i] != '\0' )
|
if( value[i] != '\0' ) break;
|
||||||
break;
|
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user