Beispiel #1
0
    public dbrushside_t[] GetBrushSides()
    {
        lump_t lump = lumps[19];
        dbrushside_t[] brushSides = new dbrushside_t[lump.filelen / 8];
        stream.Position = lump.fileofs;

        for (int i = 0; i < brushSides.Length; i++)
        {
            brushSides[i].planenum = FileReader.readUShort(stream);
            brushSides[i].texinfo = FileReader.readShort(stream);
            brushSides[i].dispinfo = FileReader.readShort(stream);
            brushSides[i].bevel = FileReader.readShort(stream);
        }

        lumpData[19] = brushSides;
        return brushSides;
    }
Beispiel #2
0
    public dbrushside_t[] GetBrushSides()
    {
        lump_t lump = lumps[19];

        dbrushside_t[] brushSides = new dbrushside_t[lump.filelen / 8];
        stream.Position = lump.fileofs;

        for (int i = 0; i < brushSides.Length; i++)
        {
            brushSides[i].planenum = FileReader.readUShort(stream);
            brushSides[i].texinfo  = FileReader.readShort(stream);
            brushSides[i].dispinfo = FileReader.readShort(stream);
            brushSides[i].bevel    = FileReader.readShort(stream);
        }

        lumpData[19] = brushSides;
        return(brushSides);
    }
Beispiel #3
0
        static void LoadBrushes(BinaryReader br, Header header)
        {
            // read brushsides
            br.BaseStream.Seek(header.lumps[19].fileofs, SeekOrigin.Begin);
            int numBrushSides = header.lumps[19].filelen / 8;
            for (int i = 0; i < numBrushSides; i++)
            {
                dbrushside_t brushside = new dbrushside_t();
                brushside.planenum = br.ReadUInt16();

                brushside.plane = world.planes[brushside.planenum];
                if (brushside.planenum == 9)
                {
                    int test = 2;
                }
                brushside.texinfo = br.ReadInt16();
                brushside.dispinfo = br.ReadInt16();
                brushside.bevel = br.ReadInt16();

                world.brushsides.Add(brushside);
            }

            // read brushes
            br.BaseStream.Seek(header.lumps[18].fileofs, SeekOrigin.Begin);
            //brushes = new dbrush_t[];
            int numBrushes = header.lumps[18].filelen / 12;
            for (int i = 0; i < numBrushes; i++)
            {
                dbrush_t brush = new dbrush_t();
                brush.firstside = br.ReadInt32();
                brush.numsides = br.ReadInt32();
                brush.sides = new dbrushside_t[brush.numsides];
                for (int j = 0; j < brush.numsides; j++)
                {
                    brush.sides[j] = world.brushsides[brush.firstside + j];
                }
                brush.contents = (brushflags)br.ReadInt32();
                brush.boundsmin = Vector3.Zero;
                brush.boundsmax = Vector3.Zero;
                brush.boundsmin[0] = -brush.sides[0].plane.dist;
                brush.boundsmax[0] = brush.sides[1].plane.dist;
                brush.boundsmin[1] = -brush.sides[2].plane.dist;
                brush.boundsmax[1] = brush.sides[3].plane.dist;
                brush.boundsmin[2] = -brush.sides[4].plane.dist;
                brush.boundsmax[2] = brush.sides[5].plane.dist;
                world.brushes.Add(brush);
            }
        }
Beispiel #4
0
        void ReadBrushSides(Header header, BinaryReader br)
        {
            // read brushsides
            br.BaseStream.Seek(header.lumps[19].fileofs, SeekOrigin.Begin);
            int numBrushSides = header.lumps[19].filelen / 8;
            for (int i = 0; i < numBrushSides; i++)
            {
                dbrushside_t brushside = new dbrushside_t();
                brushside.planenum = br.ReadUInt16();
                brushside.plane = planes[brushside.planenum];
                brushside.texinfo = br.ReadInt16();
                brushside.dispinfo = br.ReadInt16();
                brushside.bevel = br.ReadInt16();

                brushsides.Add(brushside);
            }
        }
Beispiel #5
0
        /*
        ===================
        CM_InitBoxHull

        Set up the planes and nodes so that the six floats of a bounding box
        can just be stored out and get a proper clipping hull structure.
        ===================
        */
        void InitHullBox()
        {
            //box_planes =

            dbrush_t boxbrush = new dbrush_t();
            boxbrush.numsides = 6;
            boxbrush.contents = brushflags.CONTENTS_PLAYERCLIP;
            brushes.Add(boxbrush);
            box_brush = boxbrush;

            box_model = new cmodel_t();
            box_model.leaf = new dleaf_t();
            box_model.leaf.numleafbrushes = 1;
            box_model.leaf.firstleafbrush = (ushort)leafbrushes.Count;
            leafbrushes.Add(brushes.Count);

            cplane_t[] plan = new cplane_t[6*2];
            for (int i = 0; i < 12; i++)
            {
                plan[i] = new cplane_t();
            }

            dbrushside_t[] sides = new dbrushside_t[6];
            for (int i = 0; i < 6; i++)
            {
                sides[i] = new dbrushside_t();
            }

            int numBrushSides = brushsides.Count;
            for (int i = 0; i < 6; i++)
            {
                int side = i & 1;
                dbrushside_t s = sides[i];
                s.plane = plan[i * 2 + side];

                // planes
                cplane_t p = plan[i * 2];
                p.type = i >> 1;
                p.signbits = 0;
                p.normal = Vector3.Zero;
                p.normal[i >> 1] = 1;

                p = planes[i * 2 + 1];
                p.type = 3 + (i >> 1);
                p.signbits = 0;
                p.normal = Vector3.Zero;
                p.normal[i >> 1] = -1;

                Common.SetPlaneSignbits(p);
            }

            box_planes.AddRange(plan);
            planes.AddRange(plan);
            brushsides.AddRange(sides);
        }