]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
use dynamic eye position-centered bouncegrid when rendering in dynamic
[xonotic/darkplaces.git] / cl_parse.c
index 04819e73f2b61369b7591e24cd91b8ea3acb5dd4..dd9f550420347e45551e55c1326e47324ffa6e2f 100644 (file)
@@ -25,8 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "csprogs.h"
 #include "libcurl.h"
 #include "utf8lib.h"
+#include "menu.h"
 
-char *svc_strings[128] =
+const char *svc_strings[128] =
 {
        "svc_bad",
        "svc_nop",
@@ -100,7 +101,7 @@ char *svc_strings[128] =
        "svc_pointparticles1", //       62              // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
 };
 
-char *qw_svc_strings[128] =
+const char *qw_svc_strings[128] =
 {
        "qw_svc_bad",                                   // 0
        "qw_svc_nop",                                   // 1
@@ -486,6 +487,9 @@ static void CL_SetupWorldModel(void)
        // check memory integrity
        Mem_CheckSentinelsGlobal();
 
+       // make menu know
+       MR_NewMap();
+
        // load the csqc now
        if (cl.loadcsqc)
        {
@@ -1190,13 +1194,13 @@ void CL_BeginDownloads(qboolean aborteddownload)
                // finished loading sounds
        }
 
-       if(gamemode == GAME_NEXUIZ)
+       if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                Cvar_SetValueQuick(&cl_serverextension_download, false);
-               // in Nexuiz, the built in download protocol is kinda broken (misses lots
+               // in Nexuiz/Xonotic, the built in download protocol is kinda broken (misses lots
                // of dependencies) anyway, and can mess around with the game directory;
                // until this is fixed, only support pk3 downloads via curl, and turn off
                // individual file downloads other than for CSQC
-               // on the other end of the download protocol, GAME_NEXUIZ enforces writing
+               // on the other end of the download protocol, GAME_NEXUIZ/GAME_XONOTIC enforces writing
                // to dlcache only
                // idea: support download of pk3 files using this protocol later
 
@@ -1369,8 +1373,8 @@ void CL_StopDownload(int size, int crc)
                        // save to disk only if we don't already have it
                        // (this is mainly for playing back demos)
                        existingcrc = FS_CRCFile(cls.qw_downloadname, &existingsize);
-                       if (existingsize || gamemode == GAME_NEXUIZ || !strcmp(cls.qw_downloadname, csqc_progname.string))
-                               // let csprogs ALWAYS go to dlcache, to prevent "viral csprogs"; also, never put files outside dlcache for Nexuiz
+                       if (existingsize || gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC || !strcmp(cls.qw_downloadname, csqc_progname.string))
+                               // let csprogs ALWAYS go to dlcache, to prevent "viral csprogs"; also, never put files outside dlcache for Nexuiz/Xonotic
                        {
                                if ((int)existingsize != size || existingcrc != crc)
                                {
@@ -1794,7 +1798,7 @@ void CL_ParseServerInfo (void)
                // set the base name for level-specific things...  this gets updated again by CL_SetupWorldModel later
                strlcpy(cl.worldname, cl.model_name[1], sizeof(cl.worldname));
                FS_StripExtension(cl.worldname, cl.worldnamenoextension, sizeof(cl.worldnamenoextension));
-               strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 4 : cl.worldnamenoextension, sizeof(cl.worldbasename));
+               strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename));
                Cvar_SetQuick(&cl_worldmessage, cl.worldmessage);
                Cvar_SetQuick(&cl_worldname, cl.worldname);
                Cvar_SetQuick(&cl_worldnamenoextension, cl.worldnamenoextension);
@@ -1905,11 +1909,14 @@ void CL_ValidateState(entity_state_t *s)
        if (!(s->flags & RENDER_COLORMAPPED) && s->colormap > cl.maxclients)
                Con_DPrintf("CL_ValidateState: colormap (%i) > cl.maxclients (%i)\n", s->colormap, cl.maxclients);
 
-       model = CL_GetModelByIndex(s->modelindex);
-       if (model && model->type && s->frame >= model->numframes)
-               Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\" (which has %i frames)\n", s->frame, model->name, model->numframes);
-       if (model && model->type && s->skin > 0 && s->skin >= model->numskins && !(s->lightpflags & PFLAGS_FULLDYNAMIC))
-               Con_DPrintf("CL_ValidateState: no such skin %i in \"%s\" (which has %i skins)\n", s->skin, model->name, model->numskins);
+       if (developer_extra.integer)
+       {
+               model = CL_GetModelByIndex(s->modelindex);
+               if (model && model->type && s->frame >= model->numframes)
+                       Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\" (which has %i frames)\n", s->frame, model->name, model->numframes);
+               if (model && model->type && s->skin > 0 && s->skin >= model->numskins && !(s->lightpflags & PFLAGS_FULLDYNAMIC))
+                       Con_DPrintf("CL_ValidateState: no such skin %i in \"%s\" (which has %i skins)\n", s->skin, model->name, model->numskins);
+       }
 }
 
 void CL_MoveLerpEntityStates(entity_t *ent)
@@ -2012,6 +2019,16 @@ void CL_MoveLerpEntityStates(entity_t *ent)
        // trigger muzzleflash effect if necessary
        if (ent->state_current.effects & EF_MUZZLEFLASH)
                ent->persistent.muzzleflash = 1;
+
+       // restart animation bit
+       if ((ent->state_previous.effects & EF_RESTARTANIM_BIT) != (ent->state_current.effects & EF_RESTARTANIM_BIT))
+       {
+               ent->render.framegroupblend[1] = ent->render.framegroupblend[0];
+               ent->render.framegroupblend[1].lerp = 1;
+               ent->render.framegroupblend[0].frame = ent->state_current.frame;
+               ent->render.framegroupblend[0].start = cl.time;
+               ent->render.framegroupblend[0].lerp = 0;
+       }
 }
 
 /*
@@ -2864,7 +2881,7 @@ void CL_ParseTrailParticles(void)
        effectindex = (unsigned short)MSG_ReadShort();
        MSG_ReadVector(start, cls.protocol);
        MSG_ReadVector(end, cls.protocol);
-       CL_ParticleEffect(effectindex, VectorDistance(start, end), start, end, vec3_origin, vec3_origin, entityindex > 0 ? cl.entities + entityindex : NULL, 0);
+       CL_ParticleEffect(effectindex, 1, start, end, vec3_origin, vec3_origin, entityindex > 0 ? cl.entities + entityindex : NULL, 0);
 }
 
 void CL_ParsePointParticles(void)
@@ -3288,7 +3305,7 @@ void CL_ParseServerMessage(void)
        int                     i;
        protocolversion_t protocol;
        unsigned char           cmdlog[32];
-       char            *cmdlogname[32], *temp;
+       const char              *cmdlogname[32], *temp;
        int                     cmdindex, cmdcount = 0;
        qboolean        qwplayerupdatereceived;
        qboolean        strip_pqc;
@@ -4075,7 +4092,7 @@ void CL_ParseServerMessage(void)
                                        MSG_ReadCoord(cls.protocol);
                                        MSG_ReadCoord(cls.protocol);
                                        MSG_ReadCoord(cls.protocol);
-                                       MSG_ReadByte();
+                                       (void) MSG_ReadByte();
                                        MSG_ReadLong();
                                        MSG_ReadLong();
                                        MSG_ReadString();
@@ -4090,7 +4107,7 @@ void CL_ParseServerMessage(void)
                                        MSG_ReadCoord(cls.protocol);
                                        MSG_ReadCoord(cls.protocol);
                                        MSG_ReadCoord(cls.protocol);
-                                       MSG_ReadByte();
+                                       (void) MSG_ReadByte();
                                        MSG_ReadString();
                                }
                                else