"DP_HALFLIFE_MAP "
"DP_HALFLIFE_MAP_CVAR "
"DP_INPUTBUTTONS "
+"DP_LITSUPPORT "
"DP_MONSTERWALK "
"DP_MOVETYPEBOUNCEMISSILE "
"DP_MOVETYPEFOLLOW "
"NEH_CMD_PLAY2 "
"NEH_RESTOREGAME "
"TW_SV_STEPCONTROL "
+"DP_QC_FS_SEARCH " // Black: same as in the menu qc
;
qboolean checkextension(char *name)
float *org;
e = G_EDICT(OFS_PARM0);
+ if (e == sv.edicts)
+ Host_Error("setorigin: can not modify world entity\n");
+ if (e->e->free)
+ Host_Error("setorigin: can not modify free entity\n");
org = G_VECTOR(OFS_PARM1);
VectorCopy (org, e->v->origin);
SV_LinkEdict (e, false);
float *min, *max;
e = G_EDICT(OFS_PARM0);
+ if (e == sv.edicts)
+ Host_Error("setsize: can not modify world entity\n");
+ if (e->e->free)
+ Host_Error("setsize: can not modify free entity\n");
min = G_VECTOR(OFS_PARM1);
max = G_VECTOR(OFS_PARM2);
SetMinMaxSize (e, min, max, false);
int i;
e = G_EDICT(OFS_PARM0);
+ if (e == sv.edicts)
+ Host_Error("setmodel: can not modify world entity\n");
+ if (e->e->free)
+ Host_Error("setmodel: can not modify free entity\n");
m = G_STRING(OFS_PARM1);
// check to see if model was properly precached
pr_xfunction->builtinsprofile += 600;
ent = G_EDICT(OFS_PARM0);
+ if (ent == sv.edicts)
+ Host_Error("tracetoss: can not use world entity\n");
ignore = G_EDICT(OFS_PARM1);
trace = SV_Trace_Toss (ent, ignore);
=================
PF_localcmd
-Sends text over to the client's execution buffer
+Sends text to server console
localcmd (string)
=================
Host_Error("remove: tried to remove world\n");
if (NUM_FOR_EDICT(ed) <= svs.maxclients)
Host_Error("remove: tried to remove a client\n");
+ // LordHavoc: not an error because id1 progs did this in some cases (killtarget removes entities, even if they are already removed in some cases...)
+ if (ed->e->free && developer.integer)
+ Con_Printf("remove: tried to remove an entity that was already removed\n");
ED_Free (ed);
}
int oldself;
ent = PROG_TO_EDICT(pr_global_struct->self);
+ if (ent == sv.edicts)
+ Host_Error("walkmove: can not modify world entity\n");
+ if (ent->e->free)
+ Host_Error("walkmove: can not modify free entity\n");
yaw = G_FLOAT(OFS_PARM0);
dist = G_FLOAT(OFS_PARM1);
trace_t trace;
ent = PROG_TO_EDICT(pr_global_struct->self);
+ if (ent == sv.edicts)
+ Host_Error("droptofloor: can not modify world entity\n");
+ if (ent->e->free)
+ Host_Error("droptofloor: can not modify free entity\n");
VectorCopy (ent->v->origin, end);
end[2] -= 256;
float speed;
ent = G_EDICT(OFS_PARM0);
+ if (ent == sv.edicts)
+ Host_Error("aim: can not use world entity\n");
+ if (ent->e->free)
+ Host_Error("aim: can not use free entity\n");
speed = G_FLOAT(OFS_PARM1);
VectorCopy (ent->v->origin, start);
float ideal, current, move, speed;
ent = PROG_TO_EDICT(pr_global_struct->self);
+ if (ent == sv.edicts)
+ Host_Error("changeyaw: can not modify world entity\n");
+ if (ent->e->free)
+ Host_Error("changeyaw: can not modify free entity\n");
current = ANGLEMOD(ent->v->angles[1]);
ideal = ent->v->ideal_yaw;
speed = ent->v->yaw_speed;
eval_t *val;
ent = G_EDICT(OFS_PARM0);
+ if (ent == sv.edicts)
+ Host_Error("changepitch: can not modify world entity\n");
+ if (ent->e->free)
+ Host_Error("changepitch: can not modify free entity\n");
current = ANGLEMOD( ent->v->angles[0] );
if ((val = GETEDICTFIELDVALUE(ent, eval_idealpitch)))
ideal = val->_float;
ent = PROG_TO_EDICT(pr_global_struct->msg_entity);
entnum = NUM_FOR_EDICT(ent);
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
- Con_Printf("WriteDest: tried to write to non-client\n");
+ Host_Error("WriteDest: tried to write to non-client\n");
return &svs.clients[entnum-1].message;
case MSG_ALL:
int i, large;
ent = G_EDICT(OFS_PARM0);
+ if (ent == sv.edicts)
+ Host_Error("makestatic: can not modify world entity\n");
+ if (ent->e->free)
+ Host_Error("makestatic: can not modify free entity\n");
large = false;
if (ent->v->modelindex >= 256 || ent->v->frame >= 256)
{
edict_t *in, *out;
in = G_EDICT(OFS_PARM0);
+ if (in == sv.edicts)
+ Host_Error("copyentity: can not read world entity\n");
+ if (in->e->free)
+ Host_Error("copyentity: can not read free entity\n");
out = G_EDICT(OFS_PARM1);
+ if (out == sv.edicts)
+ Host_Error("copyentity: can not modify world entity\n");
+ if (out->e->free)
+ Host_Error("copyentity: can not modify free entity\n");
memcpy(out->v, in->v, progs->entityfields * 4);
}
int i, modelindex;
model_t *model;
+ if (e == sv.edicts)
+ Host_Error("setattachment: can not modify world entity\n");
+ if (e->e->free)
+ Host_Error("setattachment: can not modify free entity\n");
+
if (tagentity == NULL)
tagentity = sv.edicts;
if (tagentity != NULL && tagentity != sv.edicts && tagname && tagname[0])
{
modelindex = (int)tagentity->v->modelindex;
- if (modelindex >= 0 && modelindex < MAX_MODELS)
+ if (modelindex >= 0 && modelindex < MAX_MODELS && (model = sv.models[modelindex]))
{
- model = sv.models[modelindex];
if (model->data_overridetagnamesforskin && (unsigned int)tagentity->v->skin < (unsigned int)model->numskins && model->data_overridetagnamesforskin[(unsigned int)tagentity->v->skin].num_overridetagnames)
for (i = 0;i < model->data_overridetagnamesforskin[(unsigned int)tagentity->v->skin].num_overridetagnames;i++)
if (!strcmp(tagname, model->data_overridetagnamesforskin[(unsigned int)tagentity->v->skin].data_overridetagnames[i].name))
}
+/////////////////////////////////////////
+// DP_QC_FS_SEARCH extension
+
+// qc fs search handling
+#define MAX_SEARCHES 128
+
+fssearch_t *pr_fssearchlist[MAX_SEARCHES];
+
+void PR_Search_Init(void)
+{
+ memset(pr_fssearchlist,0,sizeof(pr_fssearchlist));
+}
+
+void PR_Search_Reset(void)
+{
+ int i;
+ // reset the fssearch list
+ for(i = 0; i < MAX_SEARCHES; i++)
+ if(pr_fssearchlist[i])
+ FS_FreeSearch(pr_fssearchlist[i]);
+ memset(pr_fssearchlist,0,sizeof(pr_fssearchlist));
+}
+
+/*
+=========
+PF_search_begin
+
+float search_begin(string pattern, float caseinsensitive, float quiet)
+=========
+*/
+void PF_search_begin(void)
+{
+ int handle;
+ char *pattern;
+ int caseinsens, quiet;
+
+ pattern = G_STRING(OFS_PARM0);
+
+ PR_CheckEmptyString(pattern);
+
+ caseinsens = G_FLOAT(OFS_PARM1);
+ quiet = G_FLOAT(OFS_PARM2);
+
+ for(handle = 0; handle < MAX_SEARCHES; handle++)
+ if(!pr_fssearchlist[handle])
+ break;
+
+ if(handle >= MAX_SEARCHES)
+ {
+ Con_Printf("PR_search_begin: ran out of search handles (%i)\n", MAX_SEARCHES);
+ G_FLOAT(OFS_RETURN) = -2;
+ return;
+ }
+
+ if(!(pr_fssearchlist[handle] = FS_Search(pattern,caseinsens, quiet)))
+ G_FLOAT(OFS_RETURN) = -1;
+ else
+ G_FLOAT(OFS_RETURN) = handle;
+}
+
+/*
+=========
+VM_search_end
+
+void search_end(float handle)
+=========
+*/
+void PF_search_end(void)
+{
+ int handle;
+
+ handle = G_FLOAT(OFS_PARM0);
+
+ if(handle < 0 || handle >= MAX_SEARCHES)
+ {
+ Con_Printf("PF_search_end: invalid handle %i\n", handle);
+ return;
+ }
+ if(pr_fssearchlist[handle] == NULL)
+ {
+ Con_Printf("PF_search_end: no such handle %i\n", handle);
+ return;
+ }
+
+ FS_FreeSearch(pr_fssearchlist[handle]);
+ pr_fssearchlist[handle] = NULL;
+}
+
+/*
+=========
+VM_search_getsize
+
+float search_getsize(float handle)
+=========
+*/
+void PF_search_getsize(void)
+{
+ int handle;
+
+ handle = G_FLOAT(OFS_PARM0);
+
+ if(handle < 0 || handle >= MAX_SEARCHES)
+ {
+ Con_Printf("PF_search_getsize: invalid handle %i\n", handle);
+ return;
+ }
+ if(pr_fssearchlist[handle] == NULL)
+ {
+ Con_Printf("PF_search_getsize: no such handle %i\n", handle);
+ return;
+ }
+
+ G_FLOAT(OFS_RETURN) = pr_fssearchlist[handle]->numfilenames;
+}
+
+/*
+=========
+VM_search_getfilename
+
+string search_getfilename(float handle, float num)
+=========
+*/
+void PF_search_getfilename(void)
+{
+ int handle, filenum;
+ char *tmp;
+
+ handle = G_FLOAT(OFS_PARM0);
+ filenum = G_FLOAT(OFS_PARM1);
+
+ if(handle < 0 || handle >= MAX_SEARCHES)
+ {
+ Con_Printf("PF_search_getfilename: invalid handle %i\n", handle);
+ return;
+ }
+ if(pr_fssearchlist[handle] == NULL)
+ {
+ Con_Printf("PF_search_getfilename: no such handle %i\n", handle);
+ return;
+ }
+ if(filenum < 0 || filenum >= pr_fssearchlist[handle]->numfilenames)
+ {
+ Con_Printf("PF_search_getfilename: invalid filenum %i\n", filenum);
+ return;
+ }
+
+ tmp = PR_GetTempString();
+ strcpy(tmp, pr_fssearchlist[handle]->filenames[filenum]);
+
+ G_INT(OFS_RETURN) = PR_SetString(tmp);
+}
+
+
builtin_t pr_builtin[] =
{
NULL, // #0
PF_tokenize, // #441 float(string s) tokenize (KRIMZON_SV_PARSECLIENTCOMMAND)
PF_argv, // #442 string(float n) argv (KRIMZON_SV_PARSECLIENTCOMMAND)
PF_setattachment, // #443 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS)
-NULL, // #444
-NULL, // #445
-NULL, // #446
-NULL, // #447
+PF_search_begin, // #444
+PF_search_end, // #445
+PF_search_getsize, // #446
+PF_search_getfilename, // #447
NULL, // #448
NULL, // #449
a a a a a // #450-499 (LordHavoc)
{
pr_strings_mempool = Mem_AllocPool("pr_stringszone");
PR_Files_Init();
+ PR_Search_Init();
}
void PR_Cmd_Reset(void)
{
Mem_EmptyPool(pr_strings_mempool);
+ PR_Search_Reset();
PR_Files_CloseAll();
}