"SVC_PARTICLE"
};
-#define REQFIELDS (sizeof(reqfields) / sizeof(prvm_required_field_t))
+#define SV_REQFUNCS (sizeof(sv_reqfuncs) / sizeof(const char *))
-prvm_required_field_t reqfields[] =
+#define sv_reqfuncs NULL
+//static const char *sv_reqfuncs[] = {
+//};
+
+#define SV_REQFIELDS (sizeof(sv_reqfields) / sizeof(prvm_required_field_t))
+
+prvm_required_field_t sv_reqfields[] =
{
+ {ev_entity, "aiment"},
+ {ev_entity, "chain"},
+ {ev_entity, "clientcamera"},
{ev_entity, "cursor_trace_ent"},
{ev_entity, "drawonlytoclient"},
+ {ev_entity, "enemy"},
{ev_entity, "exteriormodeltoclient"},
+ {ev_entity, "groundentity"},
{ev_entity, "nodrawtoclient"},
{ev_entity, "tag_entity"},
{ev_entity, "viewmodelforclient"},
{ev_float, "ammo_plasma"},
{ev_float, "ammo_rockets1"},
{ev_float, "ammo_shells1"},
+ {ev_float, "bouncefactor"},
+ {ev_float, "bouncestop"},
{ev_float, "button3"},
{ev_float, "button4"},
{ev_float, "button5"},
{ev_float, "buttonchat"},
{ev_float, "buttonuse"},
{ev_float, "clientcolors"},
+ {ev_float, "color"},
+ {ev_float, "colormod"},
{ev_float, "cursor_active"},
+ {ev_float, "cursor_screen"},
+ {ev_float, "cursor_trace_endpos"},
+ {ev_float, "cursor_trace_start"},
+ {ev_float, "dimension_hit"},
+ {ev_float, "dimension_solid"},
{ev_float, "disableclientprediction"},
+ {ev_float, "discardabledemo"},
+ {ev_float, "dphitcontentsmask"},
+ {ev_float, "fatness"},
+ {ev_float, "forceshader"},
+ {ev_float, "frame"},
+ {ev_float, "frame1time"},
+ {ev_float, "frame2"},
+ {ev_float, "frame2time"},
+ {ev_float, "frame3"},
+ {ev_float, "frame3time"},
+ {ev_float, "frame4"},
+ {ev_float, "frame4time"},
{ev_float, "fullbright"},
{ev_float, "glow_color"},
{ev_float, "glow_size"},
{ev_float, "glow_trail"},
{ev_float, "gravity"},
+ {ev_float, "hull"},
+ {ev_float, "ideal_yaw"},
{ev_float, "idealpitch"},
{ev_float, "items2"},
+ {ev_float, "jointtype"},
+ {ev_float, "lerpfrac"},
+ {ev_float, "lerpfrac3"},
+ {ev_float, "lerpfrac4"},
{ev_float, "light_lev"},
+ {ev_float, "mass"},
{ev_float, "modelflags"},
+ {ev_float, "modelindex"},
+ {ev_float, "movetype"},
+ {ev_float, "nextthink"},
+ {ev_float, "packetloss"},
{ev_float, "pflags"},
{ev_float, "ping"},
+ {ev_float, "ping_packetloss"},
+ {ev_float, "ping_movementloss"},
{ev_float, "pitch_speed"},
{ev_float, "pmodel"},
- {ev_float, "renderamt"}, // HalfLife support
- {ev_float, "rendermode"}, // HalfLife support
+ {ev_float, "renderamt"},
+ {ev_float, "renderflags"},
+ {ev_float, "rendermode"},
{ev_float, "scale"},
+ {ev_float, "sendcomplexanimation"},
+ {ev_float, "shadertime"},
+ {ev_float, "skeletonindex"},
+ {ev_float, "solid"},
{ev_float, "style"},
{ev_float, "tag_index"},
+ {ev_float, "think"},
+ {ev_float, "userwavefunc_param0"},
+ {ev_float, "userwavefunc_param1"},
+ {ev_float, "userwavefunc_param2"},
+ {ev_float, "userwavefunc_param3"},
{ev_float, "viewzoom"},
+ {ev_float, "yaw_speed"},
{ev_function, "SendEntity"},
- {ev_function, "contentstransition"}, // DRESK - Support for Entity Contents Transition Event
+ {ev_function, "camera_transform"},
+ {ev_function, "contentstransition"},
{ev_function, "customizeentityforclient"},
- {ev_function, "movetypesteplandevent"}, // DRESK - Support for MOVETYPE_STEP Entity Land Event
+ {ev_function, "movetypesteplandevent"},
+ {ev_string, "classname"},
+ {ev_string, "clientstatus"},
+ {ev_string, "crypto_encryptmethod"},
+ {ev_string, "crypto_idfp"},
+ {ev_string, "crypto_keyfp"},
+ {ev_string, "crypto_mykeyfp"},
+ {ev_string, "crypto_signmethod"},
+ {ev_string, "message"},
{ev_string, "netaddress"},
{ev_string, "playermodel"},
{ev_string, "playerskin"},
- {ev_vector, "color"},
- {ev_vector, "colormod"},
- {ev_vector, "cursor_screen"},
- {ev_vector, "cursor_trace_endpos"},
- {ev_vector, "cursor_trace_start"},
+ {ev_vector, "angles"},
+ {ev_vector, "angles"},
+ {ev_vector, "avelocity"},
+// {ev_vector, "axis_forward"},
+// {ev_vector, "axis_left"},
+// {ev_vector, "axis_up"},
{ev_vector, "glowmod"},
+ {ev_vector, "maxs"},
+ {ev_vector, "mins"},
+ {ev_vector, "movedir"},
{ev_vector, "movement"},
+ {ev_vector, "origin"},
{ev_vector, "punchvector"},
+// {ev_vector, "spinvelocity"},
+ {ev_vector, "velocity"},
+};
- // physics
- //{ev_float, "solid"},
- //{ev_float, "movetype"},
- //{ev_float, "modelindex"},
- {ev_vector, "mass"},
- //{ev_vector, "origin"},
- //{ev_vector, "velocity"},
- //{ev_vector, "axis_forward"},
- //{ev_vector, "axis_left"},
- //{ev_vector, "axis_up"},
- //{ev_vector, "spinvelocity"},
- //{ev_vector, "angles"},
- //{ev_vector, "avelocity"},
+#define SV_REQGLOBALS (sizeof(sv_reqglobals) / sizeof(prvm_required_field_t))
+prvm_required_field_t sv_reqglobals[] =
+{
+ {ev_entity, "self"},
+ {ev_entity, "trace_ent"},
+ {ev_entity, "trace_networkentity"},
+ {ev_float, "coop"},
+ {ev_float, "deathmatch"},
+ {ev_float, "dmg_save"},
+ {ev_float, "dmg_take"},
+ {ev_float, "drawfont"},
+ {ev_float, "drawfontscale"},
+ {ev_float, "gettaginfo_parent"},
+ {ev_float, "intermission"},
+ {ev_float, "particles_alphamax"},
+ {ev_float, "particles_alphamin"},
+ {ev_float, "require_spawnfunc_prefix"},
+ {ev_float, "sb_showscores"},
+ {ev_float, "serverdeltatime"},
+ {ev_float, "serverprevtime"},
+ {ev_float, "servertime"},
+ {ev_float, "time"},
+ {ev_float, "trace_allsolid"},
+ {ev_float, "trace_dphitcontents"},
+ {ev_float, "trace_dphitq3surfaceflags"},
+ {ev_float, "trace_dpstartcontents"},
+ {ev_float, "trace_fraction"},
+ {ev_float, "trace_inopen"},
+ {ev_float, "trace_inwater"},
+ {ev_float, "trace_plane_dist"},
+ {ev_float, "trace_startsolid"},
+ {ev_float, "transparent_offset"},
+ {ev_string, "SV_InitCmd"},
+ {ev_string, "gettaginfo_name"},
+ {ev_string, "trace_dphittexturename"},
+ {ev_string, "worldstatus"},
+ {ev_vector, "dmg_origin"},
+ {ev_vector, "gettaginfo_forward"},
+ {ev_vector, "gettaginfo_offset"},
+ {ev_vector, "gettaginfo_right"},
+ {ev_vector, "gettaginfo_up"},
+ {ev_vector, "particles_colormax"},
+ {ev_vector, "particles_colormin"},
+ {ev_vector, "trace_endpos"},
+ {ev_vector, "trace_plane_normal"},
+ {ev_vector, "v_forward"},
+ {ev_vector, "v_right"},
+ {ev_vector, "v_up"},
+ {ev_vector, "view_angles"},
+ {ev_vector, "view_punchangle"},
+ {ev_vector, "view_punchvector"},
};
//[515]: init csprogs according to version of svprogs, check the crc, etc.
if (sv.csqc_progname[0])
{
- prvm_eval_t *val;
Con_DPrintf("sending csqc info to client (\"%s\" with size %i and crc %i)\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
MSG_WriteByte (&client->netconnection->message, svc_stufftext);
MSG_WriteString (&client->netconnection->message, va("csqc_progname %s\n", sv.csqc_progname));
}
//[515]: init stufftext string (it is sent before svc_serverinfo)
- val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.SV_InitCmd);
- if (val)
+ if (PRVM_GetString(PRVM_GLOBALFIELDSTRING(prog->globaloffsets.SV_InitCmd)))
{
MSG_WriteByte (&client->netconnection->message, svc_stufftext);
- MSG_WriteString (&client->netconnection->message, va("%s\n", PRVM_GetString(val->string)));
+ MSG_WriteString (&client->netconnection->message, va("%s\n", PRVM_GetString(PRVM_GLOBALFIELDSTRING(prog->globaloffsets.SV_InitCmd))));
}
}
unsigned int customizeentityforclient;
unsigned int sendentity;
float f;
+ float *v;
vec3_t cullmins, cullmaxs;
dp_model_t *model;
- prvm_eval_t *val, *val2;
// fast path for games that do not use legacy entity networking
// note: still networks clients even if they are legacy
- sendentity = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.SendEntity)->function;
+ sendentity = PRVM_EDICTFIELDFUNCTION(ent, prog->fieldoffsets.SendEntity);
if (sv_onlycsqcnetworking.integer && !sendentity && enumber > svs.maxclients)
return false;
modelindex = (i >= 1 && i < MAX_MODELS && ent->fields.server->model && *PRVM_GetString(ent->fields.server->model) && sv.models[i]) ? i : 0;
flags = 0;
- i = (int)(PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_size)->_float * 0.25f);
+ i = (int)(PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.glow_size) * 0.25f);
glowsize = (unsigned char)bound(0, i, 255);
- if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_trail)->_float)
+ if (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.glow_trail))
flags |= RENDER_GLOWTRAIL;
- if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)->edict)
+ if (PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.viewmodelforclient))
flags |= RENDER_VIEWMODEL;
- f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[0]*256;
+ v = PRVM_EDICTFIELDVECTOR(ent, prog->fieldoffsets.color);
+ f = v[0]*256;
light[0] = (unsigned short)bound(0, f, 65535);
- f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[1]*256;
+ f = v[1]*256;
light[1] = (unsigned short)bound(0, f, 65535);
- f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[2]*256;
+ f = v[2]*256;
light[2] = (unsigned short)bound(0, f, 65535);
- f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.light_lev)->_float;
+ f = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.light_lev);
light[3] = (unsigned short)bound(0, f, 65535);
- lightstyle = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.style)->_float;
- lightpflags = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.pflags)->_float;
+ lightstyle = (unsigned char)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.style);
+ lightpflags = (unsigned char)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.pflags);
if (gamemode == GAME_TENEBRAE)
{
// early culling checks
// (final culling is done by SV_MarkWriteEntityStateToClient)
- customizeentityforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.customizeentityforclient)->function;
+ customizeentityforclient = PRVM_EDICTFIELDFUNCTION(ent, prog->fieldoffsets.customizeentityforclient);
if (!customizeentityforclient && enumber > svs.maxclients && (!modelindex && !specialvisibilityradius))
return false;
cs->modelindex = modelindex;
cs->skin = (unsigned)ent->fields.server->skin;
cs->frame = (unsigned)ent->fields.server->frame;
- cs->viewmodelforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)->edict;
- cs->exteriormodelforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.exteriormodeltoclient)->edict;
- cs->nodrawtoclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.nodrawtoclient)->edict;
- cs->drawonlytoclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.drawonlytoclient)->edict;
+ cs->viewmodelforclient = PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.viewmodelforclient);
+ cs->exteriormodelforclient = PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.exteriormodeltoclient);
+ cs->nodrawtoclient = PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.nodrawtoclient);
+ cs->drawonlytoclient = PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.drawonlytoclient);
cs->customizeentityforclient = customizeentityforclient;
- cs->tagentity = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)->edict;
- cs->tagindex = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float;
+ cs->tagentity = PRVM_EDICTFIELDEDICT(ent, prog->fieldoffsets.tag_entity);
+ cs->tagindex = (unsigned char)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.tag_index);
cs->glowsize = glowsize;
// don't need to init cs->colormod because the defaultstate did that for us
//cs->colormod[0] = cs->colormod[1] = cs->colormod[2] = 32;
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.colormod);
- if (val->vector[0] || val->vector[1] || val->vector[2])
+ v = PRVM_EDICTFIELDVECTOR(ent, prog->fieldoffsets.colormod);
+ if (VectorLength2(v))
{
- i = (int)(val->vector[0] * 32.0f);cs->colormod[0] = bound(0, i, 255);
- i = (int)(val->vector[1] * 32.0f);cs->colormod[1] = bound(0, i, 255);
- i = (int)(val->vector[2] * 32.0f);cs->colormod[2] = bound(0, i, 255);
+ i = (int)(v[0] * 32.0f);cs->colormod[0] = bound(0, i, 255);
+ i = (int)(v[1] * 32.0f);cs->colormod[1] = bound(0, i, 255);
+ i = (int)(v[2] * 32.0f);cs->colormod[2] = bound(0, i, 255);
}
// don't need to init cs->glowmod because the defaultstate did that for us
//cs->glowmod[0] = cs->glowmod[1] = cs->glowmod[2] = 32;
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glowmod);
- if (val->vector[0] || val->vector[1] || val->vector[2])
+ v = PRVM_EDICTFIELDVECTOR(ent, prog->fieldoffsets.glowmod);
+ if (VectorLength2(v))
{
- i = (int)(val->vector[0] * 32.0f);cs->glowmod[0] = bound(0, i, 255);
- i = (int)(val->vector[1] * 32.0f);cs->glowmod[1] = bound(0, i, 255);
- i = (int)(val->vector[2] * 32.0f);cs->glowmod[2] = bound(0, i, 255);
+ i = (int)(v[0] * 32.0f);cs->glowmod[0] = bound(0, i, 255);
+ i = (int)(v[1] * 32.0f);cs->glowmod[1] = bound(0, i, 255);
+ i = (int)(v[2] * 32.0f);cs->glowmod[2] = bound(0, i, 255);
}
cs->modelindex = modelindex;
cs->alpha = 255;
- f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.alpha)->_float * 255.0f);
+ f = (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.alpha) * 255.0f);
if (f)
{
i = (int)f;
cs->alpha = (unsigned char)bound(0, i, 255);
}
// halflife
- f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.renderamt)->_float);
+ f = (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.renderamt));
if (f)
{
i = (int)f;
}
cs->scale = 16;
- f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale)->_float * 16.0f);
+ f = (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.scale) * 16.0f);
if (f)
{
i = (int)f;
}
cs->glowcolor = 254;
- f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_color)->_float);
+ f = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.glow_color);
if (f)
cs->glowcolor = (int)f;
- if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.fullbright)->_float)
+ if (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.fullbright))
cs->effects |= EF_FULLBRIGHT;
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.modelflags);
- if (val && val->_float)
- cs->effects |= ((unsigned int)val->_float & 0xff) << 24;
+ f = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.modelflags);
+ if (f)
+ cs->effects |= ((unsigned int)f & 0xff) << 24;
if (ent->fields.server->movetype == MOVETYPE_STEP)
cs->flags |= RENDER_STEP;
if (cs->viewmodelforclient)
cs->flags |= RENDER_VIEWMODEL; // show relative to the view
+ if (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.sendcomplexanimation))
+ {
+ cs->flags |= RENDER_COMPLEXANIMATION;
+ if (PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.skeletonindex) >= 1)
+ cs->skeletonobject = ent->priv.server->skeleton;
+ cs->framegroupblend[0].frame = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame);
+ cs->framegroupblend[1].frame = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame2);
+ cs->framegroupblend[2].frame = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame3);
+ cs->framegroupblend[3].frame = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame4);
+ cs->framegroupblend[0].start = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame1time);
+ cs->framegroupblend[1].start = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame2time);
+ cs->framegroupblend[2].start = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame3time);
+ cs->framegroupblend[3].start = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.frame4time);
+ cs->framegroupblend[1].lerp = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.lerpfrac);
+ cs->framegroupblend[2].lerp = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.lerpfrac3);
+ cs->framegroupblend[3].lerp = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.lerpfrac4);
+ cs->framegroupblend[0].lerp = 1.0f - cs->framegroupblend[1].lerp - cs->framegroupblend[2].lerp - cs->framegroupblend[3].lerp;
+ }
+
cs->light[0] = light[0];
cs->light[1] = light[1];
cs->light[2] = light[2];
// (to let the QC know that they've been read)
if (sendentity)
{
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.SendFlags);
- sendflags = (unsigned int)val->_float;
- val->_float = 0;
+ sendflags = (unsigned int)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.SendFlags);
+ PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.SendFlags) = 0;
// legacy self.Version system
- val2 = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.Version);
- if (val2->_float)
+ if ((version = (unsigned int)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.Version)))
{
- version = (unsigned int)val2->_float;
if (sv.csqcentityversion[enumber] != version)
sendflags = 0xFFFFFF;
sv.csqcentityversion[enumber] = version;
if (!model || !model->brush.TraceLineOfSight)
continue;
// skip obviously transparent entities
- alpha = PRVM_EDICTFIELDVALUE(touch, prog->fieldoffsets.alpha)->_float;
+ alpha = PRVM_EDICTFIELDFLOAT(touch, prog->fieldoffsets.alpha);
if (alpha && alpha < 1)
continue;
if ((int)touch->fields.server->effects & EF_ADDITIVE)
static int eye_levels[MAX_CLIENTNETWORKEYES];
int n_cameras = 0;
vec3_t mi, ma;
- prvm_eval_t *valendpos, *val;
if(!prog->fieldoffsets.camera_transform)
return;
- valendpos = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_endpos);
- if(!valendpos)
- return;
for(i = 0; i < sv.writeentitiestoclient_numeyes; ++i)
eye_levels[i] = 0;
{
if (!ed->priv.server->free)
{
- if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.camera_transform)) && val->function)
+ if(PRVM_EDICTFIELDFUNCTION(ed, prog->fieldoffsets.camera_transform))
{
prog->globals.server->self = e;
prog->globals.server->other = sv.writeentitiestoclient_cliententitynumber;
- VectorCopy(sv.writeentitiestoclient_eyes[0], valendpos->vector);
+ VectorCopy(sv.writeentitiestoclient_eyes[0], PRVM_GLOBALFIELDVECTOR(prog->globaloffsets.trace_endpos));
VectorCopy(sv.writeentitiestoclient_eyes[0], PRVM_G_VECTOR(OFS_PARM0));
VectorClear(PRVM_G_VECTOR(OFS_PARM1));
- PRVM_ExecuteProgram(val->function, "QC function e.camera_transform is missing");
- if(!VectorCompare(valendpos->vector, sv.writeentitiestoclient_eyes[0]))
+ PRVM_ExecuteProgram(PRVM_EDICTFIELDFUNCTION(ed, prog->fieldoffsets.camera_transform), "QC function e.camera_transform is missing");
+ if(!VectorCompare(PRVM_GLOBALFIELDVECTOR(prog->globaloffsets.trace_endpos), sv.writeentitiestoclient_eyes[0]))
{
- VectorCopy(valendpos->vector, camera_origins[n_cameras]);
+ VectorCopy(PRVM_GLOBALFIELDVECTOR(prog->globaloffsets.trace_endpos), camera_origins[n_cameras]);
cameras[n_cameras] = e;
++n_cameras;
if(n_cameras >= MAX_LEVELNETWORKEYES)
int i;
prvm_edict_t *other;
int items;
- prvm_eval_t *val;
vec3_t punchvector;
int viewzoom;
const char *s;
float *statsf = (float *)stats;
+ float gravity;
//
// send a damage message
// stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.items2);
if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
- items = (int)ent->fields.server->items | ((int)val->_float << 23);
+ items = (int)ent->fields.server->items | ((int)PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.items2) << 23);
else
items = (int)ent->fields.server->items | ((int)prog->globals.server->serverflags << 28);
- VectorClear(punchvector);
- if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.punchvector)))
- VectorCopy(val->vector, punchvector);
+ VectorCopy(PRVM_EDICTFIELDVECTOR(ent, prog->fieldoffsets.punchvector), punchvector);
// cache weapon model name and index in client struct to save time
// (this search can be almost 1% of cpu time!)
client->weaponmodelindex = SV_ModelIndex(s, 1);
}
- viewzoom = 255;
- if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewzoom)))
- viewzoom = (int)(val->_float * 255.0f);
+ viewzoom = (int)(PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.viewzoom) * 255.0f);
if (viewzoom == 0)
viewzoom = 255;
bits |= (SU_VELOCITY1<<i);
}
+ gravity = PRVM_EDICTFIELDFLOAT(ent, prog->fieldoffsets.gravity);if (!gravity) gravity = 1.0f;
+
memset(stats, 0, sizeof(int[MAX_CL_STATS]));
stats[STAT_VIEWHEIGHT] = (int)ent->fields.server->view_ofs[2];
stats[STAT_ITEMS] = items;
statsf[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value;
statsf[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value >= 0 ? sv_airaccelerate.value : sv_accelerate.value;
statsf[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value >= 0 ? sv_wateraccelerate.value : sv_accelerate.value;
- val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.gravity);
- statsf[STAT_MOVEVARS_ENTGRAVITY] = (val && val->_float != 0) ? val->_float : 1.0f;
+ statsf[STAT_MOVEVARS_ENTGRAVITY] = gravity;
statsf[STAT_MOVEVARS_JUMPVELOCITY] = sv_jumpvelocity.value;
statsf[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value;
statsf[STAT_MOVEVARS_MAXAIRSPEED] = sv_maxairspeed.value;
{
int i, j;
client_t *client;
- prvm_eval_t *val;
const char *name;
const char *model;
const char *skin;
+ int clientcamera;
// check for changes to be sent over the reliable streams
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
}
// DP_SV_CLIENTCOLORS
- // this is always found (since it's added by the progs loader)
- if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcolors)))
- host_client->colors = (int)val->_float;
+ host_client->colors = (int)PRVM_EDICTFIELDFLOAT(host_client->edict, prog->fieldoffsets.clientcolors);
if (host_client->old_colors != host_client->colors)
{
host_client->old_colors = host_client->colors;
// NEXUIZ_PLAYERMODEL
if( prog->fieldoffsets.playermodel >= 0 ) {
- model = PRVM_GetString(PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string);
+ model = PRVM_GetString(PRVM_EDICTFIELDSTRING(host_client->edict, prog->fieldoffsets.playermodel));
if (model == NULL)
model = "";
// always point the string back at host_client->name to keep it safe
strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
- PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(host_client->playermodel);
+ PRVM_EDICTFIELDSTRING(host_client->edict, prog->fieldoffsets.playermodel) = PRVM_SetEngineString(host_client->playermodel);
}
// NEXUIZ_PLAYERSKIN
if( prog->fieldoffsets.playerskin >= 0 ) {
- skin = PRVM_GetString(PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string);
+ skin = PRVM_GetString(PRVM_EDICTFIELDSTRING(host_client->edict, prog->fieldoffsets.playerskin));
if (skin == NULL)
skin = "";
// always point the string back at host_client->name to keep it safe
strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
- PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(host_client->playerskin);
+ PRVM_EDICTFIELDSTRING(host_client->edict, prog->fieldoffsets.playerskin) = PRVM_SetEngineString(host_client->playerskin);
}
// TODO: add an extension name for this [1/17/2008 Black]
- if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcamera)) && val->edict > 0 ) {
+ clientcamera = PRVM_EDICTFIELDEDICT(host_client->edict, prog->fieldoffsets.clientcamera);
+ if (clientcamera > 0)
+ {
int oldclientcamera = host_client->clientcamera;
- if( val->edict >= prog->max_edicts || PRVM_EDICT_NUM( val->edict )->priv.required->free ) {
- val->edict = host_client->clientcamera = PRVM_NUM_FOR_EDICT( host_client->edict );
- } else {
- host_client->clientcamera = val->edict;
- }
+ if (clientcamera >= prog->max_edicts || PRVM_EDICT_NUM(clientcamera)->priv.required->free)
+ clientcamera = PRVM_NUM_FOR_EDICT(host_client->edict);
+ host_client->clientcamera = clientcamera;
- if( oldclientcamera != host_client->clientcamera ) {
- MSG_WriteByte (&host_client->netconnection->message, svc_setview );
- MSG_WriteShort (&host_client->netconnection->message, host_client->clientcamera);
+ if (oldclientcamera != host_client->clientcamera)
+ {
+ MSG_WriteByte(&host_client->netconnection->message, svc_setview);
+ MSG_WriteShort(&host_client->netconnection->message, host_client->clientcamera);
}
}
//
// AK possible hack since num_edicts is still 0
ent = PRVM_EDICT_NUM(0);
- memset (ent->fields.server, 0, prog->progs->entityfields * 4);
+ memset (ent->fields.server, 0, prog->entityfields * 4);
ent->priv.server->free = false;
ent->fields.server->model = PRVM_SetEngineString(sv.worldname);
ent->fields.server->modelindex = 1; // world model
if (num >= 0 && num < svs.maxclients)
{
- prvm_eval_t *val;
// set colormap and team on newly created player entity
e->fields.server->colormap = num + 1;
e->fields.server->team = (svs.clients[num].colors & 15) + 1;
// DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS will not immediately
// reset them
e->fields.server->netname = PRVM_SetEngineString(svs.clients[num].name);
- if ((val = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.clientcolors)))
- val->_float = svs.clients[num].colors;
+ PRVM_EDICTFIELDFLOAT(e, prog->fieldoffsets.clientcolors) = svs.clients[num].colors;
// NEXUIZ_PLAYERMODEL and NEXUIZ_PLAYERSKIN
if( prog->fieldoffsets.playermodel >= 0 )
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(svs.clients[num].playermodel);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.playermodel) = PRVM_SetEngineString(svs.clients[num].playermodel);
if( prog->fieldoffsets.playerskin >= 0 )
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(svs.clients[num].playerskin);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.playerskin) = PRVM_SetEngineString(svs.clients[num].playerskin);
// Assign netaddress (IP Address, etc)
if(prog->fieldoffsets.netaddress >= 0)
{ // Valid Field; Process
{// Valid Address; Assign
// Acquire Readable Address
LHNETADDRESS_ToString(&svs.clients[num].netconnection->peeraddress, svs.clients[num].netaddress, sizeof(svs.clients[num].netaddress), false);
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.netaddress)->string = PRVM_SetEngineString(svs.clients[num].netaddress);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.netaddress) = PRVM_SetEngineString(svs.clients[num].netaddress);
}
else
// Invalid / Bot
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.netaddress)->string = PRVM_SetEngineString("null/botclient");
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.netaddress) = PRVM_SetEngineString("null/botclient");
}
if(prog->fieldoffsets.crypto_idfp >= 0)
{ // Valid Field; Process
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_idfp[0])
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_idfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_idfp);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_idfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_idfp);
else
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_idfp)->string = 0;
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_idfp) = 0;
}
if(prog->fieldoffsets.crypto_keyfp >= 0)
{ // Valid Field; Process
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_keyfp[0])
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_keyfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_keyfp);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_keyfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_keyfp);
else
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_keyfp)->string = 0;
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_keyfp) = 0;
}
if(prog->fieldoffsets.crypto_mykeyfp >= 0)
{ // Valid Field; Process
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.server_keyfp[0])
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_mykeyfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.server_keyfp);
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_mykeyfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.server_keyfp);
else
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_mykeyfp)->string = 0;
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_mykeyfp) = 0;
}
if(prog->fieldoffsets.crypto_encryptmethod >= 0)
{ // Valid Field; Process
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.use_aes)
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_encryptmethod)->string = PRVM_SetEngineString("AES128");
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_encryptmethod) = PRVM_SetEngineString("AES128");
else
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_encryptmethod)->string = 0;
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_encryptmethod) = 0;
}
if(prog->fieldoffsets.crypto_signmethod >= 0)
{ // Valid Field; Process
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated)
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_signmethod)->string = PRVM_SetEngineString("HMAC-SHA256");
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_signmethod) = PRVM_SetEngineString("HMAC-SHA256");
else
- PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_signmethod)->string = 0;
+ PRVM_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_signmethod) = 0;
}
}
}
prog->error_cmd = Host_Error;
prog->ExecuteProgram = SVVM_ExecuteProgram;
- // TODO: add a requiredfuncs list (ask LH if this is necessary at all)
- PRVM_LoadProgs( sv_progs.string, 0, NULL, REQFIELDS, reqfields, 0, NULL );
+ PRVM_LoadProgs( sv_progs.string, SV_REQFUNCS, sv_reqfuncs, SV_REQFIELDS, sv_reqfields, SV_REQGLOBALS, sv_reqglobals);
// some mods compiled with scrambling compilers lack certain critical
// global names and field names such as "self" and "time" and "nextthink"