Пример #1
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;
            }
        }