Get rid of nearly all lambda usage

This commit is contained in:
UnknownShadow200 2017-09-15 10:10:49 +10:00
parent 5c2ac98003
commit 4413fc69e6
23 changed files with 359 additions and 331 deletions

View file

@ -58,7 +58,7 @@ namespace ClassicalSharp.Gui.Screens {
.SetLocation(Anchor.Centre, Anchor.BottomOrRight, 0, y);
}
protected void SwitchOptions(Game g, Widget w) { g.Gui.SetNewScreen(new OptionsGroupScreen(g)); }
protected void SwitchPause(Game g, Widget w) { g.Gui.SetNewScreen(new PauseScreen(g)); }
protected static void SwitchOptions(Game g, Widget w) { g.Gui.SetNewScreen(new OptionsGroupScreen(g)); }
protected static void SwitchPause(Game g, Widget w) { g.Gui.SetNewScreen(new PauseScreen(g)); }
}
}

View file

@ -17,50 +17,22 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
IServerConnection network = game.Server;
bool multi = !game.Server.IsSinglePlayer, hacks = game.ClassicHacks;
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
MakeVolumeBool(-1, -150, "Music", OptionsKey.MusicVolume,
g => g.MusicVolume > 0,
(g, v) => { g.MusicVolume = v ? 100 : 0; g.AudioPlayer.SetMusic(g.MusicVolume); }),
MakeVolumeBool(-1, -150, "Music", OptionsKey.MusicVolume, GetMusic, SetMusic),
MakeBool(-1, -100, "Invert mouse", OptionsKey.InvertMouse, onClick, GetInvert, SetInvert),
MakeOpt(-1, -50, "View distance", onClick, GetViewDist, SetViewDist),
multi ? null : MakeBool(-1, 0, "Block physics", OptionsKey.Physics, onClick, GetPhysics, SetPhysics),
MakeBool(-1, -100, "Invert mouse", OptionsKey.InvertMouse,
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v),
MakeOpt(-1, -50, "View distance", OnWidgetClick,
g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance(Int32.Parse(v), true)),
!network.IsSinglePlayer ? null :
MakeBool(-1, 0, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled,
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v),
// Column 2
MakeVolumeBool(1, -150, "Sound", OptionsKey.SoundsVolume,
g => g.SoundsVolume > 0,
(g, v) => { g.SoundsVolume = v ? 100 : 0; g.AudioPlayer.SetSounds(g.SoundsVolume); }),
MakeBool(1, -100, "Show FPS", OptionsKey.ShowFPS,
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v),
MakeBool(1, -50, "View bobbing", OptionsKey.ViewBobbing,
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),
MakeOpt(1, 0, "FPS mode", OnWidgetClick,
g => g.FpsLimit.ToString(),
(g, v) => { }),
!game.ClassicHacks ? null :
MakeBool(0, 60, "Hacks enabled", OptionsKey.HacksEnabled,
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
g.LocalPlayer.CheckHacksConsistency(); }),
MakeVolumeBool(1, -150, "Sound", OptionsKey.SoundsVolume, GetSounds, SetSounds),
MakeBool(1, -100, "Show FPS", OptionsKey.ShowFPS, onClick, GetShowFPS, SetShowFPS),
MakeBool(1, -50, "View bobbing", OptionsKey.ViewBobbing, onClick, GetViewBob, SetViewBob),
MakeOpt(1, 0, "FPS mode", onClick, GetFPS, SetFPS),
!hacks ? null : MakeBool(0, 60, "Hacks enabled", OptionsKey.HacksOn, onClick, GetHacks, SetHacks),
ButtonWidget.Create(game, 400, "Controls", titleFont, LeftOnly(SwitchClassic))
.SetLocation(Anchor.Centre, Anchor.BottomOrRight, 0, 95),
.SetLocation(Anchor.Centre, Anchor.BottomOrRight, 0, 95),
MakeBack(400, "Done", 25, titleFont, SwitchPause),
null, null,
};
@ -71,7 +43,34 @@ namespace ClassicalSharp.Gui.Screens {
btn.SetValue = SetFPSLimitMethod;
}
void SwitchClassic(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicKeyBindingsScreen(g)); }
static bool GetMusic(Game g) { return g.MusicVolume > 0; }
static void SetMusic(Game g, bool v) { g.MusicVolume = v ? 100 : 0; g.AudioPlayer.SetMusic(g.MusicVolume); }
static bool GetInvert(Game g) { return g.InvertMouse; }
static void SetInvert(Game g, bool v) { g.InvertMouse = v; }
static string GetViewDist(Game g) { return g.ViewDistance.ToString(); }
static void SetViewDist(Game g, string v) { g.SetViewDistance(Int32.Parse(v), true); }
static bool GetPhysics(Game g) { return ((SinglePlayerServer)g.Server).physics.Enabled; }
static void SetPhysics(Game g, bool v) { ((SinglePlayerServer)g.Server).physics.Enabled = v; }
static bool GetSounds(Game g) { return g.SoundsVolume > 0; }
static void SetSounds(Game g, bool v) { g.SoundsVolume = v ? 100 : 0; g.AudioPlayer.SetSounds(g.SoundsVolume); }
static bool GetShowFPS(Game g) { return g.ShowFPS; }
static void SetShowFPS(Game g, bool v) { g.ShowFPS = v; }
static bool GetViewBob(Game g) { return g.ViewBobbing; }
static void SetViewBob(Game g, bool v) { g.ViewBobbing = v; }
static string GetFPS(Game g) { return g.FpsLimit.ToString(); }
static void SetFPS(Game g, string v) { }
static bool GetHacks(Game g) { return g.LocalPlayer.Hacks.Enabled; }
static void SetHacks(Game g, bool v) { g.LocalPlayer.Hacks.Enabled = v; g.LocalPlayer.CheckHacksConsistency(); }
static void SwitchClassic(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicKeyBindingsScreen(g)); }
ButtonWidget MakeVolumeBool(int dir, int y, string text, string optKey,
ButtonBoolGetter getter, ButtonBoolSetter setter) {

View file

@ -23,54 +23,55 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
MakeOpt(-1, -150, "Clouds col", OnWidgetClick,
g => g.World.Env.CloudsCol.ToRGBHexString(),
(g, v) => g.World.Env.SetCloudsColour(FastColour.Parse(v))),
MakeOpt(-1, -100, "Sky col", OnWidgetClick,
g => g.World.Env.SkyCol.ToRGBHexString(),
(g, v) => g.World.Env.SetSkyColour(FastColour.Parse(v))),
MakeOpt(-1, -50, "Fog col", OnWidgetClick,
g => g.World.Env.FogCol.ToRGBHexString(),
(g, v) => g.World.Env.SetFogColour(FastColour.Parse(v))),
MakeOpt(-1, 0, "Clouds speed", OnWidgetClick,
g => g.World.Env.CloudsSpeed.ToString("F2"),
(g, v) => g.World.Env.SetCloudsSpeed(Utils.ParseDecimal(v))),
MakeOpt(-1, 50, "Clouds height", OnWidgetClick,
g => g.World.Env.CloudHeight.ToString(),
(g, v) => g.World.Env.SetCloudsLevel(Int32.Parse(v))),
// Column 2
MakeOpt(1, -150, "Sunlight col", OnWidgetClick,
g => g.World.Env.Sunlight.ToRGBHexString(),
(g, v) => g.World.Env.SetSunlight(FastColour.Parse(v))),
MakeOpt(1, -100, "Shadow col", OnWidgetClick,
g => g.World.Env.Shadowlight.ToRGBHexString(),
(g, v) => g.World.Env.SetShadowlight(FastColour.Parse(v))),
MakeOpt(1, -50, "Weather", OnWidgetClick,
g => g.World.Env.Weather.ToString(),
(g, v) => g.World.Env.SetWeather((Weather)Enum.Parse(typeof(Weather), v))),
MakeOpt(1, 0, "Rain/Snow speed", OnWidgetClick,
g => g.World.Env.WeatherSpeed.ToString("F2"),
(g, v) => g.World.Env.SetWeatherSpeed(Utils.ParseDecimal(v))),
MakeOpt(1, 50, "Water level", OnWidgetClick,
g => g.World.Env.EdgeHeight.ToString(),
(g, v) => g.World.Env.SetEdgeLevel(Int32.Parse(v))),
MakeOpt(-1, -150, "Clouds col", onClick, GetCloudsCol, SetCloudsCol),
MakeOpt(-1, -100, "Sky col", onClick, GetSkyCol, SetSkyCol),
MakeOpt(-1, -50, "Fog col", onClick, GetFogCol, SetFogCol),
MakeOpt(-1, 0, "Clouds speed", onClick, GetCloudsSpeed, SetCloudsSpeed),
MakeOpt(-1, 50, "Clouds height", onClick, GetCloudsHeight, SetCloudsHeight),
MakeOpt(1, -150, "Sunlight col", onClick, GetSunCol, SetSunCol),
MakeOpt(1, -100, "Shadow col", onClick, GetShadowCol, SetShadowCol),
MakeOpt(1, -50, "Weather", onClick, GetWeather, SetWeather),
MakeOpt(1, 0, "Rain/Snow speed", onClick, GetWeatherSpeed, SetWeatherSpeed),
MakeOpt(1, 50, "Water level", onClick, GetEdgeHeight, SetEdgeHeight),
MakeBack(false, titleFont, SwitchOptions),
null, null, null,
};
}
static string GetCloudsCol(Game g) { return g.World.Env.CloudsCol.ToRGBHexString(); }
static void SetCloudsCol(Game g, string v) { g.World.Env.SetCloudsColour(FastColour.Parse(v)); }
static string GetSkyCol(Game g) { return g.World.Env.SkyCol.ToRGBHexString(); }
static void SetSkyCol(Game g, string v) { g.World.Env.SetSkyColour(FastColour.Parse(v)); }
static string GetFogCol(Game g) { return g.World.Env.FogCol.ToRGBHexString(); }
static void SetFogCol(Game g, string v) { g.World.Env.SetFogColour(FastColour.Parse(v)); }
static string GetCloudsSpeed(Game g) { return g.World.Env.CloudsSpeed.ToString("F2"); }
static void SetCloudsSpeed(Game g, string v) { g.World.Env.SetCloudsSpeed(Utils.ParseDecimal(v)); }
static string GetCloudsHeight(Game g) { return g.World.Env.CloudHeight.ToString(); }
static void SetCloudsHeight(Game g, string v) { g.World.Env.SetCloudsLevel(Int32.Parse(v)); }
static string GetSunCol(Game g) { return g.World.Env.Sunlight.ToRGBHexString(); }
static void SetSunCol(Game g, string v) { g.World.Env.SetSunlight(FastColour.Parse(v)); }
static string GetShadowCol(Game g) { return g.World.Env.Shadowlight.ToRGBHexString(); }
static void SetShadowCol(Game g, string v) { g.World.Env.SetShadowlight(FastColour.Parse(v)); }
static string GetWeather(Game g) { return g.World.Env.Weather.ToString(); }
static void SetWeather(Game g, string v) { g.World.Env.SetWeather((Weather)Enum.Parse(typeof(Weather), v)); }
static string GetWeatherSpeed(Game g) { return g.World.Env.WeatherSpeed.ToString("F2"); }
static void SetWeatherSpeed(Game g, string v) { g.World.Env.SetWeatherSpeed(Utils.ParseDecimal(v)); }
static string GetEdgeHeight(Game g) { return g.World.Env.EdgeHeight.ToString(); }
static void SetEdgeHeight(Game g, string v) { g.World.Env.SetEdgeLevel(Int32.Parse(v)); }
void MakeDefaultValues() {
defaultIndex = widgets.Length - 3;
defaultValues = new string[] {

View file

@ -19,37 +19,15 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
MakeOpt(-1, -50, "FPS mode", onClick, GetFPS, SetFPS),
MakeOpt(-1, 0, "View distance", onClick, GetViewDist, SetViewDist),
MakeBool(-1, 50, "Advanced lighting", OptionsKey.SmoothLighting, onClick, GetSmooth, SetSmooth),
MakeOpt(-1, -50, "FPS mode", OnWidgetClick,
g => g.FpsLimit.ToString(),
(g, v) => { }),
MakeOpt(-1, 0, "View distance", OnWidgetClick,
g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance(Int32.Parse(v), true)),
MakeBool(-1, 50, "Advanced lighting", OptionsKey.SmoothLighting,
OnWidgetClick, g => g.SmoothLighting, SetSmoothLighting),
MakeOpt(1, -50, "Names", OnWidgetClick,
g => g.Entities.NamesMode.ToString(),
(g, v) => {
object rawNames = Enum.Parse(typeof(NameMode), v);
g.Entities.NamesMode = (NameMode)rawNames;
Options.Set(OptionsKey.NamesMode, v);
}),
MakeOpt(1, 0, "Shadows", OnWidgetClick,
g => g.Entities.ShadowMode.ToString(),
(g, v) => {
object rawShadows = Enum.Parse(typeof(EntityShadow), v);
g.Entities.ShadowMode = (EntityShadow)rawShadows;
Options.Set(OptionsKey.EntityShadow, v);
}),
MakeBool(1, 50, "Mipmaps", OptionsKey.Mipmaps,
OnWidgetClick, g => g.Graphics.Mipmaps, SetMipmaps),
MakeOpt(1, -50, "Names", onClick, GetNames, SetNames),
MakeOpt(1, 0, "Shadows", onClick, GetShadows, SetShadows),
MakeBool(1, 50, "Mipmaps", OptionsKey.Mipmaps, onClick, GetMipmaps, SetMipmaps),
MakeBack(false, titleFont, SwitchOptions),
null, null,
@ -60,32 +38,55 @@ namespace ClassicalSharp.Gui.Screens {
ButtonWidget btn = (ButtonWidget)widgets[0];
btn.SetValue = SetFPSLimitMethod;
}
void SetSmoothLighting(Game g, bool v) {
static string GetFPS(Game g) { return g.FpsLimit.ToString(); }
static void SetFPS(Game g, string v) { }
static string GetViewDist(Game g) { return g.ViewDistance.ToString(); }
static void SetViewDist(Game g, string v) { g.SetViewDistance(Int32.Parse(v), true); }
static bool GetSmooth(Game g) { return g.SmoothLighting; }
static void SetSmooth(Game g, bool v) {
g.SmoothLighting = v;
ChunkMeshBuilder builder = g.MapRenderer.DefaultMeshBuilder();
g.MapRenderer.SetMeshBuilder(builder);
g.MapRenderer.Refresh();
}
void SetMipmaps(Game g, bool v) {
static string GetNames(Game g) { return g.Entities.NamesMode.ToString(); }
static void SetNames(Game g, string v) {
object rawNames = Enum.Parse(typeof(NameMode), v);
g.Entities.NamesMode = (NameMode)rawNames;
Options.Set(OptionsKey.NamesMode, v);
}
static string GetShadows(Game g) { return g.Entities.ShadowMode.ToString(); }
static void SetShadows(Game g, string v) {
object rawShadows = Enum.Parse(typeof(EntityShadow), v);
g.Entities.ShadowMode = (EntityShadow)rawShadows;
Options.Set(OptionsKey.EntityShadow, v);
}
static bool GetMipmaps(Game g) { return g.Graphics.Mipmaps; }
static void SetMipmaps(Game g, bool v) {
g.Graphics.Mipmaps = v;
string url = game.World.TextureUrl;
string url = g.World.TextureUrl;
if (url == null) {
TexturePack.ExtractDefault(game); return;
TexturePack.ExtractDefault(g); return;
}
using (Stream data = TextureCache.GetStream(url)) {
if (data == null) {
TexturePack.ExtractDefault(game); return;
TexturePack.ExtractDefault(g); return;
}
if (url.Contains(".zip")) {
TexturePack extractor = new TexturePack();
extractor.Extract(data, game);
extractor.Extract(data, g);
} else {
TexturePack.ExtractTerrainPng(game, data, url);
TexturePack.ExtractTerrainPng(g, data, url);
}
}
}

View file

@ -16,64 +16,67 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
MakeBool(-1, -150, "Black text shadows", OptionsKey.BlackTextShadows,
OnWidgetClick, g => g.Drawer2D.BlackTextShadows,
(g, v) => { g.Drawer2D.BlackTextShadows = v; HandleFontChange(); }),
MakeBool(-1, -100, "Show FPS", OptionsKey.ShowFPS,
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v),
MakeOpt(-1, -50, "Hotbar scale", OnWidgetClick,
g => g.HotbarScale.ToString("F1"),
(g, v) => { g.HotbarScale = Utils.ParseDecimal(v);
Options.Set(OptionsKey.HotbarScale, v);
g.Gui.RefreshHud();
}),
MakeOpt(-1, 0, "Inventory scale", OnWidgetClick,
g => g.InventoryScale.ToString("F1"),
(g, v) => { g.InventoryScale = Utils.ParseDecimal(v);
Options.Set(OptionsKey.InventoryScale, v);
g.Gui.RefreshHud();
}),
MakeBool(-1, 50, "Tab auto-complete", OptionsKey.TabAutocomplete,
OnWidgetClick, g => g.TabAutocomplete, (g, v) => g.TabAutocomplete = v),
// Column 2
MakeBool(1, -150, "Clickable chat", OptionsKey.ClickableChat,
OnWidgetClick, g => g.ClickableChat, (g, v) => g.ClickableChat = v),
MakeOpt(1, -100, "Chat scale", OnWidgetClick,
g => g.ChatScale.ToString("F1"),
(g, v) => { g.ChatScale = Utils.ParseDecimal(v);
Options.Set(OptionsKey.ChatScale, v);
g.Gui.RefreshHud();
}),
MakeBool(-1, -150, "Black text shadows", OptionsKey.BlackText, onClick, GetShadows, SetShadows),
MakeBool(-1, -100, "Show FPS", OptionsKey.ShowFPS, onClick, GetShowFPS, SetShowFPS),
MakeOpt(-1, -50, "Hotbar scale", onClick, GetHotbar, SetHotbar),
MakeOpt(-1, 0, "Inventory scale", onClick, GetInventory, SetInventory),
MakeBool(-1, 50, "Tab auto-complete", OptionsKey.TabAutocomplete, onClick, GetTabAuto, SetTabAuto),
MakeOpt(1, -50, "Chat lines", OnWidgetClick,
g => g.ChatLines.ToString(),
(g, v) => { g.ChatLines = Int32.Parse(v);
Options.Set(OptionsKey.ChatLines, v);
g.Gui.RefreshHud();
}),
MakeBool(1, 0, "Use font", OptionsKey.ArialChatFont,
OnWidgetClick, g => !g.Drawer2D.UseBitmappedChat,
(g, v) => { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); }),
MakeOpt(1, 50, "Font", OnWidgetClick,
g => g.FontName,
(g, v) => { g.FontName = v;
Options.Set(OptionsKey.FontName, v);
HandleFontChange();
}),
MakeBool(1, -150, "Clickable chat", OptionsKey.ClickableChat, onClick, GetClickable, SetClickable),
MakeOpt(1, -100, "Chat scale", onClick, GetChatScale, SetChatScale),
MakeOpt(1, -50, "Chat lines", onClick, GetChatlines, SetChatlines),
MakeBool(1, 0, "Use font", OptionsKey.UseChatFont, onClick, GetUseFont, SetUseFont),
MakeOpt(1, 50, "Font", onClick, GetFont, SetFont),
MakeBack(false, titleFont, SwitchOptions),
null, null,
};
};
}
static bool GetShadows(Game g) { return g.Drawer2D.BlackTextShadows; }
void SetShadows(Game g, bool v) { g.Drawer2D.BlackTextShadows = v; HandleFontChange(); }
static bool GetShowFPS(Game g) { return g.ShowFPS; }
static void SetShowFPS(Game g, bool v) { g.ShowFPS = v; }
static void SetScale(Game g, string v, ref float target, string optKey) {
target = Utils.ParseDecimal(v);
Options.Set(optKey, v);
g.Gui.RefreshHud();
}
static string GetHotbar(Game g) { return g.HotbarScale.ToString("F1"); }
static void SetHotbar(Game g, string v) { SetScale(g, v, ref g.HotbarScale, OptionsKey.HotbarScale); }
static string GetInventory(Game g) { return g.InventoryScale.ToString("F1"); }
static void SetInventory(Game g, string v) { SetScale(g, v, ref g.InventoryScale, OptionsKey.InventoryScale); }
static bool GetTabAuto(Game g) { return g.TabAutocomplete; }
void SetTabAuto(Game g, bool v) { g.TabAutocomplete = v; }
static bool GetClickable(Game g) { return g.ClickableChat; }
void SetClickable(Game g, bool v) { g.ClickableChat = v; }
static string GetChatScale(Game g) { return g.ChatScale.ToString("F1"); }
static void SetChatScale(Game g, string v) { SetScale(g, v, ref g.ChatScale, OptionsKey.ChatScale); }
static string GetChatlines(Game g) { return g.ChatLines.ToString(); }
static void SetChatlines(Game g, string v) {
g.ChatLines = Int32.Parse(v);
Options.Set(OptionsKey.ChatLines, v);
g.Gui.RefreshHud();
}
static bool GetUseFont(Game g) { return !g.Drawer2D.UseBitmappedChat; }
void SetUseFont(Game g, bool v) { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); }
static string GetFont(Game g) { return g.FontName; }
void SetFont(Game g, string v) {
g.FontName = v;
Options.Set(OptionsKey.FontName, v);
HandleFontChange();
}
void HandleFontChange() {

View file

@ -26,51 +26,19 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
MakeBool(-1, -150, "Hacks enabled", OptionsKey.HacksEnabled,
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
g.LocalPlayer.CheckHacksConsistency(); }),
MakeOpt(-1, -100, "Speed multiplier", OnWidgetClick,
g => g.LocalPlayer.Hacks.SpeedMultiplier.ToString("F2"),
(g, v) => { g.LocalPlayer.Hacks.SpeedMultiplier = Utils.ParseDecimal(v);
Options.Set(OptionsKey.Speed, v); }),
MakeBool(-1, -50, "Camera clipping", OptionsKey.CameraClipping,
OnWidgetClick, g => g.CameraClipping, (g, v) => g.CameraClipping = v),
MakeOpt(-1, 0, "Jump height", OnWidgetClick,
g => g.LocalPlayer.JumpHeight.ToString("F3"),
(g, v) => g.LocalPlayer.physics.CalculateJumpVelocity(true, Utils.ParseDecimal(v))),
MakeBool(-1, 50, "WOM style hacks", OptionsKey.WOMStyleHacks,
OnWidgetClick, g => g.LocalPlayer.Hacks.WOMStyleHacks,
(g, v) => g.LocalPlayer.Hacks.WOMStyleHacks = v),
// Column 2
MakeBool(1, -150, "Full block stepping", OptionsKey.FullBlockStep,
OnWidgetClick, g => g.LocalPlayer.Hacks.FullBlockStep,
(g, v) => g.LocalPlayer.Hacks.FullBlockStep = v),
MakeBool(1, -100, "Modifiable liquids", OptionsKey.ModifiableLiquids,
OnWidgetClick, g => g.ModifiableLiquids, (g, v) => g.ModifiableLiquids = v),
MakeBool(1, -50, "Pushback placing", OptionsKey.PushbackPlacing,
OnWidgetClick, g => g.LocalPlayer.Hacks.PushbackPlacing,
(g, v) => g.LocalPlayer.Hacks.PushbackPlacing = v),
MakeBool(1, 0, "Noclip slide", OptionsKey.NoclipSlide,
OnWidgetClick, g => g.LocalPlayer.Hacks.NoclipSlide,
(g, v) => g.LocalPlayer.Hacks.NoclipSlide = v),
MakeOpt(1, 50, "Field of view", OnWidgetClick,
g => g.Fov.ToString(),
(g, v) => { g.Fov = Int32.Parse(v);
Options.Set(OptionsKey.FieldOfView, v);
g.UpdateProjection();
}),
MakeBool(-1, -150, "Hacks enabled", OptionsKey.HacksOn, onClick, GetHacks, SetHacks),
MakeOpt(-1, -100, "Speed multiplier", onClick, GetSpeed, SetSpeed),
MakeBool(-1, -50, "Camera clipping", OptionsKey.CameraClipping, onClick, GetCameraClip, SetCameraClip),
MakeOpt(-1, 0, "Jump height", onClick, GetJump, SetJump),
MakeBool(-1, 50, "WOM style hacks", OptionsKey.WOMStyleHacks, onClick, GetWOMHacks, SetWOMHacks),
MakeBool(1, -150, "Full block stepping", OptionsKey.FullBlockStep, onClick, GetFullStep, SetFullStep),
MakeBool(1, -100, "Modifiable liquids", OptionsKey.ModifiableLiquids, onClick, GetLiquids, SetLiquids),
MakeBool(1, -50, "Pushback placing", OptionsKey.PushbackPlacing, onClick, GetPushback, SetPushback),
MakeBool(1, 0, "Noclip slide", OptionsKey.NoclipSlide, onClick, GetNoclipSlide, SetNoclipSlide),
MakeOpt(1, 50, "Field of view", onClick, GetFOV, SetFOV),
null,
MakeBack(false, titleFont, SwitchOptions),
@ -79,6 +47,46 @@ namespace ClassicalSharp.Gui.Screens {
CheckHacksAllowed(null, null);
}
static bool GetHacks(Game g) { return g.LocalPlayer.Hacks.Enabled; }
static void SetHacks(Game g, bool v) {
g.LocalPlayer.Hacks.Enabled = v; g.LocalPlayer.CheckHacksConsistency();
}
static string GetSpeed(Game g) { return g.LocalPlayer.Hacks.SpeedMultiplier.ToString("F2"); }
static void SetSpeed(Game g, string v) {
g.LocalPlayer.Hacks.SpeedMultiplier = Utils.ParseDecimal(v); Options.Set(OptionsKey.Speed, v);
}
static bool GetCameraClip(Game g) { return g.CameraClipping; }
static void SetCameraClip(Game g, bool v) { g.CameraClipping = v; }
static string GetJump(Game g) { return g.LocalPlayer.JumpHeight.ToString("F3"); }
static void SetJump(Game g, string v) {
g.LocalPlayer.physics.CalculateJumpVelocity(true, Utils.ParseDecimal(v));
}
static bool GetWOMHacks(Game g) { return g.LocalPlayer.Hacks.WOMStyleHacks; }
static void SetWOMHacks(Game g, bool v) { g.LocalPlayer.Hacks.WOMStyleHacks = v; }
static bool GetFullStep(Game g) { return g.LocalPlayer.Hacks.FullBlockStep; }
static void SetFullStep(Game g, bool v) { g.LocalPlayer.Hacks.FullBlockStep = v; }
static bool GetPushback(Game g) { return g.LocalPlayer.Hacks.PushbackPlacing; }
static void SetPushback(Game g, bool v) { g.LocalPlayer.Hacks.PushbackPlacing = v; }
static bool GetLiquids(Game g) { return g.ModifiableLiquids; }
static void SetLiquids(Game g, bool v) { g.ModifiableLiquids = v; }
static bool GetNoclipSlide(Game g) { return g.LocalPlayer.Hacks.NoclipSlide; }
static void SetNoclipSlide(Game g, bool v) { g.LocalPlayer.Hacks.NoclipSlide = v; }
static string GetFOV(Game g) { return g.Fov.ToString(); }
static void SetFOV(Game g, string v) {
g.Fov = Int32.Parse(v);
Options.Set(OptionsKey.FieldOfView, v);
g.UpdateProjection();
}
void CheckHacksAllowed(object sender, EventArgs e) {
for (int i = 0; i < widgets.Length; i++) {
if (widgets[i] == null) continue;

View file

@ -57,13 +57,13 @@ namespace ClassicalSharp.Gui.Screens {
}
}
void SwitchClassicOptions(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicOptionsScreen(g)); }
protected void SwitchClassic(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicKeyBindingsScreen(g)); }
protected void SwitchClassicHacks(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicHacksKeyBindingsScreen(g)); }
protected void SwitchNormal(Game g, Widget w) { g.Gui.SetNewScreen(new NormalKeyBindingsScreen(g)); }
protected void SwitchHacks(Game g, Widget w) { g.Gui.SetNewScreen(new HacksKeyBindingsScreen(g)); }
protected void SwitchOther(Game g, Widget w) { g.Gui.SetNewScreen(new OtherKeyBindingsScreen(g)); }
protected void SwitchMouse(Game g, Widget w) { g.Gui.SetNewScreen(new MouseKeyBindingsScreen(g)); }
static void SwitchClassicOptions(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicOptionsScreen(g)); }
protected static void SwitchClassic(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicKeyBindingsScreen(g)); }
protected static void SwitchClassicHacks(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicHacksKeyBindingsScreen(g)); }
protected static void SwitchNormal(Game g, Widget w) { g.Gui.SetNewScreen(new NormalKeyBindingsScreen(g)); }
protected static void SwitchHacks(Game g, Widget w) { g.Gui.SetNewScreen(new HacksKeyBindingsScreen(g)); }
protected static void SwitchOther(Game g, Widget w) { g.Gui.SetNewScreen(new OtherKeyBindingsScreen(g)); }
protected static void SwitchMouse(Game g, Widget w) { g.Gui.SetNewScreen(new MouseKeyBindingsScreen(g)); }
void MakePages(int btnY) {
if (leftPage == null && rightPage == null) return;

View file

@ -18,46 +18,59 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
IServerConnection network = game.Server;
bool multi = !game.Server.IsSinglePlayer;
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
!network.IsSinglePlayer ? null :
MakeOpt(-1, -100, "Click distance", OnWidgetClick,
g => g.LocalPlayer.ReachDistance.ToString(),
(g, v) => g.LocalPlayer.ReachDistance = Utils.ParseDecimal(v)),
MakeOpt(-1, -50, "Music volume", OnWidgetClick,
g => g.MusicVolume.ToString(), SetMusicVolume),
MakeOpt(-1, 0, "Sounds volume", OnWidgetClick,
g => g.SoundsVolume.ToString(), SetSoundsVolume),
MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing,
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),
// Column 2
!network.IsSinglePlayer ? null :
MakeBool(1, -100, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled,
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v),
MakeBool(1, -50, "Auto close launcher", OptionsKey.AutoCloseLauncher, OnWidgetClick,
g => Options.GetBool(OptionsKey.AutoCloseLauncher, false),
(g, v) => Options.Set(OptionsKey.AutoCloseLauncher, v)),
MakeBool(1, 0, "Invert mouse", OptionsKey.InvertMouse,
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v),
MakeOpt(1, 50, "Mouse sensitivity", OnWidgetClick,
g => g.MouseSensitivity.ToString(),
(g, v) => { g.MouseSensitivity = Int32.Parse(v);
Options.Set(OptionsKey.Sensitivity, v); }),
multi ? null : MakeOpt(-1, -100, "Click distance", onClick, GetReach, SetReach),
MakeOpt(-1, -50, "Music volume", onClick, GetMusic, SetMusic),
MakeOpt(-1, 0, "Sounds volume", onClick, GetSounds, SetSounds),
MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing, onClick, GetViewBob, SetViewBob),
multi ? null : MakeBool(1, -100, "Block physics", OptionsKey.Physics, onClick, GetPhysics, SetPhysics),
MakeBool(1, -50, "Auto close launcher", OptionsKey.AutoCloseLauncher, onClick, GetAutoClose, SetAutoClose),
MakeBool(1, 0, "Invert mouse", OptionsKey.InvertMouse, onClick, GetInvert, SetInvert),
MakeOpt(1, 50, "Mouse sensitivity", onClick, GetSensitivity, SetSensitivity),
MakeBack(false, titleFont, SwitchOptions),
null, null,
};
}
static string GetReach(Game g) { return g.LocalPlayer.ReachDistance.ToString(); }
static void SetReach(Game g, string v) { g.LocalPlayer.ReachDistance = Utils.ParseDecimal(v); }
static string GetMusic(Game g) { return g.MusicVolume.ToString(); }
static void SetMusic(Game g, string v) {
g.MusicVolume = Int32.Parse(v);
Options.Set(OptionsKey.MusicVolume, v);
g.AudioPlayer.SetMusic(g.MusicVolume);
}
static string GetSounds(Game g) { return g.SoundsVolume.ToString(); }
static void SetSounds(Game g, string v) {
g.SoundsVolume = Int32.Parse(v);
Options.Set(OptionsKey.SoundsVolume, v);
g.AudioPlayer.SetSounds(g.SoundsVolume);
}
static bool GetViewBob(Game g) { return g.ViewBobbing; }
static void SetViewBob(Game g, bool v) { g.ViewBobbing = v; }
static bool GetPhysics(Game g) { return ((SinglePlayerServer)g.Server).physics.Enabled; }
static void SetPhysics(Game g, bool v) { ((SinglePlayerServer)g.Server).physics.Enabled = v; }
static bool GetAutoClose(Game g) { return Options.GetBool(OptionsKey.AutoCloseLauncher, false); }
static void SetAutoClose(Game g, bool v) { Options.Set(OptionsKey.AutoCloseLauncher, v); }
static bool GetInvert(Game g) { return g.InvertMouse; }
static void SetInvert(Game g, bool v) { g.InvertMouse = v; }
static string GetSensitivity(Game g) { return g.MouseSensitivity.ToString(); }
static void SetSensitivity(Game g, string v) {
g.MouseSensitivity = Int32.Parse(v);
Options.Set(OptionsKey.Sensitivity, v);
}
void MakeValidators() {
IServerConnection network = game.Server;
validators = new MenuInputValidator[] {
@ -80,17 +93,5 @@ namespace ClassicalSharp.Gui.Screens {
"&fThe default click distance is 5 blocks.",
};
}
void SetMusicVolume(Game g, string v) {
g.MusicVolume = Int32.Parse(v);
Options.Set(OptionsKey.MusicVolume, v);
g.AudioPlayer.SetMusic(g.MusicVolume);
}
void SetSoundsVolume(Game g, string v) {
g.SoundsVolume = Int32.Parse(v);
Options.Set(OptionsKey.SoundsVolume, v);
g.AudioPlayer.SetSounds(g.SoundsVolume);
}
}
}

View file

@ -28,26 +28,17 @@ namespace ClassicalSharp.Gui.Screens {
}
protected override void ContextRecreated() {
ClickHandler onClick = OnWidgetClick;
widgets = new Widget[] {
// Column 1
MakeBool(-1, -150, "Classic hand model", OptionsKey.ClassicArmModel,
OnWidgetClick, g => g.ClassicArmModel, (g, v) => g.ClassicArmModel = v),
MakeBool(-1, -100, "Classic walk anim", OptionsKey.SimpleArmsAnim, true,
OnWidgetClick, g => !g.SimpleArmsAnim, (g, v) => g.SimpleArmsAnim = !v),
MakeBool(-1, -50, "Classic gui textures", OptionsKey.UseClassicGui,
OnWidgetClick, g => g.UseClassicGui, (g, v) => g.UseClassicGui = v),
MakeBool(-1, 0, "Classic player list", OptionsKey.UseClassicTabList,
OnWidgetClick, g => g.UseClassicTabList, (g, v) => g.UseClassicTabList = v),
MakeBool(-1, 50, "Classic options", OptionsKey.UseClassicOptions,
OnWidgetClick, g => g.UseClassicOptions, (g, v) => g.UseClassicOptions = v),
// Column 2
MakeBool(1, -150, "Allow custom blocks", OptionsKey.AllowCustomBlocks,
OnWidgetClick, g => g.AllowCustomBlocks, (g, v) => g.AllowCustomBlocks = v),
MakeBool(1, -100, "Use CPE", OptionsKey.UseCPE,
OnWidgetClick, g => g.UseCPE, (g, v) => g.UseCPE = v),
MakeBool(1, -50, "Use server textures", OptionsKey.AllowServerTextures,
OnWidgetClick, g => g.AllowServerTextures, (g, v) => g.AllowServerTextures = v),
MakeBool(-1, -150, "Classic hand model", OptionsKey.ClassicArmModel, onClick, GetHand, SetHand),
MakeBool(-1, -100, "Classic walk anim", OptionsKey.SimpleArmsAnim, true, onClick, GetAnim, SetAnim),
MakeBool(-1, -50, "Classic gui textures", OptionsKey.UseClassicGui, onClick, GetGui, SetGui),
MakeBool(-1, 0, "Classic player list", OptionsKey.UseClassicTabList, onClick, GetList, SetList),
MakeBool(-1, 50, "Classic options", OptionsKey.UseClassicOptions, onClick, GetOpts, SetOpts),
MakeBool(1, -150, "Allow custom blocks", OptionsKey.UseCustomBlocks, onClick, GetCustom, SetCustom),
MakeBool(1, -100, "Use CPE", OptionsKey.UseCPE, onClick, GetCPE, SetCPE),
MakeBool(1, -50, "Use server textures", OptionsKey.UseServerTextures, onClick, GetTexs, SetTexs),
TextWidget.Create(game, "&eButtons on the right require a client restart", regularFont)
.SetLocation(Anchor.Centre, Anchor.Centre, 0, 100),
@ -57,6 +48,30 @@ namespace ClassicalSharp.Gui.Screens {
};
}
static bool GetHand(Game g) { return g.ClassicArmModel; }
static void SetHand(Game g, bool v) { g.ClassicArmModel = v; }
static bool GetAnim(Game g) { return !g.SimpleArmsAnim; }
static void SetAnim(Game g, bool v) { g.SimpleArmsAnim = !v; }
static bool GetGui(Game g) { return g.UseClassicGui; }
static void SetGui(Game g, bool v) { g.UseClassicGui = v; }
static bool GetList(Game g) { return g.UseClassicTabList; }
static void SetList(Game g, bool v) { g.UseClassicTabList = v; }
static bool GetOpts(Game g) { return g.UseClassicOptions; }
static void SetOpts(Game g, bool v) { g.UseClassicOptions = v; }
static bool GetCustom(Game g) { return g.UseCustomBlocks; }
static void SetCustom(Game g, bool v) { g.UseCustomBlocks = v; }
static bool GetCPE(Game g) { return g.UseCPE; }
static void SetCPE(Game g, bool v) { g.UseCPE = v; }
static bool GetTexs(Game g) { return g.AllowServerTextures; }
static void SetTexs(Game g, bool v) { g.AllowServerTextures = v; }
Screen PreviousScreen() {
if (game.UseClassicOptions) return new PauseScreen(game);
return new OptionsGroupScreen(game);

View file

@ -47,13 +47,13 @@ namespace ClassicalSharp.Gui.Screens {
CheckHacksAllowed(null, null);
}
void SwitchMiscOptions(Game g, Widget w) { g.Gui.SetNewScreen(new MiscOptionsScreen(g)); }
void SwitchGuiOptions(Game g, Widget w) { g.Gui.SetNewScreen(new GuiOptionsScreen(g)); }
void SwitchGfxOptions(Game g, Widget w) { g.Gui.SetNewScreen(new GraphicsOptionsScreen(g)); }
void SwitchControls(Game g, Widget w) { g.Gui.SetNewScreen(new NormalKeyBindingsScreen(g)); }
void SwitchHacksOptions(Game g, Widget w) { g.Gui.SetNewScreen(new HacksSettingsScreen(g)); }
void SwitchEnvOptions(Game g, Widget w) { g.Gui.SetNewScreen(new EnvSettingsScreen(g)); }
void SwitchNostalgiaOptions(Game g, Widget w) { g.Gui.SetNewScreen(new NostalgiaScreen(g)); }
static void SwitchMiscOptions(Game g, Widget w) { g.Gui.SetNewScreen(new MiscOptionsScreen(g)); }
static void SwitchGuiOptions(Game g, Widget w) { g.Gui.SetNewScreen(new GuiOptionsScreen(g)); }
static void SwitchGfxOptions(Game g, Widget w) { g.Gui.SetNewScreen(new GraphicsOptionsScreen(g)); }
static void SwitchControls(Game g, Widget w) { g.Gui.SetNewScreen(new NormalKeyBindingsScreen(g)); }
static void SwitchHacksOptions(Game g, Widget w) { g.Gui.SetNewScreen(new HacksSettingsScreen(g)); }
static void SwitchEnvOptions(Game g, Widget w) { g.Gui.SetNewScreen(new EnvSettingsScreen(g)); }
static void SwitchNostalgiaOptions(Game g, Widget w) { g.Gui.SetNewScreen(new NostalgiaScreen(g)); }
void CheckHacksAllowed(object sender, EventArgs e) {
if (game.UseClassicOptions) return;

View file

@ -64,15 +64,15 @@ namespace ClassicalSharp.Gui.Screens {
};
}
void SwitchGenLevel(Game g, Widget w) { g.Gui.SetNewScreen(new GenLevelScreen(g)); }
void SwitchLoadLevel(Game g, Widget w) { g.Gui.SetNewScreen(new LoadLevelScreen(g)); }
void SwitchSaveLevel(Game g, Widget w) { g.Gui.SetNewScreen(new SaveLevelScreen(g)); }
void SwitchTexPack(Game g, Widget w) { g.Gui.SetNewScreen(new TexturePackScreen(g)); }
void SwitchHotkeys(Game g, Widget w) { g.Gui.SetNewScreen(new HotkeyListScreen(g)); }
void SwitchNostalgiaOptions(Game g, Widget w) { g.Gui.SetNewScreen(new NostalgiaScreen(g)); }
void SwitchGame(Game g, Widget w) { g.Gui.SetNewScreen(null); }
void SwitchClassicOptions(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicOptionsScreen(g)); }
void QuitGame(Game g, Widget w) { g.Exit(); }
static void SwitchGenLevel(Game g, Widget w) { g.Gui.SetNewScreen(new GenLevelScreen(g)); }
static void SwitchLoadLevel(Game g, Widget w) { g.Gui.SetNewScreen(new LoadLevelScreen(g)); }
static void SwitchSaveLevel(Game g, Widget w) { g.Gui.SetNewScreen(new SaveLevelScreen(g)); }
static void SwitchTexPack(Game g, Widget w) { g.Gui.SetNewScreen(new TexturePackScreen(g)); }
static void SwitchHotkeys(Game g, Widget w) { g.Gui.SetNewScreen(new HotkeyListScreen(g)); }
static void SwitchNostalgiaOptions(Game g, Widget w) { g.Gui.SetNewScreen(new NostalgiaScreen(g)); }
static void SwitchGame(Game g, Widget w) { g.Gui.SetNewScreen(null); }
static void SwitchClassicOptions(Game g, Widget w) { g.Gui.SetNewScreen(new ClassicOptionsScreen(g)); }
static void QuitGame(Game g, Widget w) { g.Exit(); }
void CheckHacksAllowed(object sender, EventArgs e) {
if (game.UseClassicOptions) return;

View file

@ -140,7 +140,7 @@ namespace ClassicalSharp.Entities {
Hacks.PushbackPlacing = !game.ClassicMode && Options.GetBool(OptionsKey.PushbackPlacing, false);
Hacks.NoclipSlide = Options.GetBool(OptionsKey.NoclipSlide, false);
Hacks.WOMStyleHacks = !game.ClassicMode && Options.GetBool(OptionsKey.WOMStyleHacks, false);
Hacks.Enabled = !game.PureClassic && Options.GetBool(OptionsKey.HacksEnabled, true);
Hacks.Enabled = !game.PureClassic && Options.GetBool(OptionsKey.HacksOn, true);
Hacks.FullBlockStep = !game.ClassicMode && Options.GetBool(OptionsKey.FullBlockStep, false);
Health = 20;
}

View file

@ -75,8 +75,8 @@ namespace ClassicalSharp {
AsyncDownloader = AddComponent(new AsyncDownloader(Drawer2D));
Lighting = AddComponent(new BasicLighting());
Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.ArialChatFont, false);
Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackTextShadows, false);
Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.UseChatFont, false);
Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackText, false);
Graphics.Mipmaps = Options.GetBool(OptionsKey.Mipmaps, false);
TerrainAtlas1D = new TerrainAtlas1D(this);
@ -163,7 +163,7 @@ namespace ClassicalSharp {
void LoadOptions() {
ClassicMode = Options.GetBool("mode-classic", false);
ClassicHacks = Options.GetBool(OptionsKey.AllowClassicHacks, false);
AllowCustomBlocks = Options.GetBool(OptionsKey.AllowCustomBlocks, true);
UseCustomBlocks = Options.GetBool(OptionsKey.UseCustomBlocks, true);
UseCPE = Options.GetBool(OptionsKey.UseCPE, true);
SimpleArmsAnim = Options.GetBool(OptionsKey.SimpleArmsAnim, false);
ChatLogging = Options.GetBool(OptionsKey.ChatLogging, true);
@ -182,7 +182,7 @@ namespace ClassicalSharp {
ModifiableLiquids = !ClassicMode && Options.GetBool(OptionsKey.ModifiableLiquids, false);
CameraClipping = Options.GetBool(OptionsKey.CameraClipping, true);
AllowServerTextures = Options.GetBool(OptionsKey.AllowServerTextures, true);
AllowServerTextures = Options.GetBool(OptionsKey.UseServerTextures, true);
MouseSensitivity = Options.GetInt(OptionsKey.Sensitivity, 1, 100, 30);
ShowBlockInHand = Options.GetBool(OptionsKey.ShowBlockInHand, true);
InvertMouse = Options.GetBool(OptionsKey.InvertMouse, false);

View file

@ -175,7 +175,7 @@ namespace ClassicalSharp {
public bool PureClassic { get { return ClassicMode && !ClassicHacks; } }
public bool AllowCustomBlocks, UseCPE, AllowServerTextures;
public bool UseCustomBlocks, UseCPE, AllowServerTextures;
public bool SmoothLighting;

View file

@ -94,7 +94,7 @@ namespace ClassicalSharp.Map {
map.Env.SetWeather((Weather)weather);
}
if (game.AllowCustomBlocks && CheckKey("BlockDefinitions", 1, metadata)) {
if (game.UseCustomBlocks && CheckKey("BlockDefinitions", 1, metadata)) {
foreach (var pair in curCpeExt) {
if (pair.Value.TagId != NbtTagType.Compound) continue;
if (!Utils.CaselessStarts(pair.Key, "Block")) continue;

View file

@ -12,7 +12,7 @@ namespace ClassicalSharp.Network.Protocols {
public override void Init() { Reset(); }
public override void Reset() {
if (!game.UseCPE || !game.AllowCustomBlocks) return;
if (!game.UseCPE || !game.UseCustomBlocks) return;
net.Set(Opcode.CpeDefineBlock, HandleDefineBlock, 80);
net.Set(Opcode.CpeRemoveBlockDefinition, HandleRemoveBlockDefinition, 2);
net.Set(Opcode.CpeDefineBlockExt, HandleDefineBlockExt, 85);
@ -60,7 +60,7 @@ namespace ClassicalSharp.Network.Protocols {
}
void HandleDefineBlockExt() {
if (!game.AllowCustomBlocks) {
if (!game.UseCustomBlocks) {
net.SkipPacketData(Opcode.CpeDefineBlockExt); return;
}
byte block = HandleDefineBlockCommonStart(reader, net.cpeData.blockDefsExtVer >= 2);

View file

@ -463,7 +463,7 @@ namespace ClassicalSharp.Network.Protocols {
if (net.cpeData.ServerExtensionsCount != 0) return;
string[] clientExts = CPESupport.ClientExtensions;
int count = clientExts.Length;
if (!game.AllowCustomBlocks) count -= 2;
if (!game.UseCustomBlocks) count -= 2;
WriteExtInfo(net.AppName, count);
net.SendPacket();
@ -474,7 +474,7 @@ namespace ClassicalSharp.Network.Protocols {
if (name == "EnvMapAppearance") ver = net.cpeData.envMapVer;
if (name == "BlockDefinitionsExt") ver = net.cpeData.blockDefsExtVer;
if (!game.AllowCustomBlocks && name.StartsWith("BlockDefinitions")) continue;
if (!game.UseCustomBlocks && name.StartsWith("BlockDefinitions")) continue;
WriteExtEntry(name, ver);
net.SendPacket();

View file

@ -42,7 +42,7 @@ namespace ClassicalSharp.Singleplayer {
map = game.World;
game.WorldEvents.OnNewMapLoaded += ResetMap;
game.UserEvents.BlockChanged += BlockChanged;
enabled = Options.GetBool(OptionsKey.SingleplayerPhysics, true);
enabled = Options.GetBool(OptionsKey.Physics, true);
falling = new FallingPhysics(game, this);
tnt = new TNTPhysics(game, this);

View file

@ -16,7 +16,7 @@ namespace ClassicalSharp {
public const string ForceOldOpenGL = "force-oldgl";
public const string ViewDist = "viewdist";
public const string SingleplayerPhysics = "singleplayerphysics";
public const string Physics = "singleplayerphysics";
public const string NamesMode = "namesmode";
public const string InvertMouse = "invertmouse";
public const string Sensitivity = "mousesensitivity";
@ -33,7 +33,7 @@ namespace ClassicalSharp {
public const string SurvivalMode = "game-survivalmode";
public const string ChatLogging = "chat-logging";
public const string HacksEnabled = "hacks-hacksenabled";
public const string HacksOn = "hacks-hacksenabled";
public const string FieldOfView = "hacks-fov";
public const string Speed = "hacks-speedmultiplier";
public const string ModifiableLiquids = "hacks-liquidsbreakable";
@ -48,18 +48,18 @@ namespace ClassicalSharp {
public const string ChatLines = "gui-chatlines";
public const string ClickableChat = "gui-chatclickable";
#endif
public const string ArialChatFont = "gui-arialchatfont";
public const string UseChatFont = "gui-arialchatfont";
#if !LAUNCHER
public const string HotbarScale = "gui-hotbarscale";
public const string InventoryScale = "gui-inventoryscale";
public const string ChatScale = "gui-chatscale";
public const string ShowFPS = "gui-showfps";
public const string FontName = "gui-fontname";
public const string BlackTextShadows = "gui-blacktextshadows";
public const string BlackText = "gui-blacktextshadows";
public const string AllowCustomBlocks = "nostalgia-customblocks";
public const string UseCustomBlocks = "nostalgia-customblocks";
public const string UseCPE = "nostalgia-usecpe";
public const string AllowServerTextures = "nostalgia-servertextures";
public const string UseServerTextures = "nostalgia-servertextures";
public const string UseClassicGui = "nostalgia-classicgui";
public const string SimpleArmsAnim = "nostalgia-simplearms";
public const string UseClassicTabList = "nostalgia-classictablist";

View file

@ -56,7 +56,7 @@ namespace Launcher {
Bitmap bmp = Platform.ReadBmp32Bpp(Drawer, data);
Drawer.SetFontBitmap(bmp);
useBitmappedFont = !Options.GetBool(OptionsKey.ArialChatFont, false);
useBitmappedFont = !Options.GetBool(OptionsKey.UseChatFont, false);
fontPng = true;
} else if (filename == "terrain.png") {
if (terrainPng) return;

View file

@ -1,7 +1,7 @@
#include "Options.h"
#include "ExtMath.h"
UInt8 Options_KeysBuffer[String_BufferSize(24) * OPTIONS_COUNT];
UInt8 Options_KeysBuffer[String_BufferSize(26) * OPTIONS_COUNT];
UInt8 Options_ValuesBuffer[
String_BufferSize(8) * OPTIONS_TINYSTRS +
String_BufferSize(16) * OPTIONS_SMALLSTRS +

View file

@ -21,7 +21,7 @@ typedef UInt8 FpsLimitMethod;
#define OptionsKey_ForceOldOpenGL "force-oldgl"
#define OptionsKey_ViewDist "viewdist"
#define OptionsKey_SingleplayerPhysics "singleplayerphysics"
#define OptionsKey_Physics "singleplayerphysics"
#define OptionsKey_NamesMode "namesmode"
#define OptionsKey_InvertMouse "invertmouse"
#define OptionsKey_Sensitivity "mousesensitivity"
@ -50,17 +50,17 @@ typedef UInt8 FpsLimitMethod;
#define OptionsKey_ShowBlockInHand "gui-blockinhand"
#define OptionsKey_ChatLines "gui-chatlines"
#define OptionsKey_ClickableChat "gui-chatclickable"
#define OptionsKey_ArialChatFont "gui-arialchatfont"
#define OptionsKey_UseChatFont "gui-arialchatfont"
#define OptionsKey_HotbarScale "gui-hotbarscale"
#define OptionsKey_InventoryScale "gui-inventoryscale"
#define OptionsKey_ChatScale "gui-chatscale"
#define OptionsKey_ShowFPS "gui-showfps"
#define OptionsKey_FontName "gui-fontname"
#define OptionsKey_BlackTextShadows "gui-blacktextshadows"
#define OptionsKey_BlackText "gui-blacktextshadows"
#define OptionsKey_AllowCustomBlocks "nostalgia-customblocks"
#define OptionsKey_UseCustomBlocks "nostalgia-customblocks"
#define OptionsKey_UseCPE "nostalgia-usecpe"
#define OptionsKey_AllowServerTextures "nostalgia-servertextures"
#define OptionsKey_UseServerTextures "nostalgia-servertextures"
#define OptionsKey_UseClassicGui "nostalgia-classicgui"
#define OptionsKey_SimpleArmsAnim "nostalgia-simplearms"
#define OptionsKey_UseClassicTabList "nostalgia-classictablist"

View file

@ -423,7 +423,7 @@ void Physics_HandleTnt(Int32 index, BlockID block) {
void Physics_Init(void) {
Event_RegisterVoid(&WorldEvents_MapLoaded, Physics_OnNewMapLoaded);
Event_RegisterBlock(&UserEvents_BlockChanged, Physics_BlockChanged);
Physics_Enabled = Options_GetBool(OptionsKey_SingleplayerPhysics, true);
Physics_Enabled = Options_GetBool(OptionsKey_Physics, true);
TickQueue_Init(&physics_lavaQ);
TickQueue_Init(&physics_waterQ);