Esempio n. 1
0
        void ParseStaticProps(bspgamelump gl)
        {
            int offset = gl.fileofs;

            br.BaseStream.Seek(offset, SeekOrigin.Begin);

            staticPropDictCount = br.ReadInt32();
            staticPropDict      = new string[staticPropDictCount];
            for (int i = 0; i < staticPropDictCount; i++)
            {
                staticPropDict [i] = new string (br.ReadChars(128));
                if (staticPropDict [i].Contains("\0"))
                {
                    staticPropDict [i] = staticPropDict [i].Remove(staticPropDict [i].IndexOf('\0'));
                }
            }

            staticPropLeafCount = br.ReadInt32();
            staticPropLeaves    = new ushort[staticPropLeafCount];
            for (int i = 0; i < staticPropLeafCount; i++)
            {
                staticPropLeaves[i] = br.ReadUInt16();
            }

            StaticPropCount   = br.ReadInt32();
            StaticPropLump    = ReadStaticProps(gl);
            staticPropsReaded = true;
        }
Esempio n. 2
0
        bspStaticPropLump[] ReadStaticProps(bspgamelump gl)
        {
            bspStaticPropLump[] temp = new bspStaticPropLump[StaticPropCount];

            for (int i = 0; i < StaticPropCount; i++)
            {
                bspStaticPropLump prop = new bspStaticPropLump();
                if (gl.version >= 4)
                {
                    //4
                    prop.Origin = ConvertUtils.FlipVector(ConvertUtils.ReadVector3(br)) * uSrcSettings.Inst.worldScale;
                    Vector3 ang = ConvertUtils.ReadVector3(br);
                    prop.Angles   = new Vector3(-ang.z, -ang.y, -ang.x);
                    prop.PropType = (int)br.ReadUInt16();

                    /*prop.FirstLeaf=br.ReadUInt16();
                     * prop.LeafCount=br.ReadUInt16();
                     * prop.Solid=br.ReadChar();
                     * prop.Flags=br.ReadChar();*/
                    br.BaseStream.Seek(6, SeekOrigin.Current);
                    prop.Skin           = br.ReadInt32();
                    prop.FadeMinDist    = br.ReadSingle();
                    prop.FadeMaxDist    = br.ReadSingle();
                    prop.LightingOrigin = ConvertUtils.ReadVector3(br);
                }
                if (gl.version >= 5)
                {
                    prop.ForcedFadeScale = br.ReadSingle();
                    //br.BaseStream.Seek(12,SeekOrigin.Current);
                }
                if (gl.version >= 6 & gl.version < 8)
                {
                    prop.MinDXLevel = br.ReadUInt16();
                    prop.MaxDXLevel = br.ReadUInt16();
                }
                if (gl.version >= 8)
                {
                    prop.minCPULevel       = br.ReadByte();
                    prop.maxCPULevel       = br.ReadByte();
                    prop.minGPULevel       = br.ReadByte();
                    prop.maxGPULevel       = br.ReadByte();
                    prop.diffuseModulation = new Color32(br.ReadByte(), br.ReadByte(), br.ReadByte(), br.ReadByte());
                }
                if (gl.version >= 9)
                {
                    //prop.DisableX360=br.ReadBoolean();
                    br.BaseStream.Seek(4, SeekOrigin.Current);
                }

                temp[i] = prop;
            }

            return(temp);
        }
Esempio n. 3
0
        void ParseGameLumps()
        {
            for (int i = 0; i < gameLumpCount; i++)
            {
                bspgamelump gl = gameLump[i];

                switch (gl.id)
                {
                case SourceBSPStructs.GAMELUMP_STATIC_PROPS:
                    Debug.Log("Static props version is " + gl.version);
                    if (gl.version < 12)                  //12 not released yet
                    {
                        ParseStaticProps(gl);
                    }
                    break;
                }
            }
        }
Esempio n. 4
0
 bspgamelump[] ReadGameLump()
 {
     br.BaseStream.Seek(header.lumps [SourceBSPStructs.LUMP_GAME_LUMP].fileofs, SeekOrigin.Begin);
     gameLumpCount = br.ReadInt32();
     bspgamelump[] temp = new bspgamelump[gameLumpCount];
     for (int i = 0; i < gameLumpCount; i++)
     {
         bspgamelump gamelump = new bspgamelump();
         gamelump.id      = br.ReadInt32();
         gamelump.flags   = br.ReadUInt16();
         gamelump.version = br.ReadUInt16();
         gamelump.fileofs = br.ReadInt32();
         gamelump.filelen = br.ReadInt32();
         temp[i]          = gamelump;
     }
     tempLog += ("Load :" + gameLumpCount + " GameLumps \n");
     return(temp);
 }