mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Read saved environment metadata from maps in singleplayer mode.
This commit is contained in:
parent
81906c75ed
commit
d95272f4a7
@ -39,6 +39,31 @@ namespace ClassicalSharp {
|
|||||||
string group = ReadString( reader );
|
string group = ReadString( reader );
|
||||||
string key = ReadString( reader );
|
string key = ReadString( reader );
|
||||||
string value = ReadString( reader );
|
string value = ReadString( reader );
|
||||||
|
if( group == "CS_Client" ) {
|
||||||
|
int valueInt = Int32.Parse( value );
|
||||||
|
switch( key ) {
|
||||||
|
case "SkyCol":
|
||||||
|
game.Map.SetSkyColour( new FastColour( valueInt ) ); break;
|
||||||
|
case "CloudsCol":
|
||||||
|
game.Map.SetCloudsColour( new FastColour( valueInt ) ); break;
|
||||||
|
case "FogCol":
|
||||||
|
game.Map.SetFogColour( new FastColour( valueInt ) ); break;
|
||||||
|
|
||||||
|
case "ClickDist":
|
||||||
|
game.LocalPlayer.ReachDistance = valueInt / 32f; break;
|
||||||
|
case "SunLight":
|
||||||
|
game.Map.SetSunlight( new FastColour( valueInt ) ); break;
|
||||||
|
case "ShadowLight":
|
||||||
|
game.Map.SetShadowlight( new FastColour( valueInt ) ); break;
|
||||||
|
|
||||||
|
case "Weather":
|
||||||
|
game.Map.SetWeather( (Weather)valueInt ); break;
|
||||||
|
case "SidesBlock":
|
||||||
|
game.Map.SetSidesBlock( (Block)valueInt ); break;
|
||||||
|
case "EdgeBlock":
|
||||||
|
game.Map.SetEdgeBlock( (Block)valueInt ); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
Console.WriteLine( group + "," + key + "," + value );
|
Console.WriteLine( group + "," + key + "," + value );
|
||||||
}
|
}
|
||||||
byte[] blocks = new byte[width * height * length];
|
byte[] blocks = new byte[width * height * length];
|
||||||
|
@ -81,9 +81,8 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static FastColour ParseWomColour( string value, FastColour defaultCol ) {
|
static FastColour ParseWomColour( string value, FastColour defaultCol ) {
|
||||||
int col;
|
int argb;
|
||||||
return Int32.TryParse( value, out col ) ?
|
return Int32.TryParse( value, out argb ) ? new FastColour( argb ) : defaultCol;
|
||||||
new FastColour( ( col & 0xFF0000 ) >> 16, ( col & 0xFF00 ) >> 8, col & 0xFF ) : defaultCol;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -235,7 +235,6 @@ namespace ClassicalSharp {
|
|||||||
int adjViewDistSqr = ( game.ViewDistance + 14 ) * ( game.ViewDistance + 14 );
|
int adjViewDistSqr = ( game.ViewDistance + 14 ) * ( game.ViewDistance + 14 );
|
||||||
chunksTarget += deltaTime < 0.034 ? 1 : -1; // build more chunks if 30 FPS or over, otherwise slowdown.
|
chunksTarget += deltaTime < 0.034 ? 1 : -1; // build more chunks if 30 FPS or over, otherwise slowdown.
|
||||||
Utils.Clamp( ref chunksTarget, 4, 12 );
|
Utils.Clamp( ref chunksTarget, 4, 12 );
|
||||||
Console.WriteLine( (deltaTime * 1000) + ":" + chunksTarget );
|
|
||||||
|
|
||||||
for( int i = 0; i < chunks.Length; i++ ) {
|
for( int i = 0; i < chunks.Length; i++ ) {
|
||||||
ChunkInfo info = chunks[i];
|
ChunkInfo info = chunks[i];
|
||||||
|
@ -37,6 +37,13 @@ namespace ClassicalSharp {
|
|||||||
B = (byte)b;
|
B = (byte)b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FastColour( int argb ) {
|
||||||
|
A = (byte)( argb >> 24 );
|
||||||
|
R = (byte)( argb >> 16 );
|
||||||
|
G = (byte)( argb >> 8 );
|
||||||
|
B = (byte)argb;
|
||||||
|
}
|
||||||
|
|
||||||
public FastColour( Color c ) {
|
public FastColour( Color c ) {
|
||||||
A = c.A;
|
A = c.A;
|
||||||
R = c.R;
|
R = c.R;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user