//============================================================================
// Server
-#define PF_WARNING(s) do{Con_Printf(s);PRVM_PrintState();return;}while(0)
cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"}; //"0.93"}; // LordHavoc: disabled autoaim by default
char *vm_sv_extensions =
+"BX_WAL_SUPPORT "
"DP_CON_EXPANDCVAR "
"DP_CON_ALIASPARAMETERS "
"DP_BUTTONCHAT "
"DP_MONSTERWALK "
"DP_MOVETYPEBOUNCEMISSILE "
"DP_MOVETYPEFOLLOW "
+"DP_QC_ASINACOSATANATAN2TAN "
"DP_QC_CHANGEPITCH "
"DP_QC_COPYENTITY "
"DP_QC_CVAR_STRING "
"DP_QC_RANDOMVEC "
"DP_QC_SINCOSSQRTPOW "
"DP_QC_STRINGBUFFERS "
+"DP_QC_STRINGCOLORFUNCTIONS "
+"DP_QC_UNLIMITEDTEMPSTRINGS "
"DP_QC_TRACEBOX "
"DP_QC_TRACETOSS "
"DP_QC_TRACE_MOVETYPE_HITMODEL "
"DP_SV_DRAWONLYTOCLIENT "
"DP_SV_DROPCLIENT "
"DP_SV_EFFECT "
+"DP_SV_ENTITYCONTENTSTRANSITION "
"DP_SV_NODRAWTOCLIENT "
"DP_SV_PING "
"DP_SV_PLAYERPHYSICS "
"DP_SV_PRECACHEANYTIME "
+"DP_SV_PRINT "
"DP_SV_PUNCHVECTOR "
"DP_SV_ROTATINGBMODEL "
"DP_SV_SETCOLOR "
e = PRVM_G_EDICT(OFS_PARM0);
if (e == prog->edicts)
- PF_WARNING("setorigin: can not modify world entity\n");
+ {
+ VM_Warning("setorigin: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setorigin: can not modify free entity\n");
+ {
+ VM_Warning("setorigin: can not modify free entity\n");
+ return;
+ }
org = PRVM_G_VECTOR(OFS_PARM1);
VectorCopy (org, e->fields.server->origin);
SV_LinkEdict (e, false);
e = PRVM_G_EDICT(OFS_PARM0);
if (e == prog->edicts)
- PF_WARNING("setsize: can not modify world entity\n");
+ {
+ VM_Warning("setsize: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setsize: can not modify free entity\n");
+ {
+ VM_Warning("setsize: can not modify free entity\n");
+ return;
+ }
min = PRVM_G_VECTOR(OFS_PARM1);
max = PRVM_G_VECTOR(OFS_PARM2);
SetMinMaxSize (e, min, max, false);
e = PRVM_G_EDICT(OFS_PARM0);
if (e == prog->edicts)
- PF_WARNING("setmodel: can not modify world entity\n");
+ {
+ VM_Warning("setmodel: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setmodel: can not modify free entity\n");
+ {
+ VM_Warning("setmodel: can not modify free entity\n");
+ return;
+ }
i = SV_ModelIndex(PRVM_G_STRING(OFS_PARM1), 1);
e->fields.server->model = PRVM_SetEngineString(sv.model_precache[i]);
e->fields.server->modelindex = i;
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
{
- Con_Print("tried to sprint to a non-client\n");
+ VM_Warning("tried to centerprint to a non-client\n");
return;
}
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
{
- Con_Print("tried to sprint to a non-client\n");
+ VM_Warning("tried to centerprint to a non-client\n");
return;
}
attenuation = PRVM_G_FLOAT(OFS_PARM4);
if (volume < 0 || volume > 255)
- PF_WARNING("SV_StartSound: volume must be in range 0-1\n");
+ {
+ VM_Warning("SV_StartSound: volume must be in range 0-1\n");
+ return;
+ }
if (attenuation < 0 || attenuation > 4)
- PF_WARNING("SV_StartSound: attenuation must be in range 0-4\n");
+ {
+ VM_Warning("SV_StartSound: attenuation must be in range 0-4\n");
+ return;
+ }
if (channel < 0 || channel > 7)
- PF_WARNING("SV_StartSound: channel must be in range 0-7\n");
+ {
+ VM_Warning("SV_StartSound: channel must be in range 0-7\n");
+ return;
+ }
SV_StartSound (entity, channel, sample, volume, attenuation);
}
if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphittexturename)))
{
if (trace.hittexture)
- {
- char *s = VM_GetTempString();
- strlcpy(s, trace.hittexture->name, VM_STRINGTEMP_LENGTH);
- val->string = PRVM_SetEngineString(s);
- }
+ val->string = PRVM_SetTempString(trace.hittexture->name);
else
val->string = 0;
}
if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphittexturename)))
{
if (trace.hittexture)
- {
- char *s = VM_GetTempString();
- strlcpy(s, trace.hittexture->name, VM_STRINGTEMP_LENGTH);
- val->string = PRVM_SetEngineString(s);
- }
+ val->string = PRVM_SetTempString(trace.hittexture->name);
else
val->string = 0;
}
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("tracetoss: can not use world entity\n");
+ {
+ VM_Warning("tracetoss: can not use world entity\n");
+ return;
+ }
ignore = PRVM_G_EDICT(OFS_PARM1);
trace = SV_Trace_Toss (ent, ignore);
if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphittexturename)))
{
if (trace.hittexture)
- {
- char *s = VM_GetTempString();
- strlcpy(s, trace.hittexture->name, VM_STRINGTEMP_LENGTH);
- val->string = PRVM_SetEngineString(s);
- }
+ val->string = PRVM_SetTempString(trace.hittexture->name);
else
val->string = 0;
}
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");
+ VM_Warning("Can't stuffcmd to a non-client\n");
return;
}
ent = PRVM_PROG_TO_EDICT(prog->globals.server->self);
if (ent == prog->edicts)
- PF_WARNING("walkmove: can not modify world entity\n");
+ {
+ VM_Warning("walkmove: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("walkmove: can not modify free entity\n");
+ {
+ VM_Warning("walkmove: can not modify free entity\n");
+ return;
+ }
yaw = PRVM_G_FLOAT(OFS_PARM0);
dist = PRVM_G_FLOAT(OFS_PARM1);
ent = PRVM_PROG_TO_EDICT(prog->globals.server->self);
if (ent == prog->edicts)
- PF_WARNING("droptofloor: can not modify world entity\n");
+ {
+ VM_Warning("droptofloor: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("droptofloor: can not modify free entity\n");
+ {
+ VM_Warning("droptofloor: can not modify free entity\n");
+ return;
+ }
VectorCopy (ent->fields.server->origin, end);
end[2] -= 256;
trace = SV_Move (ent->fields.server->origin, ent->fields.server->mins, ent->fields.server->maxs, end, MOVE_NORMAL, ent);
- if (trace.fraction != 1)
+ if (trace.fraction != 1 || (trace.startsolid && sv_gameplayfix_droptofloorstartsolid.integer))
{
- VectorCopy (trace.endpos, ent->fields.server->origin);
+ if (trace.fraction < 1)
+ VectorCopy (trace.endpos, ent->fields.server->origin);
SV_LinkEdict (ent, false);
ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND;
ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent);
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("aim: can not use world entity\n");
+ {
+ VM_Warning("aim: can not use world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("aim: can not use free entity\n");
+ {
+ VM_Warning("aim: can not use free entity\n");
+ return;
+ }
speed = PRVM_G_FLOAT(OFS_PARM1);
VectorCopy (ent->fields.server->origin, start);
ent = PRVM_PROG_TO_EDICT(prog->globals.server->self);
if (ent == prog->edicts)
- PF_WARNING("changeyaw: can not modify world entity\n");
+ {
+ VM_Warning("changeyaw: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("changeyaw: can not modify free entity\n");
+ {
+ VM_Warning("changeyaw: can not modify free entity\n");
+ return;
+ }
current = ANGLEMOD(ent->fields.server->angles[1]);
ideal = ent->fields.server->ideal_yaw;
speed = ent->fields.server->yaw_speed;
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("changepitch: can not modify world entity\n");
+ {
+ VM_Warning("changepitch: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("changepitch: can not modify free entity\n");
+ {
+ VM_Warning("changepitch: can not modify free entity\n");
+ return;
+ }
current = ANGLEMOD( ent->fields.server->angles[0] );
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_idealpitch)))
ideal = val->_float;
else
{
- PF_WARNING("PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch\n");
+ VM_Warning("PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch\n");
return;
}
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_pitch_speed)))
speed = val->_float;
else
{
- PF_WARNING("PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch\n");
+ VM_Warning("PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch\n");
return;
}
entnum = PRVM_NUM_FOR_EDICT(ent);
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active || !svs.clients[entnum-1].netconnection)
{
- Con_Printf ("WriteDest: tried to write to non-client\n");
+ VM_Warning ("WriteDest: tried to write to non-client\n");
return &sv.reliable_datagram;
}
else
return &svs.clients[entnum-1].netconnection->message;
default:
- Con_Printf ("WriteDest: bad destination\n");
+ VM_Warning ("WriteDest: bad destination\n");
case MSG_ALL:
return &sv.reliable_datagram;
ent = PRVM_G_EDICT(OFS_PARM0);
if (ent == prog->edicts)
- PF_WARNING("makestatic: can not modify world entity\n");
+ {
+ VM_Warning("makestatic: can not modify world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("makestatic: can not modify free entity\n");
+ {
+ VM_Warning("makestatic: can not modify free entity\n");
+ return;
+ }
large = false;
if (ent->fields.server->modelindex >= 256 || ent->fields.server->frame >= 256)
// check for overlap with a command
if (Cmd_Exists (name))
{
- Con_Printf("PF_registercvar: %s is a command\n", name);
+ VM_Warning("PF_registercvar: %s is a command\n", name);
return;
}
vm_autosentstats = (autosentstat_t *)Z_Malloc((MAX_CL_STATS-32) * sizeof(autosentstat_t));
if(!vm_autosentstats)
{
- Con_Printf("PF_SV_AddStat: not enough memory\n");
+ VM_Warning("PF_SV_AddStat: not enough memory\n");
return;
}
}
if(i < 0)
{
- Con_Printf("PF_SV_AddStat: index may not be less than 32\n");
+ VM_Warning("PF_SV_AddStat: index may not be less than 32\n");
return;
}
if(i >= (MAX_CL_STATS-32))
{
- Con_Printf("PF_SV_AddStat: index >= MAX_CL_STATS\n");
+ VM_Warning("PF_SV_AddStat: index >= MAX_CL_STATS\n");
return;
}
if(i > (MAX_CL_STATS-32-4) && type == 1)
{
- Con_Printf("PF_SV_AddStat: index > (MAX_CL_STATS-4) with string\n");
+ VM_Warning("PF_SV_AddStat: index > (MAX_CL_STATS-4) with string\n");
return;
}
vm_autosentstats[i].type = type;
prvm_edict_t *in, *out;
in = PRVM_G_EDICT(OFS_PARM0);
if (in == prog->edicts)
- PF_WARNING("copyentity: can not read world entity\n");
+ {
+ VM_Warning("copyentity: can not read world entity\n");
+ return;
+ }
if (in->priv.server->free)
- PF_WARNING("copyentity: can not read free entity\n");
+ {
+ VM_Warning("copyentity: can not read free entity\n");
+ return;
+ }
out = PRVM_G_EDICT(OFS_PARM1);
if (out == prog->edicts)
- PF_WARNING("copyentity: can not modify world entity\n");
+ {
+ VM_Warning("copyentity: can not modify world entity\n");
+ return;
+ }
if (out->priv.server->free)
- PF_WARNING("copyentity: can not modify free entity\n");
+ {
+ VM_Warning("copyentity: can not modify free entity\n");
+ return;
+ }
memcpy(out->fields.server, in->fields.server, prog->progs->entityfields * 4);
}
int i;
const char *s;
s = PRVM_G_STRING(OFS_PARM1);
- if (!s || !s[0])
- PF_WARNING("effect: no model specified\n");
+ if (!s[0])
+ {
+ VM_Warning("effect: no model specified\n");
+ return;
+ }
i = SV_ModelIndex(s, 1);
if (!i)
- PF_WARNING("effect: model not precached\n");
+ {
+ VM_Warning("effect: model not precached\n");
+ return;
+ }
+
+ if (PRVM_G_FLOAT(OFS_PARM3) < 1)
+ {
+ VM_Warning("effect: framecount < 1\n");
+ return;
+ }
+
+ if (PRVM_G_FLOAT(OFS_PARM4) < 1)
+ {
+ VM_Warning("effect: framerate < 1\n");
+ return;
+ }
+
SV_StartEffect(PRVM_G_VECTOR(OFS_PARM0), i, (int)PRVM_G_FLOAT(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4));
}
{
model_t *model;
msurface_t *surface;
- PRVM_G_INT(OFS_RETURN) = 0;
+ 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_SetEngineString(surface->texture->name);
+ PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(surface->texture->name);
}
//PF_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint = #438;
void PF_getsurfacenearpoint(void)
model_t *model;
if (e == prog->edicts)
- PF_WARNING("setattachment: can not modify world entity\n");
+ {
+ VM_Warning("setattachment: can not modify world entity\n");
+ return;
+ }
if (e->priv.server->free)
- PF_WARNING("setattachment: can not modify free entity\n");
+ {
+ VM_Warning("setattachment: can not modify free entity\n");
+ return;
+ }
if (tagentity == NULL)
tagentity = prog->edicts;
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);
+ 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 * cl_viewmodel_scale.value);
}
int SV_GetEntityLocalTagMatrix(prvm_edict_t *ent, int tagindex, matrix4x4_t *out)
// (don't count Z, or jumping messes it up)
bob = sqrt(ent->fields.server->velocity[0]*ent->fields.server->velocity[0] + ent->fields.server->velocity[1]*ent->fields.server->velocity[1])*cl_bob.value;
bob = bob*0.3 + bob*0.7*cycle;
- out->m[2][3] += bound(-7, bob, 4);
+ Matrix4x4_AdjustOrigin(out, 0, 0, bound(-7, bob, 4));
}
*/
}
int modelindex, tag_index;
if (ent == prog->edicts)
- PF_WARNING("gettagindex: can't affect world entity\n");
+ {
+ VM_Warning("gettagindex: can't affect world entity\n");
+ return;
+ }
if (ent->priv.server->free)
- PF_WARNING("gettagindex: can't affect free entity\n");
+ {
+ VM_Warning("gettagindex: can't affect free entity\n");
+ return;
+ }
modelindex = (int)ent->fields.server->modelindex;
tag_index = 0;
switch(returncode)
{
case 1:
- PF_WARNING("gettagindex: can't affect world entity\n");
+ VM_Warning("gettagindex: can't affect world entity\n");
break;
case 2:
- PF_WARNING("gettagindex: can't affect free entity\n");
+ VM_Warning("gettagindex: can't affect free entity\n");
break;
case 3:
Con_DPrintf("SV_GetTagMatrix(entity #%i): null or non-precached model\n", PRVM_NUM_FOR_EDICT(e));
client_t *oldhostclient;
clientnum = PRVM_G_EDICTNUM(OFS_PARM0) - 1;
if (clientnum < 0 || clientnum >= svs.maxclients)
- PF_WARNING("dropclient: not a client\n");
+ {
+ VM_Warning("dropclient: not a client\n");
+ return;
+ }
if (!svs.clients[clientnum].active)
- PF_WARNING("dropclient: that client slot is not connected\n");
+ {
+ VM_Warning("dropclient: that client slot is not connected\n");
+ return;
+ }
oldhostclient = host_client;
host_client = svs.clients + clientnum;
SV_DropClient(false);
e10, // #270-#279
e10, // #280-#289
e10, // #290-#299
-e10, e10, e10, e10, e10, e10, e10, e10, e10, e10, // #300-399
+e10, // #300-309
+e10, // #310-319
+e10, // #320-329
+NULL, // #330
+NULL, // #331
+NULL, // #332
+NULL, // #333
+NULL, // #334
+NULL, // #335
+NULL, // #336
+NULL, // #337
+NULL, // #338
+VM_print, // #339 void(string, ...) print (DP_SV_PRINT)
+e10, // #340-349
+e10, // #350-359
+e10, // #360-369
+e10, // #370-379
+e10, // #380-389
+e10, // #390-399
VM_copyentity, // #400 void(entity from, entity to) copyentity (DP_QC_COPYENTITY)
PF_setcolor, // #401 void(entity ent, float colors) setcolor (DP_QC_SETCOLOR)
VM_findchain, // #402 entity(.string fld, string match) findchain (DP_QC_FINDCHAIN)
VM_bufstr_add, // #468 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
VM_bufstr_free, // #469 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
PF_SV_AddStat, // #470 void(float index, float type, .void field) SV_AddStat (EXT_CSQC)
-NULL, // #471
-NULL, // #472
-NULL, // #473
-NULL, // #474
-NULL, // #475
-NULL, // #476
-NULL, // #477
+VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
+VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
+VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
+VM_atan2, // #474 float(float c, float s) VM_atan2 (DP_QC_ASINACOSATANATAN2TAN)
+VM_tan, // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
+VM_strlennocol, // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
+VM_strdecolorize, // #477 string(string s) : DRESK - Decolorized String (DP_SV_STRINGCOLORFUNCTIONS)
NULL, // #478
NULL, // #479
e10, e10 // #480-499 (LordHavoc)