Ejemplo n.º 1
0
        public Blood(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.r = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.g = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.b = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.a = NetPacker.ByteToTinyFloat(reader.ReadByte());

            this.size = NetPacker.ShortToSmallFloat(reader.ReadInt16());
            this.flag = NetPacker.SbyteToInt(reader.ReadSByte());

            this.owner    = -1;
            this.Exists   = true;
            this.rotation = GlobalFunctions.GetAngle(new Vector2(), Trajectory);
            this.frame    = Rand.GetRandomFloat(0.3f, 0.7f);
        }
Ejemplo n.º 2
0
 public override void NetWrite(PacketWriter writer)
 {
     writer.Write(NetGame.MSG_PARTICLE);
     writer.Write(Particle.PARTICLE_FOG);
     writer.Write(Background);
     writer.Write(NetPacker.BigFloatToShort(Location.X));
     writer.Write(NetPacker.BigFloatToShort(Location.Y));
 }
Ejemplo n.º 3
0
        public override void NetWrite(PacketWriter writer)
        {
            writer.Write(NetGame.MSG_PARTICLE);
            writer.Write(Particle.PARTICLE_SHOCKWAVE);
            writer.Write(Background);
            writer.Write(NetPacker.BigFloatToShort(Location.X));
            writer.Write(NetPacker.BigFloatToShort(Location.Y));

            writer.Write(NetPacker.MidFloatToShort(size));
            writer.Write(refract);
        }
Ejemplo n.º 4
0
        public override void NetWrite(PacketWriter writer)
        {
            writer.Write(NetGame.MSG_PARTICLE);
            writer.Write(Particle.PARTICLE_HEAT);
            writer.Write(Background);
            writer.Write(NetPacker.BigFloatToShort(Location.X));
            writer.Write(NetPacker.BigFloatToShort(Location.Y));

            writer.Write(NetPacker.BigFloatToShort(Trajectory.X));
            writer.Write(NetPacker.BigFloatToShort(Trajectory.Y));

            writer.Write(NetPacker.SmallFloatToShort(size));
        }
Ejemplo n.º 5
0
        public override void NetWrite(PacketWriter writer)
        {
            writer.Write(NetGame.MSG_PARTICLE);
            writer.Write(Particle.PARTICLE_ROCKET);
            writer.Write(Background);
            writer.Write(NetPacker.BigFloatToShort(Location.X));
            writer.Write(NetPacker.BigFloatToShort(Location.Y));

            writer.Write(NetPacker.BigFloatToShort(Trajectory.X));
            writer.Write(NetPacker.BigFloatToShort(Trajectory.Y));

            writer.Write(NetPacker.IntToSbyte(owner));
        }
Ejemplo n.º 6
0
        public Shockwave(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.size    = NetPacker.ShortToMidFloat(reader.ReadInt16());
            this.refract = reader.ReadBoolean();

            this.owner  = -1;
            this.Exists = true;
            this.frame  = .5f;
        }
Ejemplo n.º 7
0
        public Fog(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory = new Vector2(80f, -30f);
            this.size       = Rand.GetRandomFloat(6f, 8f);
            this.flag       = Rand.GetRandomInt(0, 4);
            this.owner      = -1;
            this.Exists     = true;
            this.frame      = (float)Math.PI * 2f;
            this.additive   = true;
            this.rotation   = Rand.GetRandomFloat(0f, 6.28f);
        }
Ejemplo n.º 8
0
        public Rocket(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.owner = NetPacker.SbyteToInt(reader.ReadSByte());

            this.frame  = 4f;
            this.Exists = true;
        }
Ejemplo n.º 9
0
        public override void NetWrite(PacketWriter writer)
        {
            writer.Write(NetGame.MSG_PARTICLE);
            writer.Write(Particle.PARTICLE_BLOOD);
            writer.Write(Background);
            writer.Write(NetPacker.BigFloatToShort(Location.X));
            writer.Write(NetPacker.BigFloatToShort(Location.Y));

            writer.Write(NetPacker.BigFloatToShort(Trajectory.X));
            writer.Write(NetPacker.BigFloatToShort(Trajectory.Y));

            writer.Write(NetPacker.TinyFloatToByte(r));
            writer.Write(NetPacker.TinyFloatToByte(g));
            writer.Write(NetPacker.TinyFloatToByte(b));
            writer.Write(NetPacker.TinyFloatToByte(a));

            writer.Write(NetPacker.SmallFloatToShort(size));
            writer.Write(NetPacker.IntToSbyte(flag));
        }
Ejemplo n.º 10
0
        public Fire(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.size  = NetPacker.ShortToSmallFloat(reader.ReadInt16());
            this.flag  = NetPacker.SbyteToInt(reader.ReadSByte());
            this.frame = NetPacker.ShortToSmallFloat(reader.ReadInt16());

            this.Exists   = true;
            this.additive = true;
        }
Ejemplo n.º 11
0
        public MuzzleFlash(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.size = NetPacker.ShortToSmallFloat(reader.ReadInt16());

            this.rotation = Rand.GetRandomFloat(0f, 6.28f);
            this.Exists   = true;
            this.frame    = 0.05f;
            this.additive = true;
        }
Ejemplo n.º 12
0
        public void WriteToNet(PacketWriter writer)
        {
            writer.Write(NetGame.MSG_CHARACTER);

            writer.Write(NetPacker.IntToSbyte(charDef.DefID));
            writer.Write(NetPacker.IntToSbyte(Team));
            writer.Write(NetPacker.IntToSbyte(ID));

            writer.Write(NetPacker.BigFloatToShort(Loc.X));
            writer.Write(NetPacker.BigFloatToShort(Loc.Y));

            writer.Write(NetPacker.IntToShort(Anim));
            writer.Write(NetPacker.IntToShort(AnimFrame));
            writer.Write(NetPacker.MidFloatToShort(frame));


            if (State == CharState.Air)
            {
                writer.Write(true);
            }
            else
            {
                writer.Write(false);
            }

            if (Face == CharDir.Right)
            {
                writer.Write(true);
            }
            else
            {
                writer.Write(false);
            }

            writer.Write(NetPacker.BigFloatToShort(Trajectory.X));
            writer.Write(NetPacker.BigFloatToShort(Trajectory.Y));

            writer.Write(KeyRight);
            writer.Write(KeyLeft);

            writer.Write(NetPacker.IntToShort(HP));
        }
Ejemplo n.º 13
0
        public Heat(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.size = NetPacker.ShortToSmallFloat(reader.ReadInt16());

            this.flag     = Rand.GetRandomInt(0, 4);
            this.owner    = -1;
            this.Exists   = true;
            this.rotation = Rand.GetRandomFloat(0f, 6.28f);
            this.frame    = Rand.GetRandomFloat(.5f, .785f);
            this.refract  = true;
        }
Ejemplo n.º 14
0
        public Bullet(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.owner = NetPacker.ShortToInt(reader.ReadInt16());

            this.rotation = GlobalFunctions.GetAngle(new Vector2(),
                                                     Trajectory);
            this.Exists = true;
            this.frame  = 0.5f;

            this.additive = true;
        }
Ejemplo n.º 15
0
        public void ReadFromNet(PacketReader reader)
        {
            Loc.X = NetPacker.ShortToBigFloat(reader.ReadInt16());
            Loc.Y = NetPacker.ShortToBigFloat(reader.ReadInt16());

            Anim      = NetPacker.ShortToInt(reader.ReadInt16());
            AnimFrame = NetPacker.ShortToInt(reader.ReadInt16());
            AnimName  = charDef.GetAnimation(Anim).name;
            frame     = NetPacker.ShortToMidFloat(reader.ReadInt16());

            if (reader.ReadBoolean())
            {
                State = CharState.Air;
            }
            else
            {
                State = CharState.Grounded;
            }

            if (reader.ReadBoolean())
            {
                Face = CharDir.Right;
            }
            else
            {
                Face = CharDir.Left;
            }

            Trajectory.X = NetPacker.ShortToBigFloat(reader.ReadInt16());
            Trajectory.Y = NetPacker.ShortToBigFloat(reader.ReadInt16());

            KeyRight = reader.ReadBoolean();
            KeyLeft  = reader.ReadBoolean();

            HP = NetPacker.ShortToInt(reader.ReadInt16());

            ReceivedNetUpdate = true;
        }
Ejemplo n.º 16
0
        public Smoke(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.r = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.g = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.b = NetPacker.ByteToTinyFloat(reader.ReadByte());
            this.a = NetPacker.ByteToTinyFloat(reader.ReadByte());

            this.size = NetPacker.ShortToSmallFloat(reader.ReadInt16());
            this.flag = NetPacker.SbyteToInt(reader.ReadSByte());

            this.owner  = -1;
            this.Exists = true;
            this.frame  = 1.0f;
        }