SetComp() public static method

public static SetComp ( Vector3 &dest, int index, float value ) : void
dest Vector3
index int
value float
return void
示例#1
0
        /// <summary>
        /// CL_ParseClientdata
        /// Server information pertaining to this client only
        /// </summary>
        private static void ParseClientData(int bits)
        {
            if ((bits & Protocol.SU_VIEWHEIGHT) != 0)
            {
                cl.viewheight = Net.Reader.ReadChar();
            }
            else
            {
                cl.viewheight = Protocol.DEFAULT_VIEWHEIGHT;
            }

            if ((bits & Protocol.SU_IDEALPITCH) != 0)
            {
                cl.idealpitch = Net.Reader.ReadChar();
            }
            else
            {
                cl.idealpitch = 0;
            }

            cl.mvelocity[1] = cl.mvelocity[0];
            for (int i = 0; i < 3; i++)
            {
                if ((bits & (Protocol.SU_PUNCH1 << i)) != 0)
                {
                    Mathlib.SetComp(ref cl.punchangle, i, Net.Reader.ReadChar());
                }
                else
                {
                    Mathlib.SetComp(ref cl.punchangle, i, 0);
                }
                if ((bits & (Protocol.SU_VELOCITY1 << i)) != 0)
                {
                    Mathlib.SetComp(ref cl.mvelocity[0], i, Net.Reader.ReadChar() * 16);
                }
                else
                {
                    Mathlib.SetComp(ref cl.mvelocity[0], i, 0);
                }
            }

            // [always sent]	if (bits & SU_ITEMS)
            int i2 = Net.Reader.ReadLong();

            if (cl.items != i2)
            {   // set flash times
                Sbar.Changed();
                for (int j = 0; j < 32; j++)
                {
                    if ((i2 & (1 << j)) != 0 && (cl.items & (1 << j)) == 0)
                    {
                        cl.item_gettime[j] = (float)cl.time;
                    }
                }
                cl.items = i2;
            }

            cl.onground = (bits & Protocol.SU_ONGROUND) != 0;
            cl.inwater  = (bits & Protocol.SU_INWATER) != 0;

            if ((bits & Protocol.SU_WEAPONFRAME) != 0)
            {
                cl.stats[QStats.STAT_WEAPONFRAME] = Net.Reader.ReadByte();
            }
            else
            {
                cl.stats[QStats.STAT_WEAPONFRAME] = 0;
            }

            if ((bits & Protocol.SU_ARMOR) != 0)
            {
                i2 = Net.Reader.ReadByte();
            }
            else
            {
                i2 = 0;
            }
            if (cl.stats[QStats.STAT_ARMOR] != i2)
            {
                cl.stats[QStats.STAT_ARMOR] = i2;
                Sbar.Changed();
            }

            if ((bits & Protocol.SU_WEAPON) != 0)
            {
                i2 = Net.Reader.ReadByte();
            }
            else
            {
                i2 = 0;
            }
            if (cl.stats[QStats.STAT_WEAPON] != i2)
            {
                cl.stats[QStats.STAT_WEAPON] = i2;
                Sbar.Changed();
            }

            i2 = Net.Reader.ReadShort();
            if (cl.stats[QStats.STAT_HEALTH] != i2)
            {
                cl.stats[QStats.STAT_HEALTH] = i2;
                Sbar.Changed();
            }

            i2 = Net.Reader.ReadByte();
            if (cl.stats[QStats.STAT_AMMO] != i2)
            {
                cl.stats[QStats.STAT_AMMO] = i2;
                Sbar.Changed();
            }

            for (i2 = 0; i2 < 4; i2++)
            {
                int j = Net.Reader.ReadByte();
                if (cl.stats[QStats.STAT_SHELLS + i2] != j)
                {
                    cl.stats[QStats.STAT_SHELLS + i2] = j;
                    Sbar.Changed();
                }
            }

            i2 = Net.Reader.ReadByte();

            if (Common.GameKind == GameKind.StandardQuake)
            {
                if (cl.stats[QStats.STAT_ACTIVEWEAPON] != i2)
                {
                    cl.stats[QStats.STAT_ACTIVEWEAPON] = i2;
                    Sbar.Changed();
                }
            }
            else
            {
                if (cl.stats[QStats.STAT_ACTIVEWEAPON] != (1 << i2))
                {
                    cl.stats[QStats.STAT_ACTIVEWEAPON] = (1 << i2);
                    Sbar.Changed();
                }
            }
        }