]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
At O.Sezer's recommendation filematch.c has been changed to use
[xonotic/darkplaces.git] / cl_main.c
index 070982e549d97b9cf1f58e8a1131007e94e31751..fb6d9685f2a0417986d8f36deda9f1e777ae68a3 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -209,7 +209,7 @@ void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allo
        if (!allowmodel && (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel")))
                fail = true;
        for (i = 0;key[i];i++)
-               if (key[i] <= ' ' || key[i] == '\"')
+               if (ISWHITESPACE(key[i]) || key[i] == '\"')
                        fail = true;
        for (i = 0;value[i];i++)
                if (value[i] == '\r' || value[i] == '\n' || value[i] == '\"')
@@ -304,6 +304,8 @@ void CL_Disconnect(void)
 
        Con_DPrintf("CL_Disconnect\n");
 
+    Cvar_SetValueQuick(&csqc_progcrc, -1);
+       Cvar_SetValueQuick(&csqc_progsize, -1);
        CL_VM_ShutDown();
 // stop sounds (especially looping!)
        S_StopAllSounds ();
@@ -879,7 +881,10 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
        e->render.flags = e->state_current.flags;
        e->render.effects = e->state_current.effects;
        VectorScale(e->state_current.colormod, (1.0f / 32.0f), e->render.colormod);
-       e->render.entitynumber = e - cl.entities;
+       if(e >= cl.entities && e < cl.entities + cl.num_entities)
+               e->render.entitynumber = e - cl.entities;
+       else
+               e->render.entitynumber = 0;
        if (e->state_current.flags & RENDER_COLORMAPPED)
                CL_SetEntityColormapColors(&e->render, e->state_current.colormap);
        else if (e->state_current.colormap > 0 && e->state_current.colormap <= cl.maxclients && cl.scores != NULL)
@@ -1060,6 +1065,8 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
                e->render.flags |= RENDER_SHADOW;
        if (e->render.flags & RENDER_VIEWMODEL)
                e->render.flags |= RENDER_NOSELFSHADOW;
+       if (e->render.effects & EF_NOSELFSHADOW)
+               e->render.flags |= RENDER_NOSELFSHADOW;
 
        // make the other useful stuff
        CL_UpdateRenderEntity(&e->render);
@@ -1922,7 +1929,7 @@ void CL_Locs_AddNode(vec3_t mins, vec3_t maxs, const char *name)
        if (!name)
                name = "";
        namelen = strlen(name);
-       node = Mem_Alloc(cls.levelmempool, sizeof(cl_locnode_t) + namelen + 1);
+       node = (cl_locnode_t *) Mem_Alloc(cls.levelmempool, sizeof(cl_locnode_t) + namelen + 1);
        VectorSet(node->mins, min(mins[0], maxs[0]), min(mins[1], maxs[1]), min(mins[2], maxs[2]));
        VectorSet(node->maxs, max(mins[0], maxs[0]), max(mins[1], maxs[1]), max(mins[2], maxs[2]));
        node->name = (char *)(node + 1);
@@ -1990,7 +1997,7 @@ void CL_Locs_Save_f(void)
        FS_StripExtension(cl.worldmodel->name, locfilename, sizeof(locfilename));
        strlcat(locfilename, ".loc", sizeof(locfilename));
 
-       outfile = FS_Open(locfilename, "w", false, false);
+       outfile = FS_OpenRealFile(locfilename, "w", false);
        if (!outfile)
                return;
        // if any boxes are used then this is a proquake-format loc file, which
@@ -2090,10 +2097,10 @@ void CL_Locs_Reload_f(void)
                if (text < textend)
                        text++;
                // trim trailing whitespace
-               while (lineend > linestart && lineend[-1] <= ' ')
+               while (lineend > linestart && ISWHITESPACE(lineend[-1]))
                        lineend--;
                // trim leading whitespace
-               while (linestart < lineend && *linestart <= ' ')
+               while (linestart < lineend && ISWHITESPACE(*linestart))
                        linestart++;
                // check if this is a comment
                if (linestart + 2 <= lineend && !strncmp(linestart, "//", 2))
@@ -2110,7 +2117,7 @@ void CL_Locs_Reload_f(void)
                        else
                                maxs[i - 3] = atof(linetext);
                        // now advance past the number
-                       while (linetext < lineend && *linetext > ' ' && *linetext != ',')
+                       while (linetext < lineend && !ISWHITESPACE(*linetext) && *linetext != ',')
                                linetext++;
                        // advance through whitespace
                        if (linetext < lineend)
@@ -2121,10 +2128,10 @@ void CL_Locs_Reload_f(void)
                                        limit = 6;
                                        // note: comma can be followed by whitespace
                                }
-                               if (*linetext <= ' ')
+                               if (ISWHITESPACE(*linetext))
                                {
                                        // skip whitespace
-                                       while (linetext < lineend && *linetext <= ' ')
+                                       while (linetext < lineend && ISWHITESPACE(*linetext))
                                                linetext++;
                                }
                        }