diff --git a/data/map.dat b/data/map.dat index 27c29e0..d4e965e 100644 --- a/data/map.dat +++ b/data/map.dat @@ -88,5 +88,5 @@ 88,factory.dat,Factory 89,theendsofar.dat,THE END SO FAR 90,level9.5.dat,unknown -99,testlevel.dat,TEST LEVEL -0,intro.dat,INTRO +102,testlevel.dat,TEST LEVEL +101,intro.dat,INTRO diff --git a/defs.h b/defs.h index 4dc4c87..5cc61e1 100644 --- a/defs.h +++ b/defs.h @@ -105,6 +105,7 @@ // intro variables #define INTRO_RATSPEED 12 #define INTRO_LEVELNUM 101 +#define TEST_LEVELNUM 102 #define GAMEOVERWAIT 3 // # of seconds to wait before going back to title diff --git a/edit.c b/edit.c index 178420d..b212f4a 100644 --- a/edit.c +++ b/edit.c @@ -776,7 +776,7 @@ void drawstatus(void) { SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0)); // show level num - sprintf(temps, "Level %d",curlevelnum); + sprintf(temps, "Level %d",curlevel->id); wid = writetext(screen, area.x, area.y, temps, EDITTEXT, &white); area.x += (wid + STATUSPAD); // show level filename @@ -1412,10 +1412,10 @@ void newlevel(void) { maxlevid++; sprintf(tempbuf,"level%d.dat",maxlevid); - sprintf(curlevel->filename, tempbuf); + strncpy(curlevel->filename, tempbuf, BUFLEN); strncpy(levelentry[curlevelnum].filename, tempbuf, MIDBUFLEN); sprintf(tempbuf,"NEW LEVEL"); - sprintf(curlevel->name, tempbuf); + strncpy(curlevel->name, tempbuf, BUFLEN); strncpy(levelentry[curlevelnum].desc, tempbuf, MIDBUFLEN); curlevel->id = maxlevid; levelentry[curlevelnum].id = maxlevid; diff --git a/rc.c b/rc.c index 105c1ee..8d0d7d3 100644 --- a/rc.c +++ b/rc.c @@ -2248,7 +2248,7 @@ void checkcollide(sprite_t *s) { s2->willbecome = P_DIAMOND; playfx(FX_KILL); - sprintf(tempm, bifftext[rand() % MAXBIFFTEXT]); + strncpy(tempm, bifftext[rand() % MAXBIFFTEXT], BUFLEN); addoutlinetext(s2->x,s2->y - s->img->h/2, TEXTSIZE_BIFF, tempm,&red,&yellow,POINTSDELAY, TT_NORM); keepchecking = B_FALSE; } else if (s2->iced) { @@ -9575,7 +9575,7 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) { playfx(FX_CARD); // show text - sprintf(tempm, getcardname(s->id)); + sprintf(tempm, getcardname(s->id), BUFLEN); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM); // add a "card" effect. it will move slowly towards the corner. diff --git a/shared.c b/shared.c index 3214f4f..b68a09a 100644 --- a/shared.c +++ b/shared.c @@ -82,7 +82,7 @@ int loadlevel(int lnum, int wantmonsters) { level->l3tiles = NULL; } - sprintf(level->filename, levelentry[lnum].filename); + strncpy(level->filename, levelentry[lnum].filename, BUFLEN); /* set current level pointer */ curlevel = level; @@ -3538,7 +3538,10 @@ int loadlevellist(void) { // track max levelid if (levelentry[lev].id > maxlevid) { - maxlevid = levelentry[lev].id; + if ((levelentry[lev].id != INTRO_LEVELNUM) && + (levelentry[lev].id != TEST_LEVELNUM)) { + maxlevid = levelentry[lev].id; + } } diff --git a/website/map.dat b/website/map.dat index 27c29e0..d4e965e 100644 --- a/website/map.dat +++ b/website/map.dat @@ -88,5 +88,5 @@ 88,factory.dat,Factory 89,theendsofar.dat,THE END SO FAR 90,level9.5.dat,unknown -99,testlevel.dat,TEST LEVEL -0,intro.dat,INTRO +102,testlevel.dat,TEST LEVEL +101,intro.dat,INTRO