// if paused or a local game, don't predict
if (sv_predict.integer && (svs.maxclients > 1) && (!sv.paused))
host_client->latency = host_client->ping;
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_ping)))
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_ping)))
val->_float = host_client->ping * 1000.0;
// read current angles
for (i = 0;i < 3;i++)
angle[i] = MSG_ReadFloat ();
- VectorCopy (angle, host_client->edict->v->v_angle);
+ VectorCopy (angle, sv_player->v->v_angle);
// read movement
move->forwardmove = MSG_ReadShort ();
move->sidemove = MSG_ReadShort ();
move->upmove = MSG_ReadShort ();
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_movement)))
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_movement)))
{
val->vector[0] = move->forwardmove;
val->vector[1] = move->sidemove;
// read buttons
bits = MSG_ReadByte ();
- host_client->edict->v->button0 = bits & 1;
- host_client->edict->v->button2 = (bits & 2)>>1;
+ sv_player->v->button0 = bits & 1;
+ sv_player->v->button2 = (bits & 2)>>1;
// LordHavoc: added 6 new buttons
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button3))) val->_float = ((bits >> 2) & 1);
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button4))) val->_float = ((bits >> 3) & 1);
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button5))) val->_float = ((bits >> 4) & 1);
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button6))) val->_float = ((bits >> 5) & 1);
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button7))) val->_float = ((bits >> 6) & 1);
- if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button8))) val->_float = ((bits >> 7) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button3))) val->_float = ((bits >> 2) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button4))) val->_float = ((bits >> 3) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button5))) val->_float = ((bits >> 4) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button6))) val->_float = ((bits >> 5) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button7))) val->_float = ((bits >> 6) & 1);
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_button8))) val->_float = ((bits >> 7) & 1);
i = MSG_ReadByte ();
if (i)
- host_client->edict->v->impulse = i;
+ sv_player->v->impulse = i;
}
/*
int cmd;
char *s;
- do
+ for (;;)
{
nextmsg:
ret = NET_GetMessage (host_client->netconnection);
if (ret == -1)
{
- Sys_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
+ Con_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
return false;
}
if (!ret)
MSG_BeginReading ();
- while (1)
+ for(;;)
{
if (!host_client->active)
// a command caused an error
if (msg_badread)
{
- Sys_Printf ("SV_ReadClientMessage: badread\n");
+ Con_Printf ("SV_ReadClientMessage: badread\n");
return false;
}
cmd = MSG_ReadChar ();
-#ifndef NOROUTINGFIX
- if (cmd != -1 && host_client->waitingforconnect)
- {
- host_client->waitingforconnect = false;
- host_client->sendserverinfo = true;
- }
-#endif
-
switch (cmd)
{
case -1:
goto nextmsg;
default:
- Sys_Printf ("SV_ReadClientMessage: unknown command char %i\n", cmd);
+ Con_Printf ("SV_ReadClientMessage: unknown command char %i\n", cmd);
return false;
case clc_nop:
case clc_stringcmd:
s = MSG_ReadString ();
- ret = 0;
- if (strncasecmp(s, "status", 6) == 0
+ if (strncasecmp(s, "spawn", 5) == 0
+ || strncasecmp(s, "begin", 5) == 0
+ || strncasecmp(s, "prespawn", 8) == 0)
+ Cmd_ExecuteString (s, src_client);
+ else if (SV_ParseClientCommandQC)
+ {
+ G_INT(OFS_PARM0) = PR_SetString(s);
+ pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
+ PR_ExecuteProgram ((func_t)(SV_ParseClientCommandQC - pr_functions), "");
+ }
+ else if (strncasecmp(s, "status", 6) == 0
|| strncasecmp(s, "name", 4) == 0
|| strncasecmp(s, "say", 3) == 0
|| strncasecmp(s, "say_team", 8) == 0
|| strncasecmp(s, "color", 5) == 0
|| strncasecmp(s, "kill", 4) == 0
|| strncasecmp(s, "pause", 5) == 0
- || strncasecmp(s, "spawn", 5) == 0
- || strncasecmp(s, "begin", 5) == 0
- || strncasecmp(s, "prespawn", 8) == 0
|| strncasecmp(s, "kick", 4) == 0
|| strncasecmp(s, "ping", 4) == 0
|| strncasecmp(s, "ban", 3) == 0
|| strncasecmp(s, "pmodel", 6) == 0
|| (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))
|| (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)))
- {
- ret = 1;
Cmd_ExecuteString (s, src_client);
- }
else
- Con_DPrintf("%s tried to %s\n", host_client->name, s);
+ Con_Printf("%s tried to %s\n", host_client->name, s);
break;
case clc_disconnect:
}
}
}
- while (ret == 1);
-
return true;
}
if (!SV_ReadClientMessage ())
{
- // client misbehaved...
- SV_DropClient (false);
+ SV_DropClient (false); // client misbehaved...
continue;
}