cvar_t sv_freezenonclients = {CVAR_NOTIFY, "sv_freezenonclients", "0", "freezes time, except for players, allowing you to walk around and take screenshots of explosions"};
cvar_t sv_friction = {CVAR_NOTIFY, "sv_friction","4", "how fast you slow down"};
cvar_t sv_gameplayfix_blowupfallenzombies = {0, "sv_gameplayfix_blowupfallenzombies", "1", "causes findradius to detect SOLID_NOT entities such as zombies and corpses on the floor, allowing splash damage to apply to them"};
-cvar_t sv_gameplayfix_consistentplayerprethink = {0, "sv_gameplayfix_consistentplayerprethink", "0", "improves fairness in multiplayer by running all PlayerPreThink functions (which fire weapons) before performing physics, then runing all PlayerPostThink functions"};
+cvar_t sv_gameplayfix_consistentplayerprethink = {0, "sv_gameplayfix_consistentplayerprethink", "0", "improves fairness in multiplayer by running all PlayerPreThink functions (which fire weapons) before performing physics, then running all PlayerPostThink functions"};
cvar_t sv_gameplayfix_delayprojectiles = {0, "sv_gameplayfix_delayprojectiles", "1", "causes entities to not move on the same frame they are spawned, meaning that projectiles wait until the next frame to perform their first move, giving proper interpolation and rocket trails, but making weapons harder to use at low framerates"};
cvar_t sv_gameplayfix_droptofloorstartsolid = {0, "sv_gameplayfix_droptofloorstartsolid", "1", "prevents items and monsters that start in a solid area from falling out of the level (makes droptofloor treat trace_startsolid as an acceptable outcome)"};
cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect = {0, "sv_gameplayfix_droptofloorstartsolid_nudgetocorrect", "1", "tries to nudge stuck items and monsters out of walls before droptofloor is performed"};
cvar_t sv_gameplayfix_nudgeoutofsolid = {0, "sv_gameplayfix_nudgeoutofsolid", "1", "attempts to fix physics errors (where an object ended up in solid for some reason)"};
cvar_t sv_gameplayfix_nudgeoutofsolid_bias = {0, "sv_gameplayfix_nudgeoutofsolid_bias", "0", "over-correction on nudgeoutofsolid logic, to prevent constant contact"};
cvar_t sv_gameplayfix_q2airaccelerate = {0, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};
-cvar_t sv_gameplayfix_nogravityonground = {0, "sv_gameplayfix_nogravityonground", "0", "Quake2-style air acceleration"};
+cvar_t sv_gameplayfix_nogravityonground = {0, "sv_gameplayfix_nogravityonground", "0", "turn off gravity when on ground (to get rid of sliding)"};
cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};
cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};
cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "0", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"};
cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1", "applies step-up onto a ledge even while airborn, useful if you would otherwise just-miss the floor when running across small areas with gaps (for instance running across the moving platforms in dm2, or jumping to the megahealth and red armor in dm2 rather than using the bridge)"};
-cvar_t sv_gameplayfix_stepmultipletimes = {0, "sv_gameplayfix_stepmultipletimes", "1", "applies step-up onto a ledge more than once in a single frame, when running quickly up stairs"};
+cvar_t sv_gameplayfix_stepmultipletimes = {0, "sv_gameplayfix_stepmultipletimes", "0", "applies step-up onto a ledge more than once in a single frame, when running quickly up stairs"};
+cvar_t sv_gameplayfix_nostepmoveonsteepslopes = {0, "sv_gameplayfix_nostepmoveonsteepslopes", "0", "grude fix which prevents MOVETYPE_STEP (not swimming or flying) to move on slopes whose angle is bigger than 45 degree"};
cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1", "causes pointcontents (used to determine if you are in a liquid) to check bmodel entities as well as the world model, so you can swim around in (possibly moving) water bmodel entities"};
cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag = {0, "sv_gameplayfix_upwardvelocityclearsongroundflag", "1", "prevents monsters, items, and most other objects from being stuck to the floor when pushed around by damage, and other situations in mods"};
cvar_t sv_gameplayfix_downtracesupportsongroundflag = {0, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps)"};
"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"},
};
Cvar_RegisterVariable (&sv_gameplayfix_stepdown);
Cvar_RegisterVariable (&sv_gameplayfix_stepwhilejumping);
Cvar_RegisterVariable (&sv_gameplayfix_stepmultipletimes);
+ Cvar_RegisterVariable (&sv_gameplayfix_nostepmoveonsteepslopes);
Cvar_RegisterVariable (&sv_gameplayfix_swiminbmodels);
Cvar_RegisterVariable (&sv_gameplayfix_upwardvelocityclearsongroundflag);
Cvar_RegisterVariable (&sv_gameplayfix_downtracesupportsongroundflag);
Cvar_RegisterVariable (&temp1);
// LordHavoc: Nehahra uses these to pass data around cutscene demos
- if (gamemode == GAME_NEHAHRA)
- {
- Cvar_RegisterVariable (&nehx00);
- Cvar_RegisterVariable (&nehx01);
- Cvar_RegisterVariable (&nehx02);
- Cvar_RegisterVariable (&nehx03);
- Cvar_RegisterVariable (&nehx04);
- Cvar_RegisterVariable (&nehx05);
- Cvar_RegisterVariable (&nehx06);
- Cvar_RegisterVariable (&nehx07);
- Cvar_RegisterVariable (&nehx08);
- Cvar_RegisterVariable (&nehx09);
- Cvar_RegisterVariable (&nehx10);
- Cvar_RegisterVariable (&nehx11);
- Cvar_RegisterVariable (&nehx12);
- Cvar_RegisterVariable (&nehx13);
- Cvar_RegisterVariable (&nehx14);
- Cvar_RegisterVariable (&nehx15);
- Cvar_RegisterVariable (&nehx16);
- Cvar_RegisterVariable (&nehx17);
- Cvar_RegisterVariable (&nehx18);
- Cvar_RegisterVariable (&nehx19);
- }
+ Cvar_RegisterVariable (&nehx00);
+ Cvar_RegisterVariable (&nehx01);
+ Cvar_RegisterVariable (&nehx02);
+ Cvar_RegisterVariable (&nehx03);
+ Cvar_RegisterVariable (&nehx04);
+ Cvar_RegisterVariable (&nehx05);
+ Cvar_RegisterVariable (&nehx06);
+ Cvar_RegisterVariable (&nehx07);
+ Cvar_RegisterVariable (&nehx08);
+ Cvar_RegisterVariable (&nehx09);
+ Cvar_RegisterVariable (&nehx10);
+ Cvar_RegisterVariable (&nehx11);
+ Cvar_RegisterVariable (&nehx12);
+ Cvar_RegisterVariable (&nehx13);
+ Cvar_RegisterVariable (&nehx14);
+ Cvar_RegisterVariable (&nehx15);
+ Cvar_RegisterVariable (&nehx16);
+ Cvar_RegisterVariable (&nehx17);
+ Cvar_RegisterVariable (&nehx18);
+ Cvar_RegisterVariable (&nehx19);
Cvar_RegisterVariable (&cutscene); // for Nehahra but useful to other mods as well
Cvar_RegisterVariable (&sv_autodemo_perclient);
Cvar_RegisterVariable (&halflifebsp);
- // any special defaults for gamemodes go here
- if (gamemode == GAME_NEHAHRA)
- {
- // Nehahra pushable crates malfunction in some levels if this is on
- Cvar_SetValueQuick (&sv_gameplayfix_upwardvelocityclearsongroundflag, 0);
- // Nehahra NPC AI is confused by this feature
- Cvar_SetValueQuick (&sv_gameplayfix_blowupfallenzombies, 0);
- }
- if (gamemode == GAME_HIPNOTIC)
- {
- // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
- Cvar_SetValueQuick (&sv_gameplayfix_blowupfallenzombies, 0);
- // hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
- Cvar_SetValueQuick (&sys_ticrate, 0.02);
- // hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
- Cvar_SetValueQuick (&sv_gameplayfix_slidemoveprojectiles, 0);
- }
- if (gamemode == GAME_ROGUE)
- {
- // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
- Cvar_SetValueQuick (&sv_gameplayfix_findradiusdistancetobox, 0);
- }
- if (gamemode == GAME_NEXUIZ)
- {
- Cvar_SetValueQuick (&sv_gameplayfix_q2airaccelerate, 1);
- }
-
sv_mempool = Mem_AllocPool("server", 0, NULL);
}
//[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))));
}
}
{
client_t *client;
int i;
- float spawn_parms[NUM_SPAWN_PARMS];
client = svs.clients + clientnum;
// set up the client_t
if (sv.loadgame)
- memcpy (spawn_parms, client->spawn_parms, sizeof(spawn_parms));
- memset (client, 0, sizeof(*client));
+ {
+ float backupparms[NUM_SPAWN_PARMS];
+ memcpy(backupparms, client->spawn_parms, sizeof(backupparms));
+ memset(client, 0, sizeof(*client));
+ memcpy(client->spawn_parms, backupparms, sizeof(backupparms));
+ }
+ else
+ memset(client, 0, sizeof(*client));
client->active = true;
client->netconnection = netconnection;
Con_DPrintf("Client %s connected\n", client->netconnection ? client->netconnection->address : "botclient");
+ if(client->netconnection && client->netconnection->crypto.authenticated)
+ {
+ Con_Printf("%s connection to %s has been established: client is %s@%.*s, I am %.*s@%.*s\n",
+ client->netconnection->crypto.use_aes ? "Encrypted" : "Authenticated",
+ client->netconnection->address,
+ client->netconnection->crypto.client_idfp[0] ? client->netconnection->crypto.client_idfp : "-",
+ crypto_keyfp_recommended_length, client->netconnection->crypto.client_keyfp[0] ? client->netconnection->crypto.client_keyfp : "-",
+ crypto_keyfp_recommended_length, client->netconnection->crypto.server_idfp[0] ? client->netconnection->crypto.server_idfp : "-",
+ crypto_keyfp_recommended_length, client->netconnection->crypto.server_keyfp[0] ? client->netconnection->crypto.server_keyfp : "-"
+ );
+ }
+
strlcpy(client->name, "unconnected", sizeof(client->name));
strlcpy(client->old_name, "unconnected", sizeof(client->old_name));
client->spawned = false;
client->rate = 1000000000;
client->connecttime = realtime;
- if (sv.loadgame)
- memcpy (client->spawn_parms, spawn_parms, sizeof(spawn_parms));
- else
+ if (!sv.loadgame)
{
// call the progs to get default spawn parms for the new client
// set self to world to intentionally cause errors with broken SetNewParms code in some mods
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)
{
int e, i, j, k;
prvm_edict_t *ed;
- int cameras[MAX_LEVELNETWORKEYES];
- vec3_t camera_origins[MAX_LEVELNETWORKEYES];
- int eye_levels[MAX_CLIENTNETWORKEYES];
+ static int cameras[MAX_LEVELNETWORKEYES];
+ static vec3_t camera_origins[MAX_LEVELNETWORKEYES];
+ 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]))
- VectorCopy(valendpos->vector, camera_origins[n_cameras]);
- cameras[n_cameras] = e;
- ++n_cameras;
- if(n_cameras >= MAX_LEVELNETWORKEYES)
- break;
+ 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(PRVM_GLOBALFIELDVECTOR(prog->globaloffsets.trace_endpos), camera_origins[n_cameras]);
+ cameras[n_cameras] = e;
+ ++n_cameras;
+ if(n_cameras >= MAX_LEVELNETWORKEYES)
+ break;
+ }
}
}
}
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);
}
}
// frags
host_client->frags = (int)host_client->edict->fields.server->frags;
- if(gamemode == GAME_NEXUIZ)
+ if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
if(!host_client->spawned && host_client->netconnection)
host_client->frags = -666;
if (host_client->old_frags != host_client->frags)
return;
}
+ Collision_Cache_Reset(true);
+
// let's not have any servers with no name
if (hostname.string[0] == 0)
Cvar_Set ("hostname", "UNNAMED");
//
// 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_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_idfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_idfp);
+ else
+ 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_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_keyfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_keyfp);
+ else
+ 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_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_mykeyfp) = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.server_keyfp);
+ else
+ 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_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_encryptmethod) = PRVM_SetEngineString("AES128");
+ else
+ 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_EDICTFIELDSTRING(e, prog->fieldoffsets.crypto_signmethod) = PRVM_SetEngineString("HMAC-SHA256");
+ else
+ 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"