-char *vm_sv_extensions =
+const char *vm_sv_extensions =
"BX_WAL_SUPPORT "
"DP_BUTTONCHAT "
"DP_BUTTONUSE "
"DP_CON_SET "
"DP_CON_SETA "
"DP_CON_STARTMAP "
+"DP_CRYPTO "
+"DP_CSQC_BINDMAPS "
"DP_CSQC_ENTITYNOCULL "
"DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET "
"DP_CSQC_MULTIFRAME_INTERPOLATION "
+"DP_CSQC_BOXPARTICLES "
"DP_CSQC_SPAWNPARTICLE "
+"DP_CSQC_QUERYRENDERENTITY "
+"DP_CSQC_ROTATEMOVES "
+"DP_CSQC_SETPAUSE "
"DP_EF_ADDITIVE "
"DP_EF_BLUE "
"DP_EF_DOUBLESIDED "
"DP_GFX_QUAKE3MODELTAGS "
"DP_GFX_SKINFILES "
"DP_GFX_SKYBOX "
+"DP_GFX_FONTS "
+"DP_GFX_FONTS_FREETYPE "
+"DP_UTF8 "
+"DP_FONT_VARIABLEWIDTH "
"DP_HALFLIFE_MAP "
"DP_HALFLIFE_MAP_CVAR "
"DP_HALFLIFE_SPRITE "
"DP_QC_FS_SEARCH "
"DP_QC_GETLIGHT "
"DP_QC_GETSURFACE "
+"DP_QC_GETSURFACETRIANGLE "
"DP_QC_GETSURFACEPOINTATTRIBUTE "
"DP_QC_GETTAGINFO "
"DP_QC_GETTAGINFO_BONEPROPERTIES "
"DP_QC_UNLIMITEDTEMPSTRINGS "
"DP_QC_URI_ESCAPE "
"DP_QC_URI_GET "
+"DP_QC_URI_POST "
"DP_QC_VECTOANGLES_WITH_ROLL "
"DP_QC_VECTORVECTORS "
"DP_QC_WHICHPACK "
"DP_SND_OGGVORBIS "
"DP_SND_SETPARAMS "
"DP_SND_STEREOWAV "
+"DP_SND_GETSOUNDTIME "
+"DP_VIDEO_DPV "
+"DP_VIDEO_SUBTITLES "
"DP_SOLIDCORPSE "
"DP_SPRITE32 "
"DP_SV_BOTCLIENT "
"DP_SV_BOUNCEFACTOR "
+"DP_SV_CLIENTCAMERA "
"DP_SV_CLIENTCOLORS "
"DP_SV_CLIENTNAME "
"DP_SV_CMD "
"DP_SV_CUSTOMIZEENTITYFORCLIENT "
+"DP_SV_DISCARDABLEDEMO "
"DP_SV_DRAWONLYTOCLIENT "
"DP_SV_DROPCLIENT "
"DP_SV_EFFECT "
"DP_SV_PING "
"DP_SV_PING_PACKETLOSS "
"DP_SV_PLAYERPHYSICS "
+"DP_PHYSICS_ODE "
"DP_SV_POINTPARTICLES "
"DP_SV_POINTSOUND "
"DP_SV_PRECACHEANYTIME "
vec3_t original_velocity;
vec3_t original_angles;
vec3_t original_avelocity;
- prvm_eval_t *val;
trace_t trace;
VectorCopy(tossent->fields.server->origin , original_origin );
VectorCopy(tossent->fields.server->angles , original_angles );
VectorCopy(tossent->fields.server->avelocity, original_avelocity);
- val = PRVM_EDICTFIELDVALUE(tossent, prog->fieldoffsets.gravity);
- if (val != NULL && val->_float != 0)
- gravity = val->_float;
- else
- gravity = 1.0;
+ gravity = PRVM_serveredictfloat(tossent, gravity);
+ if (!gravity)
+ gravity = 1.0f;
gravity *= sv_gravity.value * 0.025;
for (i = 0;i < 200;i++) // LordHavoc: sanity check; never trace more than 10 seconds
VectorMAMAM(1, eorg, -0.5f, ent->fields.server->mins, -0.5f, ent->fields.server->maxs, eorg);
if (DotProduct(eorg, eorg) < radius2)
{
- PRVM_EDICTFIELDVALUE(ent,chainfield)->edict = PRVM_EDICT_TO_PROG(chain);
+ PRVM_EDICTFIELDEDICT(ent,chainfield) = PRVM_EDICT_TO_PROG(chain);
chain = ent;
}
}
int i, j;
trace_t tr;
float dist, bestdist;
- float speed;
+ //float speed;
VM_SAFEPARMCOUNT(2, VM_SV_aim);
VM_Warning("aim: can not use free entity\n");
return;
}
- speed = PRVM_G_FLOAT(OFS_PARM1);
+ //speed = PRVM_G_FLOAT(OFS_PARM1);
VectorCopy (ent->fields.server->origin, start);
start[2] += 20;
return sv.writeentitiestoclient_msg;
}
- return NULL;
+ //return NULL;
}
static void VM_SV_WriteByte (void)
VM_Warning("copyentity: can not modify free entity\n");
return;
}
- memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
+ memcpy(out->fields.vp, in->fields.vp, prog->entityfields * 4);
SV_LinkEdict(out);
}
{
client_t *client;
int entnum, i;
- prvm_eval_t *val;
VM_SAFEPARMCOUNT(2, VM_SV_setcolor);
entnum = PRVM_G_EDICTNUM(OFS_PARM0);
client = svs.clients + entnum-1;
if (client->edict)
{
- if ((val = PRVM_EDICTFIELDVALUE(client->edict, prog->fieldoffsets.clientcolors)))
- val->_float = i;
+ PRVM_serveredictfloat(client->edict, clientcolors) = i;
client->edict->fields.server->team = (i & 15) + 1;
}
client->colors = i;
SV_FlushBroadcastMessages();
}
-void clippointtosurface(dp_model_t *model, msurface_t *surface, vec3_t p, vec3_t out)
-{
- int i, j, k;
- float *v[3], facenormal[3], edgenormal[3], sidenormal[3], temp[3], offsetdist, dist, bestdist;
- const int *e;
- bestdist = 1000000000;
- VectorCopy(p, out);
- for (i = 0, e = (model->surfmesh.data_element3i + 3 * surface->num_firsttriangle);i < surface->num_triangles;i++, e += 3)
- {
- // clip original point to each triangle of the surface and find the
- // triangle that is closest
- v[0] = model->surfmesh.data_vertex3f + e[0] * 3;
- v[1] = model->surfmesh.data_vertex3f + e[1] * 3;
- v[2] = model->surfmesh.data_vertex3f + e[2] * 3;
- TriangleNormal(v[0], v[1], v[2], facenormal);
- VectorNormalize(facenormal);
- offsetdist = DotProduct(v[0], facenormal) - DotProduct(p, facenormal);
- VectorMA(p, offsetdist, facenormal, temp);
- for (j = 0, k = 2;j < 3;k = j, j++)
- {
- VectorSubtract(v[k], v[j], edgenormal);
- CrossProduct(edgenormal, facenormal, sidenormal);
- VectorNormalize(sidenormal);
- offsetdist = DotProduct(v[k], sidenormal) - DotProduct(temp, sidenormal);
- if (offsetdist < 0)
- VectorMA(temp, offsetdist, sidenormal, temp);
- }
- dist = VectorDistance2(temp, p);
- if (bestdist > dist)
- {
- bestdist = dist;
- VectorCopy(temp, out);
- }
- }
-}
-
-#define getmodel SV_GetModelFromEdict
-
-static msurface_t *getsurface(dp_model_t *model, int surfacenum)
-{
- if (surfacenum < 0 || surfacenum >= model->nummodelsurfaces)
- return NULL;
- return model->data_surfaces + surfacenum + model->firstmodelsurface;
-}
-
-
-//PF_getsurfacenumpoints, // #434 float(entity e, float s) getsurfacenumpoints = #434;
-static void VM_SV_getsurfacenumpoints(void)
-{
- dp_model_t *model;
- msurface_t *surface;
- VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenumpoints);
- // return 0 if no such surface
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- {
- PRVM_G_FLOAT(OFS_RETURN) = 0;
- return;
- }
-
- // note: this (incorrectly) assumes it is a simple polygon
- PRVM_G_FLOAT(OFS_RETURN) = surface->num_vertices;
-}
-//PF_getsurfacepoint, // #435 vector(entity e, float s, float n) getsurfacepoint = #435;
-static void VM_SV_getsurfacepoint(void)
-{
- prvm_edict_t *ed;
- dp_model_t *model;
- msurface_t *surface;
- int pointnum;
- VM_SAFEPARMCOUNT(3, VM_SV_getsurfacepoint);
- VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- return;
- // note: this (incorrectly) assumes it is a simple polygon
- pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
- if (pointnum < 0 || pointnum >= surface->num_vertices)
- return;
- // FIXME: implement rotation/scaling
- VectorAdd(&(model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex)[pointnum * 3], ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN));
-}
-//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_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;
-static void VM_SV_getsurfacepointattribute(void)
-{
- prvm_edict_t *ed;
- dp_model_t *model;
- msurface_t *surface;
- int pointnum;
- int attributetype;
-
- VM_SAFEPARMCOUNT(4, VM_SV_getsurfacepoint);
- VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- return;
- // note: this (incorrectly) assumes it is a simple polygon
- pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
- if (pointnum < 0 || pointnum >= surface->num_vertices)
- return;
- // FIXME: implement rotation/scaling
- attributetype = (int) PRVM_G_FLOAT(OFS_PARM3);
-
- switch( attributetype ) {
- // float SPA_POSITION = 0;
- case 0:
- VectorAdd(&(model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex)[pointnum * 3], ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN));
- break;
- // float SPA_S_AXIS = 1;
- case 1:
- VectorCopy(&(model->surfmesh.data_svector3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
- break;
- // 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_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_TEXCOORDS0 = 4;
- case 4: {
- float *ret = PRVM_G_VECTOR(OFS_RETURN);
- float *texcoord = &(model->surfmesh.data_texcoordtexture2f + 2 * surface->num_firstvertex)[pointnum * 2];
- ret[0] = texcoord[0];
- ret[1] = texcoord[1];
- ret[2] = 0.0f;
- break;
- }
- // float SPA_LIGHTMAP0_TEXCOORDS = 5;
- case 5: {
- float *ret = PRVM_G_VECTOR(OFS_RETURN);
- float *texcoord = &(model->surfmesh.data_texcoordlightmap2f + 2 * surface->num_firstvertex)[pointnum * 2];
- ret[0] = texcoord[0];
- ret[1] = texcoord[1];
- ret[2] = 0.0f;
- break;
- }
- // float SPA_LIGHTMAP0_COLOR = 6;
- case 6:
- // ignore alpha for now..
- 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 );
- break;
- }
-}
-//PF_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal = #436;
-static void VM_SV_getsurfacenormal(void)
-{
- dp_model_t *model;
- msurface_t *surface;
- vec3_t normal;
- VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenormal);
- VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- return;
- // FIXME: implement rotation/scaling
- // note: this (incorrectly) assumes it is a simple polygon
- // note: this only returns the first triangle, so it doesn't work very
- // well for curved surfaces or arbitrary meshes
- TriangleNormal((model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex), (model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex) + 3, (model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex) + 6, normal);
- VectorNormalize(normal);
- VectorCopy(normal, PRVM_G_VECTOR(OFS_RETURN));
-}
-//PF_getsurfacetexture, // #437 string(entity e, float s) getsurfacetexture = #437;
-static void VM_SV_getsurfacetexture(void)
-{
- dp_model_t *model;
- msurface_t *surface;
- VM_SAFEPARMCOUNT(2, VM_SV_getsurfacetexture);
- PRVM_G_INT(OFS_RETURN) = OFS_NULL;
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- return;
- PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(surface->texture->name);
-}
-//PF_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint = #438;
-static void VM_SV_getsurfacenearpoint(void)
-{
- int surfacenum, best;
- vec3_t clipped, p;
- vec_t dist, bestdist;
- prvm_edict_t *ed;
- dp_model_t *model;
- msurface_t *surface;
- vec_t *point;
- VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenearpoint);
- PRVM_G_FLOAT(OFS_RETURN) = -1;
- ed = PRVM_G_EDICT(OFS_PARM0);
- point = PRVM_G_VECTOR(OFS_PARM1);
-
- if (!ed || ed->priv.server->free)
- return;
- model = getmodel(ed);
- if (!model || !model->num_surfaces)
- return;
-
- // FIXME: implement rotation/scaling
- VectorSubtract(point, ed->fields.server->origin, p);
- best = -1;
- bestdist = 1000000000;
- for (surfacenum = 0;surfacenum < model->nummodelsurfaces;surfacenum++)
- {
- surface = model->data_surfaces + surfacenum + model->firstmodelsurface;
- // first see if the nearest point on the surface's box is closer than the previous match
- clipped[0] = bound(surface->mins[0], p[0], surface->maxs[0]) - p[0];
- clipped[1] = bound(surface->mins[1], p[1], surface->maxs[1]) - p[1];
- clipped[2] = bound(surface->mins[2], p[2], surface->maxs[2]) - p[2];
- dist = VectorLength2(clipped);
- if (dist < bestdist)
- {
- // it is, check the nearest point on the actual geometry
- clippointtosurface(model, surface, p, clipped);
- VectorSubtract(clipped, p, clipped);
- dist += VectorLength2(clipped);
- if (dist < bestdist)
- {
- // that's closer too, store it as the best match
- best = surfacenum;
- bestdist = dist;
- }
- }
- }
- PRVM_G_FLOAT(OFS_RETURN) = best;
-}
-//PF_getsurfaceclippedpoint, // #439 vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
-static void VM_SV_getsurfaceclippedpoint(void)
-{
- prvm_edict_t *ed;
- dp_model_t *model;
- msurface_t *surface;
- vec3_t p, out;
- VM_SAFEPARMCOUNT(3, VM_SV_te_getsurfaceclippedpoint);
- VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
- return;
- // FIXME: implement rotation/scaling
- VectorSubtract(PRVM_G_VECTOR(OFS_PARM2), ed->fields.server->origin, p);
- clippointtosurface(model, surface, p, out);
- // FIXME: implement rotation/scaling
- VectorAdd(out, ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN));
-}
-
//void(entity e, string s) clientcommand = #440; // executes a command string as if it came from the specified client
//this function originally written by KrimZon, made shorter by LordHavoc
static void VM_SV_clientcommand (void)
prvm_edict_t *e = PRVM_G_EDICT(OFS_PARM0);
prvm_edict_t *tagentity = PRVM_G_EDICT(OFS_PARM1);
const char *tagname = PRVM_G_STRING(OFS_PARM2);
- prvm_eval_t *v;
dp_model_t *model;
+ int tagindex;
VM_SAFEPARMCOUNT(3, VM_SV_setattachment);
if (e == prog->edicts)
if (tagentity == NULL)
tagentity = prog->edicts;
- v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_entity);
- if (v)
- v->edict = PRVM_EDICT_TO_PROG(tagentity);
+ tagindex = 0;
- v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_index);
- if (v)
- v->_float = 0;
if (tagentity != NULL && tagentity != prog->edicts && tagname && tagname[0])
{
model = SV_GetModelFromEdict(tagentity);
if (model)
{
- v->_float = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.server->skin, tagname);
- if (v->_float == 0)
+ tagindex = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.server->skin, tagname);
+ if (tagindex == 0)
Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity), model->name);
}
else
Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i but it has no model\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity));
}
+
+ PRVM_serveredictedict(e, tag_entity) = PRVM_EDICT_TO_PROG(tagentity);
+ PRVM_serveredictfloat(e, tag_index) = tagindex;
}
/////////////////////////////////////////
void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix)
{
- prvm_eval_t *val;
float scale;
float pitchsign = 1;
- scale = 1;
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale);
- if (val && val->_float != 0)
- scale = val->_float;
+ scale = PRVM_serveredictfloat(ent, scale);
+ if (!scale)
+ scale = 1.0f;
if (viewmatrix)
Matrix4x4_CreateFromQuakeEntity(out, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] + ent->fields.server->view_ofs[2], ent->fields.server->v_angle[0], ent->fields.server->v_angle[1], ent->fields.server->v_angle[2], scale * cl_viewmodel_scale.value);
int SV_GetEntityLocalTagMatrix(prvm_edict_t *ent, int tagindex, matrix4x4_t *out)
{
dp_model_t *model;
- if (tagindex >= 0 && (model = SV_GetModelFromEdict(ent)) && model->num_bones)
+ if (tagindex >= 0 && (model = SV_GetModelFromEdict(ent)) && model->animscenes)
{
VM_GenerateFrameGroupBlend(ent->priv.server->framegroupblend, ent);
VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model);
int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
{
int ret;
- prvm_eval_t *val;
int modelindex, attachloop;
matrix4x4_t entitymatrix, tagmatrix, attachmatrix;
dp_model_t *model;
Matrix4x4_Concat(&tagmatrix, &attachmatrix, out);
Matrix4x4_Concat(out, &entitymatrix, &tagmatrix);
// next iteration we process the parent entity
- if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict)
+ if (PRVM_serveredictedict(ent, tag_entity))
{
- tagindex = (int)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float;
- ent = PRVM_EDICT_NUM(val->edict);
+ tagindex = (int)PRVM_serveredictfloat(ent, tag_index);
+ ent = PRVM_EDICT_NUM(PRVM_serveredictedict(ent, tag_entity));
}
else
break;
}
// RENDER_VIEWMODEL magic
- if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)) && val->edict)
+ if (PRVM_serveredictedict(ent, viewmodelforclient))
{
Matrix4x4_Copy(&tagmatrix, out);
- ent = PRVM_EDICT_NUM(val->edict);
+ ent = PRVM_EDICT_NUM(PRVM_serveredictedict(ent, viewmodelforclient));
SV_GetEntityMatrix(ent, &entitymatrix, true);
Matrix4x4_Concat(out, &entitymatrix, &tagmatrix);
int parentindex;
const char *tagname;
int returncode;
- prvm_eval_t *val;
vec3_t fo, le, up, trans;
const dp_model_t *model;
SV_GetExtendedTagInfo(e, tagindex, &parentindex, &tagname, &tag_localmatrix);
Matrix4x4_ToVectors(&tag_localmatrix, fo, le, up, trans);
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_parent)))
- val->_float = parentindex;
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_name)))
- val->string = tagname ? PRVM_SetTempString(tagname) : 0;
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_offset)))
- VectorCopy(trans, val->vector);
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_forward)))
- VectorCopy(fo, val->vector);
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_right)))
- VectorScale(le, -1, val->vector);
- if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_up)))
- VectorCopy(up, val->vector);
+ PRVM_serverglobalfloat(gettaginfo_parent) = parentindex;
+ PRVM_serverglobalstring(gettaginfo_name) = tagname ? PRVM_SetTempString(tagname) : 0;
+ VectorCopy(trans, PRVM_serverglobalvector(gettaginfo_offset));
+ VectorCopy(fo, PRVM_serverglobalvector(gettaginfo_forward));
+ VectorScale(le, -1, PRVM_serverglobalvector(gettaginfo_right));
+ VectorCopy(up, PRVM_serverglobalvector(gettaginfo_up));
switch(returncode)
{
break;
if (i == MAX_EDICTS)
return;
- prog->skeletons[i] = skeleton = Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t));
+ prog->skeletons[i] = skeleton = (skeleton_t *)Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t));
+ PRVM_G_FLOAT(OFS_RETURN) = i + 1;
skeleton->model = model;
skeleton->relativetransforms = (matrix4x4_t *)(skeleton+1);
// initialize to identity matrices
for (i = 0;i < skeleton->model->num_bones;i++)
skeleton->relativetransforms[i] = identitymatrix;
- PRVM_G_FLOAT(OFS_RETURN) = i + 1;
}
// #264 float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // (FTE_CSQC_SKELETONOBJECTS) blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
prvm_edict_t *ed = PRVM_G_EDICT(OFS_PARM1);
int modelindex = (int)PRVM_G_FLOAT(OFS_PARM2);
float retainfrac = PRVM_G_FLOAT(OFS_PARM3);
- int firstbone = PRVM_G_FLOAT(OFS_PARM4);
- int lastbone = PRVM_G_FLOAT(OFS_PARM5);
+ int firstbone = PRVM_G_FLOAT(OFS_PARM4) - 1;
+ int lastbone = PRVM_G_FLOAT(OFS_PARM5) - 1;
dp_model_t *model = SV_GetModelByIndex(modelindex);
float blendfrac;
int numblends;
Matrix4x4_Accumulate(&blendedmatrix, &skeleton->relativetransforms[bonenum], retainfrac);
for (blendindex = 0;blendindex < numblends;blendindex++)
{
- Matrix4x4_FromArray12FloatD3D(&matrix, model->data_poses + 12 * (frameblend[blendindex].subframe * model->num_bones + bonenum));
+ Matrix4x4_FromBonePose6s(&matrix, model->num_posescale, model->data_poses6s + 6 * (frameblend[blendindex].subframe * model->num_bones + bonenum));
Matrix4x4_Accumulate(&blendedmatrix, &matrix, frameblend[blendindex].lerp);
}
skeleton->relativetransforms[bonenum] = blendedmatrix;
}
- PRVM_G_FLOAT(OFS_RETURN) = skeletonindex;
+ PRVM_G_FLOAT(OFS_RETURN) = skeletonindex + 1;
}
// #265 float(float skel) skel_get_numbones = #265; // (FTE_CSQC_SKELETONOBJECTS) returns how many bones exist in the created skeleton
VM_SV_te_beam, // #431 void(entity own, vector start, vector end) te_beam (DP_TE_STANDARDEFFECTBUILTINS)
VM_vectorvectors, // #432 void(vector dir) vectorvectors (DP_QC_VECTORVECTORS)
VM_SV_te_plasmaburn, // #433 void(vector org) te_plasmaburn (DP_TE_PLASMABURN)
-VM_SV_getsurfacenumpoints, // #434 float(entity e, float s) getsurfacenumpoints (DP_QC_GETSURFACE)
-VM_SV_getsurfacepoint, // #435 vector(entity e, float s, float n) getsurfacepoint (DP_QC_GETSURFACE)
-VM_SV_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal (DP_QC_GETSURFACE)
-VM_SV_getsurfacetexture, // #437 string(entity e, float s) getsurfacetexture (DP_QC_GETSURFACE)
-VM_SV_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint (DP_QC_GETSURFACE)
-VM_SV_getsurfaceclippedpoint, // #439 vector(entity e, float s, vector p) getsurfaceclippedpoint (DP_QC_GETSURFACE)
+VM_getsurfacenumpoints, // #434 float(entity e, float s) getsurfacenumpoints (DP_QC_GETSURFACE)
+VM_getsurfacepoint, // #435 vector(entity e, float s, float n) getsurfacepoint (DP_QC_GETSURFACE)
+VM_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal (DP_QC_GETSURFACE)
+VM_getsurfacetexture, // #437 string(entity e, float s) getsurfacetexture (DP_QC_GETSURFACE)
+VM_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint (DP_QC_GETSURFACE)
+VM_getsurfaceclippedpoint, // #439 vector(entity e, float s, vector p) getsurfaceclippedpoint (DP_QC_GETSURFACE)
VM_SV_clientcommand, // #440 void(entity e, string s) clientcommand (KRIMZON_SV_PARSECLIENTCOMMAND)
VM_tokenize, // #441 float(string s) tokenize (KRIMZON_SV_PARSECLIENTCOMMAND)
VM_argv, // #442 string(float n) argv (KRIMZON_SV_PARSECLIENTCOMMAND)
VM_SV_pointsound, // #483 void(vector origin, string sample, float volume, float attenuation) (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_SV_getsurfacepointattribute,// #486 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+VM_getsurfacepointattribute,// #486 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
NULL, // #487
NULL, // #488
NULL, // #489
VM_uri_escape, // #510 string(string in) uri_escape = #510;
VM_uri_unescape, // #511 string(string in) uri_unescape = #511;
VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
-VM_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET)
+VM_uri_get, // #513 float(string uri, float id, [string post_contenttype, string post_delim, [float buf]]) uri_get = #513; (DP_QC_URI_GET, DP_QC_URI_POST)
VM_tokenize_console, // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE)
VM_argv_start_index, // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE)
VM_argv_end_index, // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE)
VM_loadfromfile, // #530
VM_SV_setpause, // #531 void(float pause) setpause = #531;
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
NULL, // #538
NULL, // #539
-NULL, // #540
-NULL, // #541
-NULL, // #542
+VM_physics_enable, // #540 void(entity e, float physics_enabled) physics_enable = #540; (DP_PHYSICS_ODE)
+VM_physics_addforce, // #541 void(entity e, vector force, vector relative_ofs) physics_addforce = #541; (DP_PHYSICS_ODE)
+VM_physics_addtorque, // #542 void(entity e, vector torque) physics_addtorque = #542; (DP_PHYSICS_ODE)
NULL, // #543
NULL, // #544
NULL, // #545
NULL, // #625
NULL, // #626
VM_sprintf, // #627 string sprintf(string format, ...)
-NULL, // #628
+VM_getsurfacenumtriangles, // #628 float(entity e, float s) getsurfacenumpoints (DP_QC_GETSURFACETRIANGLE)
+VM_getsurfacetriangle, // #629 vector(entity e, float s, float n) getsurfacepoint (DP_QC_GETSURFACETRIANGLE)
+NULL, // #630
};
const int vm_sv_numbuiltins = sizeof(vm_sv_builtins) / sizeof(prvm_builtin_t);
void VM_SV_Cmd_Reset(void)
{
World_End(&sv.world);
- if(prog->funcoffsets.SV_Shutdown)
+ if(PRVM_serverfunction(SV_Shutdown))
{
- func_t s = prog->funcoffsets.SV_Shutdown;
- prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again
+ func_t s = PRVM_serverfunction(SV_Shutdown);
+ PRVM_serverfunction(SV_Shutdown) = 0; // prevent it from getting called again
PRVM_ExecuteProgram(s,"SV_Shutdown() required");
}