Exemple #1
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.rwFloat(ref scaleX);         //mxd
            s.rwFloat(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
            }
        }
Exemple #2
0
        // Serialize / deserialize
        internal void ReadWrite(IReadWriteStream s)
        {
            s.rwInt(ref type);
            switch ((UniversalType)type)
            {
            case UniversalType.AngleRadians:
            case UniversalType.AngleDegreesFloat:
            case UniversalType.Float:
            {
                float v = 0.0f;
                try { v = (float)value; } catch (NullReferenceException e) { }
                s.rwFloat(ref v);
                value = v;
                break;
            }

            case UniversalType.AngleDegrees:
            case UniversalType.Color:
            case UniversalType.EnumBits:
            case UniversalType.EnumOption:
            case UniversalType.Integer:
            case UniversalType.LinedefTag:
            case UniversalType.LinedefType:
            case UniversalType.SectorEffect:
            case UniversalType.SectorTag:
            case UniversalType.ThingTag:
            case UniversalType.PortalTag:
            {
                int v = 0;
                try { v = (int)value; } catch (NullReferenceException e) { }
                s.rwInt(ref v);
                value = v;
                break;
            }

            case UniversalType.Boolean:
            {
                bool v = false;
                try { v = (bool)value; } catch (NullReferenceException e) { }
                s.rwBool(ref v);
                value = v;
                break;
            }

            case UniversalType.Flat:
            case UniversalType.String:
            case UniversalType.Texture:
            case UniversalType.EnumStrings:
            {
                string v = (string)value;
                s.rwString(ref v);
                value = v;
                break;
            }

            default:
                General.Fail("Unknown field type to read/write!");
                break;
            }
        }
Exemple #3
0
        // Serialize / deserialize
        internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
            }

            ReadWrite(s, ref flags);

            s.rwVector3D(ref pos);
            s.rwInt(ref tileindex);
            s.rwInt(ref shade);
            s.rwInt(ref paletteindex);
            s.rwInt(ref clipdistance);
            s.rwInt(ref repeatx);
            s.rwInt(ref repeaty);
            s.rwInt(ref offsetx);
            s.rwInt(ref offsety);
            s.rwInt(ref status);
            s.rwFloat(ref anglerad);

            s.rwInt(ref owner);
            s.rwVector3D(ref vel);

            s.rwInt(ref hitag);
            s.rwInt(ref lotag);
            s.rwInt(ref extra);

            //if(!s.IsWriting) anglerad = Angle2D.BuildToReal(anglebuild);
        }
        // Serialize / deserialize
        new internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
            }

            base.ReadWrite(s);

            s.rwVector2D(ref pos);
            s.rwFloat(ref zceiling);           //mxd
            s.rwFloat(ref zfloor);             //mxd

            if (s.IsWriting)
            {
                // Let all lines know they need an update
                foreach (Linedef l in linedefs)
                {
                    l.NeedUpdate();
                }
            }
        }
Exemple #5
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);
        }
Exemple #7
0
        // Serialize / deserialize (passive: this doesn't record)
        internal void ReadWrite(IReadWriteStream s)
        {
            if (!s.IsWriting)
            {
                BeforePropsChange();
                updateneeded             = true;
                ceilingplaneupdateneeded = true;
                floorplaneupdateneeded   = true;
            }

            ReadWrite(s, ref floorflags);
            ReadWrite(s, ref ceilingflags);

            if (s.IsWriting)
            {
                int firstwallindex = (firstwall == null ? -1 : firstwall.Index);
                s.rwInt(ref firstwallindex);
            }
            else
            {
                int firstwallindex = -1;
                s.rwInt(ref firstwallindex);

                if (firstwallindex != -1)
                {
                    foreach (var wall in sidedefs)
                    {
                        if (wall.Index == firstwallindex)
                        {
                            firstwall = wall;
                            break;
                        }
                    }

                    if (firstwall == null)
                    {
                        throw new Exception("Failed to restore FirstWall!");
                    }
                }
            }

            s.rwInt(ref ceilingheight);
            s.rwInt(ref floorheight);

            s.rwInt(ref ceilingtileindex);
            s.rwFloat(ref ceilingslope);
            s.rwInt(ref ceilingshade);
            s.rwInt(ref ceilingpaletteindex);
            s.rwInt(ref ceilingoffsetx);
            s.rwInt(ref ceilingoffsety);

            s.rwInt(ref floortileindex);
            s.rwFloat(ref floorslope);
            s.rwInt(ref floorshade);
            s.rwInt(ref floorpaletteindex);
            s.rwInt(ref flooroffsetx);
            s.rwInt(ref flooroffsety);

            s.rwInt(ref visibility);

            s.rwInt(ref hitag);
            s.rwInt(ref lotag);
            s.rwInt(ref extra);
        }