mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Add option to change FOV, fetch glass break sounds, no sliding on ice when flying or noclip.
This commit is contained in:
parent
53aa779fb2
commit
030b0cfb46
@ -12,7 +12,14 @@ namespace ClassicalSharp {
|
|||||||
INetworkProcessor network = game.Network;
|
INetworkProcessor network = game.Network;
|
||||||
|
|
||||||
buttons = new ButtonWidget[] {
|
buttons = new ButtonWidget[] {
|
||||||
// Column 1
|
// Column 1
|
||||||
|
Make( -140, -100, "Field of view", Anchor.Centre, OnWidgetClick,
|
||||||
|
g => g.FieldOfView.ToString(),
|
||||||
|
(g, v) => { g.FieldOfView = Int32.Parse( v );
|
||||||
|
Options.Set( OptionsKey.FieldOfView, v );
|
||||||
|
g.UpdateProjection();
|
||||||
|
} ),
|
||||||
|
|
||||||
Make( -140, -50, "Show FPS", Anchor.Centre, OnWidgetClick,
|
Make( -140, -50, "Show FPS", Anchor.Centre, OnWidgetClick,
|
||||||
g => g.ShowFPS ? "yes" : "no",
|
g => g.ShowFPS ? "yes" : "no",
|
||||||
(g, v) => g.ShowFPS = v == "yes" ),
|
(g, v) => g.ShowFPS = v == "yes" ),
|
||||||
@ -64,6 +71,7 @@ namespace ClassicalSharp {
|
|||||||
null,
|
null,
|
||||||
};
|
};
|
||||||
validators = new MenuInputValidator[] {
|
validators = new MenuInputValidator[] {
|
||||||
|
new IntegerValidator( 1, 179 ),
|
||||||
new BooleanValidator(),
|
new BooleanValidator(),
|
||||||
new RealValidator( 0.25f, 5f ),
|
new RealValidator( 0.25f, 5f ),
|
||||||
new BooleanValidator(),
|
new BooleanValidator(),
|
||||||
|
@ -176,7 +176,7 @@ namespace ClassicalSharp {
|
|||||||
float gravity = useLiquidGravity ? liquidGrav : normalGrav;
|
float gravity = useLiquidGravity ? liquidGrav : normalGrav;
|
||||||
Move( xMoving, zMoving, factor * horMul, normalDrag, gravity, yMul );
|
Move( xMoving, zMoving, factor * horMul, normalDrag, gravity, yMul );
|
||||||
|
|
||||||
if( BlockUnderFeet == Block.Ice ) {
|
if( BlockUnderFeet == Block.Ice && !flying && !noClip ) {
|
||||||
// limit components to +-0.25f by rescaling vector to [-0.25, 0.25]
|
// limit components to +-0.25f by rescaling vector to [-0.25, 0.25]
|
||||||
if( Math.Abs( Velocity.X ) > 0.25f || Math.Abs( Velocity.Z ) > 0.25f ) {
|
if( Math.Abs( Velocity.X ) > 0.25f || Math.Abs( Velocity.Z ) > 0.25f ) {
|
||||||
float scale = Math.Min(
|
float scale = Math.Min(
|
||||||
|
@ -64,13 +64,14 @@ namespace ClassicalSharp {
|
|||||||
public string Mppass;
|
public string Mppass;
|
||||||
public int Port;
|
public int Port;
|
||||||
public int ViewDistance = 512;
|
public int ViewDistance = 512;
|
||||||
|
public int FieldOfView = 70;
|
||||||
public FpsLimitMethod FpsLimit;
|
public FpsLimitMethod FpsLimit;
|
||||||
|
|
||||||
public long Vertices;
|
public long Vertices;
|
||||||
public FrustumCulling Culling;
|
public FrustumCulling Culling;
|
||||||
int width, height;
|
int width, height;
|
||||||
public AsyncDownloader AsyncDownloader;
|
public AsyncDownloader AsyncDownloader;
|
||||||
public Matrix4 View, Projection;
|
public Matrix4 View, Projection, HeldBlockProjection;
|
||||||
public int MouseSensitivity = 30;
|
public int MouseSensitivity = 30;
|
||||||
public int ChatLines = 12;
|
public int ChatLines = 12;
|
||||||
public bool ClickableChat, HideGui, ShowFPS = true;
|
public bool ClickableChat, HideGui, ShowFPS = true;
|
||||||
@ -175,6 +176,8 @@ namespace ClassicalSharp {
|
|||||||
thirdPersonCam = new ThirdPersonCamera( this );
|
thirdPersonCam = new ThirdPersonCamera( this );
|
||||||
forwardThirdPersonCam = new ForwardThirdPersonCamera( this );
|
forwardThirdPersonCam = new ForwardThirdPersonCamera( this );
|
||||||
Camera = firstPersonCam;
|
Camera = firstPersonCam;
|
||||||
|
FieldOfView = Options.GetInt( OptionsKey.FieldOfView, 1, 179, 70 );
|
||||||
|
UpdateProjection();
|
||||||
CommandManager = new CommandManager();
|
CommandManager = new CommandManager();
|
||||||
CommandManager.Init( this );
|
CommandManager.Init( this );
|
||||||
SelectionManager = new SelectionManager( this );
|
SelectionManager = new SelectionManager( this );
|
||||||
@ -330,7 +333,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProjection() {
|
public void UpdateProjection() {
|
||||||
Matrix4 projection = Camera.GetProjection();
|
Matrix4 projection = Camera.GetProjection( out HeldBlockProjection );
|
||||||
Projection = projection;
|
Projection = projection;
|
||||||
Graphics.SetMatrixMode( MatrixType.Projection );
|
Graphics.SetMatrixMode( MatrixType.Projection );
|
||||||
Graphics.LoadMatrix( ref projection );
|
Graphics.LoadMatrix( ref projection );
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using ClassicalSharp.GraphicsAPI;
|
||||||
using ClassicalSharp.Model;
|
using ClassicalSharp.Model;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
@ -43,9 +44,13 @@ namespace ClassicalSharp.Renderers {
|
|||||||
game.Graphics.LoadMatrix( ref spriteMat );
|
game.Graphics.LoadMatrix( ref spriteMat );
|
||||||
else
|
else
|
||||||
game.Graphics.LoadMatrix( ref normalMat );
|
game.Graphics.LoadMatrix( ref normalMat );
|
||||||
|
game.Graphics.SetMatrixMode( MatrixType.Projection );
|
||||||
|
game.Graphics.LoadMatrix( ref game.HeldBlockProjection );
|
||||||
fakeP.Block = type;
|
fakeP.Block = type;
|
||||||
block.RenderModel( fakeP );
|
block.RenderModel( fakeP );
|
||||||
|
|
||||||
|
game.Graphics.LoadMatrix( ref game.Projection );
|
||||||
|
game.Graphics.SetMatrixMode( MatrixType.Modelview );
|
||||||
game.Graphics.LoadMatrix( ref game.View );
|
game.Graphics.LoadMatrix( ref game.View );
|
||||||
game.Graphics.Texturing = false;
|
game.Graphics.Texturing = false;
|
||||||
game.Graphics.DepthTest = true;
|
game.Graphics.DepthTest = true;
|
||||||
|
@ -8,7 +8,7 @@ namespace ClassicalSharp {
|
|||||||
public abstract class Camera {
|
public abstract class Camera {
|
||||||
protected Game game;
|
protected Game game;
|
||||||
|
|
||||||
public abstract Matrix4 GetProjection();
|
public abstract Matrix4 GetProjection( out Matrix4 heldBlockProj );
|
||||||
|
|
||||||
public abstract Matrix4 GetView( double delta );
|
public abstract Matrix4 GetView( double delta );
|
||||||
|
|
||||||
@ -44,10 +44,12 @@ namespace ClassicalSharp {
|
|||||||
tiltMatrix = Matrix4.Identity;
|
tiltMatrix = Matrix4.Identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Matrix4 GetProjection() {
|
public override Matrix4 GetProjection( out Matrix4 heldBlockProj ) {
|
||||||
float fovy = 70 * Utils.Deg2Rad;
|
float fovy = game.FieldOfView * Utils.Deg2Rad;
|
||||||
float aspectRatio = (float)game.Width / game.Height;
|
float aspectRatio = (float)game.Width / game.Height;
|
||||||
float zNear = game.Graphics.MinZNear;
|
float zNear = game.Graphics.MinZNear;
|
||||||
|
heldBlockProj = Matrix4.CreatePerspectiveFieldOfView( 70 * Utils.Deg2Rad,
|
||||||
|
aspectRatio, zNear, game.ViewDistance );
|
||||||
return Matrix4.CreatePerspectiveFieldOfView( fovy, aspectRatio, zNear, game.ViewDistance );
|
return Matrix4.CreatePerspectiveFieldOfView( fovy, aspectRatio, zNear, game.ViewDistance );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace ClassicalSharp {
|
|||||||
public const string FpsLimit = "fpslimit";
|
public const string FpsLimit = "fpslimit";
|
||||||
public const string AutoCloseLauncher = "autocloselauncher";
|
public const string AutoCloseLauncher = "autocloselauncher";
|
||||||
public const string ViewBobbing = "viewbobbing";
|
public const string ViewBobbing = "viewbobbing";
|
||||||
|
public const string FieldOfView = "fov";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement this
|
// TODO: implement this
|
||||||
|
@ -33,9 +33,10 @@ namespace Launcher2 {
|
|||||||
ResourcePatcher patcher = new ResourcePatcher( fetcher );
|
ResourcePatcher patcher = new ResourcePatcher( fetcher );
|
||||||
patcher.Run();
|
patcher.Run();
|
||||||
}
|
}
|
||||||
|
fetcher = null;
|
||||||
|
GC.Collect();
|
||||||
game.TryLoadTexturePack();
|
game.TryLoadTexturePack();
|
||||||
game.SetScreen( new MainScreen( game ) );
|
game.SetScreen( new MainScreen( game ) );
|
||||||
fetcher = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ namespace Launcher2 {
|
|||||||
const string pngTerrainPatchUri = "http://static.classicube.net/terrain-patch.png";
|
const string pngTerrainPatchUri = "http://static.classicube.net/terrain-patch.png";
|
||||||
const string pngGuiPatchUri = "http://static.classicube.net/gui.png";
|
const string pngGuiPatchUri = "http://static.classicube.net/gui.png";
|
||||||
const string digSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/dig/";
|
const string digSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/dig/";
|
||||||
const string stepSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/step/";
|
const string stepSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/step/";
|
||||||
|
const string altSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/random/";
|
||||||
const string musicUri = "http://s3.amazonaws.com/MinecraftResources/music/";
|
const string musicUri = "http://s3.amazonaws.com/MinecraftResources/music/";
|
||||||
const string newMusicUri = "http://s3.amazonaws.com/MinecraftResources/newmusic/";
|
const string newMusicUri = "http://s3.amazonaws.com/MinecraftResources/newmusic/";
|
||||||
|
|
||||||
@ -28,10 +29,10 @@ namespace Launcher2 {
|
|||||||
DownloadMusicFiles();
|
DownloadMusicFiles();
|
||||||
digPatcher = new SoundPatcher( digSounds, "dig_",
|
digPatcher = new SoundPatcher( digSounds, "dig_",
|
||||||
"step_cloth1", digPath );
|
"step_cloth1", digPath );
|
||||||
digPatcher.FetchFiles( digSoundsUri, this );
|
digPatcher.FetchFiles( digSoundsUri, altSoundsUri, this );
|
||||||
stepPatcher = new SoundPatcher( stepSounds, "step_",
|
stepPatcher = new SoundPatcher( stepSounds, "step_",
|
||||||
"classic jar", stepPath );
|
"classic jar", stepPath );
|
||||||
stepPatcher.FetchFiles( stepSoundsUri, this );
|
stepPatcher.FetchFiles( stepSoundsUri, null, this );
|
||||||
if( !defaultZipExists ) {
|
if( !defaultZipExists ) {
|
||||||
downloader.DownloadData( jarClassicUri, false, "classic_jar" );
|
downloader.DownloadData( jarClassicUri, false, "classic_jar" );
|
||||||
downloader.DownloadData( jar162Uri, false, "162_jar" );
|
downloader.DownloadData( jar162Uri, false, "162_jar" );
|
||||||
@ -169,10 +170,10 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string digPath, stepPath;
|
string digPath, stepPath;
|
||||||
string[] digSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "grass1",
|
string[] digSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "glass1",
|
||||||
"grass2", "grass3", "grass4", "gravel1", "gravel2", "gravel3", "gravel4",
|
"glass2", "glass3", "grass1", "grass2", "grass3", "grass4", "gravel1", "gravel2",
|
||||||
"sand1", "sand2", "sand3", "sand4", "snow1", "snow2", "snow3", "snow4",
|
"gravel3", "gravel4", "sand1", "sand2", "sand3", "sand4", "snow1", "snow2", "snow3",
|
||||||
"stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4" };
|
"snow4", "stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4" };
|
||||||
|
|
||||||
string[] stepSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "grass1",
|
string[] stepSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "grass1",
|
||||||
"grass2", "grass3", "grass4", "grass5", "grass6", "gravel1", "gravel2",
|
"grass2", "grass3", "grass4", "grass5", "grass6", "gravel1", "gravel2",
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using ClassicalSharp.Network;
|
using ClassicalSharp.Network;
|
||||||
using SharpWave;
|
using SharpWave;
|
||||||
using SharpWave.Codecs;
|
|
||||||
using SharpWave.Codecs.Vorbis;
|
using SharpWave.Codecs.Vorbis;
|
||||||
using SharpWave.Containers;
|
|
||||||
|
|
||||||
namespace Launcher2 {
|
namespace Launcher2 {
|
||||||
|
|
||||||
@ -25,13 +23,16 @@ namespace Launcher2 {
|
|||||||
InitOutput( outputPath );
|
InitOutput( outputPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FetchFiles( string baseUrl, ResourceFetcher fetcher ) {
|
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
|
||||||
|
public void FetchFiles( string baseUrl, string altBaseUrl, ResourceFetcher fetcher ) {
|
||||||
identifiers = new string[files.Length];
|
identifiers = new string[files.Length];
|
||||||
for( int i = 0; i < files.Length; i++ )
|
for( int i = 0; i < files.Length; i++ )
|
||||||
identifiers[i] = prefix + files[i];
|
identifiers[i] = prefix + files[i];
|
||||||
|
|
||||||
for( int i = 0; i < files.Length; i++ ) {
|
for( int i = 0; i < files.Length; i++ ) {
|
||||||
string url = baseUrl + files[i] + ".ogg";
|
string loc = files[i].StartsWith( "glass", comp )
|
||||||
|
? altBaseUrl : baseUrl;
|
||||||
|
string url = loc + files[i] + ".ogg";
|
||||||
fetcher.downloader.DownloadData( url, false, identifiers[i] );
|
fetcher.downloader.DownloadData( url, false, identifiers[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
sounds.txt
Normal file
0
sounds.txt
Normal file
Loading…
x
Reference in New Issue
Block a user