From 6fec031c43332c784db51efa5a98061a230ecc9b Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 27 Oct 2011 07:08:50 +0000 Subject: [PATCH] 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 --- cl_parse.c | 6 +++--- cl_particles.c | 14 +++++++------- common.c | 6 +++--- common.h | 2 +- console.c | 6 +++--- gl_draw.c | 8 ++++---- host_cmd.c | 44 ++++++++++++++++++++++---------------------- libcurl.c | 2 +- menu.c | 4 ++-- model_brush.c | 38 +++++++++++++++++++------------------- model_shared.c | 39 +++++++++++++++++++++++++++++---------- prvm_cmds.c | 2 +- prvm_edict.c | 10 +++++----- r_shadow.c | 6 +++--- sv_main.c | 2 +- 15 files changed, 104 insertions(+), 85 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 334772d3..55e1a79a 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -384,13 +384,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 @@ -400,7 +400,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 d1a337ee..b1d891a7 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -317,7 +317,7 @@ static void CL_Particles_ParseEffectInfo(const char *textstart, const char *text 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; @@ -2262,7 +2262,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 @@ -2274,22 +2274,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 a0d291e2..ada40e20 100644 --- a/common.c +++ b/common.c @@ -989,7 +989,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; @@ -1024,14 +1024,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 ed21376f..e91be283 100644 --- a/common.h +++ b/common.h @@ -198,7 +198,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 769ae2f6..14175b07 100644 --- a/console.c +++ b/console.c @@ -2079,7 +2079,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; @@ -2090,7 +2090,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 a23c98c4..5cd72709 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -708,7 +708,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) @@ -732,20 +732,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 0224ec4e..b8c493b2 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -804,7 +804,7 @@ static 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) { @@ -817,15 +817,15 @@ static 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); @@ -834,14 +834,14 @@ static 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; @@ -871,7 +871,7 @@ static 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] == '{') @@ -892,7 +892,7 @@ static 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] == '{') { @@ -909,10 +909,10 @@ static 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; @@ -988,13 +988,13 @@ static 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 @@ -1002,9 +1002,9 @@ static 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])); @@ -1015,9 +1015,9 @@ static 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 @@ -1025,11 +1025,11 @@ static 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 @@ -1064,7 +1064,7 @@ static 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")) ; } } @@ -1992,7 +1992,7 @@ static 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 38278606..637a649d 100644 --- a/libcurl.c +++ b/libcurl.c @@ -1663,7 +1663,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 ba50efde..eb741b2a 100644 --- a/menu.c +++ b/menu.c @@ -869,10 +869,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 6941af6b..50ef572b 100644 --- a/model_brush.c +++ b/model_brush.c @@ -2078,13 +2078,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 @@ -2094,7 +2094,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 @@ -3064,12 +3064,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 @@ -3080,7 +3080,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 @@ -3104,7 +3104,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 @@ -3113,25 +3113,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); @@ -4454,11 +4454,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 @@ -4468,7 +4468,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 04f2c9cb..653e0c8a 100644 --- a/model_shared.c +++ b/model_shared.c @@ -234,11 +234,12 @@ static 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); static 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 @@ static int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_pars 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 @@ static int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_pars 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,19 +282,37 @@ static int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_pars 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; } -static 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 b172ea6f..cb2bff1b 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -2975,7 +2975,7 @@ void VM_parseentitydata(prvm_prog_t *prog) 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] != '{' ) prog->error_cmd("VM_parseentitydata: %s: Couldn't parse entity data:\n%s", prog->name, data ); PRVM_ED_ParseEdict (prog, data, ent); diff --git a/prvm_edict.c b/prvm_edict.c index 6fa76b68..5168b597 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -894,7 +894,7 @@ void PRVM_ED_ParseGlobals (prvm_prog_t *prog, const char *data) while (1) { // parse key - if (!COM_ParseToken_Simple(&data, false, false)) + if (!COM_ParseToken_Simple(&data, false, false, true)) prog->error_cmd("PRVM_ED_ParseGlobals: EOF without closing brace"); if (com_token[0] == '}') break; @@ -905,7 +905,7 @@ void PRVM_ED_ParseGlobals (prvm_prog_t *prog, 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)) prog->error_cmd("PRVM_ED_ParseGlobals: EOF without closing brace"); if (developer_entityparsing.integer) @@ -1244,7 +1244,7 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_ while (1) { // parse key - if (!COM_ParseToken_Simple(&data, false, false)) + if (!COM_ParseToken_Simple(&data, false, false, true)) prog->error_cmd("PRVM_ED_ParseEdict: EOF without closing brace"); if (developer_entityparsing.integer) Con_Printf("Key: \"%s\"", com_token); @@ -1276,7 +1276,7 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_ } // parse value - if (!COM_ParseToken_Simple(&data, false, false)) + if (!COM_ParseToken_Simple(&data, false, false, true)) prog->error_cmd("PRVM_ED_ParseEdict: EOF without closing brace"); if (developer_entityparsing.integer) Con_Printf(" \"%s\"\n", com_token); @@ -1354,7 +1354,7 @@ void PRVM_ED_LoadFromFile (prvm_prog_t *prog, 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] != '{') prog->error_cmd("PRVM_ED_LoadFromFile: %s: found %s when expecting {", prog->name, com_token); diff --git a/r_shadow.c b/r_shadow.c index fc10e437..92b37e6c 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -5785,7 +5785,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; @@ -5803,7 +5803,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 @@ -5813,7 +5813,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 f36bfe13..b7f0caf4 100644 --- a/sv_main.c +++ b/sv_main.c @@ -2973,7 +2973,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) { -- 2.39.2