Added 4 new fruit types

This commit is contained in:
Rob Pearce 2008-11-19 01:20:46 +00:00
parent 2495a34cee
commit 9b2ad5c3bd
4 changed files with 76 additions and 21 deletions

6
defs.h
View File

@ -339,7 +339,7 @@
#define S_SLOPE 2 #define S_SLOPE 2
// Sprite types // Sprite types
#define MAXPTYPES 140 #define MAXPTYPES 144
#define P_PLAYER 0 #define P_PLAYER 0
#define P_RAT 1 #define P_RAT 1
#define P_CHEESE 2 #define P_CHEESE 2
@ -485,6 +485,10 @@
#define P_WAND 137 #define P_WAND 137
#define P_WHISTLE 138 #define P_WHISTLE 138
#define P_CANDLE 139 #define P_CANDLE 139
#define P_PIZZA 140
#define P_SUNDAE 141
#define P_CANDY 142
#define P_CHOCOLATE 143
#define FLY_FLYTIME 150 #define FLY_FLYTIME 150

25
rc.c
View File

@ -101,6 +101,10 @@ int fruittypes[] = {
P_ICECREAM, P_ICECREAM,
P_CHIPS, P_CHIPS,
P_BURGER, P_BURGER,
P_PIZZA,
P_SUNDAE,
P_CANDY,
P_CHOCOLATE,
-1 -1
}; };
@ -121,6 +125,7 @@ int poweruptypes[] = {
-1 -1
}; };
int fruittime = -1;
int curfruittype = 0; int curfruittype = 0;
int curpoweruptype = 0; int curpoweruptype = 0;
@ -1023,6 +1028,16 @@ void tick(void) {
} }
} }
/* 3 seconds after fruit creation */
if (fruittime != -1) {
if (gtime >= fruittime + 3) {
fruittime = -1;
// reset fruit counter
curfruittype = 0;
}
}
/* 5 seconds after level completion */ /* 5 seconds after level completion */
if (levelcomplete == LV_FINAL) { if (levelcomplete == LV_FINAL) {
@ -1126,6 +1141,8 @@ void nextlevel(void) {
} }
watertime = -1; watertime = -1;
fruittime = -1;
// do the moving to next level transition (ie. scroll the screen) // do the moving to next level transition (ie. scroll the screen)
drawlevel(); drawlevel();
@ -5997,8 +6014,6 @@ void dogravity(sprite_t *s) {
if (!s->jumptimer) { if (!s->jumptimer) {
s->jumpdir = 0; s->jumpdir = 0;
} }
//oooooooooo
if (s->falling && s->iced) { if (s->falling && s->iced) {
// when an iced monster hits the ground, it smashes // when an iced monster hits the ground, it smashes
@ -6149,9 +6164,6 @@ void dogravity(sprite_t *s) {
s->slamming = 0; s->slamming = 0;
/* reset fruit type counter */
curfruittype = 0;
// if we have a mace, add an explosion and play a thump sound // if we have a mace, add an explosion and play a thump sound
if (s->powerup == PW_MACE) { if (s->powerup == PW_MACE) {
// play sound // play sound
@ -6216,6 +6228,8 @@ void dogravity(sprite_t *s) {
if (fruittypes[curfruittype] == -1) { if (fruittypes[curfruittype] == -1) {
curfruittype = 0; curfruittype = 0;
} }
// fruit time
if (fruittime == -1) fruittime = gtime;
} }
if ((s->powerup == PW_MACE) && (s2->id == P_SNAIL)) { if ((s->powerup == PW_MACE) && (s2->id == P_SNAIL)) {
@ -6360,6 +6374,7 @@ void dogravity(sprite_t *s) {
if (fruittypes[++curfruittype] == -1) { if (fruittypes[++curfruittype] == -1) {
curfruittype = 0; curfruittype = 0;
} }
if (fruittime == -1) fruittime = gtime;
} }
if (s2->id == P_SNAIL) { if (s2->id == P_SNAIL) {
// turn into a slug so that it really dies // turn into a slug so that it really dies

View File

@ -1350,6 +1350,18 @@ int loadimagesets(void) {
loadspriteimage(P_SPEED,F_WALK1, "sprites/speed.png"); loadspriteimage(P_SPEED,F_WALK1, "sprites/speed.png");
imageset[P_SPEED].numimages = 1; imageset[P_SPEED].numimages = 1;
loadspriteimage(P_PIZZA,F_WALK1, "sprites/pizza.png");
imageset[P_PIZZA].numimages = 1;
loadspriteimage(P_SUNDAE,F_WALK1, "sprites/sundae.png");
imageset[P_SUNDAE].numimages = 1;
loadspriteimage(P_CANDY,F_WALK1, "sprites/candy.png");
imageset[P_CANDY].numimages = 1;
loadspriteimage(P_CHOCOLATE,F_WALK1, "sprites/chocolate.png");
imageset[P_CHOCOLATE].numimages = 1;
// don't load image for P_RANDOM // don't load image for P_RANDOM
imageset[P_RANDOM].numimages = 0; imageset[P_RANDOM].numimages = 0;
@ -2337,6 +2349,10 @@ int isfruit(int id) {
case P_ICECREAM: case P_ICECREAM:
case P_CHIPS: case P_CHIPS:
case P_BURGER: case P_BURGER:
case P_PIZZA:
case P_SUNDAE:
case P_CANDY:
case P_CHOCOLATE:
case P_DIAMOND: case P_DIAMOND:
return FT_FRUIT; return FT_FRUIT;
@ -2893,20 +2909,32 @@ int getpoints(int id) {
int points; int points;
switch (id) { switch (id) {
case P_CHEESE: case P_CHEESE:
points = 1000; points = 500;
break; break;
case P_ICECREAM: case P_ICECREAM:
points = 1500; points = 1000;
break; break;
case P_CHIPS: case P_CHIPS:
points = 2000; points = 1500;
break; break;
case P_BURGER: case P_BURGER:
points = 2000;
break;
case P_PIZZA:
points = 2500; points = 2500;
break; break;
case P_DIAMOND: case P_SUNDAE:
points = 3000; points = 3000;
break; break;
case P_CANDY:
points = 3500;
break;
case P_CHOCOLATE:
points = 4000;
break;
case P_DIAMOND:
points = 2500;
break;
case P_FLOWERYELLOW: case P_FLOWERYELLOW:
points = 5; points = 5;
break; break;
@ -3194,6 +3222,10 @@ void setfruitinfo(void) {
setinfo(P_CHIPS, "Chips", "", "chips.png"); setinfo(P_CHIPS, "Chips", "", "chips.png");
setinfo(P_BURGER, "Burger", "", "burger.png"); setinfo(P_BURGER, "Burger", "", "burger.png");
setinfo(P_DIAMOND, "Diamond", "", "diamond.png"); setinfo(P_DIAMOND, "Diamond", "", "diamond.png");
setinfo(P_PIZZA, "Pizza", "", "pizza.png");
setinfo(P_SUNDAE, "Sundae", "", "sundae.png");
setinfo(P_CANDY, "Candy", "", "candy.png");
setinfo(P_CHOCOLATE, "Chocolate", "", "chocolate.png");
setinfo(P_FLOWERYELLOW, "Sunflower", "", "flower-yellow.png"); setinfo(P_FLOWERYELLOW, "Sunflower", "", "flower-yellow.png");
setinfo(P_FLOWERRED, "Tulip", "", "flower-red.png"); setinfo(P_FLOWERRED, "Tulip", "", "flower-red.png");
setinfo(P_FLOWERPURPLE, "Orchid", "", "flower-purple.png"); setinfo(P_FLOWERPURPLE, "Orchid", "", "flower-purple.png");

View File

@ -22,17 +22,21 @@
<center><h2>Power-Ups</h2> <center><h2>Power-Ups</h2>
<table border=1> <table border=1>
<tr bgcolor="#ffff00"><th colspan=4>Fruits</th></tr> <tr bgcolor="#ffff00"><th colspan=4>Fruits</th></tr>
<tr><td width=10% align=center><img src="img/cheese.png"><br>Cheese</td><td width=40%>Worth 1000 points.</td> <tr><td width=10% align=center><img src="img/cheese.png"><br>Cheese</td><td width=40%>Worth 500 points.</td>
<td width=10% align=center><img src="img/icecream.png"><br>Ice Cream</td><td width=40%>Worth 1500 points.</td> <td width=10% align=center><img src="img/icecream.png"><br>Ice Cream</td><td width=40%>Worth 1000 points.</td>
</tr><tr><td width=10% align=center><img src="img/chips.png"><br>Chips</td><td width=40%>Worth 2000 points.</td> </tr><tr><td width=10% align=center><img src="img/chips.png"><br>Chips</td><td width=40%>Worth 1500 points.</td>
<td width=10% align=center><img src="img/burger.png"><br>Burger</td><td width=40%>Worth 2500 points.</td> <td width=10% align=center><img src="img/burger.png"><br>Burger</td><td width=40%>Worth 2000 points.</td>
</tr><tr><td width=10% align=center><img src="img/flower-yellow.png"><br>Yellow Flower</td><td width=40%>Worth 5 points.</td> </tr><tr><td width=10% align=center><img src="img/flower-yellow.png"><br>Sunflower</td><td width=40%>Worth 5 points.</td>
<td width=10% align=center><img src="img/flower-red.png"><br>Red Flower</td><td width=40%>Worth 10 points.</td> <td width=10% align=center><img src="img/flower-red.png"><br>Tulip</td><td width=40%>Worth 10 points.</td>
</tr><tr><td width=10% align=center><img src="img/flower-purple.png"><br>Purple Flower</td><td width=40%>Worth 30 points.</td> </tr><tr><td width=10% align=center><img src="img/flower-purple.png"><br>Orchid</td><td width=40%>Worth 30 points.</td>
<td width=10% align=center><img src="img/gem-red.png"><br>Red Gem</td><td width=40%>Worth 75 points.</td> <td width=10% align=center><img src="img/gem-red.png"><br>Ruby</td><td width=40%>Worth 75 points.</td>
</tr><tr><td width=10% align=center><img src="img/gem-yellow.png"><br>Yellow Gem</td><td width=40%>Worth 50 points.</td> </tr><tr><td width=10% align=center><img src="img/gem-yellow.png"><br>Topaz</td><td width=40%>Worth 50 points.</td>
<td width=10% align=center><img src="img/gem-purple.png"><br>Purple Gem</td><td width=40%>Worth 100 points.</td> <td width=10% align=center><img src="img/gem-purple.png"><br>Amethyst</td><td width=40%>Worth 100 points.</td>
</tr><tr><td width=10% align=center><img src="img/diamond.png"><br>Diamond</td><td width=40%>Worth 3000 points.</td> </tr><tr><td width=10% align=center><img src="img/diamond.png"><br>Diamond</td><td width=40%>Worth 2500 points.</td>
<td width=10% align=center><img src="img/pizza.png"><br>Pizza</td><td width=40%>Worth 2500 points.</td>
</tr><tr><td width=10% align=center><img src="img/sundae.png"><br>Sundae</td><td width=40%>Worth 3000 points.</td>
<td width=10% align=center><img src="img/candy.png"><br>Candy</td><td width=40%>Worth 3500 points.</td>
</tr><tr><td width=10% align=center><img src="img/chocolate.png"><br>Chocolate</td><td width=40%>Worth 4000 points.</td>
<td colspan=2>&nbsp;</td></tr><tr bgcolor="#ffff00"><th colspan=4>Permenant Powerups</th></tr> <td colspan=2>&nbsp;</td></tr><tr bgcolor="#ffff00"><th colspan=4>Permenant Powerups</th></tr>
<tr><td align=center><img src="img/speed.png"><br>Speed Up</td><td>Makes you walk faster.</td> <tr><td align=center><img src="img/speed.png"><br>Speed Up</td><td>Makes you walk faster.</td>
<td align=center><img src="img/numnets.png"><br>More Nets</td><td>Increases the number of monsters you can catch simultaneously.</td> <td align=center><img src="img/numnets.png"><br>More Nets</td><td>Increases the number of monsters you can catch simultaneously.</td>