mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Fix custom key bindings not being loaded, sprites are now rotated diagonally.
This commit is contained in:
parent
067f87ce37
commit
a12ffa3730
@ -128,7 +128,7 @@
|
|||||||
<Compile Include="Map\MapCw.Exporter.cs" />
|
<Compile Include="Map\MapCw.Exporter.cs" />
|
||||||
<Compile Include="Map\MapCw.Importer.cs" />
|
<Compile Include="Map\MapCw.Importer.cs" />
|
||||||
<Compile Include="Map\MapDat.Importer.cs" />
|
<Compile Include="Map\MapDat.Importer.cs" />
|
||||||
<Compile Include="Map\MapFcm3.Exporter.cs" />
|
<Compile Include="Map\MapFcm3.Importer.cs" />
|
||||||
<Compile Include="Model\BlockModel.cs" />
|
<Compile Include="Model\BlockModel.cs" />
|
||||||
<Compile Include="Model\ChickenModel.cs" />
|
<Compile Include="Model\ChickenModel.cs" />
|
||||||
<Compile Include="Model\CreeperModel.cs" />
|
<Compile Include="Model\CreeperModel.cs" />
|
||||||
|
@ -192,7 +192,7 @@ namespace ClassicalSharp {
|
|||||||
!(Inventory.CanPlace[block] && Inventory.CanDelete[block])));
|
!(Inventory.CanPlace[block] && Inventory.CanDelete[block])));
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyMap Keys = new KeyMap();
|
public KeyMap Keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum KeyMapping {
|
public enum KeyMapping {
|
||||||
@ -279,11 +279,6 @@ namespace ClassicalSharp {
|
|||||||
for( int i = 0; i < names.Length; i++ ) {
|
for( int i = 0; i < names.Length; i++ ) {
|
||||||
Options.Set( "key-" + names[i], Keys[i].ToString() );
|
Options.Set( "key-" + names[i], Keys[i].ToString() );
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
Options.Save();
|
|
||||||
} catch( IOException ) {
|
|
||||||
Utils.LogWarning( "Unable to sace options.txt" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -97,6 +97,7 @@ namespace ClassicalSharp {
|
|||||||
} catch( IOException ) {
|
} catch( IOException ) {
|
||||||
Utils.LogWarning( "Unable to load options.txt" );
|
Utils.LogWarning( "Unable to load options.txt" );
|
||||||
}
|
}
|
||||||
|
Keys = new KeyMap();
|
||||||
ViewDistance = Options.GetInt( "viewdist", 16, 8192, 512 );
|
ViewDistance = Options.GetInt( "viewdist", 16, 8192, 512 );
|
||||||
defaultIb = Graphics.MakeDefaultIb();
|
defaultIb = Graphics.MakeDefaultIb();
|
||||||
ModelCache = new ModelCache( this );
|
ModelCache = new ModelCache( this );
|
||||||
@ -159,7 +160,6 @@ namespace ClassicalSharp {
|
|||||||
ViewDistance = distance;
|
ViewDistance = distance;
|
||||||
Utils.LogDebug( "setting view distance to: " + distance );
|
Utils.LogDebug( "setting view distance to: " + distance );
|
||||||
Options.Set( "viewdist", distance.ToString() );
|
Options.Set( "viewdist", distance.ToString() );
|
||||||
Options.Save();
|
|
||||||
Raise( ViewDistanceChanged );
|
Raise( ViewDistanceChanged );
|
||||||
UpdateProjection();
|
UpdateProjection();
|
||||||
}
|
}
|
||||||
@ -351,6 +351,14 @@ namespace ClassicalSharp {
|
|||||||
Graphics.DeleteTexture( ref CloudsTextureId );
|
Graphics.DeleteTexture( ref CloudsTextureId );
|
||||||
Graphics.DeleteTexture( ref RainTextureId );
|
Graphics.DeleteTexture( ref RainTextureId );
|
||||||
Graphics.DeleteTexture( ref SnowTextureId );
|
Graphics.DeleteTexture( ref SnowTextureId );
|
||||||
|
|
||||||
|
if( Options.HasChanged ) {
|
||||||
|
try {
|
||||||
|
Options.Save();
|
||||||
|
} catch( IOException ) {
|
||||||
|
Utils.LogWarning( "Unable to save options.txt" );
|
||||||
|
}
|
||||||
|
}
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,8 @@ namespace ClassicalSharp {
|
|||||||
countIndex += TileSide.Top;
|
countIndex += TileSide.Top;
|
||||||
if( counts[countIndex] != 0 ) {
|
if( counts[countIndex] != 0 ) {
|
||||||
X = x; Y = y; Z = z;
|
X = x; Y = y; Z = z;
|
||||||
int count = StretchX( xx, countIndex, x, y, z, chunkIndex, tile, TileSide.Top );
|
AddSpriteVertices( tile, 1 );
|
||||||
AddSpriteVertices( tile, count );
|
counts[countIndex] = 1;
|
||||||
counts[countIndex] = (byte)count;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
X = x; Y = y; Z = z;
|
X = x; Y = y; Z = z;
|
||||||
|
@ -262,29 +262,22 @@ namespace ClassicalSharp {
|
|||||||
void DrawSprite( int count ) {
|
void DrawSprite( int count ) {
|
||||||
int texId = info.GetTextureLoc( tile, TileSide.Right );
|
int texId = info.GetTextureLoc( tile, TileSide.Right );
|
||||||
int i;
|
int i;
|
||||||
TextureRectangle rec = atlas.GetTexRec( texId, count, out i );
|
TextureRectangle rec = atlas.GetTexRec( texId, 1, out i );
|
||||||
FastColour col = Y < maxY ? ( emitsLight || Y > map.heightmap[( Z * width ) + X] ? map.Sunlight : map.Shadowlight )
|
FastColour col = Y < maxY ? ( emitsLight || Y > map.heightmap[( Z * width ) + X] ? map.Sunlight : map.Shadowlight )
|
||||||
: map.Sunlight;
|
: map.Sunlight;
|
||||||
DrawInfo part = drawInfoNormal[i];
|
DrawInfo part = drawInfoNormal[i];
|
||||||
|
|
||||||
// Draw stretched Z axis
|
// Draw Z axis
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X, Y, Z + 0.5f, rec.U2, rec.V2, col );
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 2.50f/16, Y, Z + 2.5f/16, rec.U2, rec.V2, col );
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z + 0.5f, rec.U2, rec.V1, col );
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 2.50f/16, Y + blockHeight, Z + 2.5f/16, rec.U2, rec.V1, col );
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + count, Y + blockHeight, Z + 0.5f, rec.U1, rec.V1, col );
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 13.5f/16, Y + blockHeight, Z + 13.5f/16, rec.U1, rec.V1, col );
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + count, Y, Z + 0.5f, rec.U1, rec.V2, col );
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 13.5f/16, Y, Z + 13.5f/16, rec.U1, rec.V2, col );
|
||||||
|
|
||||||
// Draw X axis
|
// Draw X axis
|
||||||
rec.U2 = 1;
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 2.50f/16, Y, Z + 13.5f/16, rec.U1, rec.V2, col );
|
||||||
int startX = X;
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 2.50f/16, Y + blockHeight, Z + 13.5f/16, rec.U1, rec.V1, col );
|
||||||
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 13.5f/16, Y + blockHeight, Z + 2.5f/16, rec.U2, rec.V1, col );
|
||||||
for( int j = 0; j < count; j++ ) {
|
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 13.5f/16, Y, Z + 2.5f/16, rec.U2, rec.V2, col );
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 0.5f, Y, Z, rec.U1, rec.V2, col );
|
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 0.5f, Y + blockHeight, Z, rec.U1, rec.V1, col );
|
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 0.5f, Y + blockHeight, Z + 1, rec.U2, rec.V1, col );
|
|
||||||
part.vertices[part.spriteIndex++] = new VertexPos3fTex2fCol4b( X + 0.5f, Y, Z + 1, rec.U2, rec.V2, col );
|
|
||||||
X++;
|
|
||||||
}
|
|
||||||
X = startX;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -59,6 +59,8 @@ namespace ClassicalSharp {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Color ToColor() {
|
public Color ToColor() {
|
||||||
return Color.FromArgb( A, R, G, B );
|
return Color.FromArgb( A, R, G, B );
|
||||||
}
|
}
|
||||||
|
@ -7,32 +7,36 @@ namespace ClassicalSharp {
|
|||||||
public static class Options {
|
public static class Options {
|
||||||
|
|
||||||
static Dictionary<string, string> OptionsSet = new Dictionary<string, string>();
|
static Dictionary<string, string> OptionsSet = new Dictionary<string, string>();
|
||||||
|
public static bool HasChanged;
|
||||||
|
|
||||||
public static string Get( string key ) {
|
public static string Get( string key ) {
|
||||||
string value;
|
string value;
|
||||||
return OptionsSet.TryGetValue( key, out value ) ? value : null;
|
return OptionsSet.TryGetValue( key, out value ) ? value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetInt( string key, out int valueInt ) {
|
public static int GetInt( string key, int min, int max, int defValue ) {
|
||||||
string value;
|
string value;
|
||||||
valueInt = 0;
|
int valueInt = 0;
|
||||||
OptionsSet.TryGetValue( key, out value );
|
if( !OptionsSet.TryGetValue( key, out value ) || String.IsNullOrEmpty( value )
|
||||||
|
|| !Int32.TryParse( value, out valueInt ) )
|
||||||
|
return defValue;
|
||||||
|
|
||||||
if( String.IsNullOrEmpty( value ) ) return false;
|
Utils.Clamp( ref valueInt, min, max );
|
||||||
return Int32.TryParse( value, out valueInt );
|
return valueInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetInt( string key, int min, int max, int defValue ) {
|
public static bool GetBool( string key, bool defValue ) {
|
||||||
int valueInt = 0;
|
string value;
|
||||||
if( TryGetInt( key, out valueInt ) ) {
|
bool valueBool = false;
|
||||||
Utils.Clamp( ref valueInt, min, max );
|
if( !OptionsSet.TryGetValue( key, out value ) || String.IsNullOrEmpty( value )
|
||||||
return valueInt;
|
|| !Boolean.TryParse( value, out valueBool ) )
|
||||||
}
|
return defValue;
|
||||||
return defValue;
|
return valueBool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Set( string key, string value ) {
|
public static void Set( string key, string value ) {
|
||||||
OptionsSet[key] = value;
|
OptionsSet[key] = value;
|
||||||
|
HasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public const string OptionsFile = "options.txt";
|
public const string OptionsFile = "options.txt";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user