コード例 #1
0
        /*
         * =================
         *
         * CL_PrepRefresh
         *
         * Call before entering a new level, or after changing dlls
         * =================
         */
        public static void PrepRefresh()
        {
            string mapname;
            int    i;
            string name;
            float  rotate;
            var    axis = new float[3];

            if ((i = Globals.cl.configstrings[Defines.CS_MODELS + 1].Length) == 0)
            {
                return;                 // no map loaded
            }
            SCR.AddDirtyPoint(0, 0);
            SCR.AddDirtyPoint(Globals.viddef.getWidth() - 1, Globals.viddef.getHeight() - 1);

            // let the render dll load the map
            mapname = Globals.cl.configstrings[Defines.CS_MODELS + 1].Substring(5, i - 9);             // skip "maps/"

            // cut off ".bsp"

            // register models, pics, and skins
            Com.Printf("Map: " + mapname + "\r");
            SCR.UpdateScreen();
            Globals.re.BeginRegistration(mapname);
            Com.Printf("                                     \r");

            // precache status bar pics
            Com.Printf("pics\r");
            SCR.UpdateScreen();
            SCR.TouchPics();
            Com.Printf("                                     \r");
            CL_tent.RegisterTEntModels();
            CL_view.num_cl_weaponmodels = 1;
            CL_view.cl_weaponmodels[0]  = "weapon.md2";

            for (i = 1; i < Defines.MAX_MODELS && Globals.cl.configstrings[Defines.CS_MODELS + i].Length != 0; i++)
            {
                name = new(Globals.cl.configstrings[Defines.CS_MODELS + i]);

                if (name.Length > 37)
                {
                    name = name[..36];
コード例 #2
0
        public static void PrepRefresh()
        {
            string mapname;
            int    i;
            string name;
            float  rotate;

            float[] axis = new float[3];
            if ((i = Globals.cl.configstrings[Defines.CS_MODELS + 1].Length) == 0)
            {
                return;
            }
            SCR.AddDirtyPoint(0, 0);
            SCR.AddDirtyPoint(Globals.viddef.GetWidth() - 1, Globals.viddef.GetHeight() - 1);
            mapname = Globals.cl.configstrings[Defines.CS_MODELS + 1].Substring(5, i - 4);
            Com.Printf("Map: " + mapname + "\\r");
            SCR.UpdateScreen();
            Globals.re.BeginRegistration(mapname);
            Com.Printf("                                     \\r");
            Com.Printf("pics\\r");
            SCR.UpdateScreen();
            SCR.TouchPics();
            Com.Printf("                                     \\r");
            CL_tent.RegisterTEntModels();
            num_cl_weaponmodels = 1;
            cl_weaponmodels[0]  = "weapon.md2";
            for (i = 1; i < Defines.MAX_MODELS && Globals.cl.configstrings[Defines.CS_MODELS + i].Length != 0; i++)
            {
                name = new string (Globals.cl.configstrings[Defines.CS_MODELS + i]);
                if (name.Length > 37)
                {
                    name = name.Substring(0, 36);
                }
                if (name[0] != '*')
                {
                    Com.Printf(name + "\\r");
                }
                SCR.UpdateScreen();
                CoreSys.SendKeyEvents();
                if (name[0] == '#')
                {
                    if (num_cl_weaponmodels < Defines.MAX_CLIENTWEAPONMODELS)
                    {
                        cl_weaponmodels[num_cl_weaponmodels] = Globals.cl.configstrings[Defines.CS_MODELS + i].Substring(1);
                        num_cl_weaponmodels++;
                    }
                }
                else
                {
                    Globals.cl.model_draw[i] = Globals.re.RegisterModel(Globals.cl.configstrings[Defines.CS_MODELS + i]);
                    if (name[0] == '*')
                    {
                        Globals.cl.model_clip[i] = CM.InlineModel(Globals.cl.configstrings[Defines.CS_MODELS + i]);
                    }
                    else
                    {
                        Globals.cl.model_clip[i] = null;
                    }
                }

                if (name[0] != '*')
                {
                    Com.Printf("                                     \\r");
                }
            }

            Com.Printf("images\\r");
            SCR.UpdateScreen();
            for (i = 1; i < Defines.MAX_IMAGES && Globals.cl.configstrings[Defines.CS_IMAGES + i].Length > 0; i++)
            {
                Globals.cl.image_precache[i] = Globals.re.RegisterPic(Globals.cl.configstrings[Defines.CS_IMAGES + i]);
                CoreSys.SendKeyEvents();
            }

            Com.Printf("                                     \\r");
            for (i = 0; i < Defines.MAX_CLIENTS; i++)
            {
                if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i].Length == 0)
                {
                    continue;
                }
                Com.Printf("client " + i + '\\');
                SCR.UpdateScreen();
                CoreSys.SendKeyEvents();
                CL_parse.ParseClientinfo(i);
                Com.Printf("                                     \\r");
            }

            CL_parse.LoadClientinfo(Globals.cl.baseclientinfo, "unnamed\\\\male/grunt");
            Com.Printf("sky\\r");
            SCR.UpdateScreen();
            rotate = float.Parse(Globals.cl.configstrings[Defines.CS_SKYROTATE]);
            StringTokenizer st = new StringTokenizer(Globals.cl.configstrings[Defines.CS_SKYAXIS]);

            st.MoveNext();
            axis[0] = float.Parse(st.Current);
            st.MoveNext();
            axis[1] = float.Parse(st.Current);
            st.MoveNext();
            axis[2] = float.Parse(st.Current);
            Globals.re.SetSky(Globals.cl.configstrings[Defines.CS_SKY], rotate, axis);
            Com.Printf("                                     \\r");
            Globals.re.EndRegistration();
            Con.ClearNotify();
            SCR.UpdateScreen();
            Globals.cl.refresh_prepped = true;
            Globals.cl.force_refdef    = true;
        }