Esempio n. 1
0
        public static void SV_ReadPackets( )
        {
            Int32    i;
            client_t cl;
            var      qport = 0;

            while (NET.GetPacket(Defines.NS_SERVER, Globals.net_from, Globals.net_message))
            {
                if ((Globals.net_message.data[0] == -1) && (Globals.net_message.data[1] == -1) && (Globals.net_message.data[2] == -1) && (Globals.net_message.data[3] == -1))
                {
                    SV_ConnectionlessPacket();
                    continue;
                }

                MSG.BeginReading(Globals.net_message);
                MSG.ReadLong(Globals.net_message);
                MSG.ReadLong(Globals.net_message);
                qport = MSG.ReadShort(Globals.net_message) & 0xffff;
                for (i = 0; i < SV_MAIN.maxclients.value; i++)
                {
                    cl = SV_INIT.svs.clients[i];
                    if (cl.state == Defines.cs_free)
                    {
                        continue;
                    }
                    if (!NET.CompareBaseAdr(Globals.net_from, cl.netchan.remote_address))
                    {
                        continue;
                    }
                    if (cl.netchan.qport != qport)
                    {
                        continue;
                    }
                    if (cl.netchan.remote_address.port != Globals.net_from.port)
                    {
                        Com.Printf("SV_ReadPackets: fixing up a translated port\\n");
                        cl.netchan.remote_address.port = Globals.net_from.port;
                    }

                    if (Netchan.Process(cl.netchan, Globals.net_message))
                    {
                        if (cl.state != Defines.cs_zombie)
                        {
                            cl.lastmessage = SV_INIT.svs.realtime;
                            SV_USER.SV_ExecuteClientMessage(cl);
                        }
                    }

                    break;
                }

                if (i != SV_MAIN.maxclients.value)
                {
                    continue;
                }
            }
        }
Esempio n. 2
0
        /*
         * ================ CL_ParseInventory ================
         */
        public static void ParseInventory()
        {
            int i;

            for (i = 0; i < Defines.MAX_ITEMS; i++)
            {
                Globals.cl.inventory[i] = MSG.ReadShort(Globals.net_message);
            }
        }
Esempio n. 3
0
        public static void ParseConfigString( )
        {
            Int32 i = MSG.ReadShort(Globals.net_message);

            if (i < 0 || i >= Defines.MAX_CONFIGSTRINGS)
            {
                Com.Error(Defines.ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
            }
            var s    = MSG.ReadString(Globals.net_message);
            var olds = Globals.cl.configstrings[i];

            Globals.cl.configstrings[i] = s;
            if (i >= Defines.CS_LIGHTS && i < Defines.CS_LIGHTS + Defines.MAX_LIGHTSTYLES)
            {
                CL_fx.SetLightstyle(i - Defines.CS_LIGHTS);
            }
            else if (i >= Defines.CS_MODELS && i < Defines.CS_MODELS + Defines.MAX_MODELS)
            {
                if (Globals.cl.refresh_prepped)
                {
                    Globals.cl.model_draw[i - Defines.CS_MODELS] = Globals.re.RegisterModel(Globals.cl.configstrings[i]);
                    if (Globals.cl.configstrings[i].StartsWith("*"))
                    {
                        Globals.cl.model_clip[i - Defines.CS_MODELS] = CM.InlineModel(Globals.cl.configstrings[i]);
                    }
                    else
                    {
                        Globals.cl.model_clip[i - Defines.CS_MODELS] = null;
                    }
                }
            }
            else if (i >= Defines.CS_SOUNDS && i < Defines.CS_SOUNDS + Defines.MAX_MODELS)
            {
                if (Globals.cl.refresh_prepped)
                {
                    Globals.cl.sound_precache[i - Defines.CS_SOUNDS] = S.RegisterSound(Globals.cl.configstrings[i]);
                }
            }
            else if (i >= Defines.CS_IMAGES && i < Defines.CS_IMAGES + Defines.MAX_MODELS)
            {
                if (Globals.cl.refresh_prepped)
                {
                    Globals.cl.image_precache[i - Defines.CS_IMAGES] = Globals.re.RegisterPic(Globals.cl.configstrings[i]);
                }
            }
            else if (i >= Defines.CS_PLAYERSKINS && i < Defines.CS_PLAYERSKINS + Defines.MAX_CLIENTS)
            {
                if (Globals.cl.refresh_prepped && !olds.Equals(s))
                {
                    ParseClientinfo(i - Defines.CS_PLAYERSKINS);
                }
            }
        }
Esempio n. 4
0
        public static Int32 ParseEntityBits(Int32[] bits)
        {
            Int32 b, total;
            Int32 i;
            Int32 number;

            total = MSG.ReadByte(Globals.net_message);
            if ((total & Defines.U_MOREBITS1) != 0)
            {
                b      = MSG.ReadByte(Globals.net_message);
                total |= b << 8;
            }

            if ((total & Defines.U_MOREBITS2) != 0)
            {
                b      = MSG.ReadByte(Globals.net_message);
                total |= b << 16;
            }

            if ((total & Defines.U_MOREBITS3) != 0)
            {
                b      = MSG.ReadByte(Globals.net_message);
                total |= b << 24;
            }

            for (i = 0; i < 32; i++)
            {
                if ((total & (1 << i)) != 0)
                {
                    bitcounts[i]++;
                }
            }
            if ((total & Defines.U_NUMBER16) != 0)
            {
                number = MSG.ReadShort(Globals.net_message);
            }
            else
            {
                number = MSG.ReadByte(Globals.net_message);
            }
            bits[0] = total;
            return(number);
        }
Esempio n. 5
0
        public static void ParseServerData( )
        {
            Com.DPrintf("ParseServerData():Serverdata packet received.\\n");
            CL.ClearState();
            Globals.cls.state = Defines.ca_connected;
            var i = MSG.ReadLong(Globals.net_message);

            Globals.cls.serverProtocol = i;
            if (Globals.server_state != 0 && Defines.PROTOCOL_VERSION == 34)
            {
            }
            else if (i != Defines.PROTOCOL_VERSION)
            {
                Com.Error(Defines.ERR_DROP, "Server returned version " + i + ", not " + Defines.PROTOCOL_VERSION);
            }
            Globals.cl.servercount = MSG.ReadLong(Globals.net_message);
            Globals.cl.attractloop = MSG.ReadByte(Globals.net_message) != 0;
            var str = MSG.ReadString(Globals.net_message);

            Globals.cl.gamedir = str;
            Com.Dprintln("gamedir=" + str);
            if (str.Length > 0 && (FS.fs_gamedirvar.string_renamed == null || FS.fs_gamedirvar.string_renamed.Length == 0 || FS.fs_gamedirvar.string_renamed.Equals(str)) || (str.Length == 0 && (FS.fs_gamedirvar.string_renamed != null || FS.fs_gamedirvar.string_renamed.Length == 0)))
            {
                Cvar.Set("game", str);
            }
            Globals.cl.playernum = MSG.ReadShort(Globals.net_message);
            Com.Dprintln("numplayers=" + Globals.cl.playernum);
            str = MSG.ReadString(Globals.net_message);
            Com.Dprintln("levelname=" + str);
            if (Globals.cl.playernum == -1)
            {
                SCR.PlayCinematic(str);
            }
            else
            {
                Com.Printf("Levelname:" + str + "\\n");
                Globals.cl.refresh_prepped = false;
            }
        }
Esempio n. 6
0
        public static void ParseStartSoundPacket( )
        {
            var    flags     = MSG.ReadByte(Globals.net_message);
            var    sound_num = MSG.ReadByte(Globals.net_message);
            Single volume;

            if ((flags & Defines.SND_VOLUME) != 0)
            {
                volume = MSG.ReadByte(Globals.net_message) / 255F;
            }
            else
            {
                volume = Defines.DEFAULT_SOUND_PACKET_VOLUME;
            }
            Single attenuation;

            if ((flags & Defines.SND_ATTENUATION) != 0)
            {
                attenuation = MSG.ReadByte(Globals.net_message) / 64F;
            }
            else
            {
                attenuation = Defines.DEFAULT_SOUND_PACKET_ATTENUATION;
            }
            Single ofs;

            if ((flags & Defines.SND_OFFSET) != 0)
            {
                ofs = MSG.ReadByte(Globals.net_message) / 1000F;
            }
            else
            {
                ofs = 0;
            }
            Int32 channel;
            Int32 ent;

            if ((flags & Defines.SND_ENT) != 0)
            {
                channel = MSG.ReadShort(Globals.net_message);
                ent     = channel >> 3;
                if (ent > Defines.MAX_EDICTS)
                {
                    Com.Error(Defines.ERR_DROP, "CL_ParseStartSoundPacket: ent = " + ent);
                }
                channel &= 7;
            }
            else
            {
                ent     = 0;
                channel = 0;
            }

            Single[] pos;
            if ((flags & Defines.SND_POS) != 0)
            {
                MSG.ReadPos(Globals.net_message, pos_v);
                pos = pos_v;
            }
            else
            {
                pos = null;
            }
            if (null == Globals.cl.sound_precache[sound_num])
            {
                return;
            }
            S.StartSound(pos, ent, channel, Globals.cl.sound_precache[sound_num], volume, attenuation, ofs);
        }
Esempio n. 7
0
        public static void ParseDownload( )
        {
            Int32 size    = MSG.ReadShort(Globals.net_message);
            var   percent = MSG.ReadByte(Globals.net_message);

            if (size == -1)
            {
                Com.Printf("Server does not have this file.\\n");
                if (Globals.cls.download != null)
                {
                    try
                    {
                        Globals.cls.download.Close();
                    }
                    catch (IOException e)
                    {
                    }

                    Globals.cls.download = null;
                }

                CL.RequestNextDownload();
                return;
            }

            if (Globals.cls.download == null)
            {
                var name = DownloadFileName(Globals.cls.downloadtempname).ToLower();
                FS.CreatePath(name);
                Globals.cls.download = new QuakeFile(name, FileAccess.ReadWrite);
                if (Globals.cls.download == null)
                {
                    Globals.net_message.readcount += size;
                    Com.Printf("Failed to open " + Globals.cls.downloadtempname + "\\n");
                    CL.RequestNextDownload();
                    return;
                }
            }

            try
            {
                Globals.cls.download.Write(Globals.net_message.data, Globals.net_message.readcount, size);
            }
            catch (Exception e)
            {
            }

            Globals.net_message.readcount += size;
            if (percent != 100)
            {
                Globals.cls.downloadpercent = percent;
                MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
                SZ.Print(Globals.cls.netchan.message, "nextdl");
            }
            else
            {
                try
                {
                    Globals.cls.download.Close();
                }
                catch (IOException e)
                {
                }

                var oldn = DownloadFileName(Globals.cls.downloadtempname);
                var newn = DownloadFileName(Globals.cls.downloadname);
                var r    = Lib.Rename(oldn, newn);
                if (r != 0)
                {
                    Com.Printf("failed to rename.\\n");
                }
                Globals.cls.download        = null;
                Globals.cls.downloadpercent = 0;
                CL.RequestNextDownload();
            }
        }
Esempio n. 8
0
        /**
         * Reads packets from the network or loopback.
         */
        public static void SV_ReadPackets()
        {
            int      i;
            client_t cl;
            var      qport = 0;

            while (NET.GetPacket(Defines.NS_SERVER, Globals.net_from, Globals.net_message))
            {
                // check for connectionless packet (0xffffffff) first
                if (Globals.net_message.data[0] == 255 &&
                    Globals.net_message.data[1] == 255 &&
                    Globals.net_message.data[2] == 255 &&
                    Globals.net_message.data[3] == 255)
                {
                    SV_MAIN.SV_ConnectionlessPacket();

                    continue;
                }

                // read the qport out of the message so we can fix up
                // stupid address translating routers
                MSG.BeginReading(Globals.net_message);
                MSG.ReadLong(Globals.net_message);                 // sequence number
                MSG.ReadLong(Globals.net_message);                 // sequence number
                qport = MSG.ReadShort(Globals.net_message) & 0xffff;

                // check for packets from connected clients
                for (i = 0; i < SV_MAIN.maxclients.value; i++)
                {
                    cl = SV_INIT.svs.clients[i];

                    if (cl.state == Defines.cs_free)
                    {
                        continue;
                    }

                    if (!NET.CompareBaseAdr(Globals.net_from, cl.netchan.remote_address))
                    {
                        continue;
                    }

                    if (cl.netchan.qport != qport)
                    {
                        continue;
                    }

                    if (cl.netchan.remote_address.port != Globals.net_from.port)
                    {
                        Com.Printf("SV_ReadPackets: fixing up a translated port\n");
                        cl.netchan.remote_address.port = Globals.net_from.port;
                    }

                    if (Netchan.Process(cl.netchan, Globals.net_message))
                    {
                        // this is a valid, sequenced packet, so process it
                        if (cl.state != Defines.cs_zombie)
                        {
                            cl.lastmessage = SV_INIT.svs.realtime;                             // don't timeout
                            SV_USER.SV_ExecuteClientMessage(cl);
                        }
                    }

                    break;
                }

                if (i != SV_MAIN.maxclients.value)
                {
                    continue;
                }
            }
        }
Esempio n. 9
0
        /*
         * =====================================================================
         *
         * SERVER CONNECTING MESSAGES
         *
         * =====================================================================
         */

        /*
         * ================== CL_ParseServerData ==================
         */
        //checked once, was ok.
        public static void ParseServerData()
        {
            Com.DPrintf("ParseServerData():Serverdata packet received.\n");

            //
            //	   wipe the client_state_t struct
            //
            Cl.ClearState();
            Globals.cls.state = Defines.ca_connected;

            //	   parse protocol version number
            var i = MSG.ReadLong(Globals.net_message);

            Globals.cls.serverProtocol = i;

            // BIG HACK to let demos from release work with the 3.0x patch!!!
            if (Globals.server_state != 0 && Defines.PROTOCOL_VERSION == 34)
            {
            }
            else if (i != Defines.PROTOCOL_VERSION)
            {
                Com.Error(Defines.ERR_DROP, "Server returned version " + i + ", not " + Defines.PROTOCOL_VERSION);
            }

            Globals.cl.servercount = MSG.ReadLong(Globals.net_message);
            Globals.cl.attractloop = MSG.ReadByte(Globals.net_message) != 0;

            // game directory
            var str = MSG.ReadString(Globals.net_message);

            Globals.cl.gamedir = str;
            Com.dprintln("gamedir=" + str);

            // set gamedir
            if ((str.Length > 0 && (FS.fs_gamedirvar.@string == null || [email protected] == 0 || [email protected](str))) ||
                (str.Length == 0 && (FS.fs_gamedirvar.@string != null || [email protected] == 0)))
            {
                Cvar.Set("game", str);
            }

            // parse player entity number
            Globals.cl.playernum = MSG.ReadShort(Globals.net_message);
            Com.dprintln("numplayers=" + Globals.cl.playernum);

            // get the full level name
            str = MSG.ReadString(Globals.net_message);
            Com.dprintln("levelname=" + str);

            if (Globals.cl.playernum == -1)
            {
                // playing a cinematic or showing a
                // pic, not a level
                SCR.PlayCinematic(str);
            }
            else
            {
                // seperate the printfs so the server message can have a color
                //			Com.Printf(
                //				"\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
                //			Com.Printf('\02' + str + "\n");
                Com.Printf("Levelname:" + str + "\n");

                // need to prep refresh at next oportunity
                Globals.cl.refresh_prepped = false;
            }
        }
Esempio n. 10
0
        /*
         * ===================== CL_ParseDownload
         *
         * A download message has been received from the server
         * =====================
         */
        public static void ParseDownload()
        {
            // read the data
            int size    = MSG.ReadShort(Globals.net_message);
            var percent = MSG.ReadByte(Globals.net_message);

            if (size == -1)
            {
                Com.Printf("Server does not have this file.\n");

                if (Globals.cls.download != null)
                {
                    // if here, we tried to resume a file but the server said no
                    try
                    {
                        Globals.cls.download.Close();
                    }
                    catch (IOException)
                    {
                    }

                    Globals.cls.download = null;
                }

                Cl.RequestNextDownload();

                return;
            }

            // open the file if not opened yet
            if (Globals.cls.download == null)
            {
                var name = CL_parse.DownloadFileName(Globals.cls.downloadtempname).ToLower();
                FS.CreatePath(name);
                Globals.cls.download = File.OpenWrite(name);

                if (Globals.cls.download == null)
                {
                    Globals.net_message.readcount += size;
                    Com.Printf("Failed to open " + Globals.cls.downloadtempname + "\n");
                    Cl.RequestNextDownload();

                    return;
                }
            }

            try
            {
                Globals.cls.download.Write(Globals.net_message.data, Globals.net_message.readcount, size);
            }
            catch (Exception)
            {
            }

            Globals.net_message.readcount += size;

            if (percent != 100)
            {
                // request next block
                //	   change display routines by zoid
                Globals.cls.downloadpercent = percent;
                MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
                SZ.Print(Globals.cls.netchan.message, "nextdl");
            }
            else
            {
                try
                {
                    Globals.cls.download.Close();
                }
                catch (IOException)
                {
                }

                // rename the temp file to it's final name
                var oldn = CL_parse.DownloadFileName(Globals.cls.downloadtempname);
                var newn = CL_parse.DownloadFileName(Globals.cls.downloadname);
                File.Move(oldn, newn);
                Globals.cls.download        = null;
                Globals.cls.downloadpercent = 0;

                // get another file if needed
                Cl.RequestNextDownload();
            }
        }
Esempio n. 11
0
 public static void ParseDelta(entity_state_t from, entity_state_t to, Int32 number, Int32 bits)
 {
     to.Set(from);
     Math3D.VectorCopy(from.origin, to.old_origin);
     to.number = number;
     if ((bits & Defines.U_MODEL) != 0)
     {
         to.modelindex = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_MODEL2) != 0)
     {
         to.modelindex2 = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_MODEL3) != 0)
     {
         to.modelindex3 = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_MODEL4) != 0)
     {
         to.modelindex4 = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_FRAME8) != 0)
     {
         to.frame = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_FRAME16) != 0)
     {
         to.frame = MSG.ReadShort(Globals.net_message);
     }
     if ((bits & Defines.U_SKIN8) != 0 && (bits & Defines.U_SKIN16) != 0)
     {
         to.skinnum = MSG.ReadLong(Globals.net_message);
     }
     else if ((bits & Defines.U_SKIN8) != 0)
     {
         to.skinnum = MSG.ReadByte(Globals.net_message);
     }
     else if ((bits & Defines.U_SKIN16) != 0)
     {
         to.skinnum = MSG.ReadShort(Globals.net_message);
     }
     if ((bits & (Defines.U_EFFECTS8 | Defines.U_EFFECTS16)) == (Defines.U_EFFECTS8 | Defines.U_EFFECTS16))
     {
         to.effects = MSG.ReadLong(Globals.net_message);
     }
     else if ((bits & Defines.U_EFFECTS8) != 0)
     {
         to.effects = MSG.ReadByte(Globals.net_message);
     }
     else if ((bits & Defines.U_EFFECTS16) != 0)
     {
         to.effects = MSG.ReadShort(Globals.net_message);
     }
     if ((bits & (Defines.U_RENDERFX8 | Defines.U_RENDERFX16)) == (Defines.U_RENDERFX8 | Defines.U_RENDERFX16))
     {
         to.renderfx = MSG.ReadLong(Globals.net_message);
     }
     else if ((bits & Defines.U_RENDERFX8) != 0)
     {
         to.renderfx = MSG.ReadByte(Globals.net_message);
     }
     else if ((bits & Defines.U_RENDERFX16) != 0)
     {
         to.renderfx = MSG.ReadShort(Globals.net_message);
     }
     if ((bits & Defines.U_ORIGIN1) != 0)
     {
         to.origin[0] = MSG.ReadCoord(Globals.net_message);
     }
     if ((bits & Defines.U_ORIGIN2) != 0)
     {
         to.origin[1] = MSG.ReadCoord(Globals.net_message);
     }
     if ((bits & Defines.U_ORIGIN3) != 0)
     {
         to.origin[2] = MSG.ReadCoord(Globals.net_message);
     }
     if ((bits & Defines.U_ANGLE1) != 0)
     {
         to.angles[0] = MSG.ReadAngle(Globals.net_message);
     }
     if ((bits & Defines.U_ANGLE2) != 0)
     {
         to.angles[1] = MSG.ReadAngle(Globals.net_message);
     }
     if ((bits & Defines.U_ANGLE3) != 0)
     {
         to.angles[2] = MSG.ReadAngle(Globals.net_message);
     }
     if ((bits & Defines.U_OLDORIGIN) != 0)
     {
         MSG.ReadPos(Globals.net_message, to.old_origin);
     }
     if ((bits & Defines.U_SOUND) != 0)
     {
         to.sound = MSG.ReadByte(Globals.net_message);
     }
     if ((bits & Defines.U_EVENT) != 0)
     {
         to.event_renamed = MSG.ReadByte(Globals.net_message);
     }
     else
     {
         to.event_renamed = 0;
     }
     if ((bits & Defines.U_SOLID) != 0)
     {
         to.solid = MSG.ReadShort(Globals.net_message);
     }
 }
Esempio n. 12
0
        public static void ParsePlayerstate(frame_t oldframe, frame_t newframe)
        {
            Int32          flags;
            player_state_t state;
            Int32          i;
            Int32          statbits;

            state = newframe.playerstate;
            if (oldframe != null)
            {
                state.Set(oldframe.playerstate);
            }
            else
            {
                state.Clear();
            }
            flags = MSG.ReadShort(Globals.net_message);
            if ((flags & Defines.PS_M_TYPE) != 0)
            {
                state.pmove.pm_type = MSG.ReadByte(Globals.net_message);
            }
            if ((flags & Defines.PS_M_ORIGIN) != 0)
            {
                state.pmove.origin[0] = MSG.ReadShort(Globals.net_message);
                state.pmove.origin[1] = MSG.ReadShort(Globals.net_message);
                state.pmove.origin[2] = MSG.ReadShort(Globals.net_message);
            }

            if ((flags & Defines.PS_M_VELOCITY) != 0)
            {
                state.pmove.velocity[0] = MSG.ReadShort(Globals.net_message);
                state.pmove.velocity[1] = MSG.ReadShort(Globals.net_message);
                state.pmove.velocity[2] = MSG.ReadShort(Globals.net_message);
            }

            if ((flags & Defines.PS_M_TIME) != 0)
            {
                state.pmove.pm_time = ( Byte )MSG.ReadByte(Globals.net_message);
            }

            if ((flags & Defines.PS_M_FLAGS) != 0)
            {
                state.pmove.pm_flags = ( Byte )MSG.ReadByte(Globals.net_message);
            }
            if ((flags & Defines.PS_M_GRAVITY) != 0)
            {
                state.pmove.gravity = MSG.ReadShort(Globals.net_message);
            }
            if ((flags & Defines.PS_M_DELTA_ANGLES) != 0)
            {
                state.pmove.delta_angles[0] = MSG.ReadShort(Globals.net_message);
                state.pmove.delta_angles[1] = MSG.ReadShort(Globals.net_message);
                state.pmove.delta_angles[2] = MSG.ReadShort(Globals.net_message);
            }

            if (Globals.cl.attractloop)
            {
                state.pmove.pm_type = Defines.PM_FREEZE;
            }
            if ((flags & Defines.PS_VIEWOFFSET) != 0)
            {
                state.viewoffset[0] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.viewoffset[1] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.viewoffset[2] = MSG.ReadChar(Globals.net_message) * 0.25F;
            }

            if ((flags & Defines.PS_VIEWANGLES) != 0)
            {
                state.viewangles[0] = MSG.ReadAngle16(Globals.net_message);
                state.viewangles[1] = MSG.ReadAngle16(Globals.net_message);
                state.viewangles[2] = MSG.ReadAngle16(Globals.net_message);
            }

            if ((flags & Defines.PS_KICKANGLES) != 0)
            {
                state.kick_angles[0] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.kick_angles[1] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.kick_angles[2] = MSG.ReadChar(Globals.net_message) * 0.25F;
            }

            if ((flags & Defines.PS_WEAPONINDEX) != 0)
            {
                state.gunindex = MSG.ReadByte(Globals.net_message);
            }

            if ((flags & Defines.PS_WEAPONFRAME) != 0)
            {
                state.gunframe     = MSG.ReadByte(Globals.net_message);
                state.gunoffset[0] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.gunoffset[1] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.gunoffset[2] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.gunangles[0] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.gunangles[1] = MSG.ReadChar(Globals.net_message) * 0.25F;
                state.gunangles[2] = MSG.ReadChar(Globals.net_message) * 0.25F;
            }

            if ((flags & Defines.PS_BLEND) != 0)
            {
                state.blend[0] = MSG.ReadByte(Globals.net_message) / 255F;
                state.blend[1] = MSG.ReadByte(Globals.net_message) / 255F;
                state.blend[2] = MSG.ReadByte(Globals.net_message) / 255F;
                state.blend[3] = MSG.ReadByte(Globals.net_message) / 255F;
            }

            if ((flags & Defines.PS_FOV) != 0)
            {
                state.fov = MSG.ReadByte(Globals.net_message);
            }
            if ((flags & Defines.PS_RDFLAGS) != 0)
            {
                state.rdflags = MSG.ReadByte(Globals.net_message);
            }
            statbits = MSG.ReadLong(Globals.net_message);
            for (i = 0; i < Defines.MAX_STATS; i++)
            {
                if ((statbits & (1 << i)) != 0)
                {
                    state.stats[i] = MSG.ReadShort(Globals.net_message);
                }
            }
        }