- Can now have animated tiles in layer2

- Life powerup now registers on powerup detector
This commit is contained in:
Rob Pearce 2009-03-26 20:29:41 +00:00
parent 3967e8d5dd
commit d478852cc9
4 changed files with 55 additions and 9 deletions

View File

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

View File

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

4
rc.c
View File

@ -543,7 +543,11 @@ int main (int argc, char **argv) {
offset = *animtile;
// 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;

View File

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