- Added new monsters: ant, fireball

- Snake spit now animates
- Changed sound effect for snake shooting
- Added new sound effects for ant
This commit is contained in:
Rob Pearce 2008-12-22 23:48:04 +00:00
parent c4f2d760d8
commit 3c9b730eeb
33 changed files with 508 additions and 56 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

BIN
data/sounds/chomp.wav Normal file

Binary file not shown.

BIN
data/sounds/growl.wav Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sprites/ant1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
data/sprites/ant1caught.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

BIN
data/sprites/ant1dead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

BIN
data/sprites/ant1jump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
data/sprites/ant2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

BIN
data/sprites/ant2caught.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

BIN
data/sprites/ant2dead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

BIN
data/sprites/ant2jump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

BIN
data/sprites/ant3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/sprites/ant3caught.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/sprites/ant3dead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/sprites/ant3jump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/sprites/fire1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

BIN
data/sprites/fire2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

BIN
data/sprites/spit2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

10
defs.h
View File

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

384
rc.c
View File

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

View File

@ -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");