diff --git a/defs.h b/defs.h index aaebe35..21ff5b2 100644 --- a/defs.h +++ b/defs.h @@ -992,6 +992,7 @@ typedef struct level_s { int map3[LEVELW*LEVELH]; // third map layer int tileframe[LEVELW*LEVELH]; // tracks frame numbers for tiles int tilewalkvanish[LEVELW*LEVELH]; // tracks how long before tiles disappear + // -1 == "don't disappear" int *animtiles; // array of offsets to map positions which are animated int *l3tiles; // array of layer 3 tiles struct level_s *next; diff --git a/rc.c b/rc.c index ea94149..466d71b 100644 --- a/rc.c +++ b/rc.c @@ -884,8 +884,6 @@ int main (int argc, char **argv) { } } - - /********************************************** * Drawing routines */ @@ -905,7 +903,6 @@ int main (int argc, char **argv) { docannoneffect(player2); } } - // draw sprites if (levelcomplete != LV_DOPOKER) { @@ -924,7 +921,6 @@ int main (int argc, char **argv) { // redraw it drawl3tile(screen, offset%LEVELW,offset/LEVELW); - } @@ -1305,7 +1301,6 @@ printf("timer = %d\n",timer); n--; } } - } if (toggletimer > 0) toggletimer--; @@ -1696,7 +1691,7 @@ void nextlevel(void) { loadlevel(curlevelnum, B_TRUE); } - // remmeber layer 2 in case we replace it with water + // remember layer 2 in case we replace it with water for (y = 0 ; y < LEVELH; y++) { for (x = 0 ; x < LEVELW; x++) { savemap[y*LEVELW+x] = curlevel->map2[y*LEVELW+x]; @@ -1707,7 +1702,7 @@ void nextlevel(void) { fruittime = -1; // do the moving to next level transition (ie. scroll the screen) - drawlevel(); + drawleveltransition(); // now the player gets invincibility if (!inintro()) { @@ -7107,7 +7102,7 @@ void dotileeffects(sprite_t *s) { // initial transition to a new level -void drawlevel(void) { +void drawleveltransition(void) { int x,y,i; double turns; double dist[2]; @@ -7194,7 +7189,6 @@ void drawlevel(void) { } } - // figure out where the players' new start positions are if (player) { scrollinfo.dstx[0] = (curlevel->p1x * TILEW) + (TILEW/2); @@ -7842,8 +7836,6 @@ void removeall(void) { SDL_Rect area; int clearfull = B_FALSE; int *animtile; - - /* switch (player->powerup) { case PW_CANNONFIRE: @@ -7879,14 +7871,13 @@ void removeall(void) { */ clearfull = B_TRUE; - if (clearfull) { // clear the entire screen SDL_BlitSurface(temps, NULL, screen, NULL); } else { for (s = sprite; s ; s = s->next) { /* - // blit every tile coverting this sprite + // blit every tile covering this sprite startx = s->x - (s->img->w/2); starty = s->y - s->img->h; endx = s->x + (s->img->w/2); @@ -7947,8 +7938,6 @@ void removeall(void) { area.h = 24; SDL_BlitSurface(temps, &area, screen, &area); } - - } void drawnetting(sprite_t *s) { @@ -11399,7 +11388,6 @@ void undoflood(void) { } } SDL_BlitSurface(temps, NULL, screen, NULL); - } @@ -13466,8 +13454,6 @@ void startgame(void) { nextlevel(); firstlevel = B_FALSE; - flip(B_TRUE); - if (skipto == -1) { playfx(FX_BIRDS); } diff --git a/rc.h b/rc.h index 24aea78..b6a928f 100644 --- a/rc.h +++ b/rc.h @@ -7,7 +7,7 @@ void drawbosshealth(void); void drawtext(void); void movetext(void); void removeall(void); -void drawlevel(void); +void drawleveltransition(void); int randommonster(void); void removesprite(sprite_t *s); void removenetting(sprite_t *s); diff --git a/shared.c b/shared.c index f82ddac..ed67fd4 100644 --- a/shared.c +++ b/shared.c @@ -497,7 +497,7 @@ nfadingtiles = 0; if (newversion) { strncpy(buf2, buf, BUFLEN); p = strtok(buf2, ","); - while (p) { + while (p && *p != '\n') { int numframes; tileid = atoi(p); /* validate it */ @@ -536,10 +536,9 @@ nfadingtiles = 0; numanim++; } - level->tilewalkvanish[y*LEVELW+x] = getwalkvanish(tileid); - /*if (level->tilewalkvanish[y*LEVELW+x] != -1) { + if (level->tilewalkvanish[y*LEVELW+x] != -1) { printf("tilevanish %d,%d = %d\n",x,y,level->tilewalkvanish[y*LEVELW+x]); - } */ + } // if this is the last line, update level->bottomopen if (y == LEVELH-1) { @@ -561,7 +560,7 @@ nfadingtiles = 0; } /* make sure enough data was found */ - if (x < LEVELW+1) { + if (x < LEVELW) { printf("Not enough tiles on line: y = %d\n",y); fclose(f); return B_TRUE; @@ -2952,6 +2951,7 @@ void flip(int wantclear) { gengl(screen); blittoscreen(); if (wantclear) { + // clear screen buffer afterwards SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, black.r, black.g, black.b)); } #else @@ -3554,6 +3554,7 @@ void drawtile(SDL_Surface *where, int x, int y) { #endif } + /* now draw layer2 if it exists */ if (curlevel->map2[offset] != T_BLANK) { tt = gettile(curlevel->map2[offset]); @@ -3565,7 +3566,6 @@ void drawtile(SDL_Surface *where, int x, int y) { if (tt->id != curlevel->bgtileid) { SDL_BlitSurface(tt->img[frame], NULL, where, &area); } - } }