//4 feature darkplaces csqc: add builtin to clientside qc for reading triangles of model meshes (useful to orient a ui along a triangle of a model mesh)
//4 feature darkplaces csqc: add builtins to clientside qc for gl calls
-#ifndef PF_WARNING
-#define PF_WARNING(s) do{Con_Printf(s);PRVM_PrintState();return;}while(0)
-#endif
-
//[515]: really need new list ?
char *vm_cl_extensions =
"DP_CON_SET "
e = PRVM_G_EDICT(OFS_PARM0);
if (e == prog->edicts)
- PF_WARNING("setorigin: can not modify world entity\n");
+ {
+ VM_Warning("setorigin: can not modify world entity\n");
+ return;
+ }
if (e->priv.required->free)
- PF_WARNING("setorigin: can not modify free entity\n");
+ {
+ VM_Warning("setorigin: can not modify free entity\n");
+ return;
+ }
org = PRVM_G_VECTOR(OFS_PARM1);
VectorCopy (org, e->fields.client->origin);
}
e = PRVM_G_EDICT(OFS_PARM0);
if (e == prog->edicts)
- PF_WARNING("setsize: can not modify world entity\n");
+ {
+ VM_Warning("setsize: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setsize: can not modify free entity\n");
+ {
+ VM_Warning("setsize: can not modify free entity\n");
+ return;
+ }
min = PRVM_G_VECTOR(OFS_PARM1);
max = PRVM_G_VECTOR(OFS_PARM2);
attenuation = PRVM_G_FLOAT(OFS_PARM4);
if (volume < 0 || volume > 255)
- PF_WARNING("VM_CL_sound: volume must be in range 0-1\n");
+ {
+ VM_Warning("VM_CL_sound: volume must be in range 0-1\n");
+ return;
+ }
if (attenuation < 0 || attenuation > 4)
- PF_WARNING("VM_CL_sound: attenuation must be in range 0-4\n");
+ {
+ VM_Warning("VM_CL_sound: attenuation must be in range 0-4\n");
+ return;
+ }
if (channel < 0 || channel > 7)
- PF_WARNING("VM_CL_sound: channel must be in range 0-7\n");
+ {
+ VM_Warning("VM_CL_sound: channel must be in range 0-7\n");
+ return;
+ }
S_StartSound(32768 + PRVM_NUM_FOR_EDICT(entity), channel, S_FindName(sample), entity->fields.client->origin, volume, attenuation);
}
if(!cl.csqc_model_precache[i])
break;
if(i == MAX_MODELS)
- PF_WARNING("VM_CL_precache_model: no free models\n");
+ {
+ VM_Warning("VM_CL_precache_model: no free models\n");
+ return;
+ }
cl.csqc_model_precache[i] = (model_t*)m;
PRVM_G_FLOAT(OFS_RETURN) = -(i+1);
return;
}
- Con_Printf("VM_CL_precache_model: model \"%s\" not found\n", name);
+ VM_Warning("VM_CL_precache_model: model \"%s\" not found\n", name);
}
int CSQC_EntitiesInBox (vec3_t mins, vec3_t maxs, int maxlist, prvm_edict_t **list)
ent = PRVM_PROG_TO_EDICT(prog->globals.client->self);
if (ent == prog->edicts)
- PF_WARNING("droptofloor: can not modify world entity\n");
+ {
+ VM_Warning("droptofloor: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("droptofloor: can not modify free entity\n");
+ {
+ VM_Warning("droptofloor: can not modify free entity\n");
+ return;
+ }
VectorCopy (ent->fields.client->origin, end);
end[2] -= 256;
i = (int)PRVM_G_FLOAT(OFS_PARM0);
c = PRVM_G_STRING(OFS_PARM1);
if (i >= cl.max_lightstyle)
- PF_WARNING("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
+ {
+ VM_Warning("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
+ return;
+ }
strlcpy (cl.lightstyle[i].map, MSG_ReadString(), sizeof (cl.lightstyle[i].map));
cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("changeyaw: can not modify world entity\n");
+ {
+ VM_Warning("changeyaw: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("changeyaw: can not modify free entity\n");
+ {
+ VM_Warning("changeyaw: can not modify free entity\n");
+ return;
+ }
current = ANGLEMOD(ent->fields.client->angles[1]);
ideal = PRVM_G_FLOAT(OFS_PARM1);
speed = PRVM_G_FLOAT(OFS_PARM2);
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("changepitch: can not modify world entity\n");
+ {
+ VM_Warning("changepitch: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("changepitch: can not modify free entity\n");
+ {
+ VM_Warning("changepitch: can not modify free entity\n");
+ return;
+ }
current = ANGLEMOD( ent->fields.client->angles[0] );
ideal = PRVM_G_FLOAT(OFS_PARM1);
speed = PRVM_G_FLOAT(OFS_PARM2);
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("tracetoss: can not use world entity\n");
+ {
+ VM_Warning("tracetoss: can not use world entity\n");
+ return;
+ }
ignore = PRVM_G_EDICT(OFS_PARM1);
//FIXME
case VF_CL_VIEWANGLES_Z:cl.viewangles[2] = k;
break;
- default: Con_Printf("VM_R_SetView : unknown parm %i\n", c);
- PRVM_G_FLOAT(OFS_RETURN) = 0;
+ default: PRVM_G_FLOAT(OFS_RETURN) = 0;
+ VM_Warning("VM_R_SetView : unknown parm %i\n", c);
return;
}
PRVM_G_FLOAT(OFS_RETURN) = 1;
i = (int)PRVM_G_FLOAT(OFS_PARM0);
if(i < 0 || i >= MAX_CL_STATS)
{
- Con_Printf("VM_CL_getstatf: index>=MAX_CL_STATS or index<0\n");
+ VM_Warning("VM_CL_getstatf: index>=MAX_CL_STATS or index<0\n");
return;
}
dat.l = cl.stats[i];
if(index < 0 || index >= MAX_CL_STATS)
{
- Con_Printf("VM_CL_getstati: index>=MAX_CL_STATS or index<0\n");
+ VM_Warning("VM_CL_getstati: index>=MAX_CL_STATS or index<0\n");
return;
}
i = cl.stats[index];
i = (int)PRVM_G_FLOAT(OFS_PARM0);
if(i < 0 || i > MAX_CL_STATS-4)
{
- Con_Printf("VM_CL_getstats: index>MAX_CL_STATS-4 or index<0\n");
+ VM_Warning("VM_CL_getstats: index>MAX_CL_STATS-4 or index<0\n");
return;
}
t = VM_GetTempString();
{
i = -(i+1);
if(i >= MAX_MODELS)
- PF_WARNING("VM_CL_setmodelindex >= MAX_MODELS\n");
+ {
+ VM_Warning("VM_CL_setmodelindex >= MAX_MODELS\n");
+ return;
+ }
m = cl.csqc_model_precache[i];
}
else
if(i >= MAX_MODELS)
- PF_WARNING("VM_CL_setmodelindex >= MAX_MODELS\n");
+ {
+ VM_Warning("VM_CL_setmodelindex >= MAX_MODELS\n");
+ return;
+ }
else
m = cl.model_precache[i];
if(!m)
- PF_WARNING("VM_CL_setmodelindex: null model\n");
+ {
+ VM_Warning("VM_CL_setmodelindex: null model\n");
+ return;
+ }
t->fields.client->model = PRVM_SetEngineString(m->name);
t->fields.client->modelindex = i;
}
{
i = -(i+1);
if(i >= MAX_MODELS)
- PF_WARNING("VM_CL_modelnameforindex >= MAX_MODELS\n");
+ {
+ VM_Warning("VM_CL_modelnameforindex >= MAX_MODELS\n");
+ return;
+ }
if(cl.csqc_model_precache[i])
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(cl.csqc_model_precache[i]->name);
return;
}
if(i >= MAX_MODELS)
- PF_WARNING("VM_CL_modelnameforindex >= MAX_MODELS\n");
+ {
+ VM_Warning("VM_CL_modelnameforindex >= MAX_MODELS\n");
+ return;
+ }
if(cl.model_precache[i])
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(cl.model_precache[i]->name);
}
if (entnum >= MAX_EDICTS)
{
- Con_Printf("CSQC_ParseBeam: invalid entity number %i\n", entnum);
+ VM_Warning("CSQC_ParseBeam: invalid entity number %i\n", entnum);
return;
}
if (entnum >= cl.max_csqcentities)
model_t *model;
if (e == prog->edicts)
- PF_WARNING("setattachment: can not modify world entity\n");
+ {
+ VM_Warning("setattachment: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setattachment: can not modify free entity\n");
+ {
+ VM_Warning("setattachment: can not modify free entity\n");
+ return;
+ }
if (tagentity == NULL)
tagentity = prog->edicts;
int modelindex, tag_index;
if (ent == prog->edicts)
- PF_WARNING("gettagindex: can't affect world entity\n");
+ {
+ VM_Warning("gettagindex: can't affect world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("gettagindex: can't affect free entity\n");
+ {
+ VM_Warning("gettagindex: can't affect free entity\n");
+ return;
+ }
modelindex = (int)ent->fields.client->modelindex;
if(modelindex < 0)
switch(returncode)
{
case 1:
- PF_WARNING("gettagindex: can't affect world entity\n");
+ VM_Warning("gettagindex: can't affect world entity\n");
break;
case 2:
- PF_WARNING("gettagindex: can't affect free entity\n");
+ VM_Warning("gettagindex: can't affect free entity\n");
break;
case 3:
Con_DPrintf("CL_GetTagMatrix(entity #%i): null or non-precached model\n", PRVM_NUM_FOR_EDICT(e));
if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
{
- Con_Printf("VM_CL_selecttraceline: out of entities\n");
+ VM_Warning("VM_CL_selecttraceline: out of entities\n");
return;
}
else