From e2ccbf68704ab6666e58490aa36fd68175d61784 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 6 Sep 2006 04:18:28 +0000 Subject: [PATCH] Replaced the 'dynquote' primitive with 'qsprintf' and fixed a parsing bug with some of the level and sound name definition stuff. git-svn-id: https://svn.eduke32.com/eduke32@290 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 1 - polymer/eduke32/source/gamedef.c | 33 +++++++++++++------------ polymer/eduke32/source/gamedef.h | 2 +- polymer/eduke32/source/gameexec.c | 16 ++++++------ polymer/eduke32/source/jfaud_sounds.cpp | 6 +++++ 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 745d455c8..81662b37a 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9087,7 +9087,6 @@ void app_main(int argc,char **argv) { Bsprintf(ud.user_name[j],"PLAYER %d",j+1); ps[j].team = ud.pteam[j] = i; - initprintf("p %d t %d\n",j,ps[j].team); i = 1-i; } } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index d23f0c7a7..cf7fc0fac 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -408,7 +408,7 @@ char *keyw[] = { "precache", // 261 "definegamefuncname", // 262 "redefinequote", // 263 - "dynquote", // 264 + "qsprintf", // 264 "getpname", // 265 "qstrcat", // 266 "qstrcpy", // 267 @@ -2788,7 +2788,8 @@ char parsecommand(void) ReportError(WARNING_EVENTSYNC); return 0; - case CON_DYNQUOTE: + case CON_QSPRINTF: + transnum(LABEL_DEFINE); transnum(LABEL_DEFINE); for(j = 0;j < 4;j++) { @@ -4309,7 +4310,7 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' ) textptr++; + skipcomments(); if (j < 0 || j > MAXVOLUMES-1) { @@ -4342,7 +4343,7 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' ) textptr++; + skipcomments(); if (j < 0 || j > NUMGAMEFUNCTIONS-1) { @@ -4376,7 +4377,7 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' ) textptr++; + skipcomments(); if (j < 0 || j > 4) { @@ -4413,7 +4414,7 @@ repeatcase: scriptptr--; //remove it from compiled code gametype_flags[j] = *scriptptr; //put it into the flags - while( *textptr == ' ' ) textptr++; + skipcomments(); if (j < 0 || j > MAXGAMETYPES-1) { @@ -4449,7 +4450,7 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; k = *scriptptr; - while( *textptr == ' ' ) textptr++; + skipcomments(); if (j < 0 || j > MAXVOLUMES-1) { @@ -4468,7 +4469,7 @@ repeatcase: } i = 0; - while( *textptr != ' ' && *textptr != 0x0a ) + while( *textptr != ' ' && *textptr != 0x0d && *textptr != 0x0a ) { level_file_names[j*11+k][i] = *textptr; textptr++,i++; @@ -4482,21 +4483,21 @@ repeatcase: } level_names[j*11+k][i] = '\0'; - while( *textptr == ' ' ) textptr++; + skipcomments(); partime[j*11+k] = (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); textptr += 5; - while( *textptr == ' ' ) textptr++; + skipcomments(); designertime[j*11+k] = (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); textptr += 5; - while( *textptr == ' ' ) textptr++; + skipcomments(); i = 0; @@ -4544,8 +4545,7 @@ repeatcase: i = 0; - while( *textptr == ' ' ) - textptr++; + skipcomments(); if (tw == CON_REDEFINEQUOTE) { @@ -4613,8 +4613,9 @@ repeatcase: } scriptptr--; i = 0; - while( *textptr == ' ' ) - textptr++; + + skipcomments(); + while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') { cheatquotes[k][i] = *textptr; @@ -4643,7 +4644,7 @@ repeatcase: i = 0; skipcomments(); - while( *textptr != ' ' ) + while( *textptr != ' ' && *textptr != 0x0d && *textptr != 0x0a) { sounds[k][i] = *textptr; textptr++,i++; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 95225879c..51944a6c2 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -695,7 +695,7 @@ enum keywords { CON_PRECACHE, // 261 CON_DEFINEGAMEFUNCNAME, // 262 CON_REDEFINEQUOTE, // 263 - CON_DYNQUOTE, // 264 + CON_QSPRINTF, // 264 CON_GETPNAME, // 265 CON_QSTRCAT, // 266 CON_QSTRCPY, // 267 diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 7747e2536..599b5a307 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5364,21 +5364,23 @@ SKIPJIBS: ps[g_p].pals[j] = *insptr++; break; - case CON_DYNQUOTE: + case CON_QSPRINTF: { - long var1, var2, var3, var4; + long var1, var2, var3, var4, sq, dq; insptr++; - if(fta_quotes[*insptr] != NULL) + dq = *insptr++; + sq = *insptr++; + if(fta_quotes[sq] != NULL && fta_quotes[dq] != NULL) { - Bstrcpy(tempbuf,fta_quotes[*insptr++]); + Bstrcpy(tempbuf,fta_quotes[sq]); var1 = GetGameVarID(*insptr++, g_i, g_p); var2 = GetGameVarID(*insptr++, g_i, g_p); var3 = GetGameVarID(*insptr++, g_i, g_p); var4 = GetGameVarID(*insptr++, g_i, g_p); - Bsprintf(fta_quotes[122],tempbuf,var1,var2,var3,var4); - FTA(122,&ps[g_p]); + Bsprintf(fta_quotes[dq],tempbuf,var1,var2,var3,var4); } else { - OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); + if(fta_quotes[sq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,sq); + if(fta_quotes[dq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,dq); insptr += 5; } break; diff --git a/polymer/eduke32/source/jfaud_sounds.cpp b/polymer/eduke32/source/jfaud_sounds.cpp index 51509436e..5a7ff2376 100644 --- a/polymer/eduke32/source/jfaud_sounds.cpp +++ b/polymer/eduke32/source/jfaud_sounds.cpp @@ -61,6 +61,12 @@ static int osdcmd_setsoundfilter(const osdfuncparm_t *parm); # include #endif +#ifdef JFAUD +#define MAXCACHE1DSIZE (16*1048576) +#else +#define MAXCACHE1DSIZE (32*1048576) +#endif + class KenFile : public JFAudFile { private: int fh;