diff --git a/data/levels/level103.dat b/data/levels/level103.dat index c18669e..3b33a49 100644 --- a/data/levels/level103.dat +++ b/data/levels/level103.dat @@ -7,7 +7,6 @@ monsters 0 2 13 134 37 13 23 17 26 -60 18 6 60 4 27 60 34 21 18 27 10 @@ -26,6 +25,7 @@ monsters 17 2 28 17 37 28 49 21 26 +157 17 6 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/level114.dat b/data/levels/level114.dat index ff690df..ebba0d8 100644 --- a/data/levels/level114.dat +++ b/data/levels/level114.dat @@ -2,6 +2,7 @@ bgfile beach4.png bg 0 hurryup 30 help +Beware - ants will grow after eating! endhelp monsters 0 4 4 @@ -9,7 +10,6 @@ monsters 49 30 18 49 16 18 1 36 1 -1 26 7 1 3 1 15 32 22 15 30 22 @@ -50,6 +50,8 @@ monsters 124 26 26 124 31 26 15 18 22 +158 26 7 +14 9 4 endmonsters exitdir 2 52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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/level404.dat b/data/levels/level404.dat index a9e141a..ebaea29 100644 --- a/data/levels/level404.dat +++ b/data/levels/level404.dat @@ -10,7 +10,6 @@ monsters 6 23 5 1 25 20 18 38 10 -1 8 5 124 27 11 124 34 7 1 6 13 @@ -30,7 +29,9 @@ monsters 16 25 1 16 22 1 133 32 19 -132 12 26 200 432 200 432 200 432 291 246 +132 12 26 200 432 200 432 200 432 200 432 291 246 +158 9 5 +158 15 5 endmonsters exitdir -1 57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57, diff --git a/data/levels/level406.dat b/data/levels/level406.dat index f81c5ed..3acb624 100644 --- a/data/levels/level406.dat +++ b/data/levels/level406.dat @@ -10,10 +10,7 @@ monsters 60 26 25 60 16 27 60 5 26 -133 30 4 133 33 15 -18 25 16 -49 16 9 7 26 8 15 26 5 15 27 5 @@ -34,6 +31,10 @@ monsters 16 28 16 15 4 21 15 11 21 +158 21 16 +158 31 16 +158 32 5 +158 16 9 endmonsters exitdir -1 57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,56,84,84,84,84,84,84,56, diff --git a/data/levels/level413.dat b/data/levels/level413.dat index 4308ccb..3a09e3f 100644 --- a/data/levels/level413.dat +++ b/data/levels/level413.dat @@ -7,10 +7,8 @@ monsters 0 5 6 134 34 4 23 16 18 -132 37 5 600 96 600 96 600 96 600 96 600 444 -132 2 27 40 448 40 448 40 448 40 448 40 121 -49 13 22 -49 26 18 +132 37 5 600 96 600 96 600 96 600 96 600 96 600 444 +132 2 27 40 448 40 448 40 448 40 448 40 448 40 121 49 21 26 133 28 22 133 10 26 @@ -58,6 +56,8 @@ monsters 15 14 26 15 6 26 16 7 26 +158 26 18 +49 13 22 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/level419.dat b/data/levels/level419.dat index 61481cd..3e945f5 100644 --- a/data/levels/level419.dat +++ b/data/levels/level419.dat @@ -9,8 +9,6 @@ monsters 23 22 14 12 11 14 12 27 14 -12 18 4 -12 2 4 12 36 24 12 21 24 133 8 23 @@ -35,6 +33,9 @@ monsters 15 9 24 16 16 4 16 18 4 +158 20 4 +158 12 4 +158 3 4 endmonsters exitdir -1 74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74, diff --git a/data/levels/level420.dat b/data/levels/level420.dat index d8c63ad..4b00622 100644 --- a/data/levels/level420.dat +++ b/data/levels/level420.dat @@ -7,20 +7,17 @@ monsters 0 6 27 134 12 27 23 30 8 -49 14 6 133 2 14 133 38 3 133 33 14 60 21 14 49 27 19 -132 37 24 600 400 340 400 -18 31 8 +132 37 24 600 400 600 400 340 400 18 12 22 17 21 19 17 32 19 17 10 22 16 29 8 -16 31 8 16 11 6 16 4 6 16 5 6 @@ -30,6 +27,10 @@ monsters 15 16 15 15 6 22 17 23 15 +158 6 6 +158 23 19 +158 32 8 +16 31 8 endmonsters exitdir -1 57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57, diff --git a/data/levels/level421.dat b/data/levels/level421.dat index 6d3b1b1..d7c77b6 100644 --- a/data/levels/level421.dat +++ b/data/levels/level421.dat @@ -11,7 +11,6 @@ monsters 18 8 20 18 28 16 133 32 12 -133 8 12 15 35 12 15 27 12 15 12 12 @@ -28,6 +27,9 @@ monsters 18 11 16 18 31 20 18 5 24 +158 24 12 +158 11 12 +133 7 8 endmonsters exitdir -1 57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57, diff --git a/data/levels/level601.dat b/data/levels/level601.dat index f4e7202..64a7a9d 100644 --- a/data/levels/level601.dat +++ b/data/levels/level601.dat @@ -10,11 +10,24 @@ monsters 1 25 8 1 15 4 1 8 12 -18 29 12 -18 11 8 -18 33 4 133 1 8 133 20 28 +158 29 12 +158 11 8 +158 33 4 +15 22 23 +15 17 23 +16 35 23 +16 4 23 +16 12 12 +16 31 8 +16 9 4 +16 24 4 +17 23 12 +17 22 12 +17 17 8 +15 6 8 +15 30 4 endmonsters exitdir -2 33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33, diff --git a/data/levels/level608.dat b/data/levels/level608.dat index b31de57..ca4be97 100644 --- a/data/levels/level608.dat +++ b/data/levels/level608.dat @@ -7,14 +7,14 @@ monsters 0 17 28 134 20 28 12 17 15 -49 32 8 -49 6 26 -18 32 19 -18 10 20 133 4 16 133 30 11 49 9 9 49 29 24 +158 32 19 +158 10 20 +158 6 26 +49 30 8 endmonsters exitdir -2 33,0,0,0,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,0,0,0,33, diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 8c7f714..6f1bbd9 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,15 +4,22 @@ hurryup 30 help endhelp monsters -0 35 19 -134 36 19 -23 38 19 +0 29 13 +134 33 13 +23 36 13 6 20 10 -1 13 19 -1 23 19 -157 4 27 -157 7 23 -157 1 19 +158 2 27 +16 15 27 +16 19 24 +16 22 21 +16 5 21 +158 3 18 +16 5 18 +16 6 18 +16 7 18 +16 9 18 +16 11 18 +15 15 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, @@ -29,20 +36,20 @@ exitdir 1 4,0,0,0,0,0,0,0,0,0,0,0,0,1,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,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,1,1,1,1,1,1,1,1,1,1,1,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,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,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,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,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,0,0,0,0,0,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,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,1,1,1,1,1,1,1,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,1,1,1,1,0,0,0,0,0,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,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,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,1,0,0,0,0,0,0,0,0,0,0,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,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,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,1,0,0,0,0,0,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,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,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,1,0,0,0,0,0,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, 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 diff --git a/data/map.dat b/data/map.dat index d946d38..688dde3 100644 --- a/data/map.dat +++ b/data/map.dat @@ -42,11 +42,11 @@ 407,level407.dat,The Fly 404,level404.dat,Off Cuts 408,level408.dat,Around and Around -419,level419.dat,Snakes and Ladders 403,level403.dat,Delayed Release 405,level405.dat,Pitfalls 413,level413.dat,Three Parts 418,level418.dat,Grilled +419,level419.dat,Snakes and Ladders 415,level415.dat,Half Way 422,level422.dat,Hanging Gardens 421,level421.dat,Upwards and Onwards diff --git a/data/sounds/chomp.wav b/data/sounds/chomp.wav new file mode 100644 index 0000000..af830d7 Binary files /dev/null and b/data/sounds/chomp.wav differ diff --git a/data/sounds/growl.wav b/data/sounds/growl.wav new file mode 100644 index 0000000..bcd0102 Binary files /dev/null and b/data/sounds/growl.wav differ diff --git a/data/sounds/hiss.wav b/data/sounds/hiss.wav index 908536a..4fc84eb 100644 Binary files a/data/sounds/hiss.wav and b/data/sounds/hiss.wav differ diff --git a/data/sprites/ant1.png b/data/sprites/ant1.png new file mode 100644 index 0000000..00f56d9 Binary files /dev/null and b/data/sprites/ant1.png differ diff --git a/data/sprites/ant1caught.png b/data/sprites/ant1caught.png new file mode 100644 index 0000000..bc49286 Binary files /dev/null and b/data/sprites/ant1caught.png differ diff --git a/data/sprites/ant1dead.png b/data/sprites/ant1dead.png new file mode 100644 index 0000000..2ba5a58 Binary files /dev/null and b/data/sprites/ant1dead.png differ diff --git a/data/sprites/ant1jump.png b/data/sprites/ant1jump.png new file mode 100644 index 0000000..efcc88d Binary files /dev/null and b/data/sprites/ant1jump.png differ diff --git a/data/sprites/ant2.png b/data/sprites/ant2.png new file mode 100644 index 0000000..1e941ec Binary files /dev/null and b/data/sprites/ant2.png differ diff --git a/data/sprites/ant2caught.png b/data/sprites/ant2caught.png new file mode 100644 index 0000000..dd3aa80 Binary files /dev/null and b/data/sprites/ant2caught.png differ diff --git a/data/sprites/ant2dead.png b/data/sprites/ant2dead.png new file mode 100644 index 0000000..fba5088 Binary files /dev/null and b/data/sprites/ant2dead.png differ diff --git a/data/sprites/ant2jump.png b/data/sprites/ant2jump.png new file mode 100644 index 0000000..1419158 Binary files /dev/null and b/data/sprites/ant2jump.png differ diff --git a/data/sprites/ant3.png b/data/sprites/ant3.png new file mode 100644 index 0000000..b931615 Binary files /dev/null and b/data/sprites/ant3.png differ diff --git a/data/sprites/ant3caught.png b/data/sprites/ant3caught.png new file mode 100644 index 0000000..1c71776 Binary files /dev/null and b/data/sprites/ant3caught.png differ diff --git a/data/sprites/ant3dead.png b/data/sprites/ant3dead.png new file mode 100644 index 0000000..6e3268a Binary files /dev/null and b/data/sprites/ant3dead.png differ diff --git a/data/sprites/ant3jump.png b/data/sprites/ant3jump.png new file mode 100644 index 0000000..51ecb29 Binary files /dev/null and b/data/sprites/ant3jump.png differ diff --git a/data/sprites/fire1.png b/data/sprites/fire1.png new file mode 100644 index 0000000..6db239e Binary files /dev/null and b/data/sprites/fire1.png differ diff --git a/data/sprites/fire2.png b/data/sprites/fire2.png new file mode 100644 index 0000000..45e2082 Binary files /dev/null and b/data/sprites/fire2.png differ diff --git a/data/sprites/spit2.png b/data/sprites/spit2.png new file mode 100644 index 0000000..0ed2f4c Binary files /dev/null and b/data/sprites/spit2.png differ diff --git a/defs.h b/defs.h index 22a28d6..aeee44b 100644 --- a/defs.h +++ b/defs.h @@ -329,7 +329,7 @@ /* enums */ /* sounds */ -#define MAXFX 61 +#define MAXFX 63 #define FX_SHOOT 0 #define FX_SLAM 1 #define FX_KILL 2 @@ -391,6 +391,8 @@ #define FX_CAMERA 58 #define FX_LASER 59 #define FX_HISS 60 +#define FX_CHOMP 61 +#define FX_GROWL 62 // card suits #define CS_HEART 1 @@ -416,7 +418,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 158 +#define MAXPTYPES 162 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -580,6 +582,10 @@ #define P_RAYGUN 155 #define P_RAYGUNBULLET 156 #define P_FROG 157 +#define P_ANT1 158 +#define P_ANT2 159 +#define P_ANT3 160 +#define P_FIREBALL 161 #define FLY_FLYTIME 150 diff --git a/rc.c b/rc.c index f2c99be..6c485fd 100644 --- a/rc.c +++ b/rc.c @@ -2144,7 +2144,6 @@ void checkcollide(sprite_t *s) { die(s); } } else { -printf("dead!\n"); die(s); } } else { @@ -2207,6 +2206,46 @@ printf("dead!\n"); s2->willbecome = P_DIAMOND; } } + } else if ((s->id == P_ANT1) || (s->id == P_ANT2) || (s->id == P_ANT3)) { + int isfr; + // eat fruits + isfr = isfruit(s2->id); + if (isfr) { + int fruitamt; + // eat the fruit + s2->dead = D_FINAL; + playfx(FX_CHOMP); + puffin(-1, s2->x, s2->y, "nothing", 0); + // increase health + switch (isfr) { + case FT_FRUIT: + case FT_PERM: + case FT_TEMP: + fruitamt = 5; + break; + case FT_GEM: + default: + fruitamt = 1; + break; + } + s->timer1 += fruitamt; + if (s->timer1 >= 5) { + s->timer1 = 0; + playfx(FX_GROWL); + // grow + if (s->id == P_ANT1) { + s->id = P_ANT2; + } else if (s->id == P_ANT2) { + s->id = P_ANT3; + } else if (s->id == P_ANT3) { + sprite_t *newsp; + // spawn a new ant + newsp = addsprite(P_ANT1, s2->x, s2->y, "spawned_ant"); + puffin(-1, s->x+(s->dir*TILEH), s->y, "nothing", 0); + newsp->dir = -s->dir; + } + } + } } else if (inintro() && (s->id == P_RAT)) { // collect fruits if (isfruit(s2->id)) { @@ -3147,6 +3186,332 @@ int movesprite(sprite_t *s) { } } } // end if inintro + } else if (s->id == P_ANT1) { // worker ant - moves like a rat + if (!s->falling) { + int move = B_FALSE; + int xdiff ,absxdiff; + tiletype_t *tunder; + + /* distance to closest player */ + xdiff = getxdisttoplayer(s, NULL); + absxdiff = abs(xdiff); + + // tile in front and below + tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL); + // tile below + tunder = gettileat(s->x ,s->y + 1,NULL,NULL); + /* if there's a hole in front of us and below*/ + if (tt->solid == S_NOTSOLID) { + // we're on a slope + if (tunder->solid == S_SLOPE) { + move = B_TRUE; + } else { + if (s->angry || boss) { + if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { + /* if player is below, fall off */ + if (xdiff <= (TILEW*8)) { + move = B_TRUE; + } + } else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) { + if (globpowerup != PW_CAMERA) { + /* if player is at same level and close, jump */ + if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { + jump(s,D_RIGHT); + } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { + jump(s,D_LEFT); + } + } + } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { + // if near bottom of the screen and can fall through... + move = B_TRUE; + } + } + } + } else { + move = B_TRUE; + } + + if (globpowerup == PW_CAMERA) { + move = B_TRUE; + } + + /* either move or turn around */ + if (move) { + rv = movex(s, s->dir*getspeed(s), B_TRUE); + if (rv) { + /* if we couldn't move (hit a wall), turn */ + s->dir = -s->dir; + } + } else { + s->dir = -s->dir; + } + + if (s->angry) { + if ((!s->jumping) && (!s->jumptimer)) { + /* if player is above us, jump */ + if ( (player && (!player->dead) && (player->y < s->y)) || + (player2 && (!player2->dead) && (player2->y < s->y))) { + if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { + /* jump right */ + jump(s, 1); + } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { + /* jump left */ + jump(s, -1); + } else if ((player && (s->y - player->y <= (TILEH*6))) || + (player2 && (s->y - player2->y <= (TILEH*6)))) { + if ((xdiff >= 0) && (xdiff < (TILEW*2))) { + /* jump up */ + jump(s, 0); + } else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) { + /* jump up */ + jump(s, 0); + } + } else { + /* jump whichever way we're facing */ + /* + s->jumpdir = s->dir; + s->jumping = 1; + s->jumpspeed = 5; + */ + } + } + } + } + } else { // falling + tiletype_t *tunder, *t2under; + + // tile below + tunder = gettileat(s->x ,s->y,NULL,NULL); + t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL); + if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) { + movex(s, s->dir*getspeed(s), B_TRUE); + } else if (s->jumpdir) { + movex(s, s->jumpdir*getspeed(s), B_TRUE); + } + } + } else if (s->id == P_ANT2) { // soldier ant - moves like a tick + if (!s->falling) { + int move = B_FALSE; + int xdiff, absxdiff; + + /* distance to player */ + xdiff = getxdisttoplayer(s, NULL); + absxdiff = abs(xdiff); + + tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL); + /* if there's a hole in front of us */ + if (tt->solid == S_NOTSOLID) { + double ycutoff = s->y + (TILEH/2); + if ((player && (player->y >= ycutoff)) || (player2 && (player2->y >= ycutoff ))) { + /* if player is below and nearby, fall off */ + if (xdiff <= (TILEW*16)) { + move = B_TRUE; + } + } else if ((player && (player->y == s->y)) || (player2 && (player2->y == s->y ))) { + if (globpowerup != PW_CAMERA) { + /* if player is at same level and close, jump */ + if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { + jump(s,D_RIGHT); + } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { + jump(s,D_LEFT); + } + } + } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { + // if near bottom of the screen and can fall through... + move = B_TRUE; + } + } else { + move = B_TRUE; + } + + if (globpowerup == PW_CAMERA) { + move = B_TRUE; + } + + /* either move or turn around */ + if (move) { + rv = movex(s, s->dir*getspeed(s), B_TRUE); + if (rv) { + /* if we couldn't move (hit a wall), turn */ + s->dir = -s->dir; + } + } else { + s->dir = -s->dir; + } + + + + /* moves like an angry rat all the time */ + if (globpowerup != PW_CAMERA) { + if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) { + sprite_t *abovep; + /* if player is above us...*/ + abovep = isplayerabove(s); + if (abovep) { + if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right + /* jump right */ + jump(s, D_RIGHT); + } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { // if 2-3 tiles left + /* jump left */ + jump(s, D_LEFT); + } else if (s->y - abovep->y <= (TILEH*6)) { // player less than 6 tiles above + if ((xdiff >= 0) && (xdiff < (TILEW*4))) { // ... and within 4 tiles + /* jump up */ + jump(s, 0); + } else if ((xdiff <= 0) && (xdiff > -(TILEW*4))) { // ... and within 4 tiles + /* jump up */ + jump(s, 0); + } + } + } + } + } + } else { // falling + movex(s, s->jumpdir*getspeed(s), B_TRUE); + } + } else if (s->id == P_ANT3) { // moves like a snake + /* timer1 loopsfrom 0 - 19 + + if timer2 is 0, we can shoot. if it is 1, we can't. + + */ + + // inc shooting timer + if (s->timer1) { + s->timer1--; + if (s->timer1 == 0) { + } + } + if (!s->falling) { + int move = B_FALSE; + int xdiff, absxdiff,ydiff; + + /* distance to player */ + xdiff = getxdisttoplayer(s, NULL); + absxdiff = abs(xdiff); + + tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL); + /* if there's a hole in front of us */ + if (tt->solid == S_NOTSOLID) { + if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) { + /* if player is below, fall off */ + if (xdiff <= (TILEW*8)) { + move = B_TRUE; + } + } else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) { + if (s->angry) { + /* if player is at same level and close, jump */ + if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) { + jump(s,D_RIGHT); + } else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) { + jump(s,D_LEFT); + } + } + } else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) { + // if near bottom of the screen and can fall through... + move = B_TRUE; + } + } else { + move = B_TRUE; + } + + if (globpowerup == PW_CAMERA) { + move = B_TRUE; + } + + /* shoot */ + ydiff = getydisttoplayer(s); + ydiff = abs(ydiff); + + // if there's a player close up/down... + if (ydiff <= (TILEH*4)) { + sprite_t *ss; + sprite_t *closeplayer; + int shoot = B_FALSE; + if (player && (s->y - player->y <= (TILEH*12)) ) { + closeplayer = player; + } else if (player2 && (s->y - player2->y <= (TILEH*12))) { + closeplayer = player2; + } else { + closeplayer = NULL; + } + + if (closeplayer) { + if (s->bullet == NULL) { // if we don't already have a bullet + // if we are facing the player + if ( (closeplayer->x < s->x) && (s->dir == D_LEFT) ) { + shoot = B_TRUE; + } else if ( (closeplayer->x > s->x) && (s->dir == D_RIGHT) ) { + shoot = B_TRUE; + } + } + if (globpowerup == PW_CAMERA) shoot = B_FALSE; + if (shoot) { + // if our shooting timer is okay + if (s->timer1 == 0) { + playfx(FX_METEOR); + ss = addsprite(P_FIREBALL,s->x,s->y - s->img->h/2,"spit" ); + ss->ys = 0; + ss->xs = s->dir * (getspeed(s)*2); + ss->dir = s->dir; + ss->owner = s; + + s->bullet = ss; + + // start timer for shooting again + s->timer1 = 200; + } + } + } + } + + /* either move or turn around */ + if (move) { + rv = movex(s, s->dir*getspeed(s), B_TRUE); + if (rv) { + /* if we couldn't move (hit a wall), turn */ + s->dir = -s->dir; + } + } else { + s->dir = -s->dir; + } + + + if (globpowerup != PW_CAMERA) { + if (playersalive() && (!s->jumping) && (!s->jumptimer)) { + /* if player is above us, jump */ + if ( (player && (!player->dead) && (player->y < s->y)) || + (player2 && (!player2->dead) && (player2->y < s->y))) { + if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { + /* jump right */ + jump(s, 1); + } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { + /* jump left */ + jump(s, -1); + } else if ((player && (s->y - player->y <= (TILEH*6))) || + (player2 && (s->y - player2->y <= (TILEH*6)))) { + if ((xdiff >= 0) && (xdiff < (TILEW*2))) { + /* jump up */ + jump(s, 0); + } else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) { + /* jump up */ + jump(s, 0); + } + } else { + /* jump whichever way we're facing */ + /* + s->jumpdir = s->dir; + s->jumping = 1; + s->jumpspeed = 5; + */ + } + } + } + } + } else { // falling + movex(s, s->jumpdir*getspeed(s), B_TRUE); + } + } else if (s->id == P_SNAIL) { if (!s->falling) { int move = B_FALSE; @@ -4035,7 +4400,6 @@ printf("setting target to y = %d\n",ss->timer2); } } else if (s->id == P_TICK) { - if (!s->falling) { int move = B_FALSE; int xdiff, absxdiff; @@ -4691,7 +5055,7 @@ printf("setting target to y = %d\n",ss->timer2); } } } - } else if (s->id == P_SPIT) { + } else if ((s->id == P_SPIT) || (s->id == P_FIREBALL)) { if (movex(s, s->xs, B_TRUE)) { s->dead = D_FINAL; } @@ -5800,6 +6164,15 @@ double getspeed(sprite_t *s ) { } else if (id == P_RAT) { if (s->angry) speed = 1.5; else speed = 1; + } else if (id == P_ANT1) { + if (s->angry) speed = 1.5; + else speed = 1; + } else if (id == P_ANT2) { + if (s->angry) speed = 2.5; + else speed = 2; + } else if (id == P_ANT3) { + if (s->angry) speed = 2.5; + else speed = 2; } else if (id == P_SNAKE) { if (s->angry) speed = 1.5; else speed = 1; @@ -8457,6 +8830,8 @@ int initsound(void) { loadfx(FX_CAMERA, "camera.wav"); loadfx(FX_LASER, "laser.wav"); loadfx(FX_HISS, "hiss.wav"); + loadfx(FX_CHOMP, "chomp.wav"); + loadfx(FX_GROWL, "growl.wav"); // load sound effects for (i = 0; i < MAXFX; i++) { @@ -8985,7 +9360,6 @@ void moveallsprites(void) { void checkcollideall(void) { sprite_t *s; - /* check collisions for player and effects */ for (s = sprite ; s ; s = s->next) { if (isplayer(s)) { @@ -9004,6 +9378,8 @@ void checkcollideall(void) { checkcollide(s); } else if (inintro() && s->id == P_RAT) { checkcollide(s); + } else if ((s->id == P_ANT1) || (s->id == P_ANT2) || (s->id == P_ANT3)) { + checkcollide(s); } } } diff --git a/shared.c b/shared.c index 335e4c4..0228ca9 100644 --- a/shared.c +++ b/shared.c @@ -1339,6 +1339,31 @@ int loadimagesets(void) { /* next 3 are auto generated */ imageset[P_FROG].numimages = 8; + + loadspriteimage(P_ANT1,F_WALK1, "sprites/ant1.png"); + loadspriteimage(P_ANT1,F_JUMP, "sprites/ant1jump.png"); + loadspriteimage(P_ANT1,F_FALL, "sprites/ant1jump.png"); + loadspriteimage(P_ANT1,F_CAUGHT, "sprites/ant1caught.png"); + loadspriteimage(P_ANT1,F_DEAD, "sprites/ant1dead.png"); + /* next 3 are auto generated */ + imageset[P_ANT1].numimages = 8; + + loadspriteimage(P_ANT2,F_WALK1, "sprites/ant2.png"); + loadspriteimage(P_ANT2,F_JUMP, "sprites/ant2jump.png"); + loadspriteimage(P_ANT2,F_FALL, "sprites/ant2jump.png"); + loadspriteimage(P_ANT2,F_CAUGHT, "sprites/ant2caught.png"); + loadspriteimage(P_ANT2,F_DEAD, "sprites/ant2dead.png"); + /* next 3 are auto generated */ + imageset[P_ANT2].numimages = 8; + + loadspriteimage(P_ANT3,F_WALK1, "sprites/ant3.png"); + loadspriteimage(P_ANT3,F_JUMP, "sprites/ant3jump.png"); + loadspriteimage(P_ANT3,F_FALL, "sprites/ant3jump.png"); + loadspriteimage(P_ANT3,F_CAUGHT, "sprites/ant3caught.png"); + loadspriteimage(P_ANT3,F_DEAD, "sprites/ant3dead.png"); + /* next 3 are auto generated */ + imageset[P_ANT3].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"); @@ -1781,8 +1806,13 @@ int loadimagesets(void) { imageset[P_RAYGUNBULLET].numimages = 1; /* bullets */ - loadspriteimage(P_SPIT,F_WALK1, "sprites/spit.png"); - imageset[P_SPIT].numimages = 1; + loadspriteimage(P_SPIT,0, "sprites/spit.png"); + loadspriteimage(P_SPIT,1, "sprites/spit2.png"); + imageset[P_SPIT].numimages = 2; + + loadspriteimage(P_FIREBALL,0, "sprites/fire1.png"); + loadspriteimage(P_FIREBALL,1, "sprites/fire2.png"); + imageset[P_FIREBALL].numimages = 2; // manual angry image for black cloud @@ -1967,7 +1997,11 @@ void drawsprite(sprite_t *s) { if (isfruit(s->id)) { frame = F_WALK1; } else if (isbullet(s->id)) { - frame = F_WALK1; + if ((timer/6) % 2 == 0) { + frame = F_WALK1; + } else { + frame = F_JUMP; + } } else if (iseffect(s->id)) { if ((s->id == P_PUFF) || (s->id == P_SMASH) || (s->id == P_SPARKLE)) { if (s->timer1 >= imageset[s->id].numimages) { @@ -2621,6 +2655,7 @@ int isfruit(int id) { int isbullet(int id) { if (id == P_SPIT) return B_TRUE; + if (id == P_FIREBALL) return B_TRUE; return B_FALSE; } @@ -3037,6 +3072,9 @@ int ismonster(int id) { case P_SLUG: case P_FISH: case P_FROG: + case P_ANT1: + case P_ANT2: + case P_ANT3: return MT_MONSTER; case P_BLACKCLOUD: case P_KINGRAT: @@ -3533,6 +3571,10 @@ void setfruitinfo(void) { setinfo(P_FROG, "Frog", "Green frogs will continually bounce around, making them more difficult to catch.", "frog.png"); + setinfo(P_ANT1, "Worker Ant", "Worker ants are relatively easy to avoid, but when fed will quickly grow into more dangerous soldier ants.", "ant1.png"); + setinfo(P_ANT2, "Soldier Ant", "Soldiers move faster and are more intelligent than their worker siblings. In addition, with just a little food they will become queens.", "ant2.png"); + setinfo(P_ANT3, "Queen Ant", "After an ant has eaten enough, they become a Queen. Queens are just as fast as soldiers and can also breath fire. Furthermore, they are only one meal away from spawning additional ants!", "ant3.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");