]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_edict.c
renamed varray_ arrays to rsurface_array_, and they are no longer used outside the...
[xonotic/darkplaces.git] / prvm_edict.c
index 94d74a53be86fa6ac61dea41d4ba646ae8d4a4fe..e79cc5f1d8254de665c9a0d3ce93dd2905954484 100644 (file)
@@ -32,9 +32,9 @@ ddef_t *PRVM_ED_FieldAtOfs(int ofs);
 qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s);
 
 // LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
-cvar_t prvm_boundscheck = {0, "prvm_boundscheck", "1"};
+cvar_t prvm_boundscheck = {0, "prvm_boundscheck", "1", "enables detection of out of bounds memory access in the QuakeC code being run (in other words, prevents really exceedingly bad QuakeC code from doing nasty things to your computer)"};
 // LordHavoc: prints every opcode as it executes - warning: this is significant spew
-cvar_t prvm_traceqc = {0, "prvm_traceqc", "0"};
+cvar_t prvm_traceqc = {0, "prvm_traceqc", "0", "prints every QuakeC statement as it is executed (only for really thorough debugging!)"};
 
 //============================================================================
 // mempool handling
@@ -1009,6 +1009,7 @@ ed should be a properly initialized empty edict.
 Used for initial level load and for savegames.
 ====================
 */
+extern cvar_t developer_entityparsing;
 const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
 {
        ddef_t *key;
@@ -1025,6 +1026,8 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
        // parse key
                if (!COM_ParseToken(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
+               if (developer_entityparsing.integer)
+                       Con_Printf("Key: \"%s\"", com_token);
                if (com_token[0] == '}')
                        break;
 
@@ -1055,6 +1058,8 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
        // parse value
                if (!COM_ParseToken(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
+               if (developer_entityparsing.integer)
+                       Con_Printf(" \"%s\"\n", com_token);
 
                if (com_token[0] == '}')
                        PRVM_ERROR ("PRVM_ED_ParseEdict: closing brace without data");
@@ -1254,7 +1259,8 @@ void PRVM_LoadLNO( const char *progname ) {
 <Spike>    SafeWrite (h, statement_linenums, numstatements*sizeof(int));
 */
        if( (unsigned) filesize < (6 + prog->progs->numstatements) * sizeof( int ) ) {
-        return;
+               Mem_Free(lno);
+               return;
        }
 
        header = (unsigned int *) lno;
@@ -1494,7 +1500,7 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required
                                PRVM_ERROR("PRVM_LoadProgs: out of bounds global index (statement %d) in %s", i, PRVM_NAME);
                        break;
                default:
-                       PRVM_ERROR("PRVM_LoadProgs: unknown opcode %d at statement %d in %s", st->op, i, PRVM_NAME);
+                       Con_DPrintf("PRVM_LoadProgs: unknown opcode %d at statement %d in %s", st->op, i, PRVM_NAME);
                        break;
                }
        }
@@ -1739,15 +1745,15 @@ PRVM_Init
 */
 void PRVM_Init (void)
 {
-       Cmd_AddCommand ("prvm_edict", PRVM_ED_PrintEdict_f);
-       Cmd_AddCommand ("prvm_edicts", PRVM_ED_PrintEdicts_f);
-       Cmd_AddCommand ("prvm_edictcount", PRVM_ED_Count_f);
-       Cmd_AddCommand ("prvm_profile", PRVM_Profile_f);
-       Cmd_AddCommand ("prvm_fields", PRVM_Fields_f);
-       Cmd_AddCommand ("prvm_globals", PRVM_Globals_f);
-       Cmd_AddCommand ("prvm_global", PRVM_Global_f);
-       Cmd_AddCommand ("prvm_globalset", PRVM_GlobalSet_f);
-       Cmd_AddCommand ("prvm_edictset", PRVM_ED_EdictSet_f);
+       Cmd_AddCommand ("prvm_edict", PRVM_ED_PrintEdict_f, "print all data about an entity number in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_edicts", PRVM_ED_PrintEdicts_f, "set a property on an entity number in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_edictcount", PRVM_ED_Count_f, "prints number of active entities in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_profile", PRVM_Profile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_fields", PRVM_Fields_f, "prints usage statistics on properties (how many entities have non-zero values) in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_globals", PRVM_Globals_f, "prints all global variables in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_global", PRVM_Global_f, "prints value of a specified global variable in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_globalset", PRVM_GlobalSet_f, "sets value of a specified global variable in the selected VM (server, client, menu)");
+       Cmd_AddCommand ("prvm_edictset", PRVM_ED_EdictSet_f, "changes value of a specified property of a specified entity in the selected VM (server, client, menu)");
        // LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
        Cvar_RegisterVariable (&prvm_boundscheck);
        Cvar_RegisterVariable (&prvm_traceqc);