X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=prvm_edict.c;h=150d72c1a0bf5a287b4e415154da253aaf0598d8;hb=50804f7075a727286ca58efcf890861afe314ee8;hp=94d74a53be86fa6ac61dea41d4ba646ae8d4a4fe;hpb=ef21868609c3bf4cae418b31847a008f1e6db685;p=xonotic%2Fdarkplaces.git diff --git a/prvm_edict.c b/prvm_edict.c index 94d74a53..150d72c1 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -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"); @@ -1494,7 +1499,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 +1744,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);