]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Added the console commands edictset and prvm_edictset.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Dec 2003 17:54:22 +0000 (17:54 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Dec 2003 17:54:22 +0000 (17:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3744 d7cf8633-e32d-0410-b094-e92efae38249

pr_edict.c
prvm_edict.c
todo

index 89e6f3f17bfad4591ddcf4a5ff07a13d9f2b53e5..2a77bac1d4df77add0a2927f635045d3f2c6103d 100644 (file)
@@ -800,6 +800,34 @@ void ED_WriteGlobals (qfile_t *f)
        FS_Printf (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_Printf("edictset <edict number> <field> <value>\n");
+               return;
+       }
+       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));
+}
+
 /*
 =============
 ED_ParseGlobals
@@ -1553,6 +1581,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);
index 45f17c610dbca203da877c79b7c69c187521a41d..daa322d031e6e857a7190f8e8b1f427aa0d70646 100644 (file)
@@ -896,7 +896,6 @@ char *PRVM_ED_NewString (const char *string)
        return new;
 }
 
-
 /*
 =============
 PRVM_ED_ParseEval
@@ -985,6 +984,44 @@ qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s)
        return true;
 }
 
+/*
+=============
+PRVM_ED_EdictSet_f
+
+Console command to set a field of a specified edict
+=============
+*/
+void PRVM_ED_EdictSet_f(void)
+{
+       prvm_edict_t *ed;
+       ddef_t *key;
+
+       if(Cmd_Argc() != 5)
+       {
+               Con_Printf("prvm_edictset <program name> <edict number> <field> <value>\n");
+               return;
+       }
+
+       PRVM_Begin;
+       if(!PRVM_SetProgFromString(Cmd_Argv(1)))
+       {
+               Con_Printf("Wrong program name %s !\n", Cmd_Argv(1));
+               return;
+       }
+
+       ed = PRVM_EDICT_NUM(atoi(Cmd_Argv(2)));
+
+       if((key = PRVM_ED_FindField(Cmd_Argv(3))) == 0)
+       {
+               Con_Printf("Key %s not found !\n", Cmd_Argv(3));
+               return;
+       }
+
+       PRVM_ED_ParseEpair(ed, key, Cmd_Argv(4));
+
+       PRVM_End;
+}
+
 /*
 ====================
 PRVM_ED_ParseEdict
@@ -1635,6 +1672,7 @@ void PRVM_Init (void)
        Cmd_AddCommand ("prvm_profile", PRVM_Profile_f);
        Cmd_AddCommand ("prvm_fields", PRVM_Fields_f);
        Cmd_AddCommand ("prvm_globals", PRVM_Globals_f);
+       Cmd_AddCommand ("prvm_edictset", PRVM_ED_EdictSet_f);
        // 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);
diff --git a/todo b/todo
index 7196b9b7e7acab3585e573d2f29b7e300f469d40..1ab5e93bffbdf1c904b666e2e52d7f21003714c9 100644 (file)
--- a/todo
+++ b/todo
@@ -210,7 +210,7 @@ d darkplaces: q1bsp trace bug: scrags frequently fly through ceilings - this nee
 1 lhfire: get lhfire_gui build from Tomaz.
 1 lhfire: post lhfire_gui build.
 1 lhfire: prepare example scripts for release.
-2 darkplaces: add a "edictset" command to console to set a single field of an edict to the specified value
+-n darkplaces: add a "edictset" command to console to set a single field of an edict to the specified value
 2 darkplaces: add a flag/effect/whatever for double sided entity rendering (disable cull face for this entity) (yummyluv)
 2 darkplaces: add and document DP_SOUND_DIRECTIONLESSATTNNONE extension
 2 darkplaces: add and document DP_SOUND_STEREOWAV extension