CL_LinkEdict(e);
}
+static void SetMinMaxSize (prvm_edict_t *e, float *min, float *max)
+{
+ int i;
+
+ for (i=0 ; i<3 ; i++)
+ if (min[i] > max[i])
+ PRVM_ERROR("SetMinMaxSize: backwards mins/maxs");
+
+ // set derived values
+ VectorCopy (min, e->fields.client->mins);
+ VectorCopy (max, e->fields.client->maxs);
+ VectorSubtract (max, min, e->fields.client->size);
+
+ CL_LinkEdict (e);
+}
+
// #3 void(entity e, string m) setmodel
void VM_CL_setmodel (void)
{
prvm_edict_t *e;
const char *m;
- struct model_s *mod;
+ model_t *mod;
int i;
VM_SAFEPARMCOUNT(2, VM_CL_setmodel);
e->fields.client->modelindex = 0;
e->fields.client->model = 0;
VM_Warning ("setmodel: model '%s' not precached\n", m);
+
+ // TODO: check if this breaks needed consistency and maybe add a cvar for it too?? [1/10/2008 Black]
+ if (mod)
+ {
+ SetMinMaxSize (e, mod->normalmins, mod->normalmaxs);
+ }
+ else
+ SetMinMaxSize (e, vec3_origin, vec3_origin);
}
// #4 void(entity e, vector min, vector max) setsize
min = PRVM_G_VECTOR(OFS_PARM1);
max = PRVM_G_VECTOR(OFS_PARM2);
- VectorCopy (min, e->fields.client->mins);
- VectorCopy (max, e->fields.client->maxs);
- VectorSubtract (max, min, e->fields.client->size);
+ SetMinMaxSize( e, min, max );
CL_LinkEdict(e);
}
{
prvm_edict_t *ed;
ed = PRVM_ED_Alloc();
- // FIXME: WTF.. this should be removed imo.. entnum points to the server.. [12/17/2007 Black]
- ed->fields.client->entnum = PRVM_NUM_FOR_EDICT(ed); //[515]: not needed any more ?
VM_RETURN_EDICT(ed);
}
}
t->fields.client->model = PRVM_SetEngineString(model->name);
t->fields.client->modelindex = i;
+
+ // TODO: check if this breaks needed consistency and maybe add a cvar for it too?? [1/10/2008 Black]
+ if (model)
+ {
+ SetMinMaxSize (t, model->normalmins, model->normalmaxs);
+ }
+ else
+ SetMinMaxSize (t, vec3_origin, vec3_origin);
}
//#334 string(float mdlindex) modelnameforindex (EXT_CSQC)
//PF_getsurfacepointattribute, // #486 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
// float SPA_POSITION = 0;
// float SPA_S_AXIS = 1;
-// float SPA_R_AXIS = 2;
-// float SPA_T_AXIS = 3; // same as SPA_NORMAL
+// float SPA_T_AXIS = 2;
+// float SPA_R_AXIS = 3; // same as SPA_NORMAL
// float SPA_TEXCOORDS0 = 4;
// float SPA_LIGHTMAP0_TEXCOORDS = 5;
// float SPA_LIGHTMAP0_COLOR = 6;
int pointnum;
int attributetype;
- VM_SAFEPARMCOUNT(3, VM_CL_getsurfacenumpoints);
+ VM_SAFEPARMCOUNT(4, VM_CL_getsurfacenumpoints);
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
ed = PRVM_G_EDICT(OFS_PARM0);
if (!(model = CL_GetModelFromEdict(ed)) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
case 1:
VectorCopy(&(model->surfmesh.data_svector3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
break;
- // float SPA_R_AXIS = 2;
+ // float SPA_T_AXIS = 2;
case 2:
VectorCopy(&(model->surfmesh.data_tvector3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
break;
- // float SPA_T_AXIS = 3; // same as SPA_NORMAL
+ // float SPA_R_AXIS = 3; // same as SPA_NORMAL
case 3:
VectorCopy(&(model->surfmesh.data_normal3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
break;
// float SPA_LIGHTMAP0_COLOR = 6;
case 6:
// ignore alpha for now..
- VectorCopy( &(model->surfmesh.data_normal3f + 4 * surface->num_firstvertex)[pointnum * 4], PRVM_G_VECTOR(OFS_RETURN));
+ VectorCopy( &(model->surfmesh.data_lightmapcolor4f + 4 * surface->num_firstvertex)[pointnum * 4], PRVM_G_VECTOR(OFS_RETURN));
break;
default:
VectorSet( PRVM_G_VECTOR(OFS_RETURN), 0.0f, 0.0f, 0.0f );
//============================================================================
// To create a almost working builtin file from this replace:
-// "^NULL,.*" with ""
-// "^{.*//.*}:Wh\(.*)" with ""
+// "^NULL.*" with ""
+// "^{.*//.*}:Wh\(.*\)" with "\1"
// "\:" with "//"
-// ".*//:Wh{\#:d*}:Wh{.*}" with "\2 = \1;"
+// "^.*//:Wh{\#:d*}:Wh{.*}" with "\2 = \1;"
// "\n\n+" with "\n\n"
prvm_builtin_t vm_cl_builtins[] = {
VM_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
VM_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
VM_CL_getsurfacepointattribute,// #486 vector(entity e, float s, float n, float a) getsurfacepointattribute
-#ifdef SUPPORT_GECKO
VM_gecko_create, // #487 float gecko_create( string name )
VM_gecko_destroy, // #488 void gecko_destroy( string name )
VM_gecko_navigate, // #489 void gecko_navigate( string name, string URI )
VM_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y )
VM_gecko_resize, // #492 void gecko_resize( string name, float w, float h )
VM_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name )
-#else
-NULL, // #487
-NULL, // #488
-NULL, // #489
-NULL, // #490
-NULL, // #491
-NULL, // #492
-NULL, // #493
-#endif
NULL, // #494
NULL, // #495
NULL, // #496