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);
}
{
VM_SAFEPARMCOUNT(0, VM_CL_R_ClearScene);
// clear renderable entity and light lists
- r_refdef.numentities = 0;
- r_refdef.numlights = 0;
+ r_refdef.scene.numentities = 0;
+ r_refdef.scene.numlights = 0;
// FIXME: restore these to the values from VM_CL_UpdateView
r_refdef.view.x = 0;
r_refdef.view.y = 0;
VM_SAFEPARMCOUNTRANGE(3, 3, VM_CL_R_AddDynamicLight);
// if we've run out of dlights, just return
- if (r_refdef.numlights >= MAX_DLIGHTS)
+ if (r_refdef.scene.numlights >= MAX_DLIGHTS)
return;
pos = PRVM_G_VECTOR(OFS_PARM0);
col = PRVM_G_VECTOR(OFS_PARM2);
Matrix4x4_CreateFromQuakeEntity(&matrix, pos[0], pos[1], pos[2], 0, 0, 0, PRVM_G_FLOAT(OFS_PARM1));
- R_RTLight_Update(&r_refdef.lights[r_refdef.numlights++], false, &matrix, col, -1, NULL, true, 1, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ R_RTLight_Update(&r_refdef.scene.lights[r_refdef.scene.numlights++], false, &matrix, col, -1, NULL, true, 1, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
//============================================================================
}
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 );
DrawQ_Mesh (&mesh, (p->flags&0x0f));
}
+// TODO: move this into the client code and clean-up everything else, too! [1/6/2008 Black]
void VM_CL_AddPolygonsToMeshQueue (void)
{
int i;
vmpolygons_t* polys = vmpolygons + PRVM_GetProgNr();
+ // only add polygons of the currently active prog to the queue - if there is none, we're done
+ if( !prog )
+ return;
+
if(!polys->drawpolygons_num)
return;
R_Mesh_Matrix(&identitymatrix);
//============================================================================
+// To create a almost working builtin file from this replace:
+// "^NULL.*" with ""
+// "^{.*//.*}:Wh\(.*\)" with "\1"
+// "\:" with "//"
+// "^.*//:Wh{\#:d*}:Wh{.*}" with "\2 = \1;"
+// "\n\n+" with "\n\n"
+
prvm_builtin_t vm_cl_builtins[] = {
NULL, // #0 NULL function (not callable) (QUAKE)
VM_CL_makevectors, // #1 void(vector ang) makevectors (QUAKE)
VM_vectoyaw, // #13 float(vector v) vectoyaw (QUAKE)
VM_CL_spawn, // #14 entity() spawn (QUAKE)
VM_remove, // #15 void(entity e) remove (QUAKE)
-VM_CL_traceline, // #16 float(vector v1, vector v2, float tryents) traceline (QUAKE)
+VM_CL_traceline, // #16 float(vector v1, vector v2, float tryents, entity ignoreentity) traceline (QUAKE)
NULL, // #17 entity() checkclient (QUAKE)
VM_find, // #18 entity(entity start, .string fld, string match) find (QUAKE)
VM_precache_sound, // #19 void(string s) precache_sound (QUAKE)
VM_traceon, // #29 void() traceon (QUAKE)
VM_traceoff, // #30 void() traceoff (QUAKE)
VM_eprint, // #31 void(entity e) eprint (QUAKE)
-VM_CL_walkmove, // #32 float(float yaw, float dist) walkmove (QUAKE)
+VM_CL_walkmove, // #32 float(float yaw, float dist[, float settrace]) walkmove (QUAKE)
NULL, // #33 (QUAKE)
VM_CL_droptofloor, // #34 float() droptofloor (QUAKE)
VM_CL_lightstyle, // #35 void(float style, string value) lightstyle (QUAKE)
VM_CL_setcursormode, // #343 void(float usecursor) setcursormode (EXT_CSQC)
VM_getmousepos, // #344 vector() getmousepos (EXT_CSQC)
VM_CL_getinputstate, // #345 float(float framenum) getinputstate (EXT_CSQC)
-VM_CL_setsensitivityscale, // #346 void(float sens) setsensitivityscaler (EXT_CSQC)
+VM_CL_setsensitivityscale, // #346 void(float sens) setsensitivityscale (EXT_CSQC)
VM_CL_runplayerphysics, // #347 void() runstandardplayerphysics (EXT_CSQC)
VM_CL_getplayerkey, // #348 string(float playernum, string keyname) getplayerkeyvalue (EXT_CSQC)
VM_CL_isdemo, // #349 float() isdemo (EXT_CSQC)
NULL, // #454 entity() spawnclient (DP_SV_BOTCLIENT)
NULL, // #455 float(entity clent) clienttype (DP_SV_BOTCLIENT)
NULL, // #456 void(float to, string s) WriteUnterminatedString (DP_SV_WRITEUNTERMINATEDSTRING)
-VM_CL_te_flamejet, // #457 void(vector org, vector vel, float howmany) te_flamejet = #457 (DP_TE_FLAMEJET)
+VM_CL_te_flamejet, // #457 void(vector org, vector vel, float howmany) te_flamejet (DP_TE_FLAMEJET)
NULL, // #458
VM_ftoe, // #459 entity(float num) entitybyindex (DP_QC_EDICT_NUM)
VM_buf_create, // #460 float() buf_create (DP_QC_STRINGBUFFERS)
VM_strtolower, // #480 string(string s) VM_strtolower (DP_QC_STRING_CASE_FUNCTIONS)
VM_strtoupper, // #481 string(string s) VM_strtoupper (DP_QC_STRING_CASE_FUNCTIONS)
VM_cvar_defstring, // #482 string(string s) cvar_defstring (DP_QC_CVAR_DEFSTRING)
-VM_CL_pointsound, // #483 void(vector origin, string sample, float volume, float attenuation) (DP_SV_POINTSOUND)
+VM_CL_pointsound, // #483 void(vector origin, string sample, float volume, float attenuation) pointsound (DP_SV_POINTSOUND)
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 = #486;
-#ifdef SUPPORT_GECKO
-VM_gecko_create, // #487
-VM_gecko_destroy, // #488
-VM_gecko_navigate, // #489
-VM_gecko_keyevent, // #490
-VM_gecko_movemouse, // #491
-#else
-NULL, // #487
-NULL, // #488
-NULL, // #489
-NULL, // #490
-NULL, // #491
-#endif
-NULL, // #492
-NULL, // #493
-NULL, // #494
+VM_CL_getsurfacepointattribute,// #486 vector(entity e, float s, float n, float a) getsurfacepointattribute
+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_keyevent, // #490 float gecko_keyevent( string name, float key, float eventtype )
+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 )
+VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
NULL, // #495
NULL, // #496
NULL, // #497