Powerup detector now changes colour based on powerup type.
This commit is contained in:
parent
2c3b50fe8c
commit
48aece7927
30
rc.c
30
rc.c
|
@ -624,10 +624,30 @@ int main (int argc, char **argv) {
|
|||
* after sprite movement
|
||||
*/
|
||||
if ((player && player->hasbell) || (player2 && player2->hasbell)) {
|
||||
int dobell = B_FALSE;
|
||||
SDL_Color fcol;
|
||||
/* check for bell sound */
|
||||
|
||||
/* play a bell sound if the powerup will be a permenant one */
|
||||
if (ispermenant(level->poweruptype)) {
|
||||
// flash white
|
||||
dobell = B_TRUE;
|
||||
fcol.r = 255; fcol.g = 255; ; fcol.b = 255;
|
||||
} else if (isabilitypowerup(level->poweruptype)) {
|
||||
// flash green
|
||||
dobell = B_TRUE;
|
||||
fcol.r = 0; fcol.g = 255; ; fcol.b = 0;
|
||||
} else if (iswinpowerup(level->poweruptype)) {
|
||||
// flash red
|
||||
dobell = B_TRUE;
|
||||
fcol.r = 255; fcol.g = 0; ; fcol.b = 0;
|
||||
} else if (isbadpowerup(level->poweruptype)) {
|
||||
// flash purple
|
||||
dobell = B_TRUE;
|
||||
fcol.r = 255; fcol.g = 0; ; fcol.b = 255;
|
||||
}
|
||||
|
||||
if (dobell) {
|
||||
// play sound once
|
||||
if (!playedbell) {
|
||||
playfx(FX_BELL);
|
||||
|
@ -642,12 +662,14 @@ int main (int argc, char **argv) {
|
|||
area.y = 0;
|
||||
area.w = 640;
|
||||
area.h = 480;
|
||||
SDL_FillRect(screen, &area, SDL_MapRGB(screen->format,white.r,white.g,white.b));
|
||||
SDL_FillRect(screen, &area, SDL_MapRGB(screen->format,fcol.r,fcol.g,fcol.b));
|
||||
flip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// camera flash
|
||||
if ((globpowerup == PW_CAMERA) && (cameraalpha)) {
|
||||
|
||||
|
@ -8090,7 +8112,11 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
|
|||
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
|
||||
return B_TRUE;
|
||||
} else if (s->id == P_BELL) {
|
||||
// all powerups
|
||||
// powerup detector - makes the level flash depending on what power up will appear.
|
||||
// white = permenant
|
||||
// green = temporary ability
|
||||
// red = instawin
|
||||
// purple = bad
|
||||
playfx(FX_BELL); // different sound effect
|
||||
pp->hasbell = B_TRUE;
|
||||
sprintf(tempm, "Powerup Detector!");
|
||||
|
|
47
shared.c
47
shared.c
|
@ -2566,6 +2566,53 @@ int isflower(int id) {
|
|||
return B_FALSE;
|
||||
}
|
||||
|
||||
/* returns B_TRUE if the given powerup is one which
|
||||
gives the player a special ability */
|
||||
int isabilitypowerup(int id) {
|
||||
switch (id) {
|
||||
case P_BOXING:
|
||||
case P_MACEPOWERUP:
|
||||
case P_SHIELD:
|
||||
case P_RINGSILVER:
|
||||
case P_RINGGOLD:
|
||||
case P_CLOVER:
|
||||
case P_ACCORDION:
|
||||
case P_ZAPPOWERUP:
|
||||
case P_GUN:
|
||||
case P_CANNONPOWERUP:
|
||||
case P_MAGNET:
|
||||
case P_JETPACK:
|
||||
case P_PILL:
|
||||
case P_RAYGUN:
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int isbadpowerup(int id) {
|
||||
switch (id) {
|
||||
case P_SKULL:
|
||||
case P_BADMAGNET:
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* returns B_TRUE if the given powerup is one which
|
||||
will or could effectively win the level */
|
||||
int iswinpowerup(int id) {
|
||||
switch (id) {
|
||||
case P_BOMB:
|
||||
case P_PHONE:
|
||||
case P_WAND:
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
int isfruit(int id) {
|
||||
switch (id) {
|
||||
/* fruits */
|
||||
|
|
3
shared.h
3
shared.h
|
@ -67,6 +67,9 @@ int isplayer(sprite_t *s);
|
|||
int isplayer(sprite_t *s);
|
||||
int playersalive(void);
|
||||
int getnumplayers(void);
|
||||
int isbadpowerup(int id);
|
||||
int iswinpowerup(int id);
|
||||
int isabilitypowerup(int id);
|
||||
// for doco
|
||||
void setfruitinfo(void);
|
||||
void setinfo(int id, char *name, char *desc, char *file);
|
||||
|
|
Loading…
Reference in New Issue