Example #1
0
        public void Read(BinaryReader reader, int subtype, PSDLFile parent)
        {
            ushort junctionShorts = 0;

            if (subtype == 0)
            {
                IsJunctionTunnel = true;
                junctionShorts   = reader.ReadUInt16();
            }

            Flags  = (TunnelFlags)reader.ReadUInt16();
            Height = reader.ReadUInt16() / 256f;

            //case for really old (beta1 and below) psdls
            //which don't have the other 2 bytes
            if (subtype != 2)
            {
                Unknown = reader.ReadUInt16();
            }

            if (IsJunctionTunnel)
            {
                JunctionCeilingBits = reader.ReadUInt16();

                var ba = new BitArray(reader.ReadBytes((junctionShorts - 4) * 2));
                for (var i = 0; i < ba.Count; i++)
                {
                    JunctionWalls.Add(ba.Get(i));
                }
            }
        }
Example #2
0
        //Constructors TODO: Create static constructors such as CreateWall CreateTunnel CreateJunctionWall CreateJunctionTunnel, because this is crap
        public TunnelElement(string leftWallTexture, string rightWallTexture, string ceilingTexture, string outerRightTexture, string outerLeftTexture, string undersideTexture, TunnelFlags flags, bool isJunction = false, params bool[] visibleWalls)
        {
            Textures         = new [] { leftWallTexture, rightWallTexture, ceilingTexture, outerRightTexture, outerLeftTexture, undersideTexture };
            IsJunctionTunnel = isJunction;
            Flags            = flags;

            if (isJunction)
            {
                JunctionWalls.AddRange(visibleWalls);
            }
        }