Exemple #1
0
        protected static void ReadWrite(IReadWriteStream s, ref Dictionary <string, bool> flags)
        {
            if (s.IsWriting)
            {
                s.wInt(flags.Count);
                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c;
                s.rInt(out c);

                flags = new Dictionary <string, bool>(c, StringComparer.Ordinal);
                for (int i = 0; i < c; i++)
                {
                    string t;
                    s.rString(out t);
                    bool b;
                    s.rBool(out b);
                    flags.Add(t, b);
                }
            }
        }
Exemple #2
0
        // Serialize / deserialize (passive: this doesn't record)
        internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
                updateneeded = true;
            }

            base.ReadWrite(s);

            // villsa
            if (s.IsWriting)
            {
                s.wInt(flags.Count);

                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c; s.rInt(out c);

                flags = new Dictionary <string, bool>(c);
                for (int i = 0; i < c; i++)
                {
                    string t; s.rString(out t);
                    bool   b; s.rBool(out b);
                    flags.Add(t, b);
                }
            }

            s.rwInt(ref fixedindex);
            s.rwInt(ref floorheight);
            s.rwInt(ref ceilheight);
            s.rwString(ref floortexname);
            s.rwString(ref ceiltexname);
            s.rwLong(ref longfloortexname);
            s.rwLong(ref longceiltexname);
            s.rwInt(ref effect);
            s.rwInt(ref tag);
            s.rwInt(ref brightness);
            // villsa
            if (General.Map.FormatInterface.InDoom64Mode)
            {
                s.rwLight(ref ceilColor);
                s.rwLight(ref flrColor);
                s.rwLight(ref thingColor);
                s.rwLight(ref topColor);
                s.rwLight(ref lwrColor);
            }
        }
Exemple #3
0
        // Serialize / deserialize
        new internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
            }

            base.ReadWrite(s);

            if (s.IsWriting)
            {
                s.wInt(flags.Count);

                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c; s.rInt(out c);

                flags = new Dictionary <string, bool>(c, StringComparer.Ordinal);
                for (int i = 0; i < c; i++)
                {
                    string t; s.rString(out t);
                    bool   b; s.rBool(out b);
                    flags.Add(t, b);
                }
            }

            s.rwInt(ref type);
            s.rwVector3D(ref pos);
            s.rwInt(ref angledoom);
            s.rwInt(ref pitch);            //mxd
            s.rwInt(ref roll);             //mxd
            s.rwDouble(ref scaleX);        //mxd
            s.rwDouble(ref scaleY);        //mxd
            s.rwInt(ref tag);
            s.rwInt(ref action);
            for (int i = 0; i < NUM_ARGS; i++)
            {
                s.rwInt(ref args[i]);
            }

            if (!s.IsWriting)
            {
                anglerad = Angle2D.DoomToReal(angledoom);
                UpdateCache();                 //mxd
            }
        }
        // Serialize / deserialize
        internal void ReadWrite(IReadWriteStream s)
        {
            if (s.IsWriting)
            {
                s.wInt(islandvertices.Count);
                for (int i = 0; i < islandvertices.Count; i++)
                {
                    s.wInt(islandvertices[i]);
                }

                s.wInt(vertices.Count);
                for (int i = 0; i < vertices.Count; i++)
                {
                    s.wVector2D(vertices[i]);
                }

                s.wInt(sidedefs.Count);
                for (int i = 0; i < sidedefs.Count; i++)
                {
                    if (sidedefs[i] != null)
                    {
                        s.wInt(sidedefs[i].SerializedIndex);
                    }
                    else
                    {
                        s.wInt(-1);
                    }
                }
            }
            else
            {
                int c;

                s.rInt(out c);
                int[] islandverticeslist = new int[c];
                for (int i = 0; i < c; i++)
                {
                    s.rInt(out islandverticeslist[i]);
                }
                islandvertices = Array.AsReadOnly(islandverticeslist);

                s.rInt(out c);
                Vector2D[] verticeslist = new Vector2D[c];
                for (int i = 0; i < c; i++)
                {
                    s.rVector2D(out verticeslist[i]);
                }
                vertices = Array.AsReadOnly(verticeslist);

                s.rInt(out c);
                sidedefindices = new int[c];
                for (int i = 0; i < c; i++)
                {
                    s.rInt(out sidedefindices[i]);
                }
            }
        }
        // Serialize / deserialize (passive: this doesn't record)
        new internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
            }

            base.ReadWrite(s);

            //mxd
            if (s.IsWriting)
            {
                s.wInt(flags.Count);

                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c;
                s.rInt(out c);

                flags = new Dictionary <string, bool>(c, StringComparer.Ordinal);
                for (int i = 0; i < c; i++)
                {
                    string t;
                    s.rString(out t);
                    bool b;
                    s.rBool(out b);
                    flags.Add(t, b);
                }
            }

            s.rwInt(ref offsetx);
            s.rwInt(ref offsety);
            s.rwString(ref texnamehigh);
            s.rwString(ref texnamemid);
            s.rwString(ref texnamelow);
            s.rwLong(ref longtexnamehigh);
            s.rwLong(ref longtexnamemid);
            s.rwLong(ref longtexnamelow);
        }
Exemple #6
0
        // Serialize / deserialize
        internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
            }

            base.ReadWrite(s);

            if (s.IsWriting)
            {
                s.wInt(flags.Count);

                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c; s.rInt(out c);

                flags = new Dictionary <string, bool>(c);
                for (int i = 0; i < c; i++)
                {
                    string t; s.rString(out t);
                    bool   b; s.rBool(out b);
                    flags.Add(t, b);
                }
            }

            s.rwInt(ref type);
            s.rwVector3D(ref pos);
            s.rwFloat(ref angle);
            s.rwInt(ref tag);
            s.rwInt(ref action);
            for (int i = 0; i < NUM_ARGS; i++)
            {
                s.rwInt(ref args[i]);
            }
        }
        // Serialize / deserialize (passive: this doesn't record)
        new internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
                updateneeded = true;
            }

            base.ReadWrite(s);

            //mxd
            if (s.IsWriting)
            {
                s.wInt(flags.Count);

                foreach (KeyValuePair <string, bool> f in flags)
                {
                    s.wString(f.Key);
                    s.wBool(f.Value);
                }
            }
            else
            {
                int c; s.rInt(out c);

                flags = new Dictionary <string, bool>(c, StringComparer.Ordinal);
                for (int i = 0; i < c; i++)
                {
                    string t; s.rString(out t);
                    bool   b; s.rBool(out b);
                    flags.Add(t, b);
                }
            }

            s.rwInt(ref fixedindex);
            s.rwInt(ref floorheight);
            s.rwInt(ref ceilheight);
            s.rwString(ref floortexname);
            s.rwString(ref ceiltexname);
            s.rwLong(ref longfloortexname);
            s.rwLong(ref longceiltexname);
            s.rwInt(ref effect);
            s.rwInt(ref brightness);

            //mxd. (Re)store tags
            if (s.IsWriting)
            {
                s.wInt(tags.Count);
                foreach (int tag in tags)
                {
                    s.wInt(tag);
                }
            }
            else
            {
                int c;
                s.rInt(out c);
                tags = new List <int>(c);
                for (int i = 0; i < c; i++)
                {
                    int t;
                    s.rInt(out t);
                    tags.Add(t);
                }
            }

            //mxd. Slopes
            s.rwFloat(ref flooroffset);
            s.rwVector3D(ref floorslope);
            s.rwFloat(ref ceiloffset);
            s.rwVector3D(ref ceilslope);
        }