2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // sv_user.c -- server code for moving users
24 cvar_t sv_edgefriction = {0, "edgefriction", "2", "how much you slow down when nearing a ledge you might fall off"};
25 cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"};
26 cvar_t sv_maxspeed = {CVAR_NOTIFY, "sv_maxspeed", "320", "maximum speed a player can accelerate to when on ground (can be exceeded by tricks)"};
27 cvar_t sv_maxairspeed = {0, "sv_maxairspeed", "30", "maximum speed a player can accelerate to when airborn (note that it is possible to completely stop by moving the opposite direction)"};
28 cvar_t sv_accelerate = {0, "sv_accelerate", "10", "rate at which a player accelerates to sv_maxspeed"};
29 cvar_t sv_airaccelerate = {0, "sv_airaccelerate", "-1", "rate at which a player accelerates to sv_maxairspeed while in the air, if less than 0 the sv_accelerate variable is used instead"};
30 cvar_t sv_wateraccelerate = {0, "sv_wateraccelerate", "-1", "rate at which a player accelerates to sv_maxspeed while in the air, if less than 0 the sv_accelerate variable is used instead"};
41 void SV_SetIdealPitch (void)
43 float angleval, sinval, cosval, step, dir;
50 if (!((int)host_client->edict->fields.server->flags & FL_ONGROUND))
53 angleval = host_client->edict->fields.server->angles[YAW] * M_PI*2 / 360;
54 sinval = sin(angleval);
55 cosval = cos(angleval);
57 for (i=0 ; i<MAX_FORWARD ; i++)
59 top[0] = host_client->edict->fields.server->origin[0] + cosval*(i+3)*12;
60 top[1] = host_client->edict->fields.server->origin[1] + sinval*(i+3)*12;
61 top[2] = host_client->edict->fields.server->origin[2] + host_client->edict->fields.server->view_ofs[2];
65 bottom[2] = top[2] - 160;
67 tr = SV_Move (top, vec3_origin, vec3_origin, bottom, MOVE_NOMONSTERS, host_client->edict);
68 // if looking at a wall, leave ideal the way is was
76 z[i] = top[2] + tr.fraction*(bottom[2]-top[2]);
84 if (step > -ON_EPSILON && step < ON_EPSILON)
88 if (dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON ) )
97 host_client->edict->fields.server->idealpitch = 0;
103 host_client->edict->fields.server->idealpitch = -dir * sv_idealpitchscale.value;
106 static vec3_t wishdir, forward, right, up;
107 static float wishspeed;
109 static qboolean onground;
117 void SV_UserFriction (void)
119 float speed, newspeed, control, friction;
123 speed = sqrt(host_client->edict->fields.server->velocity[0]*host_client->edict->fields.server->velocity[0]+host_client->edict->fields.server->velocity[1]*host_client->edict->fields.server->velocity[1]);
127 // if the leading edge is over a dropoff, increase friction
128 start[0] = stop[0] = host_client->edict->fields.server->origin[0] + host_client->edict->fields.server->velocity[0]/speed*16;
129 start[1] = stop[1] = host_client->edict->fields.server->origin[1] + host_client->edict->fields.server->velocity[1]/speed*16;
130 start[2] = host_client->edict->fields.server->origin[2] + host_client->edict->fields.server->mins[2];
131 stop[2] = start[2] - 34;
133 trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, host_client->edict);
135 if (trace.fraction == 1.0)
136 friction = sv_friction.value*sv_edgefriction.value;
138 friction = sv_friction.value;
141 control = speed < sv_stopspeed.value ? sv_stopspeed.value : speed;
142 newspeed = speed - sv.frametime*control*friction;
149 VectorScale(host_client->edict->fields.server->velocity, newspeed, host_client->edict->fields.server->velocity);
157 void SV_Accelerate (void)
160 float addspeed, accelspeed, currentspeed;
162 currentspeed = DotProduct (host_client->edict->fields.server->velocity, wishdir);
163 addspeed = wishspeed - currentspeed;
166 accelspeed = sv_accelerate.value*sv.frametime*wishspeed;
167 if (accelspeed > addspeed)
168 accelspeed = addspeed;
170 for (i=0 ; i<3 ; i++)
171 host_client->edict->fields.server->velocity[i] += accelspeed*wishdir[i];
174 void SV_AirAccelerate (vec3_t wishveloc)
177 float addspeed, wishspd, accelspeed, currentspeed;
179 wishspd = VectorNormalizeLength (wishveloc);
180 if (wishspd > sv_maxairspeed.value)
181 wishspd = sv_maxairspeed.value;
182 currentspeed = DotProduct (host_client->edict->fields.server->velocity, wishveloc);
183 addspeed = wishspd - currentspeed;
186 accelspeed = (sv_airaccelerate.value < 0 ? sv_accelerate.value : sv_airaccelerate.value)*wishspeed * sv.frametime;
187 if (accelspeed > addspeed)
188 accelspeed = addspeed;
190 for (i=0 ; i<3 ; i++)
191 host_client->edict->fields.server->velocity[i] += accelspeed*wishveloc[i];
195 void DropPunchAngle (void)
200 len = VectorNormalizeLength (host_client->edict->fields.server->punchangle);
202 len -= 10*sv.frametime;
205 VectorScale (host_client->edict->fields.server->punchangle, len, host_client->edict->fields.server->punchangle);
207 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_punchvector)))
209 len = VectorNormalizeLength (val->vector);
211 len -= 20*sv.frametime;
214 VectorScale (val->vector, len, val->vector);
223 void SV_FreeMove (void)
228 AngleVectors (host_client->edict->fields.server->v_angle, forward, right, up);
230 for (i = 0; i < 3; i++)
231 host_client->edict->fields.server->velocity[i] = forward[i] * cmd.forwardmove + right[i] * cmd.sidemove;
233 host_client->edict->fields.server->velocity[2] += cmd.upmove;
235 wishspeed = VectorLength(host_client->edict->fields.server->velocity);
236 if (wishspeed > sv_maxspeed.value)
237 VectorScale(host_client->edict->fields.server->velocity, sv_maxspeed.value / wishspeed, host_client->edict->fields.server->velocity);
246 void SV_WaterMove (void)
250 float speed, newspeed, wishspeed, addspeed, accelspeed, temp;
253 AngleVectors (host_client->edict->fields.server->v_angle, forward, right, up);
255 for (i=0 ; i<3 ; i++)
256 wishvel[i] = forward[i]*cmd.forwardmove + right[i]*cmd.sidemove;
258 if (!cmd.forwardmove && !cmd.sidemove && !cmd.upmove)
259 wishvel[2] -= 60; // drift towards bottom
261 wishvel[2] += cmd.upmove;
263 wishspeed = VectorLength(wishvel);
264 if (wishspeed > sv_maxspeed.value)
266 temp = sv_maxspeed.value/wishspeed;
267 VectorScale (wishvel, temp, wishvel);
268 wishspeed = sv_maxspeed.value;
273 speed = VectorLength(host_client->edict->fields.server->velocity);
276 newspeed = speed - sv.frametime * speed * sv_waterfriction.value;
279 temp = newspeed/speed;
280 VectorScale(host_client->edict->fields.server->velocity, temp, host_client->edict->fields.server->velocity);
285 // water acceleration
289 addspeed = wishspeed - newspeed;
293 VectorNormalize (wishvel);
294 accelspeed = (sv_wateraccelerate.value < 0 ? sv_accelerate.value : sv_wateraccelerate.value) * wishspeed * sv.frametime;
295 if (accelspeed > addspeed)
296 accelspeed = addspeed;
298 for (i=0 ; i<3 ; i++)
299 host_client->edict->fields.server->velocity[i] += accelspeed * wishvel[i];
302 void SV_WaterJump (void)
304 if (sv.time > host_client->edict->fields.server->teleport_time || !host_client->edict->fields.server->waterlevel)
306 host_client->edict->fields.server->flags = (int)host_client->edict->fields.server->flags & ~FL_WATERJUMP;
307 host_client->edict->fields.server->teleport_time = 0;
309 host_client->edict->fields.server->velocity[0] = host_client->edict->fields.server->movedir[0];
310 host_client->edict->fields.server->velocity[1] = host_client->edict->fields.server->movedir[1];
320 void SV_AirMove (void)
324 float fmove, smove, temp;
326 // LordHavoc: correct quake movement speed bug when looking up/down
327 wishvel[0] = wishvel[2] = 0;
328 wishvel[1] = host_client->edict->fields.server->angles[1];
329 AngleVectors (wishvel, forward, right, up);
331 fmove = cmd.forwardmove;
332 smove = cmd.sidemove;
334 // hack to not let you back into teleporter
335 if (sv.time < host_client->edict->fields.server->teleport_time && fmove < 0)
338 for (i=0 ; i<3 ; i++)
339 wishvel[i] = forward[i]*fmove + right[i]*smove;
341 if ((int)host_client->edict->fields.server->movetype != MOVETYPE_WALK)
342 wishvel[2] += cmd.upmove;
344 VectorCopy (wishvel, wishdir);
345 wishspeed = VectorNormalizeLength(wishdir);
346 if (wishspeed > sv_maxspeed.value)
348 temp = sv_maxspeed.value/wishspeed;
349 VectorScale (wishvel, temp, wishvel);
350 wishspeed = sv_maxspeed.value;
353 if (host_client->edict->fields.server->movetype == MOVETYPE_NOCLIP)
356 VectorCopy (wishvel, host_client->edict->fields.server->velocity);
358 else if (onground && (!sv_gameplayfix_qwplayerphysics.integer || !(host_client->edict->fields.server->button2 || !((int)host_client->edict->fields.server->flags & FL_JUMPRELEASED))))
365 // not on ground, so little effect on velocity
366 SV_AirAccelerate (wishvel);
374 the move fields specify an intended velocity in pix/sec
375 the angle fields specify an exact angular motion in degrees
378 void SV_ClientThink (void)
382 if (host_client->edict->fields.server->movetype == MOVETYPE_NONE)
385 onground = (int)host_client->edict->fields.server->flags & FL_ONGROUND;
389 // if dead, behave differently
390 if (host_client->edict->fields.server->health <= 0)
393 cmd = host_client->cmd;
396 // show 1/3 the pitch angle and all the roll angle
397 VectorAdd (host_client->edict->fields.server->v_angle, host_client->edict->fields.server->punchangle, v_angle);
398 host_client->edict->fields.server->angles[ROLL] = V_CalcRoll (host_client->edict->fields.server->angles, host_client->edict->fields.server->velocity)*4;
399 if (!host_client->edict->fields.server->fixangle)
401 host_client->edict->fields.server->angles[PITCH] = -v_angle[PITCH]/3;
402 host_client->edict->fields.server->angles[YAW] = v_angle[YAW];
405 if ( (int)host_client->edict->fields.server->flags & FL_WATERJUMP )
412 // Player is (somehow) outside of the map, or flying, or noclipping
413 if (host_client->edict->fields.server->movetype != MOVETYPE_NOCLIP && (host_client->edict->fields.server->movetype == MOVETYPE_FLY || SV_TestEntityPosition (host_client->edict)))
414 //if (host_client->edict->fields.server->movetype == MOVETYPE_NOCLIP || host_client->edict->fields.server->movetype == MOVETYPE_FLY || SV_TestEntityPosition (host_client->edict))
422 if ((host_client->edict->fields.server->waterlevel >= 2) && (host_client->edict->fields.server->movetype != MOVETYPE_NOCLIP))
436 qboolean SV_ReadClientMove (void)
438 qboolean kickplayer = false;
441 #ifdef NUM_PING_TIMES
444 usercmd_t *move = &host_client->cmd;
446 oldmovetime = move->time;
448 // if this move has been applied, clear it, and start accumulating new data
450 memset(move, 0, sizeof(*move));
452 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
455 if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5 && sv.protocol != PROTOCOL_DARKPLACES6)
456 move->sequence = MSG_ReadLong ();
457 move->time = MSG_ReadFloat ();
458 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
459 move->receivetime = sv.time;
461 // calculate average ping time
462 host_client->ping = move->receivetime - move->time;
463 #ifdef NUM_PING_TIMES
464 host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = move->receivetime - move->time;
465 host_client->num_pings++;
466 for (i=0, total = 0;i < NUM_PING_TIMES;i++)
467 total += host_client->ping_times[i];
468 host_client->ping = total / NUM_PING_TIMES;
471 // read current angles
472 for (i = 0;i < 3;i++)
474 if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE)
475 move->viewangles[i] = MSG_ReadAngle8i();
476 else if (sv.protocol == PROTOCOL_DARKPLACES1)
477 move->viewangles[i] = MSG_ReadAngle16i();
478 else if (sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3)
479 move->viewangles[i] = MSG_ReadAngle32f();
481 move->viewangles[i] = MSG_ReadAngle16i();
483 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
486 move->forwardmove = MSG_ReadCoord16i ();
487 move->sidemove = MSG_ReadCoord16i ();
488 move->upmove = MSG_ReadCoord16i ();
489 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
492 // be sure to bitwise OR them into the move->buttons because we want to
493 // accumulate button presses from multiple packets per actual move
494 if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5)
495 move->buttons |= MSG_ReadByte ();
497 move->buttons |= MSG_ReadLong ();
498 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
504 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
506 // PRYDON_CLIENTCURSOR
507 if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5)
510 move->cursor_screen[0] = MSG_ReadShort() * (1.0f / 32767.0f);
511 move->cursor_screen[1] = MSG_ReadShort() * (1.0f / 32767.0f);
512 move->cursor_start[0] = MSG_ReadFloat();
513 move->cursor_start[1] = MSG_ReadFloat();
514 move->cursor_start[2] = MSG_ReadFloat();
515 move->cursor_impact[0] = MSG_ReadFloat();
516 move->cursor_impact[1] = MSG_ReadFloat();
517 move->cursor_impact[2] = MSG_ReadFloat();
518 move->cursor_entitynumber = (unsigned short)MSG_ReadShort();
519 if (move->cursor_entitynumber >= prog->max_edicts)
521 Con_DPrintf("SV_ReadClientMessage: client send bad cursor_entitynumber\n");
522 move->cursor_entitynumber = 0;
524 // as requested by FrikaC, cursor_trace_ent is reset to world if the
525 // entity is free at time of receipt
526 if (PRVM_EDICT_NUM(move->cursor_entitynumber)->priv.server->free)
527 move->cursor_entitynumber = 0;
528 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
531 if (!host_client->spawned)
532 memset(move, 0, sizeof(*move));
533 else if (move->sequence && (float)move->time > (float)sv.time + 0.125f) // add a little fuzz factor due to float precision issues
535 Con_DPrintf("client move->time %f > sv.time %f, kicking\n", (float)move->time, (float)sv.time);
536 // if the client is lying about time, we have definitively detected a
537 // speed cheat attempt of the worst sort, and we can immediately kick
538 // the offending player off.
539 // this fixes the timestamp to prevent a speed cheat from working
540 move->time = sv.time;
541 // but we kick the player for good measure
546 // apply the latest accepted move to the entity fields
547 host_client->movesequence = move->sequence;
548 if (host_client->movesequence)
550 double frametime = bound(0, move->time - oldmovetime, 0.1);
551 double oldframetime = prog->globals.server->frametime;
552 //if (move->time - oldmovetime >= 0.1001)
553 // Con_DPrintf("client move exceeds 100ms! (time %f -> time %f)\n", oldmovetime, move->time);
554 prog->globals.server->frametime = frametime;
555 SV_Physics_ClientEntity(host_client->edict);
556 prog->globals.server->frametime = oldframetime;
562 void SV_ApplyClientMove (void)
565 usercmd_t *move = &host_client->cmd;
567 if (!move->receivetime)
570 // note: a move can be applied multiple times if the client packets are
571 // not coming as often as the physics is executed, and the move must be
572 // applied before running qc each time because the id1 qc had a bug where
573 // it clears self.button2 in PlayerJump, causing pogostick behavior if
574 // moves are not applied every time before calling qc
575 move->applied = true;
577 // set the edict fields
578 host_client->edict->fields.server->button0 = move->buttons & 1;
579 host_client->edict->fields.server->button2 = (move->buttons & 2)>>1;
581 host_client->edict->fields.server->impulse = move->impulse;
582 // only send the impulse to qc once
584 VectorCopy(move->viewangles, host_client->edict->fields.server->v_angle);
585 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button3))) val->_float = ((move->buttons >> 2) & 1);
586 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button4))) val->_float = ((move->buttons >> 3) & 1);
587 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button5))) val->_float = ((move->buttons >> 4) & 1);
588 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button6))) val->_float = ((move->buttons >> 5) & 1);
589 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button7))) val->_float = ((move->buttons >> 6) & 1);
590 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button8))) val->_float = ((move->buttons >> 7) & 1);
591 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button9))) val->_float = ((move->buttons >> 11) & 1);
592 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button10))) val->_float = ((move->buttons >> 12) & 1);
593 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button11))) val->_float = ((move->buttons >> 13) & 1);
594 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button12))) val->_float = ((move->buttons >> 14) & 1);
595 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button13))) val->_float = ((move->buttons >> 15) & 1);
596 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button14))) val->_float = ((move->buttons >> 16) & 1);
597 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button15))) val->_float = ((move->buttons >> 17) & 1);
598 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button16))) val->_float = ((move->buttons >> 18) & 1);
599 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_buttonuse))) val->_float = ((move->buttons >> 8) & 1);
600 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_buttonchat))) val->_float = ((move->buttons >> 9) & 1);
601 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_active))) val->_float = ((move->buttons >> 10) & 1);
602 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_movement))) VectorSet(val->vector, move->forwardmove, move->sidemove, move->upmove);
603 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_screen))) VectorCopy(move->cursor_screen, val->vector);
604 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_trace_start))) VectorCopy(move->cursor_start, val->vector);
605 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_trace_endpos))) VectorCopy(move->cursor_impact, val->vector);
606 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_trace_ent))) val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM(move->cursor_entitynumber));
607 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ping))) val->_float = host_client->ping * 1000.0;
610 void SV_FrameLost(int framenum)
612 if (host_client->entitydatabase5)
613 EntityFrame5_LostFrame(host_client->entitydatabase5, framenum);
616 void SV_FrameAck(int framenum)
618 if (host_client->entitydatabase)
619 EntityFrame_AckFrame(host_client->entitydatabase, framenum);
620 else if (host_client->entitydatabase4)
621 EntityFrame4_AckFrame(host_client->entitydatabase4, framenum, true);
622 else if (host_client->entitydatabase5)
623 EntityFrame5_AckFrame(host_client->entitydatabase5, framenum);
631 extern void SV_SendServerinfo(client_t *client);
632 void SV_ReadClientMessage(void)
637 //MSG_BeginReading ();
641 if (!host_client->active)
643 // a command caused an error
644 SV_DropClient (false);
650 Con_Print("SV_ReadClientMessage: badread\n");
651 SV_DropClient (false);
655 cmd = MSG_ReadByte ();
665 Con_Printf("SV_ReadClientMessage: unknown command char %i\n", cmd);
666 SV_DropClient (false);
673 s = MSG_ReadString ();
674 if (strncasecmp(s, "spawn", 5) == 0
675 || strncasecmp(s, "begin", 5) == 0
676 || strncasecmp(s, "prespawn", 8) == 0)
677 Cmd_ExecuteString (s, src_client);
678 else if (SV_ParseClientCommandQC)
680 PRVM_G_INT(OFS_PARM0) = PRVM_SetEngineString(s);
681 prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
682 PRVM_ExecuteProgram ((func_t)(SV_ParseClientCommandQC - prog->functions), "QC function SV_ParseClientCommand is missing");
684 else if (strncasecmp(s, "status", 6) == 0
685 || strncasecmp(s, "name", 4) == 0
686 || strncasecmp(s, "say", 3) == 0
687 || strncasecmp(s, "say_team", 8) == 0
688 || strncasecmp(s, "tell", 4) == 0
689 || strncasecmp(s, "color", 5) == 0
690 || strncasecmp(s, "kill", 4) == 0
691 || strncasecmp(s, "pause", 5) == 0
692 || strncasecmp(s, "kick", 4) == 0
693 || strncasecmp(s, "ping", 4) == 0
694 || strncasecmp(s, "ban", 3) == 0
695 || strncasecmp(s, "pmodel", 6) == 0
696 || strncasecmp(s, "rate", 4) == 0
697 || strncasecmp(s, "playermodel", 11) == 0
698 || strncasecmp(s, "playerskin", 10) == 0
699 || (gamemode == GAME_NEHAHRA && (strncasecmp(s, "max", 3) == 0 || strncasecmp(s, "monster", 7) == 0 || strncasecmp(s, "scrag", 5) == 0 || strncasecmp(s, "gimme", 5) == 0 || strncasecmp(s, "wraith", 6) == 0))
700 || (gamemode != GAME_NEHAHRA && (strncasecmp(s, "god", 3) == 0 || strncasecmp(s, "notarget", 8) == 0 || strncasecmp(s, "fly", 3) == 0 || strncasecmp(s, "give", 4) == 0 || strncasecmp(s, "noclip", 6) == 0)))
701 Cmd_ExecuteString (s, src_client);
703 Con_Printf("%s tried to %s\n", host_client->name, s);
707 SV_DropClient (false); // client wants to disconnect
711 // if ReadClientMove returns true, the client tried to speed cheat
712 if (SV_ReadClientMove ())
713 SV_DropClient (false);
717 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
718 num = MSG_ReadLong();
719 if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
720 if (developer_networkentities.integer >= 1)
721 Con_Printf("recv clc_ackframe %i\n", num);
722 // if the client hasn't progressed through signons yet,
723 // ignore any clc_ackframes we get (they're probably from the
725 if (host_client->spawned && host_client->latestframenum < num)
728 for (i = host_client->latestframenum + 1;i < num;i++)
731 host_client->latestframenum = num;