void LoadOptions() { ClassicMode = Options.GetBool("mode-classic", false); ClassicHacks = Options.GetBool(OptionsKey.AllowClassicHacks, false); AllowCustomBlocks = Options.GetBool(OptionsKey.AllowCustomBlocks, true); UseCPE = Options.GetBool(OptionsKey.UseCPE, true); SimpleArmsAnim = Options.GetBool(OptionsKey.SimpleArmsAnim, false); ViewBobbing = Options.GetBool(OptionsKey.ViewBobbing, true); FpsLimitMethod method = Options.GetEnum(OptionsKey.FpsLimit, FpsLimitMethod.LimitVSync); SetFpsLimitMethod(method); ViewDistance = Options.GetInt(OptionsKey.ViewDist, 16, 4096, 512); UserViewDistance = ViewDistance; SmoothLighting = Options.GetBool(OptionsKey.SmoothLighting, false); DefaultFov = Options.GetInt(OptionsKey.FieldOfView, 1, 150, 70); Fov = DefaultFov; ZoomFov = DefaultFov; ModifiableLiquids = !ClassicMode && Options.GetBool(OptionsKey.ModifiableLiquids, false); CameraClipping = Options.GetBool(OptionsKey.CameraClipping, true); AllowServerTextures = Options.GetBool(OptionsKey.AllowServerTextures, true); MouseSensitivity = Options.GetInt(OptionsKey.Sensitivity, 1, 100, 30); ShowBlockInHand = Options.GetBool(OptionsKey.ShowBlockInHand, true); InvertMouse = Options.GetBool(OptionsKey.InvertMouse, false); bool skipSsl = Options.GetBool("skip-ssl-check", false); if (skipSsl) { ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; Options.Set("skip-ssl-check", false); } }
public EntityList(Game game) { this.game = game; game.Events.ChatFontChanged += ChatFontChanged; NamesMode = Options.GetEnum(OptionsKey.NamesMode, NameMode.AllNamesAndHovered); ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None); }
void LoadKeyBindings() { string[] names = KeyBinding.GetNames(typeof(KeyBinding)); for (int i = 0; i < names.Length; i++) { string key = "key-" + names[i]; Key mapping = Options.GetEnum(key, keys[i]); if (!IsReservedKey(mapping)) { keys[i] = mapping; } } }
void LoadKeyBindings() { string[] names = KeyBind.GetNames(typeof(KeyBind)); for (int i = 0; i < names.Length; i++) { string key = "key-" + names[i]; Key mapping = Options.GetEnum(key, keys[i]); if (mapping != Key.Escape) { keys[i] = mapping; } } }
void LoadMouseToKeyMappings() { mapLeft = Options.GetEnum(OptionsKey.MouseLeft, Key.Unknown); mapMiddle = Options.GetEnum(OptionsKey.MouseMiddle, Key.Unknown); mapRight = Options.GetEnum(OptionsKey.MouseRight, Key.Unknown); }
protected override void OnLoad(EventArgs e) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeGraphicsInfo(); Players = new EntityList(this); Options.Load(); AcceptedUrls.Load(); DeniedUrls.Load(); ViewDistance = Options.GetInt(OptionsKey.ViewDist, 16, 4096, 512); UserViewDistance = ViewDistance; CameraClipping = Options.GetBool(OptionsKey.CameraClipping, true); InputHandler = new InputHandler(this); Chat = new ChatLog(this); ParticleManager = new ParticleManager(this); HudScale = Options.GetFloat(OptionsKey.HudScale, 0.25f, 5f, 1f); ChatScale = Options.GetFloat(OptionsKey.ChatScale, 0.35f, 5f, 1f); defaultIb = Graphics.MakeDefaultIb(); MouseSensitivity = Options.GetInt(OptionsKey.Sensitivity, 1, 100, 30); UseClassicGui = Options.GetBool(OptionsKey.UseClassicGui, false); BlockInfo = new BlockInfo(); BlockInfo.Init(); ChatLines = Options.GetInt(OptionsKey.ChatLines, 1, 30, 12); ClickableChat = Options.GetBool(OptionsKey.ClickableChat, true); ModelCache = new ModelCache(this); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader(skinServer); Drawer2D = new GdiPlusDrawer2D(Graphics); Drawer2D.UseBitmappedChat = !Options.GetBool(OptionsKey.ArialChatFont, false); ViewBobbing = Options.GetBool(OptionsKey.ViewBobbing, false); ShowBlockInHand = Options.GetBool(OptionsKey.ShowBlockInHand, true); InvertMouse = Options.GetBool(OptionsKey.InvertMouse, false); SimpleArmsAnim = Options.GetBool(OptionsKey.SimpleArmsAnim, false); TerrainAtlas1D = new TerrainAtlas1D(Graphics); TerrainAtlas = new TerrainAtlas2D(Graphics, Drawer2D); Animations = new Animations(this); defTexturePack = Options.Get(OptionsKey.DefaultTexturePack) ?? "default.zip"; TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract("default.zip", this); // in case the user's default texture pack doesn't have all required textures if (defTexturePack != "default.zip") { extractor.Extract(DefaultTexturePack, this); } Inventory = new Inventory(this); BlockInfo.SetDefaultBlockPermissions(Inventory.CanPlace, Inventory.CanDelete); Map = new Map(this); LocalPlayer = new LocalPlayer(this); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer(this); MapBordersRenderer = new MapBordersRenderer(this); EnvRenderer = new StandardEnvRenderer(this); if (IPAddress == null) { Network = new Singleplayer.SinglePlayerServer(this); } else { Network = new NetworkProcessor(this); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera(this); thirdPersonCam = new ThirdPersonCamera(this); forwardThirdPersonCam = new ForwardThirdPersonCamera(this); Camera = firstPersonCam; FieldOfView = Options.GetInt(OptionsKey.FieldOfView, 1, 150, 70); ZoomFieldOfView = FieldOfView; UpdateProjection(); CommandManager = new CommandManager(); CommandManager.Init(this); SelectionManager = new SelectionManager(this); WeatherRenderer = new WeatherRenderer(this); WeatherRenderer.Init(); BlockHandRenderer = new BlockHandRenderer(this); BlockHandRenderer.Init(); FpsLimitMethod method = Options.GetEnum(OptionsKey.FpsLimit, FpsLimitMethod.LimitVSync); SetFpsLimitMethod(method); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); fpsScreen = new FpsScreen(this); fpsScreen.Init(); hudScreen = new HudScreen(this); hudScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapBordersRenderer.Init(); Picking = new PickingRenderer(this); AudioPlayer = new AudioPlayer(this); LiquidsBreakable = Options.GetBool(OptionsKey.LiquidsBreakable, false); AxisLinesRenderer = new AxisLinesRenderer(this); LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; Graphics.WarnIfNecessary(Chat); SetNewScreen(new LoadingMapScreen(this, connectString, "Waiting for handshake")); Network.Connect(IPAddress, Port); }