- Fixed string format warnings

- "N" in editor will now select better level numbers
This commit is contained in:
Rob Pearce 2009-03-26 23:46:40 +00:00
parent ace244678b
commit 8dee5433c6
6 changed files with 15 additions and 11 deletions

View File

@ -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

1
defs.h
View File

@ -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

6
edit.c
View File

@ -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;

4
rc.c
View File

@ -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.

View File

@ -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;
}
}

View File

@ -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