diff --git a/data/levels/level102.dat b/data/levels/level102.dat index 0c68c2f..3154a6b 100644 --- a/data/levels/level102.dat +++ b/data/levels/level102.dat @@ -33,17 +33,17 @@ monsters 17 4 28 15 34 28 15 23 28 -6 6 27 49 13 21 49 32 8 49 11 11 49 33 17 -60 28 13 60 31 24 -60 11 16 60 7 8 -6 35 0 -6 17 3 +60 28 13 +60 11 16 +157 6 27 +157 17 6 +157 35 8 endmonsters exitdir 2 44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, diff --git a/data/levels/level104.dat b/data/levels/level104.dat index 7b2070e..08e74e2 100644 --- a/data/levels/level104.dat +++ b/data/levels/level104.dat @@ -46,12 +46,12 @@ monsters 15 16 5 15 14 5 6 5 11 -18 31 14 -18 26 5 -18 9 23 49 28 23 +157 9 23 +157 24 14 +157 31 5 124 24 5 -124 15 5 +124 17 5 endmonsters exitdir 1 44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, diff --git a/data/levels/level115.dat b/data/levels/level115.dat index 8c81be9..7644159 100644 --- a/data/levels/level115.dat +++ b/data/levels/level115.dat @@ -10,8 +10,6 @@ monsters 12 34 14 12 4 14 60 22 13 -124 15 19 -124 24 19 49 32 5 49 7 5 1 32 22 @@ -42,6 +40,8 @@ monsters 17 4 2 17 5 25 17 34 25 +157 24 19 +157 15 16 endmonsters exitdir 1 44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44, diff --git a/data/levels/level41.dat b/data/levels/level41.dat index 28200d5..15d5e44 100644 --- a/data/levels/level41.dat +++ b/data/levels/level41.dat @@ -28,10 +28,11 @@ monsters 15 33 19 15 24 8 15 23 8 -132 19 6 312 112 312 442 +132 19 6 312 112 312 112 312 442 15 18 5 15 20 5 16 19 5 +157 35 6 endmonsters exitdir 1 61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,61, diff --git a/data/levels/level418.dat b/data/levels/level418.dat index ef305d7..befc25f 100644 --- a/data/levels/level418.dat +++ b/data/levels/level418.dat @@ -7,14 +7,11 @@ monsters 0 6 28 134 33 28 23 20 4 -12 31 20 12 21 16 12 24 8 -12 6 12 12 12 24 6 28 2 6 9 3 -49 21 28 16 14 20 16 16 20 16 18 20 @@ -52,6 +49,10 @@ monsters 16 31 4 16 30 4 16 29 4 +157 22 28 +157 17 28 +12 31 20 +12 6 12 endmonsters exitdir 1 61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61, diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 312eab6..738c6c9 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,12 +4,11 @@ hurryup 30 help endhelp monsters -0 5 23 -134 35 22 -23 12 19 +0 35 19 +134 36 19 +23 38 19 6 20 10 -133 18 19 -133 26 19 +157 3 18 endmonsters exitdir 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,0,0,0,0,0,0,0,0,4, @@ -31,13 +30,13 @@ exitdir 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,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,0,0,0,0,0,0,0,0,0,0,0,4, -4,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,17,0,0,0,0,0,17,0,0,0,0,0,17,0,0,0,0,0,17,0,0,0,0,17,0,0,0,0,0,0,0,4, -4,0,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,1,1,1,1,1,1,1,1,1,1,4, -4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,1,1,1,1,1,4, +4,1,1,1,1,1,1,1,1,1,0,0,0,0,0,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,1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,1,1,1,1,1,1,4, +4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4, +4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4, +4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4, +4,0,0,0,1,1,1,1,1,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4, +4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4, 4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,0,0,0,0,0,4, 4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,0,0,0,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,1, diff --git a/data/sprites/frog.png b/data/sprites/frog.png new file mode 100644 index 0000000..160d623 Binary files /dev/null and b/data/sprites/frog.png differ diff --git a/data/sprites/frogcaught.png b/data/sprites/frogcaught.png new file mode 100644 index 0000000..15d0f0d Binary files /dev/null and b/data/sprites/frogcaught.png differ diff --git a/data/sprites/frogdead.png b/data/sprites/frogdead.png new file mode 100644 index 0000000..3d303ce Binary files /dev/null and b/data/sprites/frogdead.png differ diff --git a/data/sprites/frogfall.png b/data/sprites/frogfall.png new file mode 100644 index 0000000..dcf9ad6 Binary files /dev/null and b/data/sprites/frogfall.png differ diff --git a/data/sprites/frogjump.png b/data/sprites/frogjump.png new file mode 100644 index 0000000..28c42c9 Binary files /dev/null and b/data/sprites/frogjump.png differ diff --git a/defs.h b/defs.h index e98c26d..22a28d6 100644 --- a/defs.h +++ b/defs.h @@ -193,6 +193,10 @@ #define ICESPEED 2 // how fast a level turns to ice #define MONJUMPSPEED 5 // how high monsters jump +#define FROGJUMPSPEED1 3 // how high frogs jump +#define FROGJUMPSPEED2 6 // how high frogs jump + +#define FROGPAUSE 20 // how long frog waits in between jumps #define BOMBSHAKETIME 100 // time for screen will shake after a bomb #define RATSHAKETIME 50 // shake time when king rat is stunned @@ -301,6 +305,10 @@ #define B_TRUE -1 #define B_FALSE 0 +// reasons for not being able to move +#define NM_SIDE -1 +#define NM_BELOW -2 + // fruit types #define FT_FRUIT 1 #define FT_PERM 2 @@ -408,7 +416,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 157 +#define MAXPTYPES 158 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -571,6 +579,7 @@ #define P_PILL 154 #define P_RAYGUN 155 #define P_RAYGUNBULLET 156 +#define P_FROG 157 #define FLY_FLYTIME 150 diff --git a/rc.c b/rc.c index f92f512..7a76445 100644 --- a/rc.c +++ b/rc.c @@ -1437,6 +1437,22 @@ void jump(sprite_t *s, int dir) { // jump right away s->jumpspeed = MONJUMPSPEED; // will be changed later s->jumping = 1; + } else if (s->id == P_FROG) { + sprite_t *whoabove; + whoabove = isplayerabove(s); + + if (whoabove) { + double ydis; + ydis = abs(s->y - whoabove->y); + if (ydis <= (TILEH*5)) { + s->jumpspeed = MONJUMPSPEED; // normal jump + } else { + s->jumpspeed = FROGJUMPSPEED2; // very high + } + } else { + s->jumpspeed = FROGJUMPSPEED1; // ie not high enough for most platforms + } + s->jumping = 1; } else { // delay then jump s->jumptimer = getjumpdelay(s->id); @@ -2512,7 +2528,22 @@ int movesprite(sprite_t *s) { } } else if (s->jumping) { if (s->id != P_KINGRAT) { - movex(s, s->jumpdir*getspeed(s), B_TRUE); + int rv; + rv = movex(s, s->jumpdir*getspeed(s), B_TRUE); + // frogs bounce off walls + /* + if (s->id == P_FROG) { + if (rv == NM_SIDE) { + if (!isongroundpoint(s,s->x,s->y - (TILEH/2))) { + if (!isroofabove(s)) { + s->dir = -s->dir; + s->jumpdir = -s->jumpdir; + } + } + } + } + */ + } return B_FALSE; } @@ -2657,6 +2688,11 @@ int movesprite(sprite_t *s) { } newsp = addsprite(s->timer3, s->x,s->y,s->name ); + + if (s->timer3 == P_FROG) { + // so all frogs don't jump at once. + newsp->timer3 = (rand() % FROGPAUSE); + } // is it a boss? if so update boss pointer switch (s->timer3) { @@ -3191,6 +3227,74 @@ int movesprite(sprite_t *s) { movex(s, s->jumpdir*getspeed(s), B_TRUE); } } + } else if (s->id == P_FROG) { + if (isinwater(s)) { + // move like a fish + double absxs,absys; + + s->flies = B_TRUE; + s->falling = B_FALSE; + + if ((s->xs == -99) || (s->ys == -99)) { + s->xs = getspeed(s) * s->dir; + s->ys = getspeed(s); + } + + if (s->xs > 0) absxs = 1; + else absxs = -1; + + if (s->ys > 0) absys = 1; + else absys = -1; + + /* can we move? */ + tt = gettileat(s->x + (s->dir * ((s->img->w/2)+3)) + s->xs , s->y-(s->img->h/2),NULL,NULL); + if ((tt->solid) || (tt->spikes )) { + /* turn */ + s->xs = -s->xs; + } + + tt = gettileat(s->x, s->y-(s->img->h/2) + s->ys,NULL,NULL); + if ((tt->solid) || (tt->spikes) ) { + /* turn */ + s->ys = -s->ys; + } else if (!tt->water) { + s->flies = B_FALSE; + // exit water + jump(s, s->dir); + // force big jump + s->jumpspeed = FROGJUMPSPEED2; + + } + /* move */ + s->x += s->xs; + s->y += s->ys; + s->dir = absxs; + s->moved = MV_WALK; + } else { + // for if we get back in the water + s->xs = -99; + s->ys = -99; + s->flies = B_FALSE; + + // timer3 used for pause inbetween jump + if ((!s->falling) && (!s->jumping)) { + if (s->timer3) { + s->timer3--; + } else { + // jump forwards + jump(s, s->dir); + s->timer3 = FROGPAUSE; + } + } else { // falling + int rv; + // move forwards + rv = movex(s, s->dir*getspeed(s), B_TRUE); + if (rv == NM_SIDE) { // bounce off walls + /* if we couldn't move (hit a wall), turn */ + s->dir = -s->dir; + } + } + } } else if (s->id == P_SLUG) { if (!s->falling) { int move = B_FALSE; @@ -3261,10 +3365,8 @@ int movesprite(sprite_t *s) { } else { ydiff = 999; } - if (isplayerabove(s) && (ydiff >= (TILEH*4)) && (ydiff <= (TILEH*8))) { // player between 4 and 8 tiles above - if (xdiff <= (TILEW*8)) { // if closeish horizontally /* jump up */ jump(s, 0); @@ -5686,6 +5788,9 @@ double getspeed(sprite_t *s ) { if (s->jumping) { speed = 8; // very fast jumping } + } else if (id == P_FROG) { + if (s->angry) speed = 1.5; + else speed = 1; } else if (id == P_RAT) { if (s->angry) speed = 1.5; else speed = 1; @@ -5713,7 +5818,7 @@ double getspeed(sprite_t *s ) { speed = PLATFORM_MAXSPEED; } - if (isinwater(s) && (s->id != P_FISH)) { + if (isinwater(s) && (s->id != P_FISH) && (s->id != P_FROG)) { if (!s->hasmask) { speed /= 2; } @@ -7377,11 +7482,11 @@ int movex(sprite_t *s,double amt,int onpurpose) { tt2 = gettileat(newx,newy,&newtilex,&newtiley); if (tt2->solid == S_SOLID) { s->xs = 0; - return B_TRUE; + return NM_SIDE; } if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) { s->xs = 0; - return B_TRUE; + return NM_SIDE; } } @@ -7392,11 +7497,11 @@ int movex(sprite_t *s,double amt,int onpurpose) { tt2 = gettileat(newx,newy,&newtilex,&newtiley); if (tt2->solid == S_SOLID) { //s->xs = 0; - return B_TRUE; + return NM_BELOW; } if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) { //s->xs = 0; - return B_TRUE; + return NM_BELOW; } } @@ -7427,7 +7532,7 @@ int movex(sprite_t *s,double amt,int onpurpose) { domove = B_FALSE; if (tt2->solid == S_SOLID) { // s->xs = 0; - return B_TRUE; + return NM_SIDE; } else if ((tt2->solid == S_SLOPE) && candoslopes(s->id)) { /* we can move, but need to adjust our height */ domove = B_TRUE; diff --git a/shared.c b/shared.c index 7f5b286..cf0f760 100644 --- a/shared.c +++ b/shared.c @@ -762,8 +762,14 @@ void setdefaults(sprite_t *s) { s->timer1 = 0; } s->timer2 = 0; - s->timer3 = 0; + if (s->id == P_FROG) { + // so all frogs don't jump at the same time + s->timer3 = rand() % FROGPAUSE; + } else { + s->timer3 = 0; + } s->timer4 = 0; + s->dbltimer = -1; s->dropping = 0; s->dropx = -1; @@ -1330,6 +1336,14 @@ int loadimagesets(void) { /* next 3 are auto generated */ imageset[P_FLY].numimages = 8; + loadspriteimage(P_FROG,F_WALK1, "sprites/frog.png"); + loadspriteimage(P_FROG,F_JUMP, "sprites/frogjump.png"); + loadspriteimage(P_FROG,F_FALL, "sprites/frogfall.png"); + loadspriteimage(P_FROG,F_CAUGHT, "sprites/frogcaught.png"); + loadspriteimage(P_FROG,F_DEAD, "sprites/frogdead.png"); + /* next 3 are auto generated */ + imageset[P_FROG].numimages = 8; + loadspriteimage(P_SPIDER,F_WALK1, "sprites/newspider.png"); loadspriteimage(P_SPIDER,F_JUMP, "sprites/newspiderjump.png"); loadspriteimage(P_SPIDER,F_FALL, "sprites/newspiderfall.png"); @@ -1929,10 +1943,12 @@ void drawsprite(sprite_t *s) { SDL_Rect area; int frame = 0; +#ifndef __EDITOR if (isplayer(s) && s->lives < 0) { // permenantly dead - don't draw return; } +#endif // don't show caught mosnters in gunner mode if (!isplayer(s) && (s->caughtby) ) { @@ -3025,6 +3041,7 @@ int ismonster(int id) { case P_SNAIL: case P_SLUG: case P_FISH: + case P_FROG: return MT_MONSTER; case P_BLACKCLOUD: case P_KINGRAT: @@ -3519,6 +3536,8 @@ void setfruitinfo(void) { setinfo(P_SPIDER, "Spider", "Spiders will lurk quietly on the ceiling, crawling back and forth. If they notice a player nearby however they will swiftly pounce down onto their prey!", "spider.png"); + setinfo(P_FROG, "Frog", "Green frogs will continually bounce around, making them more difficult to catch.", "frog.png"); + setinfo(P_SNAKE, "Snake", "The snake moves in a similar fashion to the rat with one important exception - upon seeing a player they will spit a glob of deadly venom at them!", "snake.png"); setinfo(P_FLY, "Fly", "Annoying pests at the best of times, flies pose additional danger to dwarves. They fly around more erratically than bees and after landing can scurry quickly back and forth.", "fly.png"); diff --git a/website/img/frog.png b/website/img/frog.png new file mode 100644 index 0000000..95ceba3 Binary files /dev/null and b/website/img/frog.png differ diff --git a/website/info.html b/website/info.html index 13049fa..a1b5be9 100644 --- a/website/info.html +++ b/website/info.html @@ -14,6 +14,7 @@