Ice bridge tile now melts when you walk on it.
Added drip sprite. Added 'thick ice bridge' tile which doesn't melt
This commit is contained in:
parent
e04a095147
commit
ec8ce89723
|
@ -18,19 +18,19 @@ exitdir -2
|
|||
90,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,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,90,
|
||||
90,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,90,
|
||||
90,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,90,
|
||||
90,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,90,
|
||||
90,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
90,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,90,
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 695 B |
Binary file not shown.
After Width: | Height: | Size: 194 B |
|
@ -587,6 +587,7 @@ tile icebridge
|
|||
id 26
|
||||
solid 2
|
||||
slippery 1
|
||||
walkvanish 32
|
||||
file newtiles/icebridge.png
|
||||
end
|
||||
|
||||
|
@ -661,3 +662,10 @@ id 5
|
|||
solid 0
|
||||
file newtiles/castlewindow.png
|
||||
end
|
||||
|
||||
tile icebridgethick
|
||||
id 27
|
||||
solid 2
|
||||
slippery 1
|
||||
file newtiles/icebridgethick.png
|
||||
end
|
||||
|
|
11
defs.h
11
defs.h
|
@ -133,6 +133,8 @@
|
|||
#define GAMEOVERDELAY 200
|
||||
#define POKERDELAY 170
|
||||
|
||||
#define ICEDRIPSPEED 0.5
|
||||
|
||||
enum ENDGAMETYPE {
|
||||
EG_FRUITFALL = 1,
|
||||
EG_FADEPAUSE,
|
||||
|
@ -379,6 +381,9 @@ enum SPELL {
|
|||
#define B_TRUE -1
|
||||
#define B_FALSE 0
|
||||
|
||||
#define B_PUFF (B_TRUE)
|
||||
#define B_NOPUFF (B_FALSE)
|
||||
|
||||
#define ALL -1
|
||||
|
||||
#define FOREVER -23
|
||||
|
@ -498,7 +503,7 @@ enum SPELL {
|
|||
#define S_SLOPE 2
|
||||
|
||||
// Sprite types
|
||||
#define MAXPTYPES 181
|
||||
#define MAXPTYPES 182
|
||||
#define P_PLAYER 0
|
||||
#define P_RAT 1
|
||||
#define P_CHEESE 2
|
||||
|
@ -685,6 +690,7 @@ enum SPELL {
|
|||
#define P_FIREUP 178
|
||||
#define P_NET 179
|
||||
#define P_UPSTAR 180
|
||||
#define P_DRIP 181
|
||||
|
||||
#define FLY_FLYTIME 150
|
||||
#define FLY_WALKTIME 300
|
||||
|
@ -855,6 +861,7 @@ enum SPELL {
|
|||
#define T_WATERDOWN 24
|
||||
#define T_WARP 25 // hidden warp point - jump to reveal
|
||||
#define T_ICEBRIDGE 26 // like land but you can drop down through it
|
||||
#define T_ICEBRIDGETH 27 // thicker version of ice bridge which doesn't melt
|
||||
|
||||
// death states
|
||||
#define D_INITIAL (1) // Need to trigger death sequence
|
||||
|
@ -914,6 +921,7 @@ typedef struct tiletype_s {
|
|||
int sticky;
|
||||
int stopnet;
|
||||
int slippery;
|
||||
int walkvanish; // -1 means 'don't vanish'
|
||||
SDL_Surface *img[MAXTILEFRAMES];
|
||||
int numframes;
|
||||
int animspeed;
|
||||
|
@ -959,6 +967,7 @@ typedef struct level_s {
|
|||
int map2[LEVELW*LEVELH]; // second map layer
|
||||
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
|
||||
int *animtiles; // array of offsets to map positions which are animated
|
||||
int *l3tiles; // array of layer 3 tiles
|
||||
struct level_s *next;
|
||||
|
|
131
rc.c
131
rc.c
|
@ -36,6 +36,8 @@ SDL_Surface *screen;
|
|||
SDL_Surface *credittext;
|
||||
SDL_Surface *endgamebox;
|
||||
|
||||
SDL_Surface *temptilesurf;
|
||||
|
||||
int lockcredits = B_FALSE;
|
||||
|
||||
int globtimer;
|
||||
|
@ -159,6 +161,10 @@ int fruittime = -1;
|
|||
int curfruittype = 0;
|
||||
int curpoweruptype[2];
|
||||
|
||||
int tilefadex[LEVELW*LEVELH];
|
||||
int tilefadey[LEVELW*LEVELH];
|
||||
int nfadingtiles = 0;
|
||||
|
||||
int gtime = 0;
|
||||
int fpsticks = 0;
|
||||
int fpsstart = 0;
|
||||
|
@ -454,6 +460,12 @@ int main (int argc, char **argv) {
|
|||
pausedshadow = TTF_RenderText_Solid(font[TEXTSIZE_PAUSED], "PAUSED", black);
|
||||
paused = B_FALSE;
|
||||
|
||||
temptilesurf = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEW, TILEH,
|
||||
screen->format->BitsPerPixel, screen->format->Rmask,
|
||||
screen->format->Gmask,screen->format->Bmask, 0);
|
||||
SDL_FillRect(temptilesurf, NULL, SDL_MapRGB(screen->format,black.r,black.g,black.b));
|
||||
SDL_SetAlpha(temptilesurf, SDL_SRCALPHA, 25);
|
||||
|
||||
|
||||
endgamebox = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
screen->w,
|
||||
|
@ -776,6 +788,33 @@ int main (int argc, char **argv) {
|
|||
|
||||
}
|
||||
|
||||
// melting/fading tiles
|
||||
for (i = nfadingtiles-1; i >= 0; i--) {
|
||||
int tx,ty;
|
||||
|
||||
tx = tilefadex[i];
|
||||
ty = tilefadey[i];
|
||||
if (--(curlevel->tilewalkvanish[ty*LEVELW+tx]) <= 0) {
|
||||
int n;
|
||||
melttile(tx,ty,REGROWTIMER_SHORT, B_NOPUFF);
|
||||
// remove from list.
|
||||
for (n = i; n < nfadingtiles-1; n++) {
|
||||
tilefadex[n] = tilefadex[n+1];
|
||||
tilefadey[n] = tilefadey[n+1];
|
||||
}
|
||||
nfadingtiles--;
|
||||
} else if (curlevel->tilewalkvanish[ty*LEVELW+tx] >= 20) { // maybe drip if not too faded
|
||||
//printf("curmelt ---- %d\n",curlevel->tilewalkvanish[ty*LEVELW+tx]);
|
||||
if ((timer % 10 == 0) && !(rand() % 3)) {
|
||||
sprite_t *s;
|
||||
// add drip
|
||||
s = addsprite(P_DRIP, tx*TILEW + (TILEW/4) + (rand() % (TILEW/2)), (ty*TILEH) + TILEH, "drip");
|
||||
s->fallspeed = ICEDRIPSPEED;
|
||||
}
|
||||
}
|
||||
// now re-draw it to change transparency
|
||||
drawtile(temps, tx, ty);
|
||||
}
|
||||
|
||||
// endgame flash
|
||||
if (globpowerup == PW_ENDGAME) {
|
||||
|
@ -1120,7 +1159,7 @@ printf("timer = %d\n",timer);
|
|||
sprite_t *ss;
|
||||
tx = poss[rand() % nposs];
|
||||
// destroy the tile
|
||||
melttile(tx,0,REGROWTIMER_SHORT);
|
||||
melttile(tx,0,REGROWTIMER_SHORT, B_PUFF);
|
||||
// add a falling brick
|
||||
ss = addsprite(P_FALLINGBRICK,
|
||||
(tx*TILEW) + (TILEW/2), TILEH,"fallingbrick");
|
||||
|
@ -1228,6 +1267,8 @@ printf("timer = %d\n",timer);
|
|||
tx = regrow[n].tx;
|
||||
ty = regrow[n].ty;
|
||||
curlevel->map[ty * LEVELW + tx] = regrow[n].origid;
|
||||
curlevel->tilewalkvanish[ty * LEVELW + tx] = getwalkvanish(regrow[n].origid);
|
||||
|
||||
drawtile(temps, tx,ty);
|
||||
puffin(-1, tx*TILEW+(TILEW/2), ty*TILEH+TILEH, "nothing", 0);
|
||||
|
||||
|
@ -3526,6 +3567,25 @@ int movesprite(sprite_t *s) {
|
|||
// die
|
||||
s->dead = D_FINAL;
|
||||
}
|
||||
} else if (s->id == P_DRIP) { // water drip from melting tile
|
||||
// fall downwards
|
||||
if (isinwater(s) && !s->iced && isongroundpoint(s, s->x, s->y+1)) {
|
||||
s->dead = D_FINAL;
|
||||
} else {
|
||||
s->y += s->fallspeed;
|
||||
|
||||
// gravity...
|
||||
if ((timer % 10 == 0) && (s->fallspeed < FALLSPEED)) {
|
||||
s->fallspeed++;
|
||||
}
|
||||
if (s->fallspeed > FALLSPEED) s->fallspeed = FALLSPEED;
|
||||
}
|
||||
|
||||
// if off screen
|
||||
if ((s->y <= 0) || (s->y >= (LEVELH*TILEH))) {
|
||||
// die
|
||||
s->dead = D_FINAL;
|
||||
}
|
||||
} else if (s->id == P_BUBBLE) { // bubble effect
|
||||
tiletype_t *tt;
|
||||
// float up, die when we leave the water
|
||||
|
@ -6407,7 +6467,7 @@ int movesprite(sprite_t *s) {
|
|||
for (yyy = s->y - s->img->h ; yyy < s->y ; yyy += 4) {
|
||||
tt = gettileat(s->x + (s->img->w/2),yyy, &tx,&ty);
|
||||
if (isbridge(tt->id)) {
|
||||
melttile(tx,ty,REGROWTIMER_SHORT);
|
||||
melttile(tx,ty,REGROWTIMER_SHORT, B_PUFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7635,6 +7695,23 @@ double getspeed(sprite_t *s ) {
|
|||
return speed;
|
||||
}
|
||||
|
||||
void addfadingtile(int x, int y) {
|
||||
int i;
|
||||
sprite_t *s;
|
||||
for (i = 0; i < nfadingtiles; i++) {
|
||||
if ((tilefadex[i] == x) && (tilefadey[i] == y)) {
|
||||
// already there
|
||||
return;
|
||||
}
|
||||
}
|
||||
tilefadex[nfadingtiles] = x;
|
||||
tilefadey[nfadingtiles] = y;
|
||||
nfadingtiles++;
|
||||
|
||||
// add drip
|
||||
s = addsprite(P_DRIP, x*TILEW + (TILEW/4) + (rand() % (TILEW/2)), (y*TILEH) + TILEH, "drip");
|
||||
s->fallspeed = ICEDRIPSPEED;
|
||||
}
|
||||
|
||||
int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay, int ttype) {
|
||||
text_t *t;
|
||||
|
@ -8483,8 +8560,6 @@ int isroofnabove(sprite_t *s, int howfar) {
|
|||
}
|
||||
|
||||
int isonground(sprite_t *s) {
|
||||
|
||||
|
||||
// are we on a platform?
|
||||
if (s->onplatform) {
|
||||
return B_TRUE;
|
||||
|
@ -8535,7 +8610,6 @@ int isongroundpoint(sprite_t *s, int x,int y) {
|
|||
|
||||
tt = gettileat(x,y, &tilex, &tiley);
|
||||
|
||||
|
||||
// slope etc doesn't matter if you're dead
|
||||
if (s->dead && tt->solid) {
|
||||
return B_TRUE;
|
||||
|
@ -8813,7 +8887,7 @@ void dogravity(sprite_t *s) {
|
|||
tt = gettileat(xxx, s->y - s->img->h,&tx,&ty);
|
||||
if (isbridge(tt->id)) {
|
||||
// melt it!
|
||||
melttile(tx,ty,REGROWTIMER_LONG);
|
||||
melttile(tx,ty,REGROWTIMER_LONG, B_PUFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8905,7 +8979,7 @@ void dogravity(sprite_t *s) {
|
|||
for (xxx = s->x - (s->img->w/2) ; xxx < s->x + (s->img->w/2) ; xxx += TILEW) {
|
||||
tt = gettileat(xxx, s->y + 2 ,&tx,&ty);
|
||||
if (isbridge(tt->id)) {
|
||||
melttile(tx,ty,REGROWTIMER_LONG);
|
||||
melttile(tx,ty,REGROWTIMER_LONG, B_PUFF);
|
||||
}
|
||||
}
|
||||
} else if ((s->id == P_KINGSNAIL) && (s->timer1 == KSS_JUMPING)) { // special case
|
||||
|
@ -8979,7 +9053,7 @@ void dogravity(sprite_t *s) {
|
|||
termvel = FALLSPEED;
|
||||
}
|
||||
|
||||
if ((timer % 10 == 0) && (s->fallspeed < FALLSPEED)) {
|
||||
if ((timer % 10 == 0) && (s->fallspeed < termvel)) {
|
||||
s->fallspeed++;
|
||||
}
|
||||
|
||||
|
@ -9413,6 +9487,39 @@ void dogravity(sprite_t *s) {
|
|||
|
||||
} // end if slamangle > 180degrees
|
||||
} // end if slamming
|
||||
|
||||
if (isonground(s) && isplayer(s) && !s->jumping && !s->falling && !s->swimming) {
|
||||
//int tx,ty,xoff;
|
||||
int px[3],py[3],i;
|
||||
|
||||
// make list of tiles:
|
||||
// firstctly at feet, and left, and right, just like isonground() !
|
||||
px[0] = s->x;
|
||||
py[0] = s->y + 1;
|
||||
|
||||
px[1] = s->x - s->img->w/2;
|
||||
py[1] = s->y + 1;
|
||||
|
||||
px[2] = s->x + s->img->w/2;
|
||||
py[2] = s->y + 1;
|
||||
|
||||
// under+left, underneath, under+right
|
||||
for (i = 0; i < 3; i++) {
|
||||
int off,tx,ty;
|
||||
tx = px[i] / TILEW;
|
||||
ty = py[i] / TILEH;
|
||||
off = ty*LEVELW+tx;
|
||||
if ((off > 0) && (off < LEVELW*LEVELH)) {
|
||||
tiletype_t *tt;
|
||||
// only check layer 1
|
||||
tt = gettile(curlevel->map[off]);
|
||||
if (tt && (tt->walkvanish != -1) && (curlevel->tilewalkvanish[off] > 0)) {
|
||||
// instead of this, just add the newx+ty to a list of fading tiles.
|
||||
addfadingtile(tx, ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -9718,7 +9825,7 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
|
|||
sprite_t *sp;
|
||||
// clear layer 2 as well
|
||||
curlevel->map2[ty * LEVELW + tx ] = getuniq(T_BLANK);
|
||||
melttile(tx, ty, FOREVER);
|
||||
melttile(tx, ty, FOREVER, B_PUFF);
|
||||
sp = addsprite(fruittypes[curfruittype],
|
||||
tx * TILEW + (TILEW/2),
|
||||
ty * TILEH + (TILEH/2), "end_fruit");
|
||||
|
@ -15153,7 +15260,7 @@ int savebmp(SDL_Surface *which) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
void melttile(int tx, int ty,int howlong) {
|
||||
void melttile(int tx, int ty,int howlong, int wantpuff) {
|
||||
if (numregrow >= (MAXREGROW-1)) {
|
||||
return;
|
||||
}
|
||||
|
@ -15168,7 +15275,9 @@ void melttile(int tx, int ty,int howlong) {
|
|||
|
||||
curlevel->map[ty * LEVELW + tx ] = getuniq(T_BLANK);
|
||||
drawtile(temps, tx,ty);
|
||||
puffin(-1, tx*TILEW+(TILEW/2), ty*TILEH+TILEH, "nothing", 0);
|
||||
if (wantpuff) {
|
||||
puffin(-1, tx*TILEW+(TILEW/2), ty*TILEH+TILEH, "nothing", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
3
rc.h
3
rc.h
|
@ -1,5 +1,6 @@
|
|||
void cleanup(void);
|
||||
int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay, int ttype);
|
||||
void addfadingtile(int x, int y);
|
||||
void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol, int delay, int ttype);
|
||||
void drawscore(void);
|
||||
void drawbosshealth(void);
|
||||
|
@ -150,7 +151,7 @@ int countbabies(sprite_t *s, int babytype);
|
|||
int isconveyor(int id);
|
||||
int isbridge(int id);
|
||||
int savebmp(SDL_Surface *which);
|
||||
void melttile(int tx,int ty, int howlong);
|
||||
void melttile(int tx,int ty, int howlong, int wantpuff);
|
||||
void selectspell(sprite_t *s);
|
||||
void incfruittype(void);
|
||||
SDL_Color *getptextcol(sprite_t *s);
|
||||
|
|
61
shared.c
61
shared.c
|
@ -21,6 +21,8 @@
|
|||
|
||||
#ifndef __EDITOR
|
||||
extern int fps;
|
||||
extern int nfadingtiles;
|
||||
extern SDL_Surface *temptilesurf;
|
||||
#endif
|
||||
|
||||
int loadlevel(int lnum, int wantmonsters) {
|
||||
|
@ -127,6 +129,15 @@ int loadlevel(int lnum, int wantmonsters) {
|
|||
}
|
||||
}
|
||||
|
||||
for (xx = 0; xx < LEVELW; xx++) {
|
||||
for (yy = 0; yy < LEVELH; yy++) {
|
||||
level->tilewalkvanish[yy*LEVELW+xx] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __EDITOR
|
||||
nfadingtiles = 0;
|
||||
#endif
|
||||
|
||||
/* read tileset */
|
||||
/*
|
||||
|
@ -445,6 +456,11 @@ int loadlevel(int lnum, int wantmonsters) {
|
|||
numanim++;
|
||||
}
|
||||
|
||||
level->tilewalkvanish[y*LEVELW+x] = getwalkvanish(tileid);
|
||||
/*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) {
|
||||
tiletype_t *thistile;
|
||||
|
@ -1190,6 +1206,7 @@ int loadtiletypes(char *filename) {
|
|||
t->sticky = B_FALSE;
|
||||
t->slippery = B_FALSE;
|
||||
t->stopnet = B_FALSE;
|
||||
t->walkvanish = -1;
|
||||
t->solid = B_TRUE;
|
||||
for (i = 0; i < TILEW; i++) {
|
||||
t->lowness[i] = 0;
|
||||
|
@ -1247,6 +1264,10 @@ int loadtiletypes(char *filename) {
|
|||
p = strtok(buf, " ");
|
||||
p = strtok(NULL, " ");
|
||||
t->stopnet = atoi(p);
|
||||
} else if (strstr(buf, "walkvanish") == buf) {
|
||||
p = strtok(buf, " ");
|
||||
p = strtok(NULL, " ");
|
||||
t->walkvanish = atoi(p);
|
||||
} else if (strstr(buf, "slippery") == buf) {
|
||||
p = strtok(buf, " ");
|
||||
p = strtok(NULL, " ");
|
||||
|
@ -2021,6 +2042,11 @@ int loadimagesets(void) {
|
|||
loadspriteimage(P_RAYGUNBULLET,F_WALK1, "sprites/raygunbullet.png");
|
||||
imageset[P_RAYGUNBULLET].numimages = 1;
|
||||
|
||||
|
||||
/* water drip */
|
||||
loadspriteimage(P_DRIP,F_WALK1, "sprites/drip.png");
|
||||
imageset[P_DRIP].numimages = 1;
|
||||
|
||||
/* bullets */
|
||||
loadspriteimage(P_SPIT,0, "sprites/spit.png");
|
||||
loadspriteimage(P_SPIT,1, "sprites/spit2.png");
|
||||
|
@ -2890,6 +2916,15 @@ int iswinpowerup(int id) {
|
|||
return B_FALSE;
|
||||
}
|
||||
|
||||
int getwalkvanish(int tileid) {
|
||||
tiletype_t *tt;
|
||||
tt = gettile(tileid);
|
||||
if (tt) {
|
||||
return tt->walkvanish;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int isfruit(int id) {
|
||||
switch (id) {
|
||||
/* fruits */
|
||||
|
@ -3035,6 +3070,7 @@ int iseffect(int id) {
|
|||
case P_BIGUMBRELLA:
|
||||
case P_SMALLANCHOR:
|
||||
case P_NET:
|
||||
case P_DRIP:
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
|
@ -3329,6 +3365,7 @@ void drawtile(SDL_Surface *where, int x, int y) {
|
|||
tiletype_t *tt;
|
||||
int frame;
|
||||
int offset;
|
||||
int fadeint = 0;
|
||||
|
||||
if ((x < 0) || (y < 0) || (x >= LEVELW) || (y >= LEVELH)) {
|
||||
return;
|
||||
|
@ -3354,8 +3391,32 @@ void drawtile(SDL_Surface *where, int x, int y) {
|
|||
frame = 0;
|
||||
}
|
||||
|
||||
// tiles which vanish when walking on them will slowly fade out
|
||||
if (curlevel->tilewalkvanish[offset] >= 0) {
|
||||
int this, max;
|
||||
double fadeamt;
|
||||
// set alpha
|
||||
this = curlevel->tilewalkvanish[offset];
|
||||
max = tt->walkvanish;
|
||||
fadeamt = ((double)this / (double)max) * 255.0;
|
||||
fadeamt = 255 - fadeamt;
|
||||
fadeint = (int)fadeamt;
|
||||
} else {
|
||||
fadeint = 0;
|
||||
}
|
||||
|
||||
if (tt->id != curlevel->bgtileid) {
|
||||
SDL_BlitSurface(tt->img[frame], NULL, where, &area);
|
||||
#ifndef __EDITOR
|
||||
if (fadeint != 0) {
|
||||
// copy background area to temp surface
|
||||
SDL_BlitSurface(levelbg, &area, temptilesurf, NULL);
|
||||
// make it tranparent
|
||||
SDL_SetAlpha(temptilesurf, SDL_SRCALPHA, fadeint);
|
||||
// blit to screen over top of tile
|
||||
SDL_BlitSurface(temptilesurf, NULL, where, &area);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* now draw layer2 if it exists */
|
||||
|
|
Loading…
Reference in New Issue