]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
qw support is 99% working
[xonotic/darkplaces.git] / host_cmd.c
index f10203a1bc93fed9af949d0342ce55aacc7c6c62..b0d86868c6528b25aac158ea1182cc1b4b89a6d0 100644 (file)
@@ -371,22 +371,39 @@ This is sent just before a server changes levels
 */
 void Host_Reconnect_f (void)
 {
-       if (cmd_source == src_command)
-       {
-               Con_Print("reconnect is not valid from the console\n");
-               return;
-       }
-       if (Cmd_Argc() != 1)
+       if (cls.protocol == PROTOCOL_QUAKEWORLD)
        {
-               Con_Print("reconnect : wait for signon messages again\n");
-               return;
+               if (cls.qw_downloadmemory)  // don't change when downloading
+                       return;
+
+               S_StopAllSounds();
+
+               if (cls.netcon)
+               {
+                       if (cls.state == ca_connected && cls.signon < SIGNONS)
+                       {
+                               Con_Printf("reconnecting...\n");
+                               MSG_WriteChar(&cls.netcon->message, qw_clc_stringcmd);
+                               MSG_WriteString(&cls.netcon->message, "new");
+                       }
+                       else
+                               Con_Printf("Please use connect instead (reconnect not implemented)\n");
+               }
        }
-       if (!cls.signon)
+       else
        {
-               //Con_Print("reconnect: no signon, ignoring reconnect\n");
-               return;
+               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;
+               }
+               cls.signon = 0;         // need new connection messages
        }
-       cls.signon = 0;         // need new connection messages
 }
 
 /*
@@ -1957,20 +1974,6 @@ static void MaxPlayers_f(void)
 
 // QuakeWorld commands
 
-char qw_emodel_name[] =
-       { 'e' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
-char qw_pmodel_name[] =
-       { 'p' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
-char qw_prespawn_name[] =
-       { 'p'^0xff, 'r'^0xff, 'e'^0xff, 's'^0xff, 'p'^0xff, 'a'^0xff, 'w'^0xff, 'n'^0xff,
-               ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '0'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
-char qw_modellist_name[] =
-       { 'm'^0xff, 'o'^0xff, 'd'^0xff, 'e'^0xff, 'l'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
-               ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
-char qw_soundlist_name[] =
-       { 's'^0xff, 'o'^0xff, 'u'^0xff, 'n'^0xff, 'd'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
-               ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
-
 /*
 =====================
 Host_Rcon_f
@@ -2091,6 +2094,7 @@ Sent by server when serverinfo changes
 // TODO: shouldn't this be a cvar instead?
 void Host_FullServerinfo_f (void) // credit: taken from QuakeWorld
 {
+       char temp[512];
        if (Cmd_Argc() != 2)
        {
                Con_Printf ("usage: fullserverinfo <complete info string>\n");
@@ -2098,6 +2102,8 @@ void Host_FullServerinfo_f (void) // credit: taken from QuakeWorld
        }
 
        strlcpy (cl.qw_serverinfo, Cmd_Argv(1), sizeof(cl.qw_serverinfo));
+       InfoString_GetValue(cl.qw_serverinfo, "teamplay", temp, sizeof(temp));
+       cl.qw_teamplay = atoi(temp);
 }
 
 /*
@@ -2146,7 +2152,7 @@ void Host_FullInfo_f (void) // credit: taken from QuakeWorld
                if (*s)
                        s++;
 
-               if (!strcasecmp(key, qw_pmodel_name) || !strcasecmp(key, qw_emodel_name))
+               if (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel"))
                        continue;
 
                if (key[0] == '*')
@@ -2178,7 +2184,7 @@ void Host_SetInfo_f (void) // credit: taken from QuakeWorld
                Con_Printf ("usage: setinfo [ <key> <value> ]\n");
                return;
        }
-       if (!strcasecmp(Cmd_Argv(1), qw_pmodel_name) || !strcasecmp(Cmd_Argv(1), qw_emodel_name))
+       if (!strcasecmp(Cmd_Argv(1), "pmodel") || !strcasecmp(Cmd_Argv(1), "emodel"))
                return;
        if (Cmd_Argv(1)[0] == '*')
        {