]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
improved setinfo handling so that quakeworld works much better now (name/topcolor...
[xonotic/darkplaces.git] / cl_main.c
index 3b605902aa6a397ed0d08119e7d78f1449da8888..3cba5cb7256aeb4bd8369eee436c2968953a7dc7 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -201,6 +201,53 @@ void CL_ClearState(void)
        CL_Screen_NewMap();
 }
 
+void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet)
+{
+       if (strchr(key, '\"') || strchr(value, '\"') || (!allowstarkey && key[0] == '*') || (!allowmodel && (!strcasecmp(Cmd_Argv(1), "pmodel") || !strcasecmp(Cmd_Argv(1), "emodel"))))
+       {
+               if (!quiet)
+                       Con_Printf("Can't setinfo \"%s\" \"%s\"\n");
+               return;
+       }
+       InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), key, value);
+       if (cls.state == ca_connected)
+       {
+               if (cls.protocol == PROTOCOL_QUAKEWORLD)
+               {
+                       MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, va("setinfo \"%s\" \"%s\"", key, value));
+               }
+               else if (!strcasecmp(key, "name"))
+               {
+                       MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, va("name \"%s\"", value));
+               }
+               else if (!strcasecmp(key, "playermodel"))
+               {
+                       MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, va("playermodel \"%s\"", value));
+               }
+               else if (!strcasecmp(key, "playerskin"))
+               {
+                       MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, va("playerskin \"%s\"", value));
+               }
+               else if (!strcasecmp(key, "topcolor"))
+               {
+                       // don't send anything, the combined color code will be updated manually
+               }
+               else if (!strcasecmp(key, "bottomcolor"))
+               {
+                       // don't send anything, the combined color code will be updated manually
+               }
+               else if (!strcasecmp(key, "rate"))
+               {
+                       MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, va("rate \"%s\"", value));
+               }
+       }
+}
+
 void CL_ExpandEntities(int num)
 {
        int i, oldmaxentities;
@@ -867,7 +914,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                // if it's the player entity, update according to client movement
                if (e == cl.entities + cl.playerentity && cl.movement)// && !e->csqc)
                {
-                       lerp = (cl.time - cl.mtime[1]) / (cl.mtime[0] - cl.mtime[1]);
+                       lerp = (cl.time - cl.movement_time[1]) / (cl.movement_time[0] - cl.movement_time[1]);
                        lerp = bound(0, lerp, 1);
                        VectorLerp(cl.movement_oldorigin, lerp, cl.movement_origin, origin);
                        VectorSet(angles, 0, cl.viewangles[1], 0);