OptionsCi LoadOptions_() { OptionsCi options = new OptionsCi(); Preferences preferences = game.platform.GetPreferences(); options.Shadows = preferences.GetBool("Shadows", true); options.Font = preferences.GetInt("Font", 0); options.DrawDistance = preferences.GetInt("DrawDistance", game.platform.IsFastSystem() ? 128 : 32); options.UseServerTextures = preferences.GetBool("UseServerTextures", true); options.EnableSound = preferences.GetBool("EnableSound", true); options.EnableAutoJump = preferences.GetBool("EnableAutoJump", false); options.ClientLanguage = preferences.GetString("ClientLanguage", ""); options.Framerate = preferences.GetInt("Framerate", 0); options.Resolution = preferences.GetInt("Resolution", 0); options.Fullscreen = preferences.GetBool("Fullscreen", false); options.Smoothshadows = preferences.GetBool("Smoothshadows", true); options.BlockShadowSave = one * preferences.GetInt("BlockShadowSave", 70) / 100; options.EnableBlockShadow = preferences.GetBool("EnableBlockShadow", true); for (int i = 0; i < 256; i++) { string preferencesKey = StringTools.StringAppend(game.platform, "Key", game.platform.IntToString(i)); int value = preferences.GetInt(preferencesKey, 0); if (value != 0) { options.Keys[i] = value; } } return(options); }
void GraphicsSet() { OptionsCi options = game.options; Language language = game.language; graphicsOptionSmoothShadows = new Button(); graphicsOptionSmoothShadows.Text = game.platform.StringFormat(language.OptionSmoothShadows(), options.Smoothshadows ? language.On() : language.Off()); graphicsOptionDarkenSides = new Button(); graphicsOptionDarkenSides.Text = game.platform.StringFormat(language.Get("OptionDarkenSides"), options.EnableBlockShadow ? language.On() : language.Off()); graphicsViewDistanceOption = new Button(); graphicsViewDistanceOption.Text = game.platform.StringFormat(language.ViewDistanceOption(), game.platform.IntToString(game.platform.FloatToInt(game.d_Config3d.viewdistance))); graphicsOptionFramerate = new Button(); graphicsOptionFramerate.Text = game.platform.StringFormat(language.OptionFramerate(), (VsyncString())); graphicsOptionResolution = new Button(); graphicsOptionResolution.Text = game.platform.StringFormat(language.OptionResolution(), (ResolutionString())); graphicsOptionFullscreen = new Button(); graphicsOptionFullscreen.Text = game.platform.StringFormat(language.OptionFullscreen(), options.Fullscreen ? language.On() : language.Off()); graphicsUseServerTexturesOption = new Button(); graphicsUseServerTexturesOption.Text = game.platform.StringFormat(language.UseServerTexturesOption(), (options.UseServerTextures ? language.On() : language.Off())); graphicsFontOption = new Button(); graphicsFontOption.Text = game.platform.StringFormat(language.FontOption(), (FontString())); graphicsReturnToOptionsMenu = new Button(); graphicsReturnToOptionsMenu.Text = language.ReturnToOptionsMenu(); WidgetsClear(); AddWidget(graphicsOptionSmoothShadows); AddWidget(graphicsOptionDarkenSides); AddWidget(graphicsViewDistanceOption); AddWidget(graphicsOptionFramerate); AddWidget(graphicsOptionResolution); AddWidget(graphicsOptionFullscreen); AddWidget(graphicsUseServerTexturesOption); AddWidget(graphicsFontOption); AddWidget(graphicsReturnToOptionsMenu); }
public void LoadOptions() { OptionsCi o = LoadOptions_(); if (o == null) { return; } game.options = o; OptionsCi options = o; game.Font = fontValues[options.Font]; game.UpdateTextRendererFont(); //game.d_CurrentShadows.ShadowsFull = options.Shadows; game.d_Config3d.viewdistance = options.DrawDistance; game.AudioEnabled = options.EnableSound; game.AutoJumpEnabled = options.EnableAutoJump; if (options.ClientLanguage != "") { game.language.OverrideLanguage = options.ClientLanguage; } game.d_TerrainChunkTesselator.EnableSmoothLight = options.Smoothshadows; game.d_TerrainChunkTesselator.BlockShadow = options.BlockShadowSave; game.d_TerrainChunkTesselator.option_DarkenBlockSides = options.EnableBlockShadow; game.ENABLE_LAG = options.Framerate; UseFullscreen(); game.UseVsync(); UseResolution(); }
public void UseResolution() { OptionsCi options = game.options; IntRef resolutionsCount = new IntRef(); DisplayResolutionCi[] resolutions = game.platform.GetDisplayResolutions(resolutionsCount); if (resolutions == null) { return; } if (options.Resolution >= resolutionsCount.value) { options.Resolution = 0; } DisplayResolutionCi res = resolutions[options.Resolution]; if (game.platform.GetWindowState() == WindowState.Fullscreen) { game.platform.ChangeResolution(res.Width, res.Height, res.BitsPerPixel, res.RefreshRate); game.platform.SetWindowState(WindowState.Normal); game.platform.SetWindowState(WindowState.Fullscreen); } else { //d_GlWindow.Width = res.Width; //d_GlWindow.Height = res.Height; } }
void SaveOptions_(OptionsCi options) { Preferences preferences = game.platform.GetPreferences(); preferences.SetBool("Shadows", options.Shadows); preferences.SetInt("Font", options.Font); preferences.SetInt("DrawDistance", options.DrawDistance); preferences.SetBool("UseServerTextures", options.UseServerTextures); preferences.SetBool("EnableSound", options.EnableSound); preferences.SetBool("EnableAutoJump", options.EnableAutoJump); if (options.ClientLanguage != "") { preferences.SetString("ClientLanguage", options.ClientLanguage); } preferences.SetInt("Framerate", options.Framerate); preferences.SetInt("Resolution", options.Resolution); preferences.SetBool("Fullscreen", options.Fullscreen); preferences.SetBool("Smoothshadows", options.Smoothshadows); preferences.SetInt("BlockShadowSave", game.platform.FloatToInt(options.BlockShadowSave * 100)); for (int i = 0; i < 256; i++) { int value = options.Keys[i]; string preferencesKey = StringTools.StringAppend(game.platform, "Key", game.platform.IntToString(i)); if (value != 0) { preferences.SetInt(preferencesKey, value); } else { preferences.Remove(preferencesKey); } } game.platform.SetPreferences(preferences); }
void GraphicsHandleClick(Button b) { OptionsCi options = game.options; if (b == graphicsOptionSmoothShadows) { options.Smoothshadows = !options.Smoothshadows; game.d_TerrainChunkTesselator.EnableSmoothLight = options.Smoothshadows; if (options.Smoothshadows) { options.BlockShadowSave = one * 7 / 10; game.d_TerrainChunkTesselator.BlockShadow = options.BlockShadowSave; } else { options.BlockShadowSave = one * 6 / 10; game.d_TerrainChunkTesselator.BlockShadow = options.BlockShadowSave; } game.RedrawAllBlocks(); } if (b == graphicsOptionDarkenSides) { options.EnableBlockShadow = !options.EnableBlockShadow; game.d_TerrainChunkTesselator.option_DarkenBlockSides = options.EnableBlockShadow; game.RedrawAllBlocks(); } if (b == graphicsViewDistanceOption) { game.ToggleFog(); } if (b == graphicsOptionFramerate) { game.ToggleVsync(); } if (b == graphicsOptionResolution) { ToggleResolution(); } if (b == graphicsOptionFullscreen) { options.Fullscreen = !options.Fullscreen; } if (b == graphicsUseServerTexturesOption) { options.UseServerTextures = !options.UseServerTextures; } if (b == graphicsFontOption) { ToggleFont(); } if (b == graphicsReturnToOptionsMenu) { UseFullscreen(); UseResolution(); SetEscapeMenuState(EscapeMenuState.Options); } }
void ToggleResolution() { OptionsCi options = game.options; options.Resolution++; IntRef resolutionsCount = new IntRef(); game.platform.GetDisplayResolutions(resolutionsCount); if (options.Resolution >= resolutionsCount.value) { options.Resolution = 0; } }
void ToggleFont() { OptionsCi options = game.options; options.Font++; if (options.Font >= fontsLength) { options.Font = 0; } game.Font = fontValues[options.Font]; game.UpdateTextRendererFont(); for (int i = 0; i < game.cachedTextTexturesMax; i++) { game.cachedTextTextures[i] = null; } }
public void SaveOptions() { OptionsCi options = game.options; options.Font = game.Font; options.Shadows = true; // game.d_CurrentShadows.ShadowsFull; options.DrawDistance = game.platform.FloatToInt(game.d_Config3d.viewdistance); options.EnableSound = game.AudioEnabled; options.EnableAutoJump = game.AutoJumpEnabled; if (game.language.OverrideLanguage != null) { options.ClientLanguage = game.language.OverrideLanguage; } options.Framerate = game.ENABLE_LAG; options.Fullscreen = game.platform.GetWindowState() == WindowState.Fullscreen; options.Smoothshadows = game.d_TerrainChunkTesselator.EnableSmoothLight; SaveOptions_(options); }
public Game() { one = 1; map = new Map(); performanceinfo = new DictionaryStringString(); AudioEnabled = true; AutoJumpEnabled = false; playerPositionSpawnX = 15 + one / 2; playerPositionSpawnY = 64; playerPositionSpawnZ = 15 + one / 2; TextureId = new int[MaxBlockTypes][]; for (int i = 0; i < MaxBlockTypes; i++) { TextureId[i] = new int[6]; } TextureIdForInventory = new int[MaxBlockTypes]; language = new Language(); lastplacedblockX = -1; lastplacedblockY = -1; lastplacedblockZ = -1; mLightLevels = new float[16]; sunlight_ = 15; mvMatrix = new StackMatrix4(); pMatrix = new StackMatrix4(); mvMatrix.Push(Mat4.Create()); pMatrix.Push(Mat4.Create()); whitetexture = -1; cachedTextTexturesMax = 1024; cachedTextTextures = new CachedTextTexture[cachedTextTexturesMax]; for (int i = 0; i < cachedTextTexturesMax; i++) { cachedTextTextures[i] = null; } packetLen = new IntRef(); ENABLE_DRAW2D = true; AllowFreemove = true; enableCameraControl = true; textures = new DictionaryStringInt1024(); ServerInfo = new ServerInformation(); menustate = new MenuState(); mouseleftclick = false; mouseleftdeclick = false; wasmouseleft = false; mouserightclick = false; mouserightdeclick = false; wasmouseright = false; ENABLE_LAG = 0; znear = one / 10; CameraMatrix = new GetCameraMatrix(); ENABLE_ZFAR = true; TotalAmmo = new int[GlobalVar.MAX_BLOCKTYPES]; LoadedAmmo = new int[GlobalVar.MAX_BLOCKTYPES]; AllowedFontsCount = 1; AllowedFonts = new string[AllowedFontsCount]; AllowedFonts[0] = "Verdana"; fov = Game.GetPi() / 3; cameratype = CameraType.Fpp; ENABLE_TPP_VIEW = false; basemovespeed = 5; movespeed = 5; RadiusWhenMoving = one * 3 / 10; playervelocity = new Vector3Ref(); LocalPlayerId = -1; dialogs = new VisibleDialog[512]; dialogsCount = 512; blockHealth = new DictionaryVector3Float(); playertexturedefault = -1; a = new AnimationState(); constRotationSpeed = one * 180 / 20; modmanager = new ClientModManager1(); particleEffectBlockBreak = new ModDrawParticleEffectBlockBreak(); PICK_DISTANCE = 4.1f; selectedmodelid = -1; grenadetime = 3; rotationspeed = one * 15 / 100; entities = new Entity[entitiesMax]; for (int i = 0; i < entitiesMax; i++) { entities[i] = null; } entitiesCount = 512; PlayerPushDistance = 2; const int KeysMax = 256; keyboardState = new bool[KeysMax]; for (int i = 0; i < KeysMax; i++) { keyboardState[i] = false; } keyboardStateRaw = new bool[KeysMax]; for (int i = 0; i < KeysMax; i++) { keyboardStateRaw[i] = false; } overheadcameradistance = 10; tppcameradistance = 3; TPP_CAMERA_DISTANCE_MIN = 1; TPP_CAMERA_DISTANCE_MAX = 10; options = new OptionsCi(); overheadcameraK = new Kamera(); fillAreaLimit = 200; speculativeCount = 0; speculative = new Speculative[speculativeMax]; typinglog = new string[1024 * 16]; typinglogCount = 0; NewBlockTypes = new Packet_BlockType[GlobalVar.MAX_BLOCKTYPES]; localplayeranim = new AnimationState(); localplayeranimationhint = new AnimationHint(); enable_move = true; handTexture = -1; modelViewInverted = new float[16]; GLScaleTempVec3 = Vec3.Create(); GLRotateTempVec3 = Vec3.Create(); GLTranslateTempVec3 = Vec3.Create(); identityMatrix = Mat4.Identity_(Mat4.Create()); Set3dProjectionTempMat4 = Mat4.Create(); getAsset = new string[1024 * 2]; PlayerStats = new Packet_ServerPlayerStats(); mLightLevels = new float[16]; for (int i = 0; i < 16; i++) { mLightLevels[i] = one * i / 15; } soundnow = new BoolRef(); camera = Mat4.Create(); packetHandlers = new ClientPacketHandler[256]; player = new Entity(); player.position = new EntityPosition_(); currentlyAttackedEntity = -1; ChatLinesMax = 1; ChatLines = new Chatline[ChatLinesMax]; ChatLineLength = 64; audio = new AudioControl(); CameraEyeX = -1; CameraEyeY = -1; CameraEyeZ = -1; controls = new Controls(); movedz = 0; taskScheduler = new TaskScheduler(); commitActions = ListAction.Create(16 * 1024); constWallDistance = 0.3f; mouseSmoothing = true; }
void SaveOptions_(OptionsCi options) { Preferences preferences = game.platform.GetPreferences(); preferences.SetBool("Shadows", options.Shadows); preferences.SetInt("Font", options.Font); preferences.SetInt("DrawDistance", options.DrawDistance); preferences.SetBool("UseServerTextures", options.UseServerTextures); preferences.SetBool("EnableSound", options.EnableSound); preferences.SetBool("EnableAutoJump", options.EnableAutoJump); if (options.ClientLanguage != "") { preferences.SetString("ClientLanguage", options.ClientLanguage); } preferences.SetInt("Framerate", options.Framerate); preferences.SetInt("Resolution", options.Resolution); preferences.SetBool("Fullscreen", options.Fullscreen); preferences.SetBool("Smoothshadows", options.Smoothshadows); preferences.SetInt("BlockShadowSave", game.platform.FloatToInt(options.BlockShadowSave * 100)); for (int i = 0; i < 256; i++) { int value = options.Keys[i];string preferencesKey = StringTools.StringAppend(game.platform, "Key", game.platform.IntToString(i)); if (value != 0) { preferences.SetInt(preferencesKey, value); } else { preferences.Remove(preferencesKey); } } game.platform.SetPreferences(preferences); }
OptionsCi LoadOptions_() { OptionsCi options = new OptionsCi(); Preferences preferences = game.platform.GetPreferences(); options.Shadows = preferences.GetBool("Shadows", true); options.Font = preferences.GetInt("Font", 0); options.DrawDistance = preferences.GetInt("DrawDistance", game.platform.IsFastSystem() ? 128 : 32); options.UseServerTextures = preferences.GetBool("UseServerTextures", true); options.EnableSound = preferences.GetBool("EnableSound", true); options.EnableAutoJump = preferences.GetBool("EnableAutoJump", false); options.ClientLanguage = preferences.GetString("ClientLanguage", ""); options.Framerate = preferences.GetInt("Framerate", 0); options.Resolution = preferences.GetInt("Resolution", 0); options.Fullscreen = preferences.GetBool("Fullscreen", false); options.Smoothshadows = preferences.GetBool("Smoothshadows", true); options.BlockShadowSave = one * preferences.GetInt("BlockShadowSave", 70) / 100; for (int i = 0; i < 256; i++) { string preferencesKey = StringTools.StringAppend(game.platform, "Key", game.platform.IntToString(i)); int value = preferences.GetInt(preferencesKey, 0); if (value != 0) { options.Keys[i] = value; } } return options; }