Beispiel #1
0
        public static List <SubMesh> CreateLowerWalls(SECTORS sector, LINEDEFS line, WAD wad)            // lowtex
        {
            List <SubMesh> walls = new List <SubMesh>();

            // figure out start and end heights
            SECTORS otherSector = (sector == line.getFrontSector()) ? line.getBackSector() : line.getFrontSector();
            float   startHeight = Math.Min(sector.floorHeight + sector.floorBounds[0] - sector.floorBounds[1], otherSector.floorHeight + otherSector.floorBounds[0] - otherSector.floorBounds[1]);
            float   endHeight   = sector.floorHeight;

            // generate a wall for each textured side
            if (line.getBackSector() == sector && line.side1 != null && wad.textures.ContainsKey(line.side1.lowTex))
            {
                walls.Add(CreateWall(line.getFrontSector(), line, wad.textures[line.side1.lowTex], startHeight, endHeight, false, WallType.Lower));
            }

            if (line.getFrontSector() == sector && line.side2 != null && wad.textures.ContainsKey(line.side2.lowTex))
            {
                walls.Add(CreateWall(line.getBackSector(), line, wad.textures[line.side2.lowTex], startHeight, endHeight, true, WallType.Lower));
            }

            return(walls);
        }
Beispiel #2
0
        public static List <SubMesh> CreateUpperWalls(SECTORS sector, LINEDEFS line, WAD wad)            // uppertex
        {
            List <SubMesh> walls = new List <SubMesh>();

            SECTORS otherSector = (sector == line.getFrontSector()) ? line.getBackSector() : line.getFrontSector();

            // figure out how much extra height we have to add to a moving ceiling
            float[] addMovementHeight = new float[2];
            addMovementHeight[0] = Math.Min(Math.Min(sector.ceilingHeight, otherSector.ceilingHeight), sector.ceilingBounds[0]);
            addMovementHeight[1] = Math.Max(Math.Max(sector.ceilingHeight, otherSector.ceilingHeight), sector.ceilingBounds[1]);

            // figure out start and end heights
            float startHeight = sector.ceilingHeight;
            float endHeight   = Math.Max(otherSector.ceilingHeight, sector.ceilingHeight + (addMovementHeight[1] - addMovementHeight[0]));

            // this is an ugly hack in order to get DOOM2 MAP31 to have correct doors:
            bool backSectorDoor = line.getBackSector() != null && line.getBackSector().isMovingCeiling;

            // generate a wall for each textured side
            if (line.getBackSector() == sector && line.side1 != null && wad.textures.ContainsKey(line.side1.upTex))
            {
                walls.Add(CreateWall(line.getFrontSector(), line, wad.textures[line.side1.upTex], startHeight, endHeight, false, WallType.Upper));
            }

            if (line.getFrontSector() == sector && line.side2 != null && wad.textures.ContainsKey(line.side2.upTex) && !backSectorDoor)
            {
                walls.Add(CreateWall(line.getBackSector(), line, wad.textures[line.side2.upTex], startHeight, endHeight, true, WallType.Upper));
            }

            // generate skybox hole textures
            if (line.getFrontSector() == sector && line.side1 != null && !wad.textures.ContainsKey(line.side1.upTex))
            {
                if (line.getFrontSector().ceilingFlat.StartsWith("F_SKY") && line.getBackSector().ceilingFlat.StartsWith("F_SKY"))
                {
                    Material texture = wad.flats[sector.ceilingFlat];
                    walls.Add(CreateWall(line.getFrontSector(), line, texture, startHeight, endHeight, false, WallType.Upper));
                }
            }

            return(walls);
        }
Beispiel #3
0
        public static List <SubMesh> CreateMidWalls(SECTORS sector, LINEDEFS line, WAD wad)            // midtex
        {
            float startHeight = 0;
            float endHeight   = 0;

            // figure out start and end heights
            if (line.getFrontSector() != null && line.getBackSector() != null)
            {
                startHeight = Math.Max(line.getFrontSector().floorHeight, line.getBackSector().floorHeight);
                endHeight   = Math.Min(line.getFrontSector().ceilingHeight, line.getBackSector().ceilingHeight);
            }
            else if (line.getFrontSector() != null && line.getBackSector() == null)
            {
                SECTORS fSector = line.getFrontSector();
                startHeight = fSector.floorHeight;
                endHeight   = fSector.ceilingHeight;

                if (fSector.isMovingCeiling)
                {
                    endHeight = fSector.ceilingBounds[1];
                }

                if (fSector.isMovingFloor)
                {
                    startHeight = Math.Min(startHeight, fSector.floorBounds[0]);
                    endHeight   = Math.Max(endHeight, fSector.floorBounds[1]);
                }
            }
            else if (line.getFrontSector() == null && line.getBackSector() != null)
            {
                startHeight = line.getBackSector().floorHeight;
                endHeight   = line.getBackSector().ceilingHeight;
            }

            // generate a wall for each textured side
            List <SubMesh> walls = new List <SubMesh>();

            if (line.getFrontSector() == sector && line.side1 != null && wad.textures.ContainsKey(line.side1.midTex))
            {
                Material texture = wad.textures[line.side1.midTex];

                if (line.getFrontSector() != null && line.getBackSector() != null)
                {
                    endHeight = Math.Min(startHeight + texture.mainTexture.height, endHeight);  //dont tile middle textures with 2 sides
                }
                walls.Add(CreateWall(line.getFrontSector(), line, texture, startHeight, endHeight, false, WallType.Middle));
            }

            if (line.getBackSector() == sector && line.side2 != null && wad.textures.ContainsKey(line.side2.midTex))
            {
                Material texture = wad.textures[line.side2.midTex];

                if (line.getFrontSector() != null && line.getBackSector() != null)
                {
                    endHeight = Math.Min(startHeight + texture.mainTexture.height, endHeight);  //dont tile middle textures with 2 sides
                }
                walls.Add(CreateWall(line.getBackSector(), line, texture, startHeight, endHeight, true, WallType.Middle));
            }

            // generate skybox hole textures
            if (line.getFrontSector() == sector && line.side1 != null && !wad.textures.ContainsKey(line.side1.midTex) && sector.ceilingFlat.StartsWith("F_SKY"))
            {
                SECTORS bSector = line.getBackSector();
                if (bSector == null || (bSector.floorHeight == bSector.ceilingHeight && !bSector.isMovingCeiling && !bSector.isMovingFloor))
                {
                    Material texture = wad.flats[sector.ceilingFlat];
                    startHeight = line.getFrontSector().floorHeight;
                    endHeight   = line.getFrontSector().ceilingHeight;
                    walls.Add(CreateWall(line.getFrontSector(), line, texture, startHeight, endHeight, false, WallType.Middle));
                }
            }

            return(walls);
        }