]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_edict.c
Added a mempool parameter to FS_LoadFile
[xonotic/darkplaces.git] / pr_edict.c
index 3c3b31e6324017bfccdbe710f897d1850641328f..2f512093eff786f34dd3361aa4383d9999e0747c 100644 (file)
@@ -42,7 +42,7 @@ int           type_size[8] = {1,sizeof(string_t)/4,1,3,1,1,sizeof(func_t)/4,sizeof(void *
 ddef_t *ED_FieldAtOfs(int ofs);
 qboolean ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s);
 
-cvar_t pr_checkextension = {0, "pr_checkextension", "1"};
+cvar_t pr_checkextension = {CVAR_READONLY, "pr_checkextension", "1"};
 cvar_t nomonsters = {0, "nomonsters", "0"};
 cvar_t gamecfg = {0, "gamecfg", "0"};
 cvar_t scratch1 = {0, "scratch1", "0"};
@@ -122,6 +122,10 @@ int eval_viewzoom;
 int eval_clientcolors;
 int eval_tag_entity;
 int eval_tag_index;
+int eval_light_lev;
+int eval_color;
+int eval_style;
+int eval_pflags;
 
 mfunction_t *SV_PlayerPhysicsQC;
 mfunction_t *EndFrameQC;
@@ -176,6 +180,10 @@ void FindEdictFieldOffsets(void)
        eval_clientcolors = FindFieldOffset("clientcolors");
        eval_tag_entity = FindFieldOffset("tag_entity");
        eval_tag_index = FindFieldOffset("tag_index");
+       eval_light_lev = FindFieldOffset("light_lev");
+       eval_color = FindFieldOffset("color");
+       eval_style = FindFieldOffset("style");
+       eval_pflags = FindFieldOffset("pflags");
 
        // LordHavoc: allowing QuakeC to override the player movement code
        SV_PlayerPhysicsQC = ED_FindFunction ("SV_PlayerPhysics");
@@ -199,11 +207,11 @@ void ED_ClearEdict (edict_t *e)
        e->e->free = false;
        // LordHavoc: for consistency set these here
        num = NUM_FOR_EDICT(e) - 1;
-       if (num >= 0 && num < MAX_SCOREBOARD && svs.connectedclients[num])
+       if (num >= 0 && num < svs.maxclients)
        {
                e->v->colormap = num + 1;
-               e->v->team = (svs.connectedclients[num]->colors & 15) + 1;
-               e->v->netname = PR_SetString(svs.connectedclients[num]->name);
+               e->v->team = (svs.clients[num].colors & 15) + 1;
+               e->v->netname = PR_SetString(svs.clients[num].name);
        }
 }
 
@@ -223,7 +231,7 @@ edict_t *ED_Alloc (void)
        int                     i;
        edict_t         *e;
 
-       for (i = MAX_SCOREBOARD + 1;i < sv.num_edicts;i++)
+       for (i = svs.maxclients + 1;i < sv.num_edicts;i++)
        {
                e = EDICT_NUM(i);
                // the first couple seconds of server time can involve a lot of
@@ -380,7 +388,7 @@ PR_ValueString
 Returns a string describing *data in a type specific manner
 =============
 */
-int NoCrash_NUM_FOR_EDICT(edict_t *e);
+//int NoCrash_NUM_FOR_EDICT(edict_t *e);
 char *PR_ValueString (etype_t type, eval_t *val)
 {
        static char line[1024]; // LordHavoc: enlarged a bit (was 256)
@@ -393,40 +401,40 @@ char *PR_ValueString (etype_t type, eval_t *val)
        switch (type)
        {
        case ev_string:
-               sprintf (line, "%s", PR_GetString(val->string));
+               strncpy(line, PR_GetString(val->string), sizeof(line));
                break;
        case ev_entity:
                //n = NoCrash_NUM_FOR_EDICT(PROG_TO_EDICT(val->edict));
                n = val->edict;
                if (n < 0 || n >= MAX_EDICTS)
-                       sprintf (line, "entity %i (invalid!)", n);
+                       snprintf (line, sizeof (line), "entity %i (invalid!)", n);
                else
-                       sprintf (line, "entity %i", n);
+                       snprintf (line, sizeof (line), "entity %i", n);
                break;
        case ev_function:
                f = pr_functions + val->function;
-               sprintf (line, "%s()", PR_GetString(f->s_name));
+               snprintf (line, sizeof (line), "%s()", PR_GetString(f->s_name));
                break;
        case ev_field:
                def = ED_FieldAtOfs ( val->_int );
-               sprintf (line, ".%s", PR_GetString(def->s_name));
+               snprintf (line, sizeof (line), ".%s", PR_GetString(def->s_name));
                break;
        case ev_void:
-               sprintf (line, "void");
+               snprintf (line, sizeof (line), "void");
                break;
        case ev_float:
                // LordHavoc: changed from %5.1f to %10.4f
-               sprintf (line, "%10.4f", val->_float);
+               snprintf (line, sizeof (line), "%10.4f", val->_float);
                break;
        case ev_vector:
                // LordHavoc: changed from %5.1f to %10.4f
-               sprintf (line, "'%10.4f %10.4f %10.4f'", val->vector[0], val->vector[1], val->vector[2]);
+               snprintf (line, sizeof (line), "'%10.4f %10.4f %10.4f'", val->vector[0], val->vector[1], val->vector[2]);
                break;
        case ev_pointer:
-               sprintf (line, "pointer");
+               snprintf (line, sizeof (line), "pointer");
                break;
        default:
-               sprintf (line, "bad type %i", type);
+               snprintf (line, sizeof (line), "bad type %i", type);
                break;
        }
 
@@ -454,23 +462,11 @@ char *PR_UglyValueString (etype_t type, eval_t *val)
        switch (type)
        {
        case ev_string:
-               sprintf (line, "%s", PR_GetString(val->string));
-               break;
-       case ev_entity:
-               sprintf (line, "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
-               break;
-       case ev_function:
-               f = pr_functions + val->function;
-               sprintf (line, "%s", PR_GetString(f->s_name));
-               break;
-       case ev_field:
-               def = ED_FieldAtOfs ( val->_int );
-               // LordHavoc: parse the string a bit to turn special characters
+               // Parse the string a bit to turn special characters
                // (like newline, specifically) into escape codes,
                // this fixes saving games from various mods
-               //sprintf (line, "%s", PR_GetString(def->s_name));
-               s = PR_GetString(def->s_name);
-               for (i = 0;i < 4095 && *s;)
+               s = PR_GetString (val->string);
+               for (i = 0;i < (int)sizeof(line) - 2 && *s;)
                {
                        if (*s == '\n')
                        {
@@ -483,22 +479,33 @@ char *PR_UglyValueString (etype_t type, eval_t *val)
                                line[i++] = 'r';
                        }
                        else
-                               line[i] = *s;
+                               line[i++] = *s;
                        s++;
                }
-               line[i++] = 0;
+               line[i] = '\0';
+               break;
+       case ev_entity:
+               snprintf (line, sizeof (line), "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
+               break;
+       case ev_function:
+               f = pr_functions + val->function;
+               strncpy(line, PR_GetString(f->s_name), sizeof(line));
+               break;
+       case ev_field:
+               def = ED_FieldAtOfs ( val->_int );
+               snprintf (line, sizeof (line), ".%s", PR_GetString(def->s_name));
                break;
        case ev_void:
-               sprintf (line, "void");
+               snprintf (line, sizeof (line), "void");
                break;
        case ev_float:
-               sprintf (line, "%f", val->_float);
+               snprintf (line, sizeof (line), "%f", val->_float);
                break;
        case ev_vector:
-               sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
+               snprintf (line, sizeof (line), "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
                break;
        default:
-               sprintf (line, "bad type %i", type);
+               snprintf (line, sizeof (line), "bad type %i", type);
                break;
        }
 
@@ -524,17 +531,17 @@ char *PR_GlobalString (int ofs)
        val = (void *)&pr_globals[ofs];
        def = ED_GlobalAtOfs(ofs);
        if (!def)
-               sprintf (line,"%i(?)", ofs);
+               snprintf (line, sizeof (line), "%i(?)", ofs);
        else
        {
                s = PR_ValueString (def->type, val);
-               sprintf (line,"%i(%s)%s", ofs, PR_GetString(def->s_name), s);
+               snprintf (line, sizeof (line), "%i(%s)%s", ofs, PR_GetString(def->s_name), s);
        }
 
        i = strlen(line);
        for ( ; i<20 ; i++)
-               strcat (line," ");
-       strcat (line," ");
+               strlcat (line, " ", sizeof (line));
+       strlcat (line, " ", sizeof (line));
 
        return line;
 }
@@ -547,14 +554,14 @@ char *PR_GlobalStringNoContents (int ofs)
 
        def = ED_GlobalAtOfs(ofs);
        if (!def)
-               sprintf (line,"%i(?)", ofs);
+               snprintf (line, sizeof (line), "%i(?)", ofs);
        else
-               sprintf (line,"%i(%s)", ofs, PR_GetString(def->s_name));
+               snprintf (line, sizeof (line), "%i(%s)", ofs, PR_GetString(def->s_name));
 
        i = strlen(line);
        for ( ; i<20 ; i++)
-               strcat (line," ");
-       strcat (line," ");
+               strlcat (line, " ", sizeof (line));
+       strlcat (line, " ", sizeof (line));
 
        return line;
 }
@@ -569,7 +576,7 @@ For debugging
 */
 // LordHavoc: optimized this to print out much more quickly (tempstring)
 // LordHavoc: changed to print out every 4096 characters (incase there are a lot of fields to print)
-void ED_Print (edict_t *ed)
+void ED_Print(edict_t *ed)
 {
        int             l;
        ddef_t  *d;
@@ -581,12 +588,12 @@ void ED_Print (edict_t *ed)
 
        if (ed->e->free)
        {
-               Con_Print("FREE\n");
+               Con_Print("FREE\n");
                return;
        }
 
        tempstring[0] = 0;
-       sprintf(tempstring, "\nEDICT %i:\n", NUM_FOR_EDICT(ed));
+       snprintf (tempstring, sizeof (tempstring), "\nEDICT %i:\n", NUM_FOR_EDICT(ed));
        for (i=1 ; i<progs->numfielddefs ; i++)
        {
                d = &pr_fielddefs[i];
@@ -612,7 +619,7 @@ void ED_Print (edict_t *ed)
                        tempstring2[259] = 0;
                        name = tempstring2;
                }
-               strcat(tempstring, name);
+               strlcat (tempstring, name, sizeof (tempstring));
                for (l = strlen(name);l < 14;l++)
                        strcat(tempstring, " ");
                strcat(tempstring, " ");
@@ -625,16 +632,16 @@ void ED_Print (edict_t *ed)
                        tempstring2[259] = 0;
                        name = tempstring2;
                }
-               strcat(tempstring, name);
-               strcat(tempstring, "\n");
+               strlcat (tempstring, name, sizeof (tempstring));
+               strlcat (tempstring, "\n", sizeof (tempstring));
                if (strlen(tempstring) >= 4096)
                {
-                       Con_Printf("%s", tempstring);
+                       Con_Print(tempstring);
                        tempstring[0] = 0;
                }
        }
        if (tempstring[0])
-               Con_Printf("%s", tempstring);
+               Con_Print(tempstring);
 }
 
 /*
@@ -652,11 +659,11 @@ void ED_Write (qfile_t *f, edict_t *ed)
        char    *name;
        int             type;
 
-       FS_Print(f, "{\n");
+       FS_Print(f, "{\n");
 
        if (ed->e->free)
        {
-               FS_Print(f, "}\n");
+               FS_Print(f, "}\n");
                return;
        }
 
@@ -677,16 +684,16 @@ void ED_Write (qfile_t *f, edict_t *ed)
                if (j == type_size[type])
                        continue;
 
-               FS_Printf (f,"\"%s\" ",name);
-               FS_Printf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v));
+               FS_Printf(f,"\"%s\" ",name);
+               FS_Printf(f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v));
        }
 
-       FS_Print(f, "}\n");
+       FS_Print(f, "}\n");
 }
 
 void ED_PrintNum (int ent)
 {
-       ED_Print (EDICT_NUM(ent));
+       ED_Print(EDICT_NUM(ent));
 }
 
 /*
@@ -700,7 +707,7 @@ void ED_PrintEdicts (void)
 {
        int             i;
 
-       Con_Printf ("%i entities\n", sv.num_edicts);
+       Con_Printf("%i entities\n", sv.num_edicts);
        for (i=0 ; i<sv.num_edicts ; i++)
                ED_PrintNum (i);
 }
@@ -717,9 +724,9 @@ void ED_PrintEdict_f (void)
        int             i;
 
        i = atoi (Cmd_Argv(1));
-       if (i >= sv.num_edicts)
+       if (i < 0 || i >= sv.num_edicts)
        {
-               Con_Printf("Bad edict number\n");
+               Con_Print("Bad edict number\n");
                return;
        }
        ED_PrintNum (i);
@@ -753,11 +760,11 @@ void ED_Count (void)
                        step++;
        }
 
-       Con_Printf ("num_edicts:%3i\n", sv.num_edicts);
-       Con_Printf ("active    :%3i\n", active);
-       Con_Printf ("view      :%3i\n", models);
-       Con_Printf ("touch     :%3i\n", solid);
-       Con_Printf ("step      :%3i\n", step);
+       Con_Printf("num_edicts:%3i\n", sv.num_edicts);
+       Con_Printf("active    :%3i\n", active);
+       Con_Printf("view      :%3i\n", models);
+       Con_Printf("touch     :%3i\n", solid);
+       Con_Printf("step      :%3i\n", step);
 
 }
 
@@ -782,7 +789,7 @@ void ED_WriteGlobals (qfile_t *f)
        char            *name;
        int                     type;
 
-       FS_Print(f,"{\n");
+       FS_Print(f,"{\n");
        for (i=0 ; i<progs->numglobaldefs ; i++)
        {
                def = &pr_globaldefs[i];
@@ -795,10 +802,38 @@ void ED_WriteGlobals (qfile_t *f)
                        continue;
 
                name = PR_GetString(def->s_name);
-               FS_Printf (f,"\"%s\" ", name);
-               FS_Printf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs]));
+               FS_Printf(f,"\"%s\" ", name);
+               FS_Printf(f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs]));
+       }
+       FS_Print(f,"}\n");
+}
+
+/*
+=============
+ED_EdictSet_f
+
+Console command to set a field of a specified edict
+=============
+*/
+void ED_EdictSet_f(void)
+{
+       edict_t *ed;
+       ddef_t *key;
+
+       if(Cmd_Argc() != 4)
+       {
+               Con_Print("edictset <edict number> <field> <value>\n");
+               return;
        }
-       FS_Printf (f,"}\n");
+       ed = EDICT_NUM(atoi(Cmd_Argv(1)));
+
+       if((key = ED_FindField(Cmd_Argv(2))) == 0)
+       {
+               Con_Printf("Key %s not found !\n", Cmd_Argv(2));
+               return;
+       }
+
+       ED_ParseEpair(ed, key, Cmd_Argv(3));
 }
 
 /*
@@ -831,7 +866,7 @@ void ED_ParseGlobals (const char *data)
                key = ED_FindGlobal (keyname);
                if (!key)
                {
-                       Con_DPrintf ("'%s' is not a global\n", keyname);
+                       Con_DPrintf("'%s' is not a global\n", keyname);
                        continue;
                }
 
@@ -949,7 +984,7 @@ qboolean ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s)
                func = ED_FindFunction(s);
                if (!func)
                {
-                       Con_Printf ("ED_ParseEpair: Can't find function %s\n", s);
+                       Con_Printf("ED_ParseEpair: Can't find function %s\n", s);
                        return false;
                }
                val->function = func - pr_functions;
@@ -996,19 +1031,15 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
 
                // anglehack is to allow QuakeEd to write single scalar angles
                // and allow them to be turned into vectors. (FIXME...)
-               if (!strcmp(com_token, "angle"))
-               {
-                       strcpy (com_token, "angles");
-                       anglehack = true;
-               }
-               else
-                       anglehack = false;
+               anglehack = !strcmp (com_token, "angle");
+               if (anglehack)
+                       strlcpy (com_token, "angles", sizeof (com_token));
 
                // FIXME: change light to _light to get rid of this hack
                if (!strcmp(com_token, "light"))
-                       strcpy (com_token, "light_lev");        // hack for single light def
+                       strlcpy (com_token, "light_lev", sizeof (com_token));   // hack for single light def
 
-               strcpy (keyname, com_token);
+               strlcpy (keyname, com_token, sizeof (keyname));
 
                // another hack to fix heynames with trailing spaces
                n = strlen(keyname);
@@ -1035,15 +1066,15 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
                key = ED_FindField (keyname);
                if (!key)
                {
-                       Con_DPrintf ("'%s' is not a field\n", keyname);
+                       Con_DPrintf("'%s' is not a field\n", keyname);
                        continue;
                }
 
                if (anglehack)
                {
                        char    temp[32];
-                       strcpy (temp, com_token);
-                       sprintf (com_token, "0 %s 0", temp);
+                       strlcpy (temp, com_token, sizeof (temp));
+                       snprintf (com_token, sizeof (com_token), "0 %s 0", temp);
                }
 
                if (!ED_ParseEpair(ent, key, com_token))
@@ -1125,8 +1156,8 @@ void ED_LoadFromFile (const char *data)
 //
                if (!ent->v->classname)
                {
-                       Con_Print("No classname for:\n");
-                       ED_Print (ent);
+                       Con_Print("No classname for:\n");
+                       ED_Print(ent);
                        ED_Free (ent);
                        continue;
                }
@@ -1138,8 +1169,8 @@ void ED_LoadFromFile (const char *data)
                {
                        if (developer.integer) // don't confuse non-developers with errors
                        {
-                               Con_Print("No spawn function for:\n");
-                               ED_Print (ent);
+                               Con_Print("No spawn function for:\n");
+                               ED_Print(ent);
                        }
                        ED_Free (ent);
                        continue;
@@ -1152,7 +1183,7 @@ void ED_LoadFromFile (const char *data)
                        died++;
        }
 
-       Con_DPrintf ("%i entities parsed, %i inhibited, %i spawned (%i removed self, %i stayed)\n", parsed, inhibited, spawned, died, spawned - died);
+       Con_DPrintf("%i entities parsed, %i inhibited, %i spawned (%i removed self, %i stayed)\n", parsed, inhibited, spawned, died, spawned - died);
 }
 
 
@@ -1202,7 +1233,11 @@ dpfield_t dpfields[] =
        {ev_vector, "punchvector"},
        {ev_float, "clientcolors"},
        {ev_entity, "tag_entity"},
-       {ev_float, "tag_index"}
+       {ev_float, "tag_index"},
+       {ev_float, "light_lev"},
+       {ev_float, "color"},
+       {ev_float, "style"},
+       {ev_float, "pflags"}
 };
 
 /*
@@ -1216,7 +1251,6 @@ void PR_LoadProgs (void)
        int i;
        dstatement_t *st;
        ddef_t *infielddefs;
-       void *temp;
        dfunction_t *dfunctions;
 
 // flush the non-C variable lookup cache
@@ -1226,16 +1260,11 @@ void PR_LoadProgs (void)
        Mem_EmptyPool(progs_mempool);
        Mem_EmptyPool(edictstring_mempool);
 
-       temp = FS_LoadFile ("progs.dat", false);
-       if (!temp)
+       progs = (dprograms_t *)FS_LoadFile ("progs.dat", progs_mempool, false);
+       if (!progs)
                Host_Error ("PR_LoadProgs: couldn't load progs.dat");
 
-       progs = (dprograms_t *)Mem_Alloc(progs_mempool, fs_filesize);
-
-       memcpy(progs, temp, fs_filesize);
-       Mem_Free(temp);
-
-       Con_DPrintf ("Programs occupy %iK.\n", fs_filesize/1024);
+       Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024);
 
        pr_crc = CRC_Block((qbyte *)progs, fs_filesize);
 
@@ -1245,7 +1274,7 @@ void PR_LoadProgs (void)
 
        if (progs->version != PROG_VERSION)
                Host_Error ("progs.dat has wrong version number (%i should be %i)", progs->version, PROG_VERSION);
-       if (progs->crc != PROGHEADER_CRC)
+       if (progs->crc != PROGHEADER_CRC && progs->crc != 32401) // tenebrae crc also allowed
                Host_Error ("progs.dat system vars have been modified, progdefs.h is out of date");
 
        //pr_functions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions);
@@ -1439,11 +1468,11 @@ void PR_Fields_f (void)
        int *v;
        if (!sv.active)
        {
-               Con_Printf("no progs loaded\n");
+               Con_Print("no progs loaded\n");
                return;
        }
        counts = Mem_Alloc(tempmempool, progs->numfielddefs * sizeof(int));
-       for (ednum = 0;ednum < MAX_EDICTS;ednum++)
+       for (ednum = 0;ednum < sv.max_edicts;ednum++)
        {
                ed = EDICT_NUM(ednum);
                if (ed->e->free)
@@ -1478,32 +1507,32 @@ void PR_Fields_f (void)
                switch(d->type & ~DEF_SAVEGLOBAL)
                {
                case ev_string:
-                       strcat(tempstring, "string   ");
+                       strlcat (tempstring, "string   ", sizeof (tempstring));
                        break;
                case ev_entity:
-                       strcat(tempstring, "entity   ");
+                       strlcat (tempstring, "entity   ", sizeof (tempstring));
                        break;
                case ev_function:
-                       strcat(tempstring, "function ");
+                       strlcat (tempstring, "function ", sizeof (tempstring));
                        break;
                case ev_field:
-                       strcat(tempstring, "field    ");
+                       strlcat (tempstring, "field    ", sizeof (tempstring));
                        break;
                case ev_void:
-                       strcat(tempstring, "void     ");
+                       strlcat (tempstring, "void     ", sizeof (tempstring));
                        break;
                case ev_float:
-                       strcat(tempstring, "float    ");
+                       strlcat (tempstring, "float    ", sizeof (tempstring));
                        break;
                case ev_vector:
-                       strcat(tempstring, "vector   ");
+                       strlcat (tempstring, "vector   ", sizeof (tempstring));
                        break;
                case ev_pointer:
-                       strcat(tempstring, "pointer  ");
+                       strlcat (tempstring, "pointer  ", sizeof (tempstring));
                        break;
                default:
-                       sprintf (tempstring2, "bad type %i ", d->type & ~DEF_SAVEGLOBAL);
-                       strcat(tempstring, tempstring2);
+                       snprintf (tempstring2, sizeof (tempstring2), "bad type %i ", d->type & ~DEF_SAVEGLOBAL);
+                       strlcat (tempstring, tempstring2, sizeof (tempstring));
                        break;
                }
                if (strlen(name) > 256)
@@ -1513,15 +1542,15 @@ void PR_Fields_f (void)
                        tempstring2[259] = 0;
                        name = tempstring2;
                }
-               strcat(tempstring, name);
+               strcat (tempstring, name);
                for (j = strlen(name);j < 25;j++)
                        strcat(tempstring, " ");
-               sprintf(tempstring2, "%5d", counts[i]);
-               strcat(tempstring, tempstring2);
-               strcat(tempstring, "\n");
+               snprintf (tempstring2, sizeof (tempstring2), "%5d", counts[i]);
+               strlcat (tempstring, tempstring2, sizeof (tempstring));
+               strlcat (tempstring, "\n", sizeof (tempstring));
                if (strlen(tempstring) >= 4096)
                {
-                       Con_Printf("%s", tempstring);
+                       Con_Print(tempstring);
                        tempstring[0] = 0;
                }
                if (counts[i])
@@ -1531,7 +1560,7 @@ void PR_Fields_f (void)
                }
        }
        Mem_Free(counts);
-       Con_Printf("%i entity fields (%i in use), totalling %i bytes per edict (%i in use), %i edicts, %i bytes total spent on edict fields (%i needed)\n", progs->entityfields, used, progs->entityfields * 4, usedamount * 4, MAX_EDICTS, progs->entityfields * 4 * MAX_EDICTS, usedamount * 4 * MAX_EDICTS);
+       Con_Printf("%i entity fields (%i in use), totalling %i bytes per edict (%i in use), %i edicts allocated, %i bytes total spent on edict fields (%i needed)\n", progs->entityfields, used, progs->entityfields * 4, usedamount * 4, sv.max_edicts, progs->entityfields * 4 * sv.max_edicts, usedamount * 4 * sv.max_edicts);
 }
 
 void PR_Globals_f (void)
@@ -1539,7 +1568,7 @@ void PR_Globals_f (void)
        int i;
        if (!sv.active)
        {
-               Con_Printf("no progs loaded\n");
+               Con_Print("no progs loaded\n");
                return;
        }
        for (i = 0;i < progs->numglobaldefs;i++)
@@ -1558,6 +1587,7 @@ void PR_Init (void)
        Cmd_AddCommand ("edict", ED_PrintEdict_f);
        Cmd_AddCommand ("edicts", ED_PrintEdicts);
        Cmd_AddCommand ("edictcount", ED_Count);
+       Cmd_AddCommand ("edictset", ED_EdictSet_f);
        Cmd_AddCommand ("profile", PR_Profile_f);
        Cmd_AddCommand ("pr_fields", PR_Fields_f);
        Cmd_AddCommand ("pr_globals", PR_Globals_f);