mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
more WIP with vorbis
This commit is contained in:
parent
12a823cc8e
commit
ae764cf2be
@ -1,155 +1,155 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Entities;
|
||||||
using ClassicalSharp.Gui.Widgets;
|
using ClassicalSharp.Gui.Widgets;
|
||||||
|
|
||||||
namespace ClassicalSharp.Gui.Screens {
|
namespace ClassicalSharp.Gui.Screens {
|
||||||
public class HacksSettingsScreen : MenuOptionsScreen {
|
public class HacksSettingsScreen : MenuOptionsScreen {
|
||||||
|
|
||||||
public HacksSettingsScreen(Game game) : base(game) {
|
public HacksSettingsScreen(Game game) : base(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init() {
|
public override void Init() {
|
||||||
base.Init();
|
base.Init();
|
||||||
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
||||||
validators = new MenuInputValidator[widgets.Length];
|
validators = new MenuInputValidator[widgets.Length];
|
||||||
defaultValues = new string[widgets.Length];
|
defaultValues = new string[widgets.Length];
|
||||||
|
|
||||||
validators[1] = new RealValidator(0.1f, 50);
|
validators[1] = new RealValidator(0.1f, 50);
|
||||||
defaultValues[1] = "10";
|
defaultValues[1] = "10";
|
||||||
validators[3] = new RealValidator(0.1f, 2048f);
|
validators[3] = new RealValidator(0.1f, 2048f);
|
||||||
defaultValues[3] = (1.233f).ToString();
|
defaultValues[3] = (1.233f).ToString();
|
||||||
validators[9] = new IntegerValidator(1, 150);
|
validators[9] = new IntegerValidator(1, 150);
|
||||||
defaultValues[9] = "70";
|
defaultValues[9] = "70";
|
||||||
|
|
||||||
MakeDescriptions();
|
MakeDescriptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
game.Events.HackPermissionsChanged -= CheckHacksAllowed;
|
game.Events.HackPermissionsChanged -= CheckHacksAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckHacksAllowed(object sender, EventArgs e) {
|
void CheckHacksAllowed(object sender, EventArgs e) {
|
||||||
for (int i = 0; i < widgets.Length; i++) {
|
for (int i = 0; i < widgets.Length; i++) {
|
||||||
if (widgets[i] == null) continue;
|
if (widgets[i] == null) continue;
|
||||||
widgets[i].Disabled = false;
|
widgets[i].Disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPlayer p = game.LocalPlayer;
|
LocalPlayer p = game.LocalPlayer;
|
||||||
bool noGlobalHacks = !p.Hacks.CanAnyHacks || !p.Hacks.Enabled;
|
bool noGlobalHacks = !p.Hacks.CanAnyHacks || !p.Hacks.Enabled;
|
||||||
widgets[3].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
widgets[3].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
||||||
widgets[4].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
widgets[4].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
||||||
widgets[5].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
widgets[5].Disabled = noGlobalHacks || !p.Hacks.CanSpeed;
|
||||||
widgets[7].Disabled = noGlobalHacks || !p.Hacks.CanPushbackBlocks;
|
widgets[7].Disabled = noGlobalHacks || !p.Hacks.CanPushbackBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ContextRecreated() {
|
protected override void ContextRecreated() {
|
||||||
ClickHandler onClick = OnInputClick;
|
ClickHandler onClick = OnInputClick;
|
||||||
ClickHandler onBool = OnBoolClick;
|
ClickHandler onBool = OnBoolClick;
|
||||||
|
|
||||||
widgets = new Widget[] {
|
widgets = new Widget[] {
|
||||||
MakeOpt(-1, -150, "Hacks enabled", onBool, GetHacks, SetHacks),
|
MakeOpt(-1, -150, "Hacks enabled", onBool, GetHacks, SetHacks),
|
||||||
MakeOpt(-1, -100, "Speed multiplier", onClick, GetSpeed, SetSpeed),
|
MakeOpt(-1, -100, "Speed multiplier", onClick, GetSpeed, SetSpeed),
|
||||||
MakeOpt(-1, -50, "Camera clipping", onBool, GetClipping, SetClipping),
|
MakeOpt(-1, -50, "Camera clipping", onBool, GetClipping, SetClipping),
|
||||||
MakeOpt(-1, 0, "Jump height", onClick, GetJump, SetJump),
|
MakeOpt(-1, 0, "Jump height", onClick, GetJump, SetJump),
|
||||||
MakeOpt(-1, 50, "WOM style hacks", onBool, GetWOMHacks, SetWOMHacks),
|
MakeOpt(-1, 50, "WOM style hacks", onBool, GetWOMHacks, SetWOMHacks),
|
||||||
|
|
||||||
MakeOpt(1, -150, "Full block stepping", onBool, GetFullStep, SetFullStep),
|
MakeOpt(1, -150, "Full block stepping", onBool, GetFullStep, SetFullStep),
|
||||||
MakeOpt(1, -100, "Modifiable liquids", onBool, GetLiquids, SetLiquids),
|
MakeOpt(1, -100, "Modifiable liquids", onBool, GetLiquids, SetLiquids),
|
||||||
MakeOpt(1, -50, "Pushback placing", onBool, GetPushback, SetPushback),
|
MakeOpt(1, -50, "Pushback placing", onBool, GetPushback, SetPushback),
|
||||||
MakeOpt(1, 0, "Noclip slide", onBool, GetSlide, SetSlide),
|
MakeOpt(1, 0, "Noclip slide", onBool, GetSlide, SetSlide),
|
||||||
MakeOpt(1, 50, "Field of view", onClick, GetFOV, SetFOV),
|
MakeOpt(1, 50, "Field of view", onClick, GetFOV, SetFOV),
|
||||||
|
|
||||||
MakeBack(false, titleFont, SwitchOptions),
|
MakeBack(false, titleFont, SwitchOptions),
|
||||||
null, null, null,
|
null, null, null,
|
||||||
};
|
};
|
||||||
CheckHacksAllowed(null, null);
|
CheckHacksAllowed(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetHacks(Game g) { return GetBool(g.LocalPlayer.Hacks.Enabled); }
|
static string GetHacks(Game g) { return GetBool(g.LocalPlayer.Hacks.Enabled); }
|
||||||
static void SetHacks(Game g, string v) {
|
static void SetHacks(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.Enabled = SetBool(v, OptionsKey.HacksOn);
|
g.LocalPlayer.Hacks.Enabled = SetBool(v, OptionsKey.HacksOn);
|
||||||
g.LocalPlayer.CheckHacksConsistency();
|
g.LocalPlayer.CheckHacksConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetSpeed(Game g) { return g.LocalPlayer.Hacks.SpeedMultiplier.ToString("F2"); }
|
static string GetSpeed(Game g) { return g.LocalPlayer.Hacks.SpeedMultiplier.ToString("F2"); }
|
||||||
static void SetSpeed(Game g, string v) {
|
static void SetSpeed(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.SpeedMultiplier = Utils.ParseDecimal(v);
|
g.LocalPlayer.Hacks.SpeedMultiplier = Utils.ParseDecimal(v);
|
||||||
Options.Set(OptionsKey.Speed, v);
|
Options.Set(OptionsKey.Speed, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetClipping(Game g) { return GetBool(g.CameraClipping); }
|
static string GetClipping(Game g) { return GetBool(g.CameraClipping); }
|
||||||
static void SetClipping(Game g, string v) {
|
static void SetClipping(Game g, string v) {
|
||||||
g.CameraClipping = SetBool(v, OptionsKey.CameraClipping);
|
g.CameraClipping = SetBool(v, OptionsKey.CameraClipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetJump(Game g) { return g.LocalPlayer.JumpHeight.ToString("F3"); }
|
static string GetJump(Game g) { return g.LocalPlayer.JumpHeight.ToString("F3"); }
|
||||||
static void SetJump(Game g, string v) {
|
static void SetJump(Game g, string v) {
|
||||||
PhysicsComponent physics = g.LocalPlayer.physics;
|
PhysicsComponent physics = g.LocalPlayer.physics;
|
||||||
physics.CalculateJumpVelocity(Utils.ParseDecimal(v));
|
physics.CalculateJumpVelocity(Utils.ParseDecimal(v));
|
||||||
physics.userJumpVel = physics.jumpVel;
|
physics.userJumpVel = physics.jumpVel;
|
||||||
Options.Set(OptionsKey.JumpVelocity, physics.jumpVel.ToString());
|
Options.Set(OptionsKey.JumpVelocity, physics.jumpVel.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetWOMHacks(Game g) { return GetBool(g.LocalPlayer.Hacks.WOMStyleHacks); }
|
static string GetWOMHacks(Game g) { return GetBool(g.LocalPlayer.Hacks.WOMStyleHacks); }
|
||||||
static void SetWOMHacks(Game g, string v) {
|
static void SetWOMHacks(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.WOMStyleHacks = SetBool(v, OptionsKey.WOMStyleHacks);
|
g.LocalPlayer.Hacks.WOMStyleHacks = SetBool(v, OptionsKey.WOMStyleHacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetFullStep(Game g) { return GetBool(g.LocalPlayer.Hacks.FullBlockStep); }
|
static string GetFullStep(Game g) { return GetBool(g.LocalPlayer.Hacks.FullBlockStep); }
|
||||||
static void SetFullStep(Game g, string v) {
|
static void SetFullStep(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.FullBlockStep = SetBool(v, OptionsKey.FullBlockStep);
|
g.LocalPlayer.Hacks.FullBlockStep = SetBool(v, OptionsKey.FullBlockStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetPushback(Game g) { return GetBool(g.LocalPlayer.Hacks.PushbackPlacing); }
|
static string GetPushback(Game g) { return GetBool(g.LocalPlayer.Hacks.PushbackPlacing); }
|
||||||
static void SetPushback(Game g, string v) {
|
static void SetPushback(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.PushbackPlacing = SetBool(v, OptionsKey.PushbackPlacing);
|
g.LocalPlayer.Hacks.PushbackPlacing = SetBool(v, OptionsKey.PushbackPlacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetLiquids(Game g) { return GetBool(g.BreakableLiquids); }
|
static string GetLiquids(Game g) { return GetBool(g.BreakableLiquids); }
|
||||||
static void SetLiquids(Game g, string v) {
|
static void SetLiquids(Game g, string v) {
|
||||||
g.BreakableLiquids = SetBool(v, OptionsKey.ModifiableLiquids);
|
g.BreakableLiquids = SetBool(v, OptionsKey.ModifiableLiquids);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetSlide(Game g) { return GetBool(g.LocalPlayer.Hacks.NoclipSlide); }
|
static string GetSlide(Game g) { return GetBool(g.LocalPlayer.Hacks.NoclipSlide); }
|
||||||
static void SetSlide(Game g, string v) {
|
static void SetSlide(Game g, string v) {
|
||||||
g.LocalPlayer.Hacks.NoclipSlide = SetBool(v, OptionsKey.NoclipSlide);
|
g.LocalPlayer.Hacks.NoclipSlide = SetBool(v, OptionsKey.NoclipSlide);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetFOV(Game g) { return g.Fov.ToString(); }
|
static string GetFOV(Game g) { return g.Fov.ToString(); }
|
||||||
static void SetFOV(Game g, string v) {
|
static void SetFOV(Game g, string v) {
|
||||||
g.Fov = Int32.Parse(v);
|
g.Fov = Int32.Parse(v);
|
||||||
if (g.ZoomFov > g.Fov) g.ZoomFov = g.Fov;
|
if (g.ZoomFov > g.Fov) g.ZoomFov = g.Fov;
|
||||||
|
|
||||||
Options.Set(OptionsKey.FieldOfView, v);
|
Options.Set(OptionsKey.FieldOfView, v);
|
||||||
g.UpdateProjection();
|
g.UpdateProjection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeDescriptions() {
|
void MakeDescriptions() {
|
||||||
string[][] descs = new string[widgets.Length][];
|
string[][] descs = new string[widgets.Length][];
|
||||||
descs[2] = new string[] {
|
descs[2] = new string[] {
|
||||||
"&eIf &fON&e, then the third person cameras will limit",
|
"&eIf &fON&e, then the third person cameras will limit",
|
||||||
"ðeir zoom distance if they hit a solid block.",
|
"ðeir zoom distance if they hit a solid block.",
|
||||||
};
|
};
|
||||||
descs[3] = new string[] {
|
descs[3] = new string[] {
|
||||||
"&eSets how many blocks high you can jump up.",
|
"&eSets how many blocks high you can jump up.",
|
||||||
"&eNote: You jump much higher when holding down the Speed key binding.",
|
"&eNote: You jump much higher when holding down the Speed key binding.",
|
||||||
};
|
};
|
||||||
descs[6] = new string[] {
|
descs[6] = new string[] {
|
||||||
"&eIf &fON&e, then water/lava can be placed and",
|
"&eIf &fON&e, then water/lava can be placed and",
|
||||||
"&edeleted the same way as any other block.",
|
"&edeleted the same way as any other block.",
|
||||||
};
|
};
|
||||||
descs[7] = new string[] {
|
descs[7] = new string[] {
|
||||||
"&eIf &fON&e, placing blocks that intersect your own position cause",
|
"&eIf &fON&e, placing blocks that intersect your own position cause",
|
||||||
"ðe block to be placed, and you to be moved out of the way.",
|
"ðe block to be placed, and you to be moved out of the way.",
|
||||||
"&fThis is mainly useful for quick pillaring/towering.",
|
"&fThis is mainly useful for quick pillaring/towering.",
|
||||||
};
|
};
|
||||||
descs[8] = new string[] {
|
descs[8] = new string[] {
|
||||||
"&eIf &fOFF&e, you will immediately stop when in noclip",
|
"&eIf &fOFF&e, you will immediately stop when in noclip",
|
||||||
"&emode and no movement keys are held down.",
|
"&emode and no movement keys are held down.",
|
||||||
};
|
};
|
||||||
descriptions = descs;
|
descriptions = descs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,8 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.Model;
|
using ClassicalSharp.Physics;
|
||||||
using ClassicalSharp.Physics;
|
using OpenTK;
|
||||||
using OpenTK;
|
using BlockID = System.UInt16;
|
||||||
using BlockID = System.UInt16;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Entities {
|
namespace ClassicalSharp.Entities {
|
||||||
|
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.GraphicsAPI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
#if ANDROID
|
|
||||||
using Android.Graphics;
|
|
||||||
#endif
|
|
||||||
using BlockID = System.UInt16;
|
using BlockID = System.UInt16;
|
||||||
|
|
||||||
namespace ClassicalSharp.Entities {
|
namespace ClassicalSharp.Entities {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using ClassicalSharp.Physics;
|
using ClassicalSharp.Physics;
|
||||||
using ClassicalSharp.Renderers;
|
using OpenTK;
|
||||||
using OpenTK;
|
using OpenTK.Input;
|
||||||
using OpenTK.Input;
|
using BlockID = System.UInt16;
|
||||||
using BlockID = System.UInt16;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Entities {
|
namespace ClassicalSharp.Entities {
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Entities;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.GraphicsAPI;
|
||||||
using ClassicalSharp.Physics;
|
using ClassicalSharp.Physics;
|
||||||
using ClassicalSharp.Renderers;
|
using ClassicalSharp.Textures;
|
||||||
using ClassicalSharp.Textures;
|
using OpenTK;
|
||||||
using OpenTK;
|
using BlockID = System.UInt16;
|
||||||
using BlockID = System.UInt16;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Model {
|
namespace ClassicalSharp.Model {
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Entities;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.Physics;
|
||||||
using ClassicalSharp.Physics;
|
using OpenTK;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Model {
|
namespace ClassicalSharp.Model {
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Entities;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.Physics;
|
||||||
using ClassicalSharp.Physics;
|
using OpenTK;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Model {
|
namespace ClassicalSharp.Model {
|
||||||
|
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Net;
|
||||||
using System.IO;
|
using ClassicalSharp.Gui.Screens;
|
||||||
using System.Net;
|
using ClassicalSharp.Network;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Textures;
|
||||||
using ClassicalSharp.Generator;
|
using OpenTK;
|
||||||
using ClassicalSharp.Gui.Screens;
|
|
||||||
using ClassicalSharp.Network;
|
|
||||||
using ClassicalSharp.Textures;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
#if ANDROID
|
|
||||||
using Android.Graphics;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace ClassicalSharp {
|
namespace ClassicalSharp {
|
||||||
|
|
||||||
@ -20,21 +13,14 @@ namespace ClassicalSharp {
|
|||||||
public abstract class IServerConnection : IGameComponent {
|
public abstract class IServerConnection : IGameComponent {
|
||||||
|
|
||||||
public bool IsSinglePlayer;
|
public bool IsSinglePlayer;
|
||||||
|
public bool Disconnected;
|
||||||
/// <summary> Opens a connection to the server, and prepares the initial state of the client. </summary>
|
|
||||||
public abstract void BeginConnect();
|
public abstract void BeginConnect();
|
||||||
|
|
||||||
public abstract void SendChat(string text);
|
|
||||||
|
|
||||||
/// <summary> Informs the server of the client's current position and orientation. </summary>
|
|
||||||
public abstract void SendPosition(Vector3 pos, float rotY, float headX);
|
|
||||||
|
|
||||||
/// <summary> Informs the server that using the given mouse button,
|
|
||||||
/// the client clicked on a particular block or entity. </summary>
|
|
||||||
public abstract void SendPlayerClick(MouseButton button, bool buttonDown, byte targetId, PickedPos pos);
|
|
||||||
|
|
||||||
public abstract void Tick(ScheduledTask task);
|
public abstract void Tick(ScheduledTask task);
|
||||||
|
|
||||||
|
public abstract void SendChat(string text);
|
||||||
|
public abstract void SendPosition(Vector3 pos, float rotY, float headX);
|
||||||
|
public abstract void SendPlayerClick(MouseButton button, bool buttonDown, byte targetId, PickedPos pos);
|
||||||
|
|
||||||
public virtual void Init(Game game) { }
|
public virtual void Init(Game game) { }
|
||||||
public virtual void Ready(Game game) { }
|
public virtual void Ready(Game game) { }
|
||||||
public virtual void OnNewMapLoaded(Game game) { }
|
public virtual void OnNewMapLoaded(Game game) { }
|
||||||
@ -47,22 +33,11 @@ namespace ClassicalSharp {
|
|||||||
public string ServerMotd;
|
public string ServerMotd;
|
||||||
public string AppName = Program.AppName;
|
public string AppName = Program.AppName;
|
||||||
|
|
||||||
/// <summary> Whether the network processor is currently connected to a server. </summary>
|
|
||||||
public bool Disconnected;
|
|
||||||
|
|
||||||
/// <summary> Whether the client should use extended player list management, with group names and ranks. </summary>
|
|
||||||
public bool UsingExtPlayerList;
|
public bool UsingExtPlayerList;
|
||||||
|
|
||||||
/// <summary> Whether the server supports handling PlayerClick packets from the client. </summary>
|
|
||||||
public bool UsingPlayerClick;
|
public bool UsingPlayerClick;
|
||||||
|
|
||||||
/// <summary> Whether the server can handle partial message packets or not. </summary>
|
|
||||||
public bool SupportsPartialMessages;
|
public bool SupportsPartialMessages;
|
||||||
|
|
||||||
/// <summary> Whether the server supports receiving all code page 437 characters from this client. </summary>
|
|
||||||
public bool SupportsFullCP437;
|
public bool SupportsFullCP437;
|
||||||
|
|
||||||
|
|
||||||
protected Game game;
|
protected Game game;
|
||||||
protected int netTicks;
|
protected int netTicks;
|
||||||
|
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Net.Sockets;
|
||||||
using System.IO;
|
using ClassicalSharp.Entities;
|
||||||
using System.Net;
|
using ClassicalSharp.Events;
|
||||||
using System.Net.Sockets;
|
using ClassicalSharp.Network.Protocols;
|
||||||
using ClassicalSharp.Entities;
|
using OpenTK;
|
||||||
using ClassicalSharp.Events;
|
using OpenTK.Input;
|
||||||
using ClassicalSharp.Gui;
|
|
||||||
using ClassicalSharp.Network;
|
|
||||||
using ClassicalSharp.Textures;
|
|
||||||
using ClassicalSharp.Network.Protocols;
|
|
||||||
using BlockID = System.UInt16;
|
using BlockID = System.UInt16;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Input;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Network {
|
namespace ClassicalSharp.Network {
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using ClassicalSharp.Entities;
|
using ClassicalSharp.Entities;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
|
||||||
|
|
||||||
namespace ClassicalSharp {
|
namespace ClassicalSharp {
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -34,8 +34,10 @@ struct VorbisState {
|
|||||||
UInt32 NumBits; /* Number of bits in Bits buffer*/
|
UInt32 NumBits; /* Number of bits in Bits buffer*/
|
||||||
struct Stream* Source; /* Source for filling Input buffer */
|
struct Stream* Source; /* Source for filling Input buffer */
|
||||||
|
|
||||||
UInt8 Channels, ModeNumBits; UInt16 CurBlockSize;
|
UInt8 Channels, ModeNumBits;
|
||||||
|
UInt16 CurBlockSize, DataSize;
|
||||||
Int32 SampleRate; Int32 BlockSizes[2];
|
Int32 SampleRate; Int32 BlockSizes[2];
|
||||||
|
Real32* Values;
|
||||||
|
|
||||||
struct Codebook* Codebooks;
|
struct Codebook* Codebooks;
|
||||||
struct Floor* Floors;
|
struct Floor* Floors;
|
||||||
@ -45,4 +47,5 @@ struct VorbisState {
|
|||||||
};
|
};
|
||||||
void Vorbis_Init(struct VorbisState* state, struct Stream* source);
|
void Vorbis_Init(struct VorbisState* state, struct Stream* source);
|
||||||
ReturnCode Vorbis_DecodeHeaders(struct VorbisState* state);
|
ReturnCode Vorbis_DecodeHeaders(struct VorbisState* state);
|
||||||
|
ReturnCode Vorbis_DecodeFrame(struct VorbisState* state);
|
||||||
#endif
|
#endif
|
||||||
|
@ -306,8 +306,8 @@ void Gfx_SetFogDensity(Real32 value) {
|
|||||||
if (value == d3d9_fogDensity) return;
|
if (value == d3d9_fogDensity) return;
|
||||||
d3d9_fogDensity = value;
|
d3d9_fogDensity = value;
|
||||||
if (Gfx_LostContext) return;
|
if (Gfx_LostContext) return;
|
||||||
IntAndFloat raw; raw.fVal = value;
|
union IntAndFloat raw; raw.f = value;
|
||||||
D3D9_SetRenderState(D3DRS_FOGDENSITY, raw.uVal, "D3D9_SetFogDensity");
|
D3D9_SetRenderState(D3DRS_FOGDENSITY, raw.u, "D3D9_SetFogDensity");
|
||||||
}
|
}
|
||||||
|
|
||||||
Real32 d3d9_fogEnd = -1.0f;
|
Real32 d3d9_fogEnd = -1.0f;
|
||||||
@ -315,8 +315,8 @@ void Gfx_SetFogEnd(Real32 value) {
|
|||||||
if (value == d3d9_fogEnd) return;
|
if (value == d3d9_fogEnd) return;
|
||||||
d3d9_fogEnd = value;
|
d3d9_fogEnd = value;
|
||||||
if (Gfx_LostContext) return;
|
if (Gfx_LostContext) return;
|
||||||
IntAndFloat raw; raw.fVal = value;
|
union IntAndFloat raw; raw.f = value;
|
||||||
D3D9_SetRenderState(D3DRS_FOGEND, raw.uVal, "D3D9_SetFogEnd");
|
D3D9_SetRenderState(D3DRS_FOGEND, raw.u, "D3D9_SetFogEnd");
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DFOGMODE d3d9_fogTableMode = D3DFOG_NONE;
|
D3DFOGMODE d3d9_fogTableMode = D3DFOG_NONE;
|
||||||
@ -636,7 +636,7 @@ static void D3D9_SetDefaultRenderStates(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void D3D9_RestoreRenderStates(void) {
|
static void D3D9_RestoreRenderStates(void) {
|
||||||
IntAndFloat raw;
|
union IntAndFloat raw;
|
||||||
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, d3d9_alphaTest, "D3D9_AlphaTest");
|
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, d3d9_alphaTest, "D3D9_AlphaTest");
|
||||||
D3D9_SetRenderState2(D3DRS_ALPHABLENDENABLE, d3d9_alphaBlend, "D3D9_AlphaBlend");
|
D3D9_SetRenderState2(D3DRS_ALPHABLENDENABLE, d3d9_alphaBlend, "D3D9_AlphaBlend");
|
||||||
D3D9_SetRenderState2(D3DRS_ALPHAFUNC, d3d9_alphaTestFunc, "D3D9_AlphaTestFunc");
|
D3D9_SetRenderState2(D3DRS_ALPHAFUNC, d3d9_alphaTestFunc, "D3D9_AlphaTestFunc");
|
||||||
@ -645,10 +645,10 @@ static void D3D9_RestoreRenderStates(void) {
|
|||||||
D3D9_SetRenderState2(D3DRS_DESTBLEND, d3d9_dstBlendFunc, "D3D9_AlphaDstBlend");
|
D3D9_SetRenderState2(D3DRS_DESTBLEND, d3d9_dstBlendFunc, "D3D9_AlphaDstBlend");
|
||||||
D3D9_SetRenderState2(D3DRS_FOGENABLE, d3d9_fogEnable, "D3D9_Fog");
|
D3D9_SetRenderState2(D3DRS_FOGENABLE, d3d9_fogEnable, "D3D9_Fog");
|
||||||
D3D9_SetRenderState2(D3DRS_FOGCOLOR, d3d9_fogCol, "D3D9_FogColor");
|
D3D9_SetRenderState2(D3DRS_FOGCOLOR, d3d9_fogCol, "D3D9_FogColor");
|
||||||
raw.fVal = d3d9_fogDensity;
|
raw.f = d3d9_fogDensity;
|
||||||
D3D9_SetRenderState2(D3DRS_FOGDENSITY, raw.uVal, "D3D9_FogDensity");
|
D3D9_SetRenderState2(D3DRS_FOGDENSITY, raw.u, "D3D9_FogDensity");
|
||||||
raw.fVal = d3d9_fogEnd;
|
raw.f = d3d9_fogEnd;
|
||||||
D3D9_SetRenderState2(D3DRS_FOGEND, raw.uVal, "D3D9_FogEnd");
|
D3D9_SetRenderState2(D3DRS_FOGEND, raw.u, "D3D9_FogEnd");
|
||||||
D3D9_SetRenderState2(D3DRS_FOGTABLEMODE, d3d9_fogTableMode, "D3D9_FogMode");
|
D3D9_SetRenderState2(D3DRS_FOGTABLEMODE, d3d9_fogTableMode, "D3D9_FogMode");
|
||||||
D3D9_SetRenderState2(D3DRS_ZFUNC, d3d9_depthTestFunc, "D3D9_DepthTestFunc");
|
D3D9_SetRenderState2(D3DRS_ZFUNC, d3d9_depthTestFunc, "D3D9_DepthTestFunc");
|
||||||
D3D9_SetRenderState2(D3DRS_ZENABLE, d3d9_depthTest, "D3D9_DepthTest");
|
D3D9_SetRenderState2(D3DRS_ZENABLE, d3d9_depthTest, "D3D9_DepthTest");
|
||||||
|
@ -822,9 +822,9 @@ static void Cw_WriteBlockDefinitionCompound(struct Stream* stream, BlockID id) {
|
|||||||
|
|
||||||
Nbt_WriteTag(stream, NBT_TAG_INT8, "CollideType");
|
Nbt_WriteTag(stream, NBT_TAG_INT8, "CollideType");
|
||||||
Nbt_WriteU8(stream, Block_Collide[id]);
|
Nbt_WriteU8(stream, Block_Collide[id]);
|
||||||
IntAndFloat speed; speed.fVal = Block_SpeedMultiplier[id];
|
union IntAndFloat speed; speed.f = Block_SpeedMultiplier[id];
|
||||||
Nbt_WriteTag(stream, NBT_TAG_REAL32, "Speed");
|
Nbt_WriteTag(stream, NBT_TAG_REAL32, "Speed");
|
||||||
Nbt_WriteI32(stream, speed.iVal);
|
Nbt_WriteI32(stream, speed.i);
|
||||||
|
|
||||||
Nbt_WriteTag(stream, NBT_TAG_INT8_ARRAY, "Textures");
|
Nbt_WriteTag(stream, NBT_TAG_INT8_ARRAY, "Textures");
|
||||||
Nbt_WriteI32(stream, 6);
|
Nbt_WriteI32(stream, 6);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||||
#define Array_Elems(arr) (sizeof(arr) / sizeof(arr[0]))
|
#define Array_Elems(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||||
typedef union IntAndFloat_ { Real32 fVal; Int32 iVal; UInt32 uVal; } IntAndFloat;
|
union IntAndFloat { Real32 f; Int32 i; UInt32 u; };
|
||||||
|
|
||||||
#define QuickSort_Swap_Maybe()\
|
#define QuickSort_Swap_Maybe()\
|
||||||
if (i <= j) {\
|
if (i <= j) {\
|
||||||
|
@ -29,6 +29,7 @@ int main(void) {
|
|||||||
struct VorbisState state;
|
struct VorbisState state;
|
||||||
Vorbis_Init(&state, &ogg);
|
Vorbis_Init(&state, &ogg);
|
||||||
Vorbis_DecodeHeaders(&state);
|
Vorbis_DecodeHeaders(&state);
|
||||||
|
Vorbis_DecodeFrame(&state);
|
||||||
|
|
||||||
/*Platform_HttpInit();
|
/*Platform_HttpInit();
|
||||||
AsyncRequest req = { 0 };
|
AsyncRequest req = { 0 };
|
||||||
|
@ -65,6 +65,7 @@ void PingList_Update(UInt16 data);
|
|||||||
Int32 PingList_AveragePingMs(void);
|
Int32 PingList_AveragePingMs(void);
|
||||||
|
|
||||||
bool ServerConnection_IsSinglePlayer;
|
bool ServerConnection_IsSinglePlayer;
|
||||||
|
bool ServerConnection_Disconnected;
|
||||||
extern String ServerConnection_ServerName;
|
extern String ServerConnection_ServerName;
|
||||||
extern String ServerConnection_ServerMOTD;
|
extern String ServerConnection_ServerMOTD;
|
||||||
extern String ServerConnection_AppName;
|
extern String ServerConnection_AppName;
|
||||||
@ -77,15 +78,9 @@ void (*ServerConnection_Tick)(struct ScheduledTask* task);
|
|||||||
struct Stream* (*ServerConnection_ReadStream)(void);
|
struct Stream* (*ServerConnection_ReadStream)(void);
|
||||||
struct Stream* (*ServerConnection_WriteStream)(void);
|
struct Stream* (*ServerConnection_WriteStream)(void);
|
||||||
|
|
||||||
/* Whether the network processor is currently disconnected from the server. */
|
|
||||||
bool ServerConnection_Disconnected;
|
|
||||||
/* Whether the client supports extended player list management, with group names and ranks. */
|
|
||||||
bool ServerConnection_SupportsExtPlayerList;
|
bool ServerConnection_SupportsExtPlayerList;
|
||||||
/* Whether the server supports handling PlayerClick packets from the client. */
|
|
||||||
bool ServerConnection_SupportsPlayerClick;
|
bool ServerConnection_SupportsPlayerClick;
|
||||||
/* Whether the server can handle partial message packets or not. */
|
|
||||||
bool ServerConnection_SupportsPartialMessages;
|
bool ServerConnection_SupportsPartialMessages;
|
||||||
/* Whether the server supports receiving all code page 437 characters from this client. */
|
|
||||||
bool ServerConnection_SupportsFullCP437;
|
bool ServerConnection_SupportsFullCP437;
|
||||||
|
|
||||||
void ServerConnection_RetrieveTexturePack(STRING_PURE String* url);
|
void ServerConnection_RetrieveTexturePack(STRING_PURE String* url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user