consistent code style

This commit is contained in:
UnknownShadow200 2017-06-27 18:56:05 +10:00
parent e757e63e19
commit 49d50cdf7f
5 changed files with 22 additions and 18 deletions

View File

@ -182,9 +182,9 @@ namespace ClassicalSharp {
public bool ChatLogging = true;
public bool autoRotate = true;
public bool AutoRotate = true;
public bool smoothCamera = false;
public bool SmoothCamera = false;
public string FontName = "Arial";

View File

@ -274,9 +274,9 @@ namespace ClassicalSharp {
}
void ToggleSmoothCamera() {
game.smoothCamera = !game.smoothCamera;
game.SmoothCamera = !game.SmoothCamera;
Key key = Keys[KeyBind.SmoothCamera];
if (game.smoothCamera) {
if (game.SmoothCamera) {
game.Chat.Add(" &eSmooth camera is &aenabled. &ePress &a" + key + " &eto disable.");
} else {
game.Chat.Add(" &eSmooth camera is &cdisabled. &ePress &a" + key + " &eto re-enable.");
@ -294,9 +294,9 @@ namespace ClassicalSharp {
}
void ToggleAutoRotate() {
game.autoRotate = !game.autoRotate;
game.AutoRotate = !game.AutoRotate;
Key key = Keys[KeyBind.Autorotate];
if (game.autoRotate) {
if (game.AutoRotate) {
game.Chat.Add(" &eAuto rotate is &aenabled. &ePress &a" + key + " &eto disable.");
} else {
game.Chat.Add(" &eAuto rotate is &cdisabled. &ePress &a" + key + " &eto re-enable.");

View File

@ -68,7 +68,7 @@ namespace ClassicalSharp {
BlockID old = game.World.GetBlock(pos);
BlockID block = inv.Selected;
if (game.autoRotate)
if (game.AutoRotate)
block = AutoRotate.RotateBlock(game, block);
if (game.CanPick(old) || !inv.CanPlace[block]) return;

View File

@ -105,22 +105,23 @@ namespace ClassicalSharp {
}
static readonly float sensiFactor = 0.0002f / 3 * Utils.Rad2Deg;
const float slippery = 0.97f;
const float adjust = 0.025f;
float speedX = 0, speedY = 0;
private void UpdateMouseRotation() {
float sensitivity = sensiFactor * game.MouseSensitivity;
const float slippery = 0.97f;
const float adjust = 0.025f;
if (game.smoothCamera) {
speedX += delta.X * adjust;
speedX *= slippery;
speedY += delta.Y * adjust;
speedY *= slippery;
}
else {
speedX = delta.X;
speedY = delta.Y;
if (game.SmoothCamera) {
speedX += delta.X * adjust;
speedX *= slippery;
speedY += delta.Y * adjust;
speedY *= slippery;
} else {
speedX = delta.X;
speedY = delta.Y;
}
float rotY = player.interp.next.HeadY + speedX * sensitivity;
float yAdj = game.InvertMouse ? -speedY * sensitivity : speedY * sensitivity;
float headX = player.interp.next.HeadX + yAdj;

View File

@ -103,6 +103,9 @@ bool Game_ChatLogging;
/* Whether auto rotation of blocks with special suffixes is enabled. */
bool Game_AutoRotate;
/* Whether camera has smooth rotation. */
bool Game_SmoothCamera;
/* Font name used for text rendering. */
String Game_FontName;