"DP_SV_BOTCLIENT "
"DP_SV_CLIENTCOLORS "
"DP_SV_CLIENTNAME "
+"DP_SV_CUSTOMIZEENTITYFORCLIENT "
"DP_SV_DRAWONLYTOCLIENT "
"DP_SV_DROPCLIENT "
"DP_SV_EFFECT "
"DP_SV_NODRAWTOCLIENT "
"DP_SV_PING "
"DP_SV_PLAYERPHYSICS "
+"DP_SV_PRECACHEANYTIME "
"DP_SV_PUNCHVECTOR "
"DP_SV_ROTATINGBMODEL "
"DP_SV_SETCOLOR "
"DP_SV_SLOWMO "
+"DP_SV_WRITEUNTERMINATEDSTRING "
"DP_TE_BLOOD "
"DP_TE_BLOODSHOWER "
"DP_TE_CUSTOMFLASH "
for (i=0 ; i<3 ; i++)
if (min[i] > max[i])
- PRVM_ERROR("SetMinMaxSize: backwards mins/maxs\n");
+ PRVM_ERROR("SetMinMaxSize: backwards mins/maxs");
// set derived values
VectorCopy (min, e->fields.server->mins);
//============================================================================
int checkpvsbytes;
-qbyte checkpvs[MAX_MAP_LEAFS/8];
+unsigned char checkpvs[MAX_MAP_LEAFS/8];
int PF_newcheckclient (int check)
{
Sends text over to the client's execution buffer
-stuffcmd (clientent, value)
+stuffcmd (clientent, value, ...)
=================
*/
void PF_stuffcmd (void)
{
int entnum;
- const char *str;
client_t *old;
+ char string[VM_STRINGTEMP_LENGTH];
entnum = PRVM_G_EDICTNUM(OFS_PARM0);
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
Con_Print("Can't stuffcmd to a non-client\n");
return;
}
- str = PRVM_G_STRING(OFS_PARM1);
+
+ VM_VarString(1, string, sizeof(string));
old = host_client;
host_client = svs.clients + entnum-1;
- Host_ClientCommands ("%s", str);
+ Host_ClientCommands ("%s", string);
host_client = old;
}
style = PRVM_G_FLOAT(OFS_PARM0);
val = PRVM_G_STRING(OFS_PARM1);
- if( (unsigned) style >= 64 ) {
+ if( (unsigned) style >= MAX_LIGHTSTYLES ) {
PRVM_ERROR( "PF_lightstyle: style: %i >= 64", style );
}
*/
void PF_pointcontents (void)
{
- PRVM_G_FLOAT(OFS_RETURN) = SV_PointQ1Contents(PRVM_G_VECTOR(OFS_PARM0));
+ PRVM_G_FLOAT(OFS_RETURN) = Mod_Q1BSP_NativeContentsFromSuperContents(NULL, SV_PointSuperContents(PRVM_G_VECTOR(OFS_PARM0)));
}
/*
return &svs.clients[entnum-1].message;
default:
- Con_Printf ("WriteDest: bad destination");
+ Con_Printf ("WriteDest: bad destination\n");
case MSG_ALL:
return &sv.reliable_datagram;
MSG_WriteString (WriteDest(), PRVM_G_STRING(OFS_PARM1));
}
+void PF_WriteUnterminatedString (void)
+{
+ MSG_WriteUnterminatedString (WriteDest(), PRVM_G_STRING(OFS_PARM1));
+}
+
void PF_WriteEntity (void)
{
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
}
+void PF_te_flamejet (void)
+{
+ MSG_WriteByte(&sv.datagram, svc_temp_entity);
+ MSG_WriteByte(&sv.datagram, TE_FLAMEJET);
+ // org
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[0], sv.protocol);
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol);
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
+ // vel
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[0], sv.protocol);
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[1], sv.protocol);
+ MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[2], sv.protocol);
+ // count
+ MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2));
+}
+
static void clippointtosurface(msurface_t *surface, vec3_t p, vec3_t out)
{
int i, j, k;
return Mod_Alias_GetTagIndexForName(model, e->fields.server->skin, tagname);
};
+void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix)
+{
+ float scale = PRVM_GETEDICTFIELDVALUE(ent, eval_scale)->_float;
+ if (scale == 0)
+ scale = 1;
+ 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);
+ else
+ Matrix4x4_CreateFromQuakeEntity(out, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2], -ent->fields.server->angles[0], ent->fields.server->angles[1], ent->fields.server->angles[2], scale * 0.333);
+}
+
+int SV_GetEntityLocalTagMatrix(prvm_edict_t *ent, int tagindex, matrix4x4_t *out)
+{
+ int modelindex;
+ int frame;
+ model_t *model;
+ if (tagindex >= 0
+ && (modelindex = ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS
+ && (model = sv.models[(int)ent->fields.server->modelindex])
+ && model->animscenes)
+ {
+ // if model has wrong frame, engine automatically switches to model first frame
+ frame = (int)ent->fields.server->frame;
+ if (frame < 0 || frame >= model->numframes)
+ frame = 0;
+ return Mod_Alias_GetTagMatrix(model, model->animscenes[frame].firstframe, tagindex, out);
+ }
+ Matrix4x4_CreateIdentity(out);
+ return 0;
+}
+
// Warnings/errors code:
// 0 - normal (everything all-right)
// 1 - world entity
extern cvar_t cl_bobup;
int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
{
+ int ret;
prvm_eval_t *val;
- int modelindex, reqframe, attachloop;
+ int modelindex, attachloop;
matrix4x4_t entitymatrix, tagmatrix, attachmatrix;
- prvm_edict_t *attachent;
model_t *model;
Matrix4x4_CreateIdentity(out); // warnings and errors return identical matrix
model = sv.models[modelindex];
- if (ent->fields.server->frame >= 0 && ent->fields.server->frame < model->numframes && model->animscenes)
- reqframe = model->animscenes[(int)ent->fields.server->frame].firstframe;
- else
- reqframe = 0; // if model has wrong frame, engine automatically switches to model first frame
-
- // get initial tag matrix
- if (tagindex)
+ Matrix4x4_CreateIdentity(&tagmatrix);
+ // DP_GFX_QUAKE3MODELTAGS, scan all chain and stop on unattached entity
+ attachloop = 0;
+ for (;;)
{
- int ret = Mod_Alias_GetTagMatrix(model, reqframe, tagindex - 1, &tagmatrix);
- if (ret)
+ if (attachloop >= 256) // prevent runaway looping
+ return 5;
+ // apply transformation by child's tagindex on parent entity and then
+ // by parent entity itself
+ ret = SV_GetEntityLocalTagMatrix(ent, tagindex - 1, &attachmatrix);
+ if (ret && attachloop == 0)
return ret;
- }
- else
- Matrix4x4_CreateIdentity(&tagmatrix);
-
- if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)) && val->edict)
- { // DP_GFX_QUAKE3MODELTAGS, scan all chain and stop on unattached entity
- attachloop = 0;
- do
+ Matrix4x4_Concat(out, &attachmatrix, &tagmatrix);
+ SV_GetEntityMatrix(ent, &entitymatrix, false);
+ Matrix4x4_Concat(&tagmatrix, &entitymatrix, out);
+ // next iteration we process the parent entity
+ if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)) && val->edict)
{
- attachent = PRVM_EDICT_NUM(val->edict); // to this it entity our entity is attached
- val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index);
- if (val->_float >= 1 && attachent->fields.server->modelindex >= 1 && attachent->fields.server->modelindex < MAX_MODELS && (model = sv.models[(int)attachent->fields.server->modelindex]) && model->animscenes && attachent->fields.server->frame >= 0 && attachent->fields.server->frame < model->numframes)
- Mod_Alias_GetTagMatrix(model, model->animscenes[(int)attachent->fields.server->frame].firstframe, val->_float - 1, &attachmatrix);
- else
- Matrix4x4_CreateIdentity(&attachmatrix);
-
- // apply transformation by child entity matrix
- val = PRVM_GETEDICTFIELDVALUE(ent, eval_scale);
- if (val->_float == 0)
- val->_float = 1;
- Matrix4x4_CreateFromQuakeEntity(&entitymatrix, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2], -ent->fields.server->angles[0], ent->fields.server->angles[1], ent->fields.server->angles[2], val->_float);
- Matrix4x4_Concat(out, &entitymatrix, &tagmatrix);
- out->m[0][3] = entitymatrix.m[0][3] + val->_float*(entitymatrix.m[0][0]*tagmatrix.m[0][3] + entitymatrix.m[0][1]*tagmatrix.m[1][3] + entitymatrix.m[0][2]*tagmatrix.m[2][3]);
- out->m[1][3] = entitymatrix.m[1][3] + val->_float*(entitymatrix.m[1][0]*tagmatrix.m[0][3] + entitymatrix.m[1][1]*tagmatrix.m[1][3] + entitymatrix.m[1][2]*tagmatrix.m[2][3]);
- out->m[2][3] = entitymatrix.m[2][3] + val->_float*(entitymatrix.m[2][0]*tagmatrix.m[0][3] + entitymatrix.m[2][1]*tagmatrix.m[1][3] + entitymatrix.m[2][2]*tagmatrix.m[2][3]);
- Matrix4x4_Copy(&tagmatrix, out);
-
- // finally transformate by matrix of tag on parent entity
- Matrix4x4_Concat(out, &attachmatrix, &tagmatrix);
- out->m[0][3] = attachmatrix.m[0][3] + attachmatrix.m[0][0]*tagmatrix.m[0][3] + attachmatrix.m[0][1]*tagmatrix.m[1][3] + attachmatrix.m[0][2]*tagmatrix.m[2][3];
- out->m[1][3] = attachmatrix.m[1][3] + attachmatrix.m[1][0]*tagmatrix.m[0][3] + attachmatrix.m[1][1]*tagmatrix.m[1][3] + attachmatrix.m[1][2]*tagmatrix.m[2][3];
- out->m[2][3] = attachmatrix.m[2][3] + attachmatrix.m[2][0]*tagmatrix.m[0][3] + attachmatrix.m[2][1]*tagmatrix.m[1][3] + attachmatrix.m[2][2]*tagmatrix.m[2][3];
- Matrix4x4_Copy(&tagmatrix, out);
-
- ent = attachent;
- attachloop += 1;
- if (attachloop > 255) // prevent runaway looping
- return 5;
+ tagindex = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
+ ent = PRVM_EDICT_NUM(val->edict);
}
- while ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)) && val->edict);
+ else
+ break;
+ attachloop++;
}
- // normal or RENDER_VIEWMODEL entity (or main parent entity on attach chain)
- val = PRVM_GETEDICTFIELDVALUE(ent, eval_scale);
- if (val->_float == 0)
- val->_float = 1;
- // Alias models have inverse pitch, bmodels can't have tags, so don't check for modeltype...
- Matrix4x4_CreateFromQuakeEntity(&entitymatrix, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2], -ent->fields.server->angles[0], ent->fields.server->angles[1], ent->fields.server->angles[2], val->_float);
- Matrix4x4_Concat(out, &entitymatrix, &tagmatrix);
- out->m[0][3] = entitymatrix.m[0][3] + val->_float*(entitymatrix.m[0][0]*tagmatrix.m[0][3] + entitymatrix.m[0][1]*tagmatrix.m[1][3] + entitymatrix.m[0][2]*tagmatrix.m[2][3]);
- out->m[1][3] = entitymatrix.m[1][3] + val->_float*(entitymatrix.m[1][0]*tagmatrix.m[0][3] + entitymatrix.m[1][1]*tagmatrix.m[1][3] + entitymatrix.m[1][2]*tagmatrix.m[2][3]);
- out->m[2][3] = entitymatrix.m[2][3] + val->_float*(entitymatrix.m[2][0]*tagmatrix.m[0][3] + entitymatrix.m[2][1]*tagmatrix.m[1][3] + entitymatrix.m[2][2]*tagmatrix.m[2][3]);
-
+ // RENDER_VIEWMODEL magic
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_viewmodelforclient)) && val->edict)
- {// RENDER_VIEWMODEL magic
+ {
Matrix4x4_Copy(&tagmatrix, out);
ent = PRVM_EDICT_NUM(val->edict);
- val = PRVM_GETEDICTFIELDVALUE(ent, eval_scale);
- if (val->_float == 0)
- val->_float = 1;
-
- Matrix4x4_CreateFromQuakeEntity(&entitymatrix, 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], val->_float);
+ SV_GetEntityMatrix(ent, &entitymatrix, true);
Matrix4x4_Concat(out, &entitymatrix, &tagmatrix);
- out->m[0][3] = entitymatrix.m[0][3] + val->_float*(entitymatrix.m[0][0]*tagmatrix.m[0][3] + entitymatrix.m[0][1]*tagmatrix.m[1][3] + entitymatrix.m[0][2]*tagmatrix.m[2][3]);
- out->m[1][3] = entitymatrix.m[1][3] + val->_float*(entitymatrix.m[1][0]*tagmatrix.m[0][3] + entitymatrix.m[1][1]*tagmatrix.m[1][3] + entitymatrix.m[1][2]*tagmatrix.m[2][3]);
- out->m[2][3] = entitymatrix.m[2][3] + val->_float*(entitymatrix.m[2][0]*tagmatrix.m[0][3] + entitymatrix.m[2][1]*tagmatrix.m[1][3] + entitymatrix.m[2][2]*tagmatrix.m[2][3]);
/*
// Cl_bob, ported from rendering code
PF_dropclient, // #453 void(entity clent) dropclient (DP_SV_DROPCLIENT)
PF_spawnclient, // #454 entity() spawnclient (DP_SV_BOTCLIENT)
PF_clienttype, // #455 float(entity clent) clienttype (DP_SV_BOTCLIENT)
-NULL, // #456
-NULL, // #457
+PF_WriteUnterminatedString, // #456 void(float to, string s) WriteUnterminatedString (DP_SV_WRITEUNTERMINATEDSTRING)
+PF_te_flamejet, // #457 void(vector org, vector vel, float howmany) te_flamejet = #457 (DP_TE_FLAMEJET)
NULL, // #458
NULL, // #459
e10, e10, e10, e10 // #460-499 (LordHavoc)