int move, svent;
prvm_edict_t *ent;
- R_TimeReport("pretraceline");
+// R_TimeReport("pretraceline");
VM_SAFEPARMCOUNTRANGE(4, 4, VM_CL_traceline);
trace = CL_TraceLine(v1, v2, move, ent, CL_GenericHitSuperContentsMask(ent), CL_HitNetworkBrushModels(move), CL_HitNetworkPlayers(move), &svent, true);
CL_VM_SetTraceGlobals(&trace, svent);
- R_TimeReport("traceline");
+// R_TimeReport("traceline");
}
/*
int move, svent;
prvm_edict_t *ent;
- R_TimeReport("pretracebox");
+// R_TimeReport("pretracebox");
VM_SAFEPARMCOUNTRANGE(6, 8, VM_CL_tracebox); // allow more parameters for future expansion
prog->xfunction->builtinsprofile += 30;
trace = CL_TraceBox(v1, m1, m2, v2, move, ent, CL_GenericHitSuperContentsMask(ent), CL_HitNetworkBrushModels(move), CL_HitNetworkPlayers(move), &svent, true);
CL_VM_SetTraceGlobals(&trace, svent);
- R_TimeReport("tracebox");
+// R_TimeReport("tracebox");
}
trace_t CL_Trace_Toss (prvm_edict_t *tossent, prvm_edict_t *ignore, int *svent)
CL_ParticleEffect(i, n, f, f, v, v, NULL, prog->argc >= 5 ? (int)PRVM_G_FLOAT(OFS_PARM4) : 0);
}
+//#531 void(float pause) setpause
+static void VM_CL_setpause(void)
+{
+ VM_SAFEPARMCOUNT(1, VM_CL_setpause);
+ if ((int)PRVM_G_FLOAT(OFS_PARM0) != 0)
+ cl.csqc_paused = true;
+ else
+ cl.csqc_paused = false;
+}
+
//#342 string(float keynum) getkeybind (EXT_CSQC)
static void VM_CL_getkeybind (void)
{
PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(t);
}
-//#349 float() isdemo (EXT_CSQC)
-static void VM_CL_isdemo (void)
-{
- VM_SAFEPARMCOUNT(0, VM_CL_isdemo);
- PRVM_G_FLOAT(OFS_RETURN) = cls.demoplayback;
-}
-
//#351 void(vector origin, vector forward, vector right, vector up) SetListener (EXT_CSQC)
static void VM_CL_setlistener (void)
{
float stainsize;
float delayspawn;
float delaycollision;
+ float angle;
+ float spin;
}vmparticletheme_t;
// particle spawner
float *particle_staintex;
float *particle_delayspawn;
float *particle_delaycollision;
+ float *particle_angle;
+ float *particle_spin;
}vmparticlespawner_t;
vmparticlespawner_t vmpartspawner;
getglobal(particle_staintex, "particle_staintex");
getglobal(particle_delayspawn, "particle_delayspawn");
getglobal(particle_delaycollision, "particle_delaycollision");
+ getglobal(particle_angle, "particle_angle");
+ getglobal(particle_spin, "particle_spin");
#undef getglobal
#undef getglobalvector
}
theme->staintex = -1;
theme->delayspawn = 0.0f;
theme->delaycollision = 0.0f;
+ theme->angle = 0.0f;
+ theme->spin = 0.0f;
}
// particle theme -> QC globals
*vmpartspawner.particle_stainsize = (float)theme->stainsize;
*vmpartspawner.particle_delayspawn = theme->delayspawn;
*vmpartspawner.particle_delaycollision = theme->delaycollision;
+ *vmpartspawner.particle_angle = theme->angle;
+ *vmpartspawner.particle_spin = theme->spin;
}
// QC globals -> particle theme
theme->stainsize = *vmpartspawner.particle_stainsize;
theme->delayspawn = *vmpartspawner.particle_delayspawn;
theme->delaycollision = *vmpartspawner.particle_delaycollision;
+ theme->angle = *vmpartspawner.particle_angle;
+ theme->spin = *vmpartspawner.particle_spin;
}
// init particle spawner interface
if (prog->argc < 3) // global-set particle
{
- part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)(vmpartspawner.particle_color1[0]) << 16) + ((int)(vmpartspawner.particle_color1[1]) << 8) + ((int)(vmpartspawner.particle_color1[2])), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, (int)(vmpartspawner.particle_staincolor1[0])*65536 + (int)(vmpartspawner.particle_staincolor1[1])*256 + (int)(vmpartspawner.particle_staincolor1[2]), (int)(vmpartspawner.particle_staincolor2[0])*65536 + (int)(vmpartspawner.particle_staincolor2[1])*256 + (int)(vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize);
+ part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)(vmpartspawner.particle_color1[0]) << 16) + ((int)(vmpartspawner.particle_color1[1]) << 8) + ((int)(vmpartspawner.particle_color1[2])), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, (int)(vmpartspawner.particle_staincolor1[0])*65536 + (int)(vmpartspawner.particle_staincolor1[1])*256 + (int)(vmpartspawner.particle_staincolor1[2]), (int)(vmpartspawner.particle_staincolor2[0])*65536 + (int)(vmpartspawner.particle_staincolor2[1])*256 + (int)(vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin);
if (!part)
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
return;
}
theme = &vmpartspawner.themes[themenum];
- part = CL_NewParticle(org, theme->typeindex, theme->color1, theme->color2, theme->tex, theme->size, theme->sizeincrease, theme->alpha, theme->alphafade, theme->gravity, theme->bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], theme->airfriction, theme->liquidfriction, theme->originjitter, theme->velocityjitter, theme->qualityreduction, theme->lifetime, theme->stretch, theme->blendmode, theme->orientation, theme->staincolor1, theme->staincolor2, theme->staintex, theme->stainalpha, theme->stainsize);
+ part = CL_NewParticle(org, theme->typeindex, theme->color1, theme->color2, theme->tex, theme->size, theme->sizeincrease, theme->alpha, theme->alphafade, theme->gravity, theme->bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], theme->airfriction, theme->liquidfriction, theme->originjitter, theme->velocityjitter, theme->qualityreduction, theme->lifetime, theme->stretch, theme->blendmode, theme->orientation, theme->staincolor1, theme->staincolor2, theme->staintex, theme->stainalpha, theme->stainsize, theme->angle, theme->spin);
if (!part)
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
org = PRVM_G_VECTOR(OFS_PARM0);
dir = PRVM_G_VECTOR(OFS_PARM1);
if (prog->argc < 5) // global-set particle
- part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)vmpartspawner.particle_color1[0] << 16) + ((int)vmpartspawner.particle_color1[1] << 8) + ((int)vmpartspawner.particle_color1[2]), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, ((int)vmpartspawner.particle_staincolor1[0] << 16) + ((int)vmpartspawner.particle_staincolor1[1] << 8) + ((int)vmpartspawner.particle_staincolor1[2]), ((int)vmpartspawner.particle_staincolor2[0] << 16) + ((int)vmpartspawner.particle_staincolor2[1] << 8) + ((int)vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize);
+ part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)vmpartspawner.particle_color1[0] << 16) + ((int)vmpartspawner.particle_color1[1] << 8) + ((int)vmpartspawner.particle_color1[2]), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, ((int)vmpartspawner.particle_staincolor1[0] << 16) + ((int)vmpartspawner.particle_staincolor1[1] << 8) + ((int)vmpartspawner.particle_staincolor1[2]), ((int)vmpartspawner.particle_staincolor2[0] << 16) + ((int)vmpartspawner.particle_staincolor2[1] << 8) + ((int)vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin);
else // themed particle
{
themenum = (int)PRVM_G_FLOAT(OFS_PARM4);
return;
}
theme = &vmpartspawner.themes[themenum];
- part = CL_NewParticle(org, theme->typeindex, theme->color1, theme->color2, theme->tex, theme->size, theme->sizeincrease, theme->alpha, theme->alphafade, theme->gravity, theme->bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], theme->airfriction, theme->liquidfriction, theme->originjitter, theme->velocityjitter, theme->qualityreduction, theme->lifetime, theme->stretch, theme->blendmode, theme->orientation, theme->staincolor1, theme->staincolor2, theme->staintex, theme->stainalpha, theme->stainsize);
+ part = CL_NewParticle(org, theme->typeindex, theme->color1, theme->color2, theme->tex, theme->size, theme->sizeincrease, theme->alpha, theme->alphafade, theme->gravity, theme->bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], theme->airfriction, theme->liquidfriction, theme->originjitter, theme->velocityjitter, theme->qualityreduction, theme->lifetime, theme->stretch, theme->blendmode, theme->orientation, theme->staincolor1, theme->staincolor2, theme->staintex, theme->stainalpha, theme->stainsize, theme->angle, theme->spin);
}
if (!part)
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
}
-//
+//====================
+//CSQC engine entities query
+//====================
+
+// float(float entitynum, float whatfld) getentity;
+// vector(float entitynum, float whatfld) getentityvec;
+// querying engine-drawn entity
+// VorteX: currently it's only tested with whatfld = 1..7
+void VM_CL_GetEntity (void)
+{
+ int entnum, fieldnum;
+ float org[3], v1[3], v2[3];
+ VM_SAFEPARMCOUNT(2, VM_CL_GetEntityVec);
+
+ entnum = PRVM_G_FLOAT(OFS_PARM0);
+ if (entnum < 0 || entnum >= cl.num_entities)
+ {
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ return;
+ }
+ fieldnum = PRVM_G_FLOAT(OFS_PARM1);
+ switch(fieldnum)
+ {
+ case 0: // active state
+ PRVM_G_FLOAT(OFS_RETURN) = cl.entities_active[entnum];
+ break;
+ case 1: // origin
+ Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 2: // forward
+ Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, PRVM_G_VECTOR(OFS_RETURN), v1, v2, org);
+ break;
+ case 3: // right
+ Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, v1, PRVM_G_VECTOR(OFS_RETURN), v2, org);
+ break;
+ case 4: // up
+ Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, v1, v2, PRVM_G_VECTOR(OFS_RETURN), org);
+ break;
+ case 5: // scale
+ PRVM_G_FLOAT(OFS_RETURN) = Matrix4x4_ScaleFromMatrix(&cl.entities[entnum].render.matrix);
+ break;
+ case 6: // origin + v_forward, v_right, v_up
+ Matrix4x4_ToVectors(&cl.entities[entnum].render.matrix, prog->globals.client->v_forward, prog->globals.client->v_right, prog->globals.client->v_up, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 7: // alpha
+ PRVM_G_FLOAT(OFS_RETURN) = cl.entities[entnum].render.alpha;
+ break;
+ case 8: // colormor
+ VectorCopy(cl.entities[entnum].render.colormod, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 9: // pants colormod
+ VectorCopy(cl.entities[entnum].render.colormap_pantscolor, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 10: // shirt colormod
+ VectorCopy(cl.entities[entnum].render.colormap_shirtcolor, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 11: // skinnum
+ PRVM_G_FLOAT(OFS_RETURN) = cl.entities[entnum].render.skinnum;
+ break;
+ case 12: // mins
+ VectorCopy(cl.entities[entnum].render.mins, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 13: // maxs
+ VectorCopy(cl.entities[entnum].render.maxs, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 14: // absmin
+ Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, org);
+ VectorAdd(cl.entities[entnum].render.mins, org, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 15: // absmax
+ Matrix4x4_OriginFromMatrix(&cl.entities[entnum].render.matrix, org);
+ VectorAdd(cl.entities[entnum].render.maxs, org, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ case 16: // light
+ VectorMA(cl.entities[entnum].render.modellight_ambient, 0.5, cl.entities[entnum].render.modellight_diffuse, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ default:
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ break;
+ }
+}
+
//====================
//QC POLYGON functions
//====================
R_Mesh_ResetTextureState();
R_EntityMatrix(&identitymatrix);
GL_CullFace(GL_NONE);
- R_Mesh_VertexPointer(polys->data_vertex3f, 0, 0);
- R_Mesh_ColorPointer(polys->data_color4f, 0, 0);
- R_Mesh_TexCoordPointer(0, 2, polys->data_texcoord2f, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(polys->num_vertices, polys->data_vertex3f, polys->data_color4f, polys->data_texcoord2f);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;)
{
VectorCopy(polys->data_triangles[surfacelist[surfacelistindex]].elements, polys->data_sortedelement3s + 3*numtriangles);
numtriangles++;
}
- R_Mesh_Draw(0, polys->num_vertices, 0, numtriangles, NULL, polys->data_sortedelement3s, 0, 0);
+ R_Mesh_Draw(0, polys->num_vertices, 0, numtriangles, NULL, NULL, 0, polys->data_sortedelement3s, NULL, 0);
}
}
VM_CL_registercmd, // #352 void(string cmdname) registercommand (EXT_CSQC)
VM_wasfreed, // #353 float(entity ent) wasfreed (EXT_CSQC) (should be availabe on server too)
VM_CL_serverkey, // #354 string(string key) serverkey (EXT_CSQC)
-NULL, // #355
+VM_CL_videoplaying, // #355
NULL, // #356
NULL, // #357
NULL, // #358
VM_CL_ReadPicture, // #501 string() ReadPicture = #501;
NULL, // #502
VM_whichpack, // #503 string(string) whichpack = #503;
-NULL, // #504
+VM_CL_GetEntity, // #504 float(float entitynum, float fldnum) getentity = #504; vector(float entitynum, float fldnum) getentityvec = #504;
NULL, // #505
NULL, // #506
NULL, // #507
VM_CL_SpawnParticleDelayed, // #528 float(vector org, vector vel, float delay, float collisiondelay, [float theme]) delayedparticle (DP_CSQC_SPAWNPARTICLE)
VM_loadfromdata, // #529
VM_loadfromfile, // #530
-NULL, // #531
+VM_CL_setpause, // #531 float(float ispaused) setpause = #531 (DP_CSQC_SETPAUSE)
VM_log, // #532
-NULL, // #533
-NULL, // #534
+VM_getsoundtime, // #533 float(entity e, float channel) getsoundtime = #533; (DP_SND_GETSOUNDTIME)
+VM_soundlength, // #534 float(string sample) soundlength = #534; (DP_SND_GETSOUNDTIME)
NULL, // #535
NULL, // #536
NULL, // #537