diff --git a/data/tiledefs.dat b/data/tiledefs.dat index a0cd00e..f6eedf0 100644 --- a/data/tiledefs.dat +++ b/data/tiledefs.dat @@ -160,12 +160,15 @@ end tile honey id 1 solid 1 +stopnet 1 file newtiles/honey.png end tile honeytop id 4 solid 1 +sticky 1 +stopnet 1 file newtiles/honeytop.png end @@ -210,12 +213,16 @@ end tile icetop id 20 solid 1 +slippery 1 +stopnet 1 file newtiles/icetop.png end tile ice id 21 solid 1 +slippery 1 +stopnet 1 file newtiles/ice.png end @@ -356,6 +363,7 @@ end tile land id 4 solid 1 +stopnet 1 file newtiles/metal.png end @@ -492,6 +500,7 @@ end tile castle id 4 solid 1 +stopnet 1 file newtiles/castle.png end @@ -577,6 +586,7 @@ end tile icebridge id 26 solid 2 +slippery 1 file newtiles/icebridge.png end diff --git a/defs.h b/defs.h index 81e16ac..ad5d268 100644 --- a/defs.h +++ b/defs.h @@ -239,6 +239,8 @@ enum ENDGAMETYPE { #define ICEACCEL 0.1 #define ICEDECCEL 0.03 +#define STICKYACCEL 0.02 + // blackcloud #define CLOUDGROWSPEED 25 // lower is faster #define CLOUDGROWAMT 0.01 // lower is faster @@ -909,6 +911,9 @@ typedef struct tiletype_s { int solid; int water; int spikes; + int sticky; + int stopnet; + int slippery; SDL_Surface *img[MAXTILEFRAMES]; int numframes; int animspeed; diff --git a/rc.c b/rc.c index b8740b4..9081aef 100644 --- a/rc.c +++ b/rc.c @@ -1894,7 +1894,7 @@ void jump(sprite_t *s, int dir) { s->jumpdir++; } else if ((tt->id == T_LEFT) && (s->jumpdir < 0)) { s->jumpdir--; - } else if (isice(tt->id) && !isinwater(s)) { + } else if (tt->slippery && !isinwater(s)) { s->jumpdir = s->xs / getspeed(s); //if (s->jumpdir > getspeed(s)) s->jumpdir -= getspeed(s); //if (s->jumpdir < -getspeed(s)) s->jumpdir += getspeed(s); @@ -2068,12 +2068,6 @@ void die(sprite_t *s) { if (s2->caughtby == s) { uncatch(s2); s2->angry = B_TRUE; - if (s2->id == P_SPIDER) { - // climb up! - s2->flies = B_TRUE; - s2->falling = B_FALSE; - s2->ys = -getspeed(s2); - } } } @@ -6850,7 +6844,7 @@ void dotileeffects(sprite_t *s) { } } finished = B_TRUE; - } else if (isice(tt->id)) { + } else if (tt->slippery) { if (isplayer(s) && !isinwater(s)) { if (globpowerup != PW_CLOCK) { if (!s->moved) { @@ -8177,8 +8171,6 @@ void drawnetting(sprite_t *s) { netsleft = s->netmax - s->netcaught; if (netsleft < 1) netsleft = 1; dis = (int)s->img->h / (int)(netsleft+1) + 1; - - for (y = dis; y < s->img->h; y += dis) { SDL_Rect endarea; @@ -8970,7 +8962,33 @@ void dogravity(sprite_t *s) { } } + // extend/withdraw player net if (s->netting) { + tiletype_t *tt; + double xx,yy; + double disfromtop,incamt; + int stop = B_FALSE; + + // check for net hitting bad tile. + xx = s->x + (s->netlen * s->netdir); + //incamt = (int)s->img->h / (int)(netsleft+1) + 1; + incamt = (int)s->img->h / (int)(s->netmax+1) + 1; + for (disfromtop = incamt; disfromtop < s->img->h; disfromtop += incamt) { + yy = s->y - s->img->h + disfromtop; + tt = gettileat(xx,yy,NULL,NULL); + if (tt->stopnet) { + stop = B_TRUE; + break; + } + } + + if (stop) { + // net immediately starts returning. + s->netspeed = -NETSPEED; + adjustx(s, F_WALK1); + } + + // net is still going if (s->powerup == PW_ACCORDION) { if (s->netspeed > 0) { s->netlen += s->netspeed; @@ -9383,9 +9401,14 @@ int movex(sprite_t *s,double amt,int onpurpose) { tt = gettileat(s->x, s->y, &tilex,&tiley); + if (amt > 0) amtdir = 1; else (amtdir = -1); + // walking on sticky tiles? + if (tt->sticky && onpurpose && !s->falling) { + amt /= 2; + } curx = s->x; cury = s->y; @@ -9424,11 +9447,12 @@ int movex(sprite_t *s,double amt,int onpurpose) { } /* get new position */ - if (isplayer(s) && isice(tt->id) && !isinwater(s) && onpurpose ) { + if (isplayer(s) && tt->slippery && !isinwater(s) && onpurpose ) { double newxs; + double accel = ICEACCEL; // change speed - newxs = s->xs + (s->dir*ICEACCEL); - s->xs += (s->dir*ICEACCEL); + newxs = s->xs + (s->dir*accel); + s->xs += (s->dir*accel); // don't get too fast! if (newxs > getspeed(s)) newxs = getspeed(s); if (newxs < -getspeed(s)) newxs = -getspeed(s); @@ -9460,9 +9484,10 @@ int movex(sprite_t *s,double amt,int onpurpose) { } if (domove) { - if (isplayer(s) && isice(tt->id) && !isinwater(s) && onpurpose) { + if (isplayer(s) && tt->slippery && !isinwater(s) && onpurpose) { + double accel = ICEACCEL; // change speed - s->xs += (s->dir*ICEACCEL); + s->xs += (s->dir*accel); // don't get too fast! if (s->xs > getspeed(s)) s->xs = getspeed(s); if (s->xs < -getspeed(s)) s->xs = -getspeed(s); @@ -9473,7 +9498,7 @@ int movex(sprite_t *s,double amt,int onpurpose) { s->x += amt; s->xs = amt; if (!onpurpose) { - if (isice(tt->id) && !isinwater(s)) { + if (tt->slippery && !isinwater(s)) { s->moved = MV_ICE; } else if (!isconveyor(tt->id)) { s->moved = MV_WALK; @@ -13389,6 +13414,13 @@ void uncatch(sprite_t *s) { } s->caughtby = NULL; s->caughtstate = B_FALSE; + + if (s->id == P_SPIDER) { + // climb up! + s->flies = B_TRUE; + s->falling = B_FALSE; + s->ys = -getspeed(s); + } } void makeinvuln(sprite_t *s) { @@ -15060,6 +15092,7 @@ int isbridge(int id) { } +/* int isice(int id) { switch (id) { case T_ICE: @@ -15069,6 +15102,8 @@ int isice(int id) { } return B_FALSE; } +*/ + int isconveyor(int id) { switch (id) { diff --git a/rc.h b/rc.h index bf16318..4a9f84b 100644 --- a/rc.h +++ b/rc.h @@ -146,7 +146,7 @@ int getpnum(sprite_t *s); sprite_t *getrandomaliveplayer(void); int isonplatform(double x, double y); int countbabies(sprite_t *s, int babytype); -int isice(int id); +//int isice(int id); int isconveyor(int id); int isbridge(int id); int savebmp(SDL_Surface *which); diff --git a/shared.c b/shared.c index e69777b..4c50d94 100644 --- a/shared.c +++ b/shared.c @@ -1181,6 +1181,9 @@ int loadtiletypes(char *filename) { t->animsync = B_FALSE; t->water = B_FALSE; t->spikes = B_FALSE; + t->sticky = B_FALSE; + t->slippery = B_FALSE; + t->stopnet = B_FALSE; t->solid = B_TRUE; for (i = 0; i < TILEW; i++) { t->lowness[i] = 0; @@ -1230,6 +1233,18 @@ int loadtiletypes(char *filename) { p = strtok(buf, " "); p = strtok(NULL, " "); t->solid = atoi(p); + } else if (strstr(buf, "sticky") == buf) { + p = strtok(buf, " "); + p = strtok(NULL, " "); + t->sticky = atoi(p); + } else if (strstr(buf, "stopnet") == buf) { + p = strtok(buf, " "); + p = strtok(NULL, " "); + t->stopnet = atoi(p); + } else if (strstr(buf, "slippery") == buf) { + p = strtok(buf, " "); + p = strtok(NULL, " "); + t->slippery = atoi(p); } else if (strstr(buf, "spikes") == buf) { p = strtok(buf, " "); p = strtok(NULL, " ");