Added new powerup: magic lamp
This commit is contained in:
parent
d2522e751a
commit
55b6881ee0
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 758 B |
Binary file not shown.
After Width: | Height: | Size: 683 B |
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
9
defs.h
9
defs.h
|
@ -354,7 +354,7 @@
|
|||
/* enums */
|
||||
|
||||
/* sounds */
|
||||
#define MAXFX 63
|
||||
#define MAXFX 64
|
||||
#define FX_SHOOT 0
|
||||
#define FX_SLAM 1
|
||||
#define FX_KILL 2
|
||||
|
@ -418,6 +418,7 @@
|
|||
#define FX_HISS 60
|
||||
#define FX_CHOMP 61
|
||||
#define FX_GROWL 62
|
||||
#define FX_LAMP 63
|
||||
|
||||
// card suits
|
||||
#define CS_HEART 1
|
||||
|
@ -443,7 +444,7 @@
|
|||
#define S_SLOPE 2
|
||||
|
||||
// Sprite types
|
||||
#define MAXPTYPES 168
|
||||
#define MAXPTYPES 171
|
||||
#define P_PLAYER 0
|
||||
#define P_RAT 1
|
||||
#define P_CHEESE 2
|
||||
|
@ -617,6 +618,9 @@
|
|||
#define P_BIGFIREBALL 165
|
||||
#define P_EGG 166
|
||||
#define P_BIGHELMET 167
|
||||
#define P_GOLDCOIN 168
|
||||
#define P_LAMP 169
|
||||
#define P_GOLDBAR 170
|
||||
|
||||
|
||||
#define FLY_FLYTIME 150
|
||||
|
@ -685,6 +689,7 @@
|
|||
#define PW_PILL 22 // pill
|
||||
#define PW_RAYGUN 23 // ray gun
|
||||
#define PW_TOPHAT 24 // top hat
|
||||
#define PW_LAMP 25 // magic lamp
|
||||
// "virtual" powerup for bosses
|
||||
#define PW_RATSHAKE 50 // shake screen horizontally
|
||||
#define PW_SNAILSHAKE 51 // shake screen vertically
|
||||
|
|
126
rc.c
126
rc.c
|
@ -108,6 +108,9 @@ int blinkspeed;
|
|||
int credits = 0;
|
||||
int titledone;
|
||||
|
||||
int forcegold = B_FALSE;
|
||||
int forcegoldlev = -1;
|
||||
|
||||
|
||||
int skiplevels;
|
||||
|
||||
|
@ -464,6 +467,9 @@ int main (int argc, char **argv) {
|
|||
if (globpowerup == PW_CLOCK) {
|
||||
Mix_ResumeMusic();
|
||||
globpowerup = -1;
|
||||
} else if (globpowerup == PW_LAMP) {
|
||||
Mix_ResumeMusic();
|
||||
globpowerup = -1;
|
||||
} else if ((curlevel->iced == WATER_INPROGRESS) || (curlevel->iced == WATER_COMPLETE)) {
|
||||
curlevel->iced = B_FALSE;
|
||||
undoflood();
|
||||
|
@ -1300,6 +1306,14 @@ void nextlevel(void) {
|
|||
levelcomplete = LV_NEXTLEV;
|
||||
|
||||
|
||||
// disable "forcegold" (comes form magic lamp) unless we got
|
||||
// if on this level
|
||||
if (forcegold) {
|
||||
if (forcegoldlev != curlevelnum) {
|
||||
forcegold = B_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* go to next level */
|
||||
// this won't trigger on the first load of the intro
|
||||
// becasue curlevelnum is decremented before this function
|
||||
|
@ -1737,6 +1751,20 @@ void die(sprite_t *s) {
|
|||
if (globpowerup == PW_CLOCK) {
|
||||
Mix_ResumeMusic();
|
||||
}
|
||||
if (globpowerup == PW_LAMP) {
|
||||
sprite_t *s2;
|
||||
Mix_ResumeMusic();
|
||||
// kill all gold coins
|
||||
for (s2 = sprite; s2 ; s2 = s2->next) {
|
||||
if (s2->id == P_GOLDCOIN) {
|
||||
s2->dead = D_FINAL;
|
||||
puffin(-1, s2->x, s2->y, "gcpuff", rand() % 5);
|
||||
} else if ((s2->id == P_PUFF) && (s2->timer3 == P_GOLDCOIN)) {
|
||||
s2->dead = D_FINAL;
|
||||
puffin(-1, s2->x, s2->y, "gcpuff", rand() % 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turn off some global powerups
|
||||
switch (globpowerup) {
|
||||
|
@ -1928,6 +1956,21 @@ void checklevelend(void) {
|
|||
if (levelcomplete == LV_INIT) return;
|
||||
|
||||
if (!levelcomplete) {
|
||||
if (globpowerup == PW_LAMP) {
|
||||
// level ends when all gold coins are gone
|
||||
mcount = 0;
|
||||
for (s2 = sprite; s2 ; s2 = s2->next) {
|
||||
if (s2->id == P_GOLDCOIN) {
|
||||
mcount++;
|
||||
} else if ((s2->id == P_PUFF) && (s2->timer3 == P_GOLDCOIN)) {
|
||||
mcount++;
|
||||
}
|
||||
}
|
||||
if (mcount == 0) {
|
||||
levelcomplete = LV_CLEAR;
|
||||
}
|
||||
} else {
|
||||
// level ends when all monsters are dead
|
||||
mcount = 0;
|
||||
/* any monsters left? */
|
||||
for (s2 = sprite; s2 ; s2 = s2->next) {
|
||||
|
@ -1941,6 +1984,7 @@ void checklevelend(void) {
|
|||
levelcomplete = LV_CLEAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// count monsters of a given type (-1 for all) on level
|
||||
|
@ -2916,6 +2960,7 @@ int movesprite(sprite_t *s) {
|
|||
if ((xdiff <= player->img->w/2 + newsp->img->w/2) &&
|
||||
(ydiff <= player->img->h/2 + newsp->img->h/2)) {
|
||||
if ((!player->dead) && (player->powerup != PW_GUNNER)) {
|
||||
if (newsp->id != P_GOLDCOIN) {
|
||||
// bonus!
|
||||
getfruit(player, newsp, 4);
|
||||
addoutlinetext(player->x,player->y - (player->img->h*1.5), TEXTSIZE_MULTI, "Nice catch!", &green,&black,MULTIDELAY, TT_NORM);
|
||||
|
@ -2923,6 +2968,7 @@ int movesprite(sprite_t *s) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!gotit && player2) {
|
||||
xdiff = player2->x - newsp->x;
|
||||
if (xdiff < 0) xdiff = -xdiff;
|
||||
|
@ -7997,6 +8043,9 @@ void dogravity(sprite_t *s) {
|
|||
if (poweruptypes[++(curpoweruptype[getpnum(s)])] == -1) {
|
||||
curpoweruptype[getpnum(s)] = 0;
|
||||
}
|
||||
} else {
|
||||
if (forcegold) {
|
||||
s2->willbecome = P_GOLDBAR;
|
||||
} else {
|
||||
s2->willbecome = fruittypes[curfruittype];
|
||||
/* increment fruit type */
|
||||
|
@ -8007,6 +8056,7 @@ void dogravity(sprite_t *s) {
|
|||
// fruit time
|
||||
fruittime = gtime;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s->powerup == PW_MACE) && (s2->id == P_SNAIL)) {
|
||||
// turn into a slug so that it really dies
|
||||
|
@ -8150,6 +8200,9 @@ void dogravity(sprite_t *s) {
|
|||
if (poweruptypes[++(curpoweruptype[getpnum(s)])] == -1) {
|
||||
curpoweruptype[getpnum(s)] = 0;
|
||||
}
|
||||
} else {
|
||||
if (forcegold) {
|
||||
s2->willbecome = P_GOLDBAR;
|
||||
} else {
|
||||
/* will become a fruit when it finishes dying */
|
||||
s2->willbecome = fruittypes[curfruittype];
|
||||
|
@ -8160,6 +8213,7 @@ void dogravity(sprite_t *s) {
|
|||
fruittime = gtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s2->id == P_SNAIL) {
|
||||
// turn into a slug so that it really dies
|
||||
s2->id = P_SLUG;
|
||||
|
@ -8719,6 +8773,52 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
|
|||
sprintf(tempm, "Top Hat!");
|
||||
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
|
||||
pp->powerup = PW_TOPHAT;
|
||||
return B_TRUE;
|
||||
} else if (s->id == P_LAMP) {
|
||||
int xx,yy,delay;
|
||||
sprite_t *s2;
|
||||
tiletype_t *tt;
|
||||
// Magic Lamp
|
||||
Mix_PauseMusic(); // pause music
|
||||
playfx(FX_LAMP);
|
||||
sprintf(tempm, "Magic Lamp!");
|
||||
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
|
||||
|
||||
globpowerup = PW_LAMP;
|
||||
|
||||
// create gold coins
|
||||
delay = 0;
|
||||
for (xx = 0; xx < LEVELW; xx++) {
|
||||
for (yy = 0; yy < (LEVELH-1); yy++) {
|
||||
tt = gettileat(xx*TILEW,yy*TILEH, NULL,NULL);
|
||||
if (!tt->solid) {
|
||||
// check tile below
|
||||
tt = gettileat(xx*TILEW,(yy+1)*TILEH, NULL,NULL);
|
||||
if (tt->id == T_LAND) {
|
||||
// add a coin ! (NAME is important as it gives a higher doom
|
||||
// count when being placed in addsprite()!)
|
||||
puffin(P_GOLDCOIN, xx*TILEW+(TILEW/2), yy*TILEH+(TILEH),"goldcoin", delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
//inc delay
|
||||
delay += 1;
|
||||
}
|
||||
|
||||
// remove all monsters
|
||||
for (s2 = sprite; s2 ; s2 = s2->next) {
|
||||
if (ismonster(s2->id) && !s2->dead ) {
|
||||
s2->dead = D_FINAL;
|
||||
//puffs
|
||||
puffin(-1, s2->x - (s2->img->w/2), s2->y, "wandpuff", rand() % 5);
|
||||
puffin(-1, s2->x + (s2->img->w/2), s2->y, "wandpuff", rand() % 5);
|
||||
puffin(-1, s2->x, s2->y - (s2->img->h/2), "wandpuff", rand() % 5);
|
||||
puffin(-1, s2->x, s2->y + (s2->img->h/2), "wandpuff", rand() % 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return B_TRUE;
|
||||
} else if (s->id == P_CANNONPOWERUP) {
|
||||
sprite_t *newsp;
|
||||
|
@ -9276,6 +9376,7 @@ int initsound(void) {
|
|||
loadfx(FX_HISS, "hiss.wav");
|
||||
loadfx(FX_CHOMP, "chomp.wav");
|
||||
loadfx(FX_GROWL, "growl.wav");
|
||||
loadfx(FX_LAMP, "lamp.wav");
|
||||
|
||||
// load sound effects
|
||||
for (i = 0; i < MAXFX; i++) {
|
||||
|
@ -10077,6 +10178,27 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
|
|||
sprintf(tempm2, "%s x %d" , tempm,multiplier);
|
||||
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm2, col,bgcol,POINTSDELAY,TT_NORM);
|
||||
}
|
||||
|
||||
// last goin coin is special...
|
||||
if (fruit->id == P_GOLDCOIN) {
|
||||
int ccount;
|
||||
sprite_t *s2;
|
||||
ccount = 0;
|
||||
for (s2 = sprite; s2 ; s2 = s2->next) {
|
||||
if (s2 != fruit) {
|
||||
if (s2->id == P_GOLDCOIN) {
|
||||
ccount++;
|
||||
} else if ((s2->id == P_PUFF) && (s2->timer3 == P_GOLDCOIN)) {
|
||||
ccount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ccount == 0) {
|
||||
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_BOMB, "Perfect!", &green,&black,CLOVERDELAY,TT_NORM);
|
||||
forcegold = B_TRUE;
|
||||
forcegoldlev = curlevelnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11943,6 +12065,8 @@ void startgame(void) {
|
|||
gothiscore = -1;
|
||||
gothiscore2 = -1;
|
||||
|
||||
forcegold = B_FALSE;
|
||||
forcegoldlev = -1;
|
||||
|
||||
curfruittype = 0;
|
||||
curpoweruptype[0] = 0;
|
||||
|
@ -13272,6 +13396,8 @@ SDL_Color *getcolour(int id) {
|
|||
case P_GEMYELLOW:
|
||||
case P_CHEESE:
|
||||
case P_PIZZA:
|
||||
case P_GOLDCOIN:
|
||||
case P_GOLDBAR:
|
||||
return &yellow;
|
||||
case P_FLOWERRED:
|
||||
case P_GEMRED:
|
||||
|
|
29
shared.c
29
shared.c
|
@ -991,6 +991,8 @@ sprite_t *addsprite(int id, int x, int y, char *name ) {
|
|||
// random powerups stay for longer
|
||||
if (!strcmp(s->name, "random_up")) {
|
||||
s->doomcount = 900;
|
||||
} else if (!strcmp(s->name, "goldcoin")) {
|
||||
s->doomcount = 1400;
|
||||
} else {
|
||||
s->doomcount = 500;
|
||||
}
|
||||
|
@ -1680,6 +1682,15 @@ int loadimagesets(void) {
|
|||
loadspriteimage(P_TOPHAT,F_WALK1, "sprites/tophat.png");
|
||||
imageset[P_TOPHAT].numimages = 1;
|
||||
|
||||
loadspriteimage(P_LAMP,F_WALK1, "sprites/lamp.png");
|
||||
imageset[P_LAMP].numimages = 1;
|
||||
|
||||
loadspriteimage(P_GOLDCOIN,F_WALK1, "sprites/goldcoin.png");
|
||||
imageset[P_GOLDCOIN].numimages = 1;
|
||||
|
||||
loadspriteimage(P_GOLDBAR,F_WALK1, "sprites/goldbar.png");
|
||||
imageset[P_GOLDBAR].numimages = 1;
|
||||
|
||||
loadspriteimage(P_GUN,F_WALK1, "sprites/gunner.png");
|
||||
imageset[P_GUN].numimages = 1;
|
||||
|
||||
|
@ -2658,6 +2669,7 @@ int iswinpowerup(int id) {
|
|||
case P_BOMB:
|
||||
case P_PHONE:
|
||||
case P_WAND:
|
||||
case P_LAMP:
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
|
@ -2675,6 +2687,8 @@ int isfruit(int id) {
|
|||
case P_CAKE:
|
||||
case P_CHOCOLATE:
|
||||
case P_DIAMOND:
|
||||
case P_GOLDCOIN:
|
||||
case P_GOLDBAR:
|
||||
return FT_FRUIT;
|
||||
|
||||
/* super powerups */
|
||||
|
@ -2733,6 +2747,7 @@ int isfruit(int id) {
|
|||
case P_PILL:
|
||||
case P_RAYGUN:
|
||||
case P_TOPHAT:
|
||||
case P_LAMP:
|
||||
return FT_TEMP;
|
||||
/* flowers */
|
||||
case P_FLOWERYELLOW:
|
||||
|
@ -3298,6 +3313,9 @@ void killtext(text_t *t) {
|
|||
int getpoints(int id) {
|
||||
int points;
|
||||
switch (id) {
|
||||
case P_GOLDCOIN:
|
||||
points = 250;
|
||||
break;
|
||||
case P_CHEESE:
|
||||
points = 500;
|
||||
break;
|
||||
|
@ -3322,6 +3340,9 @@ int getpoints(int id) {
|
|||
case P_CHOCOLATE: // LOTS
|
||||
points = 8000;
|
||||
break;
|
||||
case P_GOLDBAR:
|
||||
points = 10000;
|
||||
break;
|
||||
case P_DIAMOND:
|
||||
points = 2500;
|
||||
break;
|
||||
|
@ -3434,9 +3455,7 @@ int loadlevellist(void) {
|
|||
|
||||
int randompowerup(void) {
|
||||
int num;
|
||||
num = rand() % 46;
|
||||
|
||||
return P_JETPACK;
|
||||
num = rand() % 48;
|
||||
|
||||
switch (num) {
|
||||
case 0:
|
||||
|
@ -3539,6 +3558,8 @@ return P_JETPACK;
|
|||
return P_RAYGUN;
|
||||
case 46:
|
||||
return P_TOPHAT;
|
||||
case 47:
|
||||
return P_LAMP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3653,6 +3674,7 @@ void setfruitinfo(void) {
|
|||
setinfo(P_GEMYELLOW, "Topaz", "", "gem-yellow.png");
|
||||
setinfo(P_GEMRED, "Ruby", "", "gem-red.png");
|
||||
setinfo(P_GEMPURPLE, "Amethyst", "", "gem-purple.png");
|
||||
setinfo(P_GOLDBAR, "Amethyst", "", "goldbar.png");
|
||||
|
||||
setinfo(P_FIRSTCARD, "Card", "Keep a look out for these useful items. Collect a full poker hand for a secret bonus!", "cardh.png");
|
||||
|
||||
|
@ -3675,6 +3697,7 @@ void setfruitinfo(void) {
|
|||
setinfo(P_PILL, "Pill", "Eating this pill will cause you to enter a hyperactive state, moving at four times your standard speed!", "pill.png");
|
||||
setinfo(P_RAYGUN, "Ray Gun", "Alien in origin, the ray gun contains enough charge for five shots of burning plasma.", "raygun.png");
|
||||
setinfo(P_TOPHAT, "Top Hat", "Players wearing the top hat will find that every item which appears will now be a power-up!", "tophat.png");
|
||||
setinfo(P_LAMP, "Magic Lamp", "The magic lamp shifts you into an alternate dimension filled with gold! Collect it all for a kingly bonus...", "lamp.png");
|
||||
|
||||
setinfo(P_BOXING, "Boxing Glove", "Your net will punch monsters, killing them instantly.", "boxing.png");
|
||||
setinfo(P_MACEPOWERUP, "Mace", "Slamming your net will cause a lethal explosion!", "macepowerup.png");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in New Issue