MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "setinfo \"%s\" \"%s\"", key, value));
}
- else if (!strcasecmp(key, "name"))
+ else if (!strcasecmp(key, "_cl_name") || !strcasecmp(key, "name"))
{
MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "name \"%s\"", value));
MSG_WriteByte(&buf, clc_disconnect);
if(cls.protocol == PROTOCOL_DARKPLACES8)
MSG_WriteString(&buf, reason);
+ // DP8 TODO: write a simpler func that Sys_HandleCrash() calls
+ // to send a disconnect message indicating we crashed
}
NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000, 0, false);
NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000, 0, false);
NetConn_Close(cls.netcon);
cls.netcon = NULL;
- if(fmt)
- Con_Printf("Disconnect: %s\n", reason);
+
+ // It's possible for a server to disconnect a player with an empty reason
+ // which is checked here rather than above so we don't print "Disconnect by user".
+ if(fmt && reason[0] != '\0')
+ dpsnprintf(cl_connect_status, sizeof(cl_connect_status), "Disconnect: %s", reason);
else
- Con_Printf("Disconnected\n");
+ dp_strlcpy(cl_connect_status, "Disconnected", sizeof(cl_connect_status));
+ Con_Printf("%s\n", cl_connect_status);
}
cls.state = ca_disconnected;
cl.islocalgame = false;
if (temp[0])
CL_EstablishConnection(temp, -1);
else
- Con_Printf("Reconnect to what server? (you have not connected to a server yet)\n");
+ Con_Printf(CON_WARN "Reconnect to what server? (you have not connected to a server yet)\n");
return;
}
// if connected, do something based on protocol
if (Sys_CheckParm("-benchmark"))
return;
- // clear menu's connect error message
-#ifdef CONFIG_MENU
- M_Update_Return_Reason("");
-#endif
-
// make sure the client ports are open before attempting to connect
NetConn_UpdateSockets();
if (LHNETADDRESS_FromString(&cls.connect_address, address, 26000) && (cls.connect_mysocket = NetConn_ChooseClientSocketForAddress(&cls.connect_address)))
{
cls.connect_trying = true;
- cls.connect_remainingtries = 3;
+ cls.connect_remainingtries = 10;
cls.connect_nextsendtime = 0;
// only NOW, set connect_userinfo
*cls.connect_userinfo = 0;
}
-#ifdef CONFIG_MENU
- M_Update_Return_Reason("Trying to connect...");
-#endif
+ dp_strlcpy(cl_connect_status, "Connect: pending...", sizeof(cl_connect_status));
SCR_BeginLoadingPlaque(false);
}
else
{
- Con_Print("Unable to find a suitable network socket to connect to server.\n");
-#ifdef CONFIG_MENU
- M_Update_Return_Reason("No network");
-#endif
+ Con_Printf(CON_ERROR "Connect: failed, unable to find a network socket suitable to reach %s\n", address);
+ dp_strlcpy(cl_connect_status, "Connect: failed, no network", sizeof(cl_connect_status));
}
}
dl->die = 0;
dl->cubemapname[0] = 0;
if (cubemapname && cubemapname[0])
- strlcpy(dl->cubemapname, cubemapname, sizeof(dl->cubemapname));
+ dp_strlcpy(dl->cubemapname, cubemapname, sizeof(dl->cubemapname));
dl->style = style;
dl->shadow = shadowenable;
dl->corona = corona;
// someone or watching a cutscene of some sort
if (cl_nolerp.integer || cls.timedemo)
interpolate = false;
+
if (e == cl.entities + cl.playerentity && cl.movement_predicted && (!cl.fixangle[1] || !cl.fixangle[0]))
{
VectorCopy(cl.movement_origin, origin);
CL_UpdateViewModel();
// when csqc is loaded, it will call this in CSQC_UpdateView
- if (!cl.csqc_loaded)
+ if (!CLVM_prog->loaded || CLVM_prog->flag & PRVM_CSQC_SIMPLE)
{
// clear the CL_Mesh_Scene() used for some engine effects
CL_MeshEntities_Scene_Clear();
r_refdef.fog_end = atof(Cmd_Argv(cmd, 7));
r_refdef.fog_height = atof(Cmd_Argv(cmd, 8));
r_refdef.fog_fadedepth = atof(Cmd_Argv(cmd, 9));
- strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(cmd, 10), sizeof(r_refdef.fog_height_texturename));
+ dp_strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(cmd, 10), sizeof(r_refdef.fog_height_texturename));
}
cl_locnode_t *loc;
loc = CL_Locs_FindNearest(point);
if (loc)
- strlcpy(buffer, loc->name, buffersize);
+ dp_strlcpy(buffer, loc->name, buffersize);
else
dpsnprintf(buffer, buffersize, "LOC=%.0f:%.0f:%.0f", point[0], point[1], point[2]);
}
// on some legacy systems, we need to sleep to keep input responsive
if (cl_maxfps_alwayssleep.value > 0 && !cls.timedemo)
- Sys_Sleep((int)bound(1, cl_maxfps_alwayssleep.value * 1000, 50000));
+ Sys_Sleep(min(cl_maxfps_alwayssleep.value / 1000, 0.05));
}
// apply slowmo scaling