예제 #1
0
 /// <summary>
 /// Applies parameters read from a ThemeSector.
 /// </summary>
 /// <param name="theme">The map theme</param>
 /// <param name="themeSector">Type of ThemeSector to copy parameters from</param>
 private void ApplySectorSpecial(PreferencesTheme theme, ThemeSector themeSector)
 {
     CeilingHeight = theme.Height[(int)themeSector][1];
     FloorHeight   = theme.Height[(int)themeSector][0];
     LightLevel    = theme.LightLevel[(int)themeSector];
     SectorSpecial = theme.SectorSpecial[(int)themeSector];
 }
예제 #2
0
        /// <summary>
        /// Selects the proper theme from the PNG's upper-leftmost pixel, and picks random textures.
        /// </summary>
        /// <param name="bitmap">The PNG image</param>
        private void CreateTheme(Bitmap bitmap)
        {
            Theme = Preferences.GetTheme(bitmap.GetPixel(0, 0));
            bitmap.SetPixel(0, 0, Color.White);
            ThemeTextures = new string[PreferencesTheme.THEME_TEXTURES_COUNT];

            for (int i = 0; i < PreferencesTheme.THEME_TEXTURES_COUNT; i++)
            {
                ThemeTextures[i] = Toolbox.RandomFromArray(Theme.Textures[i]);
            }
        }
예제 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="type">Type of sector</param>
        /// <param name="theme">Map theme</param>
        /// <param name="themeTextures">Selected "default" textures for this map</param>
        public SectorInfo(TileType type, PreferencesTheme theme, string[] themeTextures)
        {
            Type = type;

            FloorHeight    = theme.Height[(int)ThemeSector.Default][0];
            CeilingHeight  = theme.Height[(int)ThemeSector.Default][1];
            LinedefSpecial = 0;
            SectorSpecial  = 0;

            LightLevel = theme.LightLevel[(int)ThemeSector.Default];

            CeilingTexture   = themeTextures[(int)ThemeTexture.Ceiling];
            FloorTexture     = themeTextures[(int)ThemeTexture.Floor];
            WallTexture      = Toolbox.RandomFromArray(theme.Textures[(int)ThemeTexture.Wall]);
            WallTextureUpper = null;
            WallTextureLower = null;

            switch (type)
            {
            case TileType.Door:
                CeilingHeight    = FloorHeight;
                LinedefSpecial   = 1;   // DR Door Open Wait Close
                CeilingTexture   = "CRATOP1";
                WallTexture      = "DOORTRAK";
                WallTextureUpper = themeTextures[(int)ThemeTexture.Door];
                break;

            case TileType.DoorSide:
                WallTexture = themeTextures[(int)ThemeTexture.DoorSide];
                break;

            case TileType.Entrance:
                ApplySectorSpecial(theme, ThemeSector.Entrance);
                FloorTexture = themeTextures[(int)ThemeTexture.FloorEntrance];
                break;

            case TileType.Exit:
                ApplySectorSpecial(theme, ThemeSector.Exit);
                LinedefSpecial = 52;     // W1 Exit Level
                FloorTexture   = themeTextures[(int)ThemeTexture.FloorExit];
                break;

            case TileType.RoomExterior:
                ApplySectorSpecial(theme, ThemeSector.Exterior);
                CeilingTexture = "F_SKY1";
                if (theme.Textures[(int)ThemeTexture.FloorExterior].Length > 0)
                {
                    FloorTexture = themeTextures[(int)ThemeTexture.FloorExterior];
                }
                if (theme.Textures[(int)ThemeTexture.WallExterior].Length > 0)
                {
                    WallTexture = Toolbox.RandomFromArray(theme.Textures[(int)ThemeTexture.WallExterior]);
                }
                break;

            case TileType.RoomSpecialCeiling:
                ApplySectorSpecial(theme, ThemeSector.SpecialCeiling);
                CeilingTexture = themeTextures[(int)ThemeTexture.CeilingSpecial];
                break;

            case TileType.RoomSpecialFloor:
                ApplySectorSpecial(theme, ThemeSector.SpecialFloor);
                FloorTexture = themeTextures[(int)ThemeTexture.FloorSpecial];
                break;

            case TileType.Secret:
                CeilingHeight  = FloorHeight;
                LinedefSpecial = 31;   // D1 Door Open Stay
                SectorSpecial  = 9;    // Secret room
                WallTexture    = "DOORTRAK";
                break;
            }

            CeilingHeight = Math.Max(FloorHeight, CeilingHeight);

            WallTextureUpper = WallTextureUpper ?? WallTexture;
            WallTextureLower = WallTextureLower ?? WallTexture;
        }