// latest received clc_ackframe (used to detect packet loss)
int latestframenum;
+ // cache weaponmodel name lookups
+ char weaponmodel[MAX_QPATH];
+ int weaponmodelindex;
+
entityframe_database_t *entitydatabase;
entityframe4_database_t *entitydatabase4;
entityframe5_database_t *entitydatabase5;
void SV_BroadcastPrintf(const char *fmt, ...);
void SV_Physics (void);
+void SV_Physics_ClientEntity (prvm_edict_t *ent);
qboolean SV_PlayerCheckGround (prvm_edict_t *ent);
qboolean SV_CheckBottom (prvm_edict_t *ent);
prvm_eval_t *val;
vec3_t punchvector;
qbyte viewzoom;
- int weaponmodelindex;
+ const char *s;
//
// send a damage message
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_punchvector)))
VectorCopy(val->vector, punchvector);
- weaponmodelindex = SV_ModelIndex(PRVM_GetString(ent->fields.server->weaponmodel), 1);
+ // FIXME: cache weapon model name and index in client struct to save time
+ // (this search can be almost 1% of cpu time!)
+ s = PRVM_GetString(ent->fields.server->weaponmodel);
+ if (strcmp(s, client->weaponmodel))
+ {
+ strlcpy(client->weaponmodel, s, sizeof(client->weaponmodel));
+ client->weaponmodelindex = SV_ModelIndex(s, 1);
+ }
viewzoom = 255;
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_viewzoom)))
stats[STAT_ITEMS] = items;
stats[STAT_WEAPONFRAME] = ent->fields.server->weaponframe;
stats[STAT_ARMOR] = ent->fields.server->armorvalue;
- stats[STAT_WEAPON] = weaponmodelindex;
+ stats[STAT_WEAPON] = client->weaponmodelindex;
stats[STAT_HEALTH] = ent->fields.server->health;
stats[STAT_AMMO] = ent->fields.server->currentammo;
stats[STAT_SHELLS] = ent->fields.server->ammo_shells;