mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -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
@ -13,6 +13,13 @@ namespace ClassicalSharp {
|
||||
|
||||
buttons = new ButtonWidget[] {
|
||||
// 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,
|
||||
g => g.ShowFPS ? "yes" : "no",
|
||||
(g, v) => g.ShowFPS = v == "yes" ),
|
||||
@ -64,6 +71,7 @@ namespace ClassicalSharp {
|
||||
null,
|
||||
};
|
||||
validators = new MenuInputValidator[] {
|
||||
new IntegerValidator( 1, 179 ),
|
||||
new BooleanValidator(),
|
||||
new RealValidator( 0.25f, 5f ),
|
||||
new BooleanValidator(),
|
||||
|
@ -176,7 +176,7 @@ namespace ClassicalSharp {
|
||||
float gravity = useLiquidGravity ? liquidGrav : normalGrav;
|
||||
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]
|
||||
if( Math.Abs( Velocity.X ) > 0.25f || Math.Abs( Velocity.Z ) > 0.25f ) {
|
||||
float scale = Math.Min(
|
||||
|
@ -64,13 +64,14 @@ namespace ClassicalSharp {
|
||||
public string Mppass;
|
||||
public int Port;
|
||||
public int ViewDistance = 512;
|
||||
public int FieldOfView = 70;
|
||||
public FpsLimitMethod FpsLimit;
|
||||
|
||||
public long Vertices;
|
||||
public FrustumCulling Culling;
|
||||
int width, height;
|
||||
public AsyncDownloader AsyncDownloader;
|
||||
public Matrix4 View, Projection;
|
||||
public Matrix4 View, Projection, HeldBlockProjection;
|
||||
public int MouseSensitivity = 30;
|
||||
public int ChatLines = 12;
|
||||
public bool ClickableChat, HideGui, ShowFPS = true;
|
||||
@ -175,6 +176,8 @@ namespace ClassicalSharp {
|
||||
thirdPersonCam = new ThirdPersonCamera( this );
|
||||
forwardThirdPersonCam = new ForwardThirdPersonCamera( this );
|
||||
Camera = firstPersonCam;
|
||||
FieldOfView = Options.GetInt( OptionsKey.FieldOfView, 1, 179, 70 );
|
||||
UpdateProjection();
|
||||
CommandManager = new CommandManager();
|
||||
CommandManager.Init( this );
|
||||
SelectionManager = new SelectionManager( this );
|
||||
@ -330,7 +333,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
public void UpdateProjection() {
|
||||
Matrix4 projection = Camera.GetProjection();
|
||||
Matrix4 projection = Camera.GetProjection( out HeldBlockProjection );
|
||||
Projection = projection;
|
||||
Graphics.SetMatrixMode( MatrixType.Projection );
|
||||
Graphics.LoadMatrix( ref projection );
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Model;
|
||||
using OpenTK;
|
||||
|
||||
@ -43,9 +44,13 @@ namespace ClassicalSharp.Renderers {
|
||||
game.Graphics.LoadMatrix( ref spriteMat );
|
||||
else
|
||||
game.Graphics.LoadMatrix( ref normalMat );
|
||||
game.Graphics.SetMatrixMode( MatrixType.Projection );
|
||||
game.Graphics.LoadMatrix( ref game.HeldBlockProjection );
|
||||
fakeP.Block = type;
|
||||
block.RenderModel( fakeP );
|
||||
|
||||
game.Graphics.LoadMatrix( ref game.Projection );
|
||||
game.Graphics.SetMatrixMode( MatrixType.Modelview );
|
||||
game.Graphics.LoadMatrix( ref game.View );
|
||||
game.Graphics.Texturing = false;
|
||||
game.Graphics.DepthTest = true;
|
||||
|
@ -8,7 +8,7 @@ namespace ClassicalSharp {
|
||||
public abstract class Camera {
|
||||
protected Game game;
|
||||
|
||||
public abstract Matrix4 GetProjection();
|
||||
public abstract Matrix4 GetProjection( out Matrix4 heldBlockProj );
|
||||
|
||||
public abstract Matrix4 GetView( double delta );
|
||||
|
||||
@ -44,10 +44,12 @@ namespace ClassicalSharp {
|
||||
tiltMatrix = Matrix4.Identity;
|
||||
}
|
||||
|
||||
public override Matrix4 GetProjection() {
|
||||
float fovy = 70 * Utils.Deg2Rad;
|
||||
public override Matrix4 GetProjection( out Matrix4 heldBlockProj ) {
|
||||
float fovy = game.FieldOfView * Utils.Deg2Rad;
|
||||
float aspectRatio = (float)game.Width / game.Height;
|
||||
float zNear = game.Graphics.MinZNear;
|
||||
heldBlockProj = Matrix4.CreatePerspectiveFieldOfView( 70 * Utils.Deg2Rad,
|
||||
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 AutoCloseLauncher = "autocloselauncher";
|
||||
public const string ViewBobbing = "viewbobbing";
|
||||
public const string FieldOfView = "fov";
|
||||
}
|
||||
|
||||
// TODO: implement this
|
||||
|
@ -33,9 +33,10 @@ namespace Launcher2 {
|
||||
ResourcePatcher patcher = new ResourcePatcher( fetcher );
|
||||
patcher.Run();
|
||||
}
|
||||
fetcher = null;
|
||||
GC.Collect();
|
||||
game.TryLoadTexturePack();
|
||||
game.SetScreen( new MainScreen( game ) );
|
||||
fetcher = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ namespace Launcher2 {
|
||||
const string pngGuiPatchUri = "http://static.classicube.net/gui.png";
|
||||
const string digSoundsUri = "http://s3.amazonaws.com/MinecraftResources/sound3/dig/";
|
||||
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 newMusicUri = "http://s3.amazonaws.com/MinecraftResources/newmusic/";
|
||||
|
||||
@ -28,10 +29,10 @@ namespace Launcher2 {
|
||||
DownloadMusicFiles();
|
||||
digPatcher = new SoundPatcher( digSounds, "dig_",
|
||||
"step_cloth1", digPath );
|
||||
digPatcher.FetchFiles( digSoundsUri, this );
|
||||
digPatcher.FetchFiles( digSoundsUri, altSoundsUri, this );
|
||||
stepPatcher = new SoundPatcher( stepSounds, "step_",
|
||||
"classic jar", stepPath );
|
||||
stepPatcher.FetchFiles( stepSoundsUri, this );
|
||||
stepPatcher.FetchFiles( stepSoundsUri, null, this );
|
||||
if( !defaultZipExists ) {
|
||||
downloader.DownloadData( jarClassicUri, false, "classic_jar" );
|
||||
downloader.DownloadData( jar162Uri, false, "162_jar" );
|
||||
@ -169,10 +170,10 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
string digPath, stepPath;
|
||||
string[] digSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "grass1",
|
||||
"grass2", "grass3", "grass4", "gravel1", "gravel2", "gravel3", "gravel4",
|
||||
"sand1", "sand2", "sand3", "sand4", "snow1", "snow2", "snow3", "snow4",
|
||||
"stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4" };
|
||||
string[] digSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "glass1",
|
||||
"glass2", "glass3", "grass1", "grass2", "grass3", "grass4", "gravel1", "gravel2",
|
||||
"gravel3", "gravel4", "sand1", "sand2", "sand3", "sand4", "snow1", "snow2", "snow3",
|
||||
"snow4", "stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4" };
|
||||
|
||||
string[] stepSounds = new [] { "cloth1", "cloth2", "cloth3", "cloth4", "grass1",
|
||||
"grass2", "grass3", "grass4", "grass5", "grass6", "gravel1", "gravel2",
|
||||
|
@ -2,9 +2,7 @@
|
||||
using System.IO;
|
||||
using ClassicalSharp.Network;
|
||||
using SharpWave;
|
||||
using SharpWave.Codecs;
|
||||
using SharpWave.Codecs.Vorbis;
|
||||
using SharpWave.Containers;
|
||||
|
||||
namespace Launcher2 {
|
||||
|
||||
@ -25,13 +23,16 @@ namespace Launcher2 {
|
||||
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];
|
||||
for( int i = 0; i < files.Length; i++ )
|
||||
identifiers[i] = prefix + files[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] );
|
||||
}
|
||||
}
|
||||
|
0
sounds.txt
Normal file
0
sounds.txt
Normal file
Loading…
x
Reference in New Issue
Block a user