]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
framegroups: add support for group names specified as // comment
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 27 Oct 2011 07:08:50 +0000 (07:08 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 31 Oct 2011 08:04:18 +0000 (09:04 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11481 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=6fec031c43332c784db51efa5a98061a230ecc9b

15 files changed:
cl_parse.c
cl_particles.c
common.c
common.h
console.c
gl_draw.c
host_cmd.c
libcurl.c
menu.c
model_brush.c
model_shared.c
prvm_cmds.c
prvm_edict.c
r_shadow.c
sv_main.c

index 9ba71419851d4c396db9192384f8574f99a26c5c..477d64b813c6d2110a8897605748ced8fc9f0ffb 100644 (file)
@@ -393,13 +393,13 @@ void CL_ParseEntityLump(char *entdata)
        data = entdata;
        if (!data)
                return;
-       if (!COM_ParseToken_Simple(&data, false, false))
+       if (!COM_ParseToken_Simple(&data, false, false, true))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -409,7 +409,7 @@ void CL_ParseEntityLump(char *entdata)
                        strlcpy (key, com_token, sizeof (key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        return; // error
                strlcpy (value, com_token, sizeof (value));
                if (!strcmp("sky", key))
index 2e725194280fb5666d66d03af2014c497a5fb904..0fea5152370e7a701da309718998d61b76a001ec 100644 (file)
@@ -317,7 +317,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend, co
                        argv[arrayindex][0] = 0;
                for (;;)
                {
-                       if (!COM_ParseToken_Simple(&text, true, false))
+                       if (!COM_ParseToken_Simple(&text, true, false, true))
                                return;
                        if (!strcmp(com_token, "\n"))
                                break;
@@ -2259,7 +2259,7 @@ static void R_InitParticleTexture (void)
                bufptr = buf;
                for(;;)
                {
-                       if(!COM_ParseToken_Simple(&bufptr, true, false))
+                       if(!COM_ParseToken_Simple(&bufptr, true, false, true))
                                break;
                        if(!strcmp(com_token, "\n"))
                                continue; // empty line
@@ -2271,22 +2271,22 @@ static void R_InitParticleTexture (void)
                        s2 = 1;
                        t2 = 1;
 
-                       if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+                       if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                        {
                                strlcpy(texturename, com_token, sizeof(texturename));
                                s1 = atof(com_token);
-                               if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+                               if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                {
                                        texturename[0] = 0;
                                        t1 = atof(com_token);
-                                       if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+                                       if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                        {
                                                s2 = atof(com_token);
-                                               if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+                                               if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                                {
                                                        t2 = atof(com_token);
                                                        strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename));
-                                                       if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+                                                       if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                                                strlcpy(texturename, com_token, sizeof(texturename));
                                                }
                                        }
index 206cc05794200b93a0d2aa7f2a0c920342967d44..7c0e4a84e9c162c2e65c02e0484505aca4e71fd9 100644 (file)
--- a/common.c
+++ b/common.c
@@ -992,7 +992,7 @@ COM_ParseToken_Simple
 Parse a token out of a string
 ==============
 */
-int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash)
+int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash, qboolean parsecomments)
 {
        int len;
        int c;
@@ -1027,14 +1027,14 @@ skipwhite:
        if (data[0] == '\r' && data[1] == '\n')
                data++;
 
-       if (data[0] == '/' && data[1] == '/')
+       if (parsecomments && data[0] == '/' && data[1] == '/')
        {
                // comment
                while (*data && *data != '\n' && *data != '\r')
                        data++;
                goto skipwhite;
        }
-       else if (data[0] == '/' && data[1] == '*')
+       else if (parsecomments && data[0] == '/' && data[1] == '*')
        {
                // comment
                data++;
index bd715ed65eeb2cc9259b33bfabb116c5db959b6a..2aa1dc0c19b44f117c540c6c54466011030610d0 100644 (file)
--- a/common.h
+++ b/common.h
@@ -197,7 +197,7 @@ int COM_Wordwrap(const char *string, size_t length, float continuationSize, floa
 
 extern char com_token[MAX_INPUTLINE];
 
-int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash);
+int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash, qboolean parsecomments);
 int COM_ParseToken_QuakeC(const char **datapointer, qboolean returnnewline);
 int COM_ParseToken_VM_Tokenize(const char **datapointer, qboolean returnnewline);
 int COM_ParseToken_Console(const char **datapointer);
index b604fe139a0a7e7952628c11314d6791c627fc69..22feca7367eb4ef8251cf7db59bdd2c17f1573b6 100644 (file)
--- a/console.c
+++ b/console.c
@@ -2080,7 +2080,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                for (;;)
                                {
                                        int l;
-                                       if (!COM_ParseToken_Simple(&data, false, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                                break;
                                        if (com_token[0] == '{')
                                                continue;
@@ -2091,7 +2091,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                        for (l = 0;l < (int)sizeof(keyname) - 1 && com_token[k+l] && !ISWHITESPACE(com_token[k+l]);l++)
                                                keyname[l] = com_token[k+l];
                                        keyname[l] = 0;
-                                       if (!COM_ParseToken_Simple(&data, false, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                                break;
                                        if (developer_extra.integer)
                                                Con_DPrintf("key: %s %s\n", keyname, com_token);
@@ -2766,7 +2766,7 @@ void Con_CompleteCommandLine (void)
 
                                stringlistinit(&resultbuf);
                                stringlistinit(&dirbuf);
-                               while(COM_ParseToken_Simple(&patterns, false, false))
+                               while(COM_ParseToken_Simple(&patterns, false, false, true))
                                {
                                        fssearch_t *search;
                                        if(strchr(com_token, '/'))
index 44a83a94380a267d9431d7b6c610b540d0daeab5..63fa5cf1e2ce9fac5ec9c9edf99dca4791c666c5 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -706,7 +706,7 @@ void LoadFont(qboolean override, const char *name, dp_font_t *fnt, float scale,
                ch = 0;
                while(ch < 256)
                {
-                       if(!COM_ParseToken_Simple(&p, false, false))
+                       if(!COM_ParseToken_Simple(&p, false, false, true))
                                return;
 
                        switch(*com_token)
@@ -730,20 +730,20 @@ void LoadFont(qboolean override, const char *name, dp_font_t *fnt, float scale,
                                default:
                                        if(!strcmp(com_token, "extraspacing"))
                                        {
-                                               if(!COM_ParseToken_Simple(&p, false, false))
+                                               if(!COM_ParseToken_Simple(&p, false, false, true))
                                                        return;
                                                extraspacing = atof(com_token);
                                        }
                                        else if(!strcmp(com_token, "scale"))
                                        {
-                                               if(!COM_ParseToken_Simple(&p, false, false))
+                                               if(!COM_ParseToken_Simple(&p, false, false, true))
                                                        return;
                                                fnt->settings.scale = atof(com_token);
                                        }
                                        else
                                        {
                                                Con_Printf("Warning: skipped unknown font property %s\n", com_token);
-                                               if(!COM_ParseToken_Simple(&p, false, false))
+                                               if(!COM_ParseToken_Simple(&p, false, false, true))
                                                        return;
                                        }
                                        break;
index 764787051f97e637c372a9eebee17889e6e07476..482d7e589da542ab9202fb05acdda38e4f0f71fe 100644 (file)
@@ -808,7 +808,7 @@ void Host_Loadgame_f (void)
                Con_Printf("Host_Loadgame_f: loading version\n");
 
        // version
-       COM_ParseToken_Simple(&t, false, false);
+       COM_ParseToken_Simple(&t, false, false, true);
        version = atoi(com_token);
        if (version != SAVEGAME_VERSION)
        {
@@ -821,15 +821,15 @@ void Host_Loadgame_f (void)
                Con_Printf("Host_Loadgame_f: loading description\n");
 
        // description
-       COM_ParseToken_Simple(&t, false, false);
+       COM_ParseToken_Simple(&t, false, false, true);
 
        for (i = 0;i < NUM_SPAWN_PARMS;i++)
        {
-               COM_ParseToken_Simple(&t, false, false);
+               COM_ParseToken_Simple(&t, false, false, true);
                spawn_parms[i] = atof(com_token);
        }
        // skill
-       COM_ParseToken_Simple(&t, false, false);
+       COM_ParseToken_Simple(&t, false, false, true);
 // this silliness is so we can load 1.06 save files, which have float skill values
        current_skill = (int)(atof(com_token) + 0.5);
        Cvar_SetValue ("skill", (float)current_skill);
@@ -838,14 +838,14 @@ void Host_Loadgame_f (void)
                Con_Printf("Host_Loadgame_f: loading mapname\n");
 
        // mapname
-       COM_ParseToken_Simple(&t, false, false);
+       COM_ParseToken_Simple(&t, false, false, true);
        strlcpy (mapname, com_token, sizeof(mapname));
 
        if(developer_entityparsing.integer)
                Con_Printf("Host_Loadgame_f: loading time\n");
 
        // time
-       COM_ParseToken_Simple(&t, false, false);
+       COM_ParseToken_Simple(&t, false, false, true);
        time = atof(com_token);
 
        allowcheats = sv_cheats.integer != 0;
@@ -876,7 +876,7 @@ void Host_Loadgame_f (void)
        {
                // light style
                start = t;
-               COM_ParseToken_Simple(&t, false, false);
+               COM_ParseToken_Simple(&t, false, false, true);
                // if this is a 64 lightstyle savegame produced by Quake, stop now
                // we have to check this because darkplaces may save more than 64
                if (com_token[0] == '{')
@@ -897,7 +897,7 @@ void Host_Loadgame_f (void)
        for (;;)
        {
                start = t;
-               if (!COM_ParseToken_Simple(&t, false, false))
+               if (!COM_ParseToken_Simple(&t, false, false, true))
                        break;
                if (com_token[0] == '{')
                {
@@ -914,10 +914,10 @@ void Host_Loadgame_f (void)
        for (;;)
        {
                start = t;
-               while (COM_ParseToken_Simple(&t, false, false))
+               while (COM_ParseToken_Simple(&t, false, false, true))
                        if (!strcmp(com_token, "}"))
                                break;
-               if (!COM_ParseToken_Simple(&start, false, false))
+               if (!COM_ParseToken_Simple(&start, false, false, true))
                {
                        // end of file
                        break;
@@ -993,13 +993,13 @@ void Host_Loadgame_f (void)
                        memset(sv.lightstyles[0], 0, sizeof(sv.lightstyles));
                        memset(sv.model_precache[0], 0, sizeof(sv.model_precache));
                        memset(sv.sound_precache[0], 0, sizeof(sv.sound_precache));
-                       while (COM_ParseToken_Simple(&t, false, false))
+                       while (COM_ParseToken_Simple(&t, false, false, true))
                        {
                                if (!strcmp(com_token, "sv.lightstyles"))
                                {
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        i = atoi(com_token);
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        if (i >= 0 && i < MAX_LIGHTSTYLES)
                                                strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i]));
                                        else
@@ -1007,9 +1007,9 @@ void Host_Loadgame_f (void)
                                }
                                else if (!strcmp(com_token, "sv.model_precache"))
                                {
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        i = atoi(com_token);
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        if (i >= 0 && i < MAX_MODELS)
                                        {
                                                strlcpy(sv.model_precache[i], com_token, sizeof(sv.model_precache[i]));
@@ -1020,9 +1020,9 @@ void Host_Loadgame_f (void)
                                }
                                else if (!strcmp(com_token, "sv.sound_precache"))
                                {
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        i = atoi(com_token);
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        if (i >= 0 && i < MAX_SOUNDS)
                                                strlcpy(sv.sound_precache[i], com_token, sizeof(sv.sound_precache[i]));
                                        else
@@ -1030,11 +1030,11 @@ void Host_Loadgame_f (void)
                                }
                                else if (!strcmp(com_token, "sv.bufstr"))
                                {
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        i = atoi(com_token);
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        k = atoi(com_token);
-                                       COM_ParseToken_Simple(&t, false, false);
+                                       COM_ParseToken_Simple(&t, false, false, true);
                                        stringbuffer = (prvm_stringbuffer_t*) Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, i);
                                        // VorteX: nasty code, cleanup required
                                        // create buffer at this index
@@ -1069,7 +1069,7 @@ void Host_Loadgame_f (void)
                                        }
                                }       
                                // skip any trailing text or unrecognized commands
-                               while (COM_ParseToken_Simple(&t, true, false) && strcmp(com_token, "\n"))
+                               while (COM_ParseToken_Simple(&t, true, false, true) && strcmp(com_token, "\n"))
                                        ;
                        }
                }
@@ -1991,7 +1991,7 @@ void Host_Kick_f (void)
                if (Cmd_Argc() > 2)
                {
                        message = Cmd_Args();
-                       COM_ParseToken_Simple(&message, false, false);
+                       COM_ParseToken_Simple(&message, false, false, true);
                        if (byNumber)
                        {
                                message++;                                                      // skip the #
index 7f1760595d87330d168b9daed21f727622be4e4a..bd5b067c7927c4c51da46b445dcadc0d91c4f95d 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -1653,7 +1653,7 @@ void Curl_SendRequirements(void)
                foundone = Curl_SendRequirement(req->filename, foundone, sendbuffer, sizeof(sendbuffer)) || foundone;
 
        p = sv_curl_serverpackages.string;
-       while(COM_ParseToken_Simple(&p, false, false))
+       while(COM_ParseToken_Simple(&p, false, false, true))
                foundone = Curl_SendRequirement(com_token, foundone, sendbuffer, sizeof(sendbuffer)) || foundone;
 
        if(foundone)
diff --git a/menu.c b/menu.c
index f61dc5e8b4b7862d3a31986ba0646e71e6957bfe..140759f4325659014d48731f95cdef491bb9cdde 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -866,10 +866,10 @@ static void M_ScanSaves (void)
                buf[len] = 0;
                t = buf;
                // version
-               COM_ParseToken_Simple(&t, false, false);
+               COM_ParseToken_Simple(&t, false, false, true);
                //version = atoi(com_token);
                // description
-               COM_ParseToken_Simple(&t, false, false);
+               COM_ParseToken_Simple(&t, false, false, true);
                strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));
 
        // change _ back to space
index 3bec9cdcfff9dcd3b2410e15a6f0daace6a034a0..fc6a3410cacc9511a6d3465839ae2f87bdc30377 100644 (file)
@@ -2077,13 +2077,13 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
        int i, j, k;
        if (!data)
                return;
-       if (!COM_ParseToken_Simple(&data, false, false))
+       if (!COM_ParseToken_Simple(&data, false, false, true))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -2093,7 +2093,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
                        strlcpy(key, com_token, sizeof(key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        return; // error
                dpsnprintf(value, sizeof(value), "%s", com_token);
                if (!strcmp("wad", key)) // for HalfLife maps
@@ -3062,12 +3062,12 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
        if (!maptext)
                return;
        text = maptext;
-       if (!COM_ParseToken_Simple(&data, false, false))
+       if (!COM_ParseToken_Simple(&data, false, false, true))
                return; // error
        submodel = 0;
        for (;;)
        {
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        break;
                if (com_token[0] != '{')
                        return; // error
@@ -3078,7 +3078,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                brushes = Mem_Alloc(loadmodel->mempool, maxbrushes * sizeof(mbrush_t));
                for (;;)
                {
-                       if (!COM_ParseToken_Simple(&data, false, false))
+                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                return; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -3102,7 +3102,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                }
                                for (;;)
                                {
-                                       if (!COM_ParseToken_Simple(&data, false, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                                return; // error
                                        if (com_token[0] == '}')
                                                break; // end of brush
@@ -3111,25 +3111,25 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                        // FIXME: support hl .map format
                                        for (pointnum = 0;pointnum < 3;pointnum++)
                                        {
-                                               COM_ParseToken_Simple(&data, false, false);
+                                               COM_ParseToken_Simple(&data, false, false, true);
                                                for (componentnum = 0;componentnum < 3;componentnum++)
                                                {
-                                                       COM_ParseToken_Simple(&data, false, false);
+                                                       COM_ParseToken_Simple(&data, false, false, true);
                                                        point[pointnum][componentnum] = atof(com_token);
                                                }
-                                               COM_ParseToken_Simple(&data, false, false);
+                                               COM_ParseToken_Simple(&data, false, false, true);
                                        }
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        strlcpy(facetexture, com_token, sizeof(facetexture));
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        //scroll_s = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        //scroll_t = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        //rotate = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        //scale_s = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false, false);
+                                       COM_ParseToken_Simple(&data, false, false, true);
                                        //scale_t = atof(com_token);
                                        TriangleNormal(point[0], point[1], point[2], planenormal);
                                        VectorNormalizeDouble(planenormal);
@@ -4452,11 +4452,11 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
        // some Q3 maps override the lightgrid_cellsize with a worldspawn key
        // VorteX: q3map2 FS-R generates tangentspace deluxemaps for q3bsp and sets 'deluxeMaps' key
        loadmodel->brushq3.deluxemapping = false;
-       if (data && COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{')
+       if (data && COM_ParseToken_Simple(&data, false, false, true) && com_token[0] == '{')
        {
                while (1)
                {
-                       if (!COM_ParseToken_Simple(&data, false, false))
+                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of worldspawn
@@ -4466,7 +4466,7 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseToken_Simple(&data, false, false))
+                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
                        if (!strcasecmp("gridsize", key)) // this one is case insensitive to 100% match q3map2
index 47b4c58fabedfde42ed40f62707e0f17c9a13598..530597d9a1dd02d80fddfc4080a87db39627b5a1 100644 (file)
@@ -234,11 +234,12 @@ void R_Model_Null_Draw(entity_render_t *ent)
 }
 
 
-typedef void (*mod_framegroupify_parsegroups_t) (unsigned int i, int start, int len, float fps, qboolean loop, void *pass);
+typedef void (*mod_framegroupify_parsegroups_t) (unsigned int i, int start, int len, float fps, qboolean loop, const char *name, void *pass);
 
 int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups_t cb, void *pass)
 {
        const char *bufptr;
+       const char *name;
        int start, len;
        float fps;
        unsigned int i;
@@ -249,12 +250,12 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
        for(;;)
        {
                // an anim scene!
-               if (!COM_ParseToken_Simple(&bufptr, true, false))
+               if (!COM_ParseToken_Simple(&bufptr, true, false, false))
                        break;
                if (!strcmp(com_token, "\n"))
                        continue; // empty line
                start = atoi(com_token);
-               if (!COM_ParseToken_Simple(&bufptr, true, false))
+               if (!COM_ParseToken_Simple(&bufptr, true, false, false))
                        break;
                if (!strcmp(com_token, "\n"))
                {
@@ -262,15 +263,15 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
                        continue;
                }
                len = atoi(com_token);
-               if (!COM_ParseToken_Simple(&bufptr, true, false))
+               if (!COM_ParseToken_Simple(&bufptr, true, false, false))
                        break;
                // we default to looping as it's usually wanted, so to NOT loop you append a 0
-               if (strcmp(com_token, "\n"))
+               if (strcmp(com_token, "\n") && strcmp(com_token, "//"))
                {
                        fps = atof(com_token);
-                       if (!COM_ParseToken_Simple(&bufptr, true, false))
+                       if (!COM_ParseToken_Simple(&bufptr, true, false, false))
                                break;
-                       if (strcmp(com_token, "\n"))
+                       if (strcmp(com_token, "\n") && strcmp(com_token, "//"))
                                loop = atoi(com_token) != 0;
                        else
                                loop = true;
@@ -281,25 +282,37 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
                        loop = true;
                }
 
+               name = NULL;
+               if(!strcmp(com_token, "//"))
+               {
+                       if (COM_ParseToken_Simple(&bufptr, true, false, false))
+                       {
+                               if(strcmp(com_token, "\n"))
+                               {
+                                       name = com_token;
+                                       // skip to EOL
+                                       while (*bufptr && *bufptr != '\n' && *bufptr != '\r')
+                                               bufptr++;
+                               }
+                       }
+               }
+
                if(cb)
-                       cb(i, start, len, fps, loop, pass);
+                       cb(i, start, len, fps, loop, name, pass);
                ++i;
        }
 
        return i;
 }
 
-void Mod_FrameGroupify_ParseGroups_Count (unsigned int i, int start, int len, float fps, qboolean loop, void *pass)
-{
-       unsigned int *cnt = (unsigned int *) pass;
-       ++*cnt;
-}
-
-void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int len, float fps, qboolean loop, void *pass)
+static void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int len, float fps, qboolean loop, const char *name, void *pass)
 {
        dp_model_t *mod = (dp_model_t *) pass;
        animscene_t *anim = &mod->animscenes[i];
-       dpsnprintf(anim->name, sizeof(anim[i].name), "groupified_%d_anim", i);
+       if(name)
+               strlcpy(anim->name, name, sizeof(anim[i].name));
+       else
+               dpsnprintf(anim->name, sizeof(anim[i].name), "groupified_%d_anim", i);
        anim->firstframe = bound(0, start, mod->num_poses - 1);
        anim->framecount = bound(1, len, mod->num_poses - anim->firstframe);
        anim->framerate = max(1, fps);
index c2eb5b16646e630dfb400600ab9020cb6b8a20d7..e99e0222aa824ee5fe5837c8dc5b66e929d03901 100644 (file)
@@ -2991,7 +2991,7 @@ void VM_parseentitydata(void)
        data = PRVM_G_STRING(OFS_PARM1);
 
        // parse the opening brace
-       if (!COM_ParseToken_Simple(&data, false, false) || com_token[0] != '{' )
+       if (!COM_ParseToken_Simple(&data, false, false, true) || com_token[0] != '{' )
                PRVM_ERROR ("VM_parseentitydata: %s: Couldn't parse entity data:\n%s", PRVM_NAME, data );
 
        PRVM_ED_ParseEdict (data, ent);
index ffe917a8060034737664e089d8cb042321b4740a..3bfb67c26e4a79247fc6760cc6b2b0fcecd09e49 100644 (file)
@@ -941,7 +941,7 @@ void PRVM_ED_ParseGlobals (const char *data)
        while (1)
        {
                // parse key
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
                if (com_token[0] == '}')
                        break;
@@ -952,7 +952,7 @@ void PRVM_ED_ParseGlobals (const char *data)
                strlcpy (keyname, com_token, sizeof(keyname));
 
                // parse value
-               if (!COM_ParseToken_Simple(&data, false, true))
+               if (!COM_ParseToken_Simple(&data, false, true, true))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
 
                if (developer_entityparsing.integer)
@@ -1307,7 +1307,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
        while (1)
        {
        // parse key
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf("Key: \"%s\"", com_token);
@@ -1339,7 +1339,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
                }
 
        // parse value
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf(" \"%s\"\n", com_token);
@@ -1416,7 +1416,7 @@ void PRVM_ED_LoadFromFile (const char *data)
        while (1)
        {
 // parse the opening brace
-               if (!COM_ParseToken_Simple(&data, false, false))
+               if (!COM_ParseToken_Simple(&data, false, false, true))
                        break;
                if (com_token[0] != '{')
                        PRVM_ERROR ("PRVM_ED_LoadFromFile: %s: found %s when expecting {", PRVM_NAME, com_token);
index 644c71f19669687e68047b4885e9337e8da1a1e2..64546e1d0ce183a0da68ededafb4bca765fe9f29 100644 (file)
@@ -5780,7 +5780,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                data = cl.worldmodel->brush.entities;
        if (!data)
                return;
-       for (entnum = 0;COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{';entnum++)
+       for (entnum = 0;COM_ParseToken_Simple(&data, false, false, true) && com_token[0] == '{';entnum++)
        {
                type = LIGHTTYPE_MINUSX;
                origin[0] = origin[1] = origin[2] = 0;
@@ -5798,7 +5798,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                islight = false;
                while (1)
                {
-                       if (!COM_ParseToken_Simple(&data, false, false))
+                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -5808,7 +5808,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseToken_Simple(&data, false, false))
+                       if (!COM_ParseToken_Simple(&data, false, false, true))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
 
index c69d5cb9453de58058450c516336c8cc707b7f39..df96939e058e492e4df282b82d8d538f4971c5a7 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2942,7 +2942,7 @@ int SV_ParticleEffectIndex(const char *name)
                                argc = 0;
                                for (;;)
                                {
-                                       if (!COM_ParseToken_Simple(&text, true, false) || !strcmp(com_token, "\n"))
+                                       if (!COM_ParseToken_Simple(&text, true, false, true) || !strcmp(com_token, "\n"))
                                                break;
                                        if (argc < 16)
                                        {