From: divverent Date: Thu, 27 Oct 2011 07:08:50 +0000 (+0000) Subject: framegroups: add support for group names specified as // comment X-Git-Tag: xonotic-v0.6.0~206 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bff1f8247a0674eb9e9d51cbdc35443176b5215d;p=xonotic%2Fdarkplaces.git framegroups: add support for group names specified as // comment git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11481 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6fec031c43332c784db51efa5a98061a230ecc9b --- diff --git a/cl_parse.c b/cl_parse.c index 9ba71419..477d64b8 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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)) diff --git a/cl_particles.c b/cl_particles.c index 2e725194..0fea5152 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -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)); } } diff --git a/common.c b/common.c index 206cc057..7c0e4a84 100644 --- 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++; diff --git a/common.h b/common.h index bd715ed6..2aa1dc0c 100644 --- 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); diff --git a/console.c b/console.c index b604fe13..22feca73 100644 --- 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, '/')) diff --git a/gl_draw.c b/gl_draw.c index 44a83a94..63fa5cf1 100644 --- 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; diff --git a/host_cmd.c b/host_cmd.c index 76478705..482d7e58 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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 # diff --git a/libcurl.c b/libcurl.c index 7f176059..bd5b067c 100644 --- 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 f61dc5e8..140759f4 100644 --- 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 diff --git a/model_brush.c b/model_brush.c index 3bec9cdc..fc6a3410 100644 --- a/model_brush.c +++ b/model_brush.c @@ -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 diff --git a/model_shared.c b/model_shared.c index 47b4c58f..530597d9 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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); diff --git a/prvm_cmds.c b/prvm_cmds.c index c2eb5b16..e99e0222 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -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); diff --git a/prvm_edict.c b/prvm_edict.c index ffe917a8..3bfb67c2 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -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); diff --git a/r_shadow.c b/r_shadow.c index 644c71f1..64546e1d 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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)); diff --git a/sv_main.c b/sv_main.c index c69d5cb9..df96939e 100644 --- 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) {