diff --git a/data/levels/level99.dat b/data/levels/level99.dat index eb74d8e..f3614da 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -24,9 +24,9 @@ exitdir 1 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,4, 4,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,1,0,0,0,0,0,4,4,4,4,4,4,4,4,4,0,0,0,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,0,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,0,0,0,4, +4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,53,0,0,4, +4,0,0,0,0,0,0,0,0,81,81,81,81,81,81,81,81,0,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,0,0,0,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,7,0,0,4, @@ -40,11 +40,17 @@ exitdir 1 4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,1,0,0,0,0,7,0,0,4, -4,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,7,0,0,4, +4,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,72,71,73,1,1,1,1,0,0,0,1,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,4, 4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,4, 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4, layer2 +30,11,72 +31,11,71 +32,11,73 +30,12,69 +31,12,68 +32,12,70 36,13,8 10,16,8 20,16,8 diff --git a/data/tiledefs.dat b/data/tiledefs.dat index d9c231e..279a2da 100644 --- a/data/tiledefs.dat +++ b/data/tiledefs.dat @@ -61,7 +61,7 @@ id 8 solid 1 dir newtiles file log1.png log1.5.png log2.png log2.5.png log3.png log3.5.png log4.png log4.5.png -animspeed 5 +animspeed 15 end tile left @@ -534,6 +534,7 @@ tile light id 5 solid 0 file newtiles/light.png +animspeed 5 end tile light2 diff --git a/rc.c b/rc.c index daee635..512ac57 100644 --- a/rc.c +++ b/rc.c @@ -543,7 +543,11 @@ int main (int argc, char **argv) { offset = *animtile; - tt = gettile(curlevel->map[offset]); + // Is l2 tile animated? + tt = gettile(curlevel->map2[offset]); + if (tt->numframes == 1) { // if no l2, use l1 + tt = gettile(curlevel->map[offset]); + } numframes = tt->numframes; diff --git a/shared.c b/shared.c index b8e7283..3b1e2e6 100644 --- a/shared.c +++ b/shared.c @@ -503,7 +503,28 @@ int loadlevel(int lnum, int wantmonsters) { p = strtok(NULL, ","); tid = atoi(p); p = strtok(NULL, ","); if (p == NULL) { // no more data + int numframes; level->map2[yy*LEVELW+xx] = tid; + + // animated l2 + numframes = gettileframecount(tid); + if (numframes == 1) { + // not animated + // don't clear this, in case l1 is animated + //level->tileframe[y*LEVELW+x] = 0; + } else { + tiletype_t *thistile; + // animated + thistile = gettile(tid); + if (thistile->animsync) { + level->tileframe[yy*LEVELW+xx] = 0; + } else { + level->tileframe[yy*LEVELW+xx] = rand() % numframes; + } + tempanim[numanim] = yy*LEVELW+xx; + numanim++; + } + } else { // more data! this means use layer 3 level->map3[yy*LEVELW+xx] = tid; } @@ -1243,7 +1264,9 @@ int loadtiletypes(char *filename) { } t->numframes = frame; // default animation speed - t->animspeed = 20; + if ((t->numframes > 1) && (t->animspeed = 0)) { + t->animspeed = 20; + } } } @@ -2716,6 +2739,7 @@ int isabilitypowerup(int id) { case P_JETPACK: case P_PILL: case P_RAYGUN: + case P_LIFE: case P_TOPHAT: return B_TRUE; } @@ -3193,10 +3217,16 @@ void drawtile(SDL_Surface *where, int x, int y) { tt = gettile(curlevel->bgtileid); SDL_BlitSurface(levelbg, &area, where, &area); - /* now draw real one */ + /* now draw layer 1 tile */ offset = y*LEVELW+x; + tt = gettile(curlevel->map[offset]); - frame = curlevel->tileframe[offset]; + if (tt->numframes > 1) { + frame = curlevel->tileframe[offset]; + } else { + frame = 0; + } + if (tt->id != curlevel->bgtileid) { SDL_BlitSurface(tt->img[frame], NULL, where, &area); } @@ -3204,6 +3234,11 @@ void drawtile(SDL_Surface *where, int x, int y) { /* now draw layer2 if it exists */ if (curlevel->map2[offset] != T_BLANK) { tt = gettile(curlevel->map2[offset]); + if (tt->numframes > 1) { + frame = curlevel->tileframe[offset]; + } else { + frame = 0; + } if (tt->id != curlevel->bgtileid) { SDL_BlitSurface(tt->img[frame], NULL, where, &area); }