*/
void Host_Status_f (void)
{
+ const char *protocolname;
client_t *client;
int seconds, minutes, hours = 0, j, players;
void (*print) (const char *fmt, ...);
players++;
print ("host: %s\n", Cvar_VariableString ("hostname"));
print ("version: %s build %s\n", gamename, buildstring);
+ switch(sv.protocol)
+ {
+ case PROTOCOL_QUAKE: protocolname = sv.netquakecompatible ? "QUAKE" : "QUAKEDP";break;
+ case PROTOCOL_DARKPLACES1: protocolname = "PROTOCOL_DARKPLACES1";break;
+ case PROTOCOL_DARKPLACES2: protocolname = "PROTOCOL_DARKPLACES2";break;
+ case PROTOCOL_DARKPLACES3: protocolname = "PROTOCOL_DARKPLACES3";break;
+ case PROTOCOL_DARKPLACES4: protocolname = "PROTOCOL_DARKPLACES4";break;
+ case PROTOCOL_DARKPLACES5: protocolname = "PROTOCOL_DARKPLACES5";break;
+ default: protocolname = "PROTOCOL_UNKNOWN";break;
+ }
+ print ("protocol: %i (%s)\n", sv.protocol, protocolname);
print ("map: %s\n", sv.name);
print ("players: %i active (%i max)\n\n", players, svs.maxclients);
for (j = 0, client = svs.clients;j < svs.maxclients;j++, client++)
{
char level[MAX_QPATH];
+ if (Cmd_Argc() != 2)
+ {
+ Con_Print("map <levelname> : start a new game (kicks off all players)\n");
+ return;
+ }
+
if (cmd_source != src_command)
return;
+ SCR_BeginLoadingPlaque ();
cls.demonum = -1; // stop demo loop in case this fails
CL_Disconnect ();
Host_ShutdownServer(false);
- key_dest = key_game; // remove console or menu
- SCR_BeginLoadingPlaque ();
+ // remove console or menu
+ key_dest = key_game;
+ key_consoleactive = 0;
svs.serverflags = 0; // haven't completed an episode yet
allowcheats = sv_cheats.integer != 0;
Con_Print("Only the server may changelevel\n");
return;
}
+ if (cmd_source != src_command)
+ return;
+
+ // remove console or menu
+ key_dest = key_game;
+ key_consoleactive = 0;
+
SV_SaveSpawnparms ();
+ SCR_BeginLoadingPlaque();
allowcheats = sv_cheats.integer != 0;
strcpy(level, Cmd_Argv(1));
SV_SpawnServer(level);
{
char mapname[MAX_QPATH];
- if (cls.demoplayback || !sv.active)
+ if (Cmd_Argc() != 1)
+ {
+ Con_Print("restart : restart current level\n");
return;
-
+ }
+ if (!sv.active || cls.demoplayback)
+ {
+ Con_Print("Only the server may restart\n");
+ return;
+ }
if (cmd_source != src_command)
return;
+
+ // remove console or menu
+ key_dest = key_game;
+ key_consoleactive = 0;
+
+ SCR_BeginLoadingPlaque();
allowcheats = sv_cheats.integer != 0;
strcpy(mapname, sv.name);
SV_SpawnServer(mapname);
*/
void Host_Reconnect_f (void)
{
+ if (Cmd_Argc() != 1)
+ {
+ Con_Print("reconnect : wait for signon messages again\n");
+ return;
+ }
+ if (!cls.signon)
+ {
+ Con_Print("reconnect: no signon, ignoring reconnect\n");
+ return;
+ }
SCR_BeginLoadingPlaque();
cls.signon = 0; // need new connection messages
}
*/
void Host_Connect_f (void)
{
+ if (Cmd_Argc() != 2)
+ {
+ Con_Print("connect <serveraddress> : connect to a multiplayer game\n");
+ return;
+ }
CL_EstablishConnection(Cmd_Argv(1));
}
void Host_Say(qboolean teamonly)
{
client_t *save;
- int j;
- const char *p1, *p2;
+ int j, quoted;
+ const char *p1;
+ char *p2;
// LordHavoc: 256 char say messages
unsigned char text[256];
qboolean fromServer = false;
if (Cmd_Argc () < 2)
return;
- save = host_client;
+ if (!teamplay.integer)
+ teamonly = false;
// turn on color set 1
- if (!fromServer)
- sprintf (text, "%c%s: ", 1, host_client->name);
- else
- sprintf (text, "%c<%s> ", 1, hostname.string);
-
p1 = Cmd_Args();
- p2 = p1 + strlen(p1);
- // remove trailing newlines
- while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
- p2--;
- // remove quotes if present
- if (*p1 == '"')
+ quoted = false;
+ if (*p1 == '\"')
{
+ quoted = true;
p1++;
- if (p2[-1] == '"')
- p2--;
- else if (fromServer)
- Con_Print("Host_Say: missing end quote\n");
- else
- SV_ClientPrint("Host_Say: missing end quote\n");
}
- while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
+ if (!fromServer)
+ snprintf (text, sizeof(text), "%c%s: %s", 1, host_client->name, p1);
+ else
+ snprintf (text, sizeof(text), "%c<%s> %s", 1, hostname.string, p1);
+ p2 = text + strlen(text);
+ while ((const char *)p2 > (const char *)text && (p2[-1] == '\r' || p2[-1] == '\n' || (p2[-1] == '\"' && quoted)))
+ {
+ if (p2[-1] == '\"' && quoted)
+ quoted = false;
+ p2[-1] = 0;
p2--;
- for (j = strlen(text);j < (int)(sizeof(text) - 2) && p1 < p2;)
- text[j++] = *p1++;
- text[j++] = '\n';
- text[j++] = 0;
+ }
+ // note: save is not a valid edict if fromServer is true
+ save = host_client;
for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++)
- if (host_client->spawned && (!teamplay.integer || host_client->edict->v->team == save->edict->v->team))
+ if (host_client->spawned && (!teamonly || host_client->edict->v->team == save->edict->v->team))
SV_ClientPrint(text);
host_client = save;
pr_global_struct->time = sv.time;
pr_globals[OFS_PARM0] = playercolor;
pr_global_struct->self = EDICT_TO_PROG(sv_player);
- PR_ExecuteProgram (SV_ChangeTeam, "");
+ PR_ExecuteProgram (SV_ChangeTeam, "QC function SV_ChangeTeam is missing");
}
else
{
}
cvar_t cl_rate = {CVAR_SAVE, "_cl_rate", "10000"};
-cvar_t sv_maxrate = {CVAR_SAVE | CVAR_NOTIFY, "sv_maxrate", "10000"};
void Host_Rate_f(void)
{
- int rate, maxrate;
+ int rate;
if (Cmd_Argc() != 2)
{
return;
}
- maxrate = bound(NET_MINRATE, sv_maxrate.integer, NET_MAXRATE);
- if (sv_maxrate.integer != maxrate)
- Cvar_SetValueQuick(&sv_maxrate, maxrate);
-
- if (LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
- host_client->netconnection->rate = bound(NET_MINRATE, rate, maxrate);
+ host_client->netconnection->rate = rate;
}
/*
Con_DPrint("Calling RestoreGame\n");
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(sv_player);
- PR_ExecuteProgram (RestoreGame, "");
+ PR_ExecuteProgram (RestoreGame, "QC function RestoreGame is missing");
}
}
else
// and it won't happen if the game was just loaded, so you wind up
// with a permanent head tilt
MSG_WriteByte (&host_client->message, svc_setangle);
- for (i=0 ; i < 2 ; i++)
- MSG_WriteAngle (&host_client->message, sv_player->v->angles[i] );
- MSG_WriteAngle (&host_client->message, 0 );
+ MSG_WriteAngle (&host_client->message, sv_player->v->angles[0], sv.protocol);
+ MSG_WriteAngle (&host_client->message, sv_player->v->angles[1], sv.protocol);
+ MSG_WriteAngle (&host_client->message, 0, sv.protocol);
SV_WriteClientdataToMessage (sv_player, &host_client->message);
Cmd_AddCommand ("color", Host_Color_f);
Cvar_RegisterVariable (&cl_rate);
Cmd_AddCommand ("rate", Host_Rate_f);
- Cvar_RegisterVariable (&sv_maxrate);
if (gamemode == GAME_NEHAHRA)
{
Cvar_RegisterVariable (&cl_pmodel);