-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_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;
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_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;
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
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");
}