Example #1
0
        void HandleSetMapEnvProperty()
        {
            byte     type  = reader.ReadUInt8();
            int      value = reader.ReadInt32();
            WorldEnv env   = game.World.Env;

            Utils.Clamp(ref value, -0xFFFFFF, 0xFFFFFF);
            int maxBlock = BlockInfo.Count - 1;

            switch (type)
            {
            case 0:
                Utils.Clamp(ref value, 0, maxBlock);
                env.SetSidesBlock((BlockID)value); break;

            case 1:
                Utils.Clamp(ref value, 0, maxBlock);
                env.SetEdgeBlock((BlockID)value); break;

            case 2:
                env.SetEdgeLevel(value); break;

            case 3:
                env.SetCloudsLevel(value); break;

            case 4:
                Utils.Clamp(ref value, -0x7FFF, 0x7FFF);
                game.MaxViewDistance = value <= 0 ? 32768 : value;
                game.SetViewDistance(game.UserViewDistance, false); break;

            case 5:
                env.SetCloudsSpeed(value / 256f); break;

            case 6:
                env.SetWeatherSpeed(value / 256f); break;

            case 7:
                Utils.Clamp(ref value, byte.MinValue, byte.MaxValue);
                env.SetWeatherFade(value / 128f); break;

            case 8:
                env.SetExpFog(value != 0); break;

            case 9:
                env.SetSidesOffset(value); break;

            case 10:
                env.SetSkyboxHorSpeed(value / 1024f); break;

            case 11:
                env.SetSkyboxVerSpeed(value / 1024f); break;
            }
        }
Example #2
0
        void HandleSetMapEnvProperty()
        {
            byte     type  = reader.ReadUInt8();
            int      value = reader.ReadInt32();
            WorldEnv env   = game.World.Env;

            Utils.Clamp(ref value, short.MinValue, short.MaxValue);

            switch (type)
            {
            case 0:
                Utils.Clamp(ref value, byte.MinValue, byte.MaxValue);
                env.SetSidesBlock((byte)value); break;

            case 1:
                Utils.Clamp(ref value, byte.MinValue, byte.MaxValue);
                env.SetEdgeBlock((byte)value); break;

            case 2:
                env.SetEdgeLevel(value); break;

            case 3:
                env.SetCloudsLevel(value); break;

            case 4:
                game.MaxViewDistance = value <= 0 ? 32768 : value;
                game.SetViewDistance(game.UserViewDistance, false); break;

            case 5:
                env.SetCloudsSpeed(value / 256f); break;

            case 6:
                env.SetWeatherSpeed(value / 256f); break;

            case 7:
                Utils.Clamp(ref value, byte.MinValue, byte.MaxValue);
                env.SetWeatherFade(value / 128f); break;

            case 8:
                env.SetExpFog(value != 0); break;

            case 9:
                env.SetSidesOffset(value); break;
            }
        }