From ea3cf4e16bfd95fae5bc323b3608cbb3d5bf3835 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sat, 18 Oct 2008 04:16:06 +0000 Subject: [PATCH] Added powerup: accordion (makes net super-super long) --- defs.h | 6 +++++- rc.c | 26 ++++++++++++++++++++++---- shared.c | 9 ++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/defs.h b/defs.h index 3795095..dfaeaba 100644 --- a/defs.h +++ b/defs.h @@ -108,6 +108,8 @@ #define SHIELDTIME 500 // how long a shield lasts #define FALLSPEED 4 // terminal velocity of falling sprites #define NETSPEED 9 // how fast the player's net moves +#define BIGNETSPEED 12 // how fast the player's net moves with bignet +#define ACCNETSPEED 28 // how fast the player's net moves with accordion #define POWERUPTIME 15 // # secs before a powerup appears #define PLAYERFAST 2 // how fast player goes with speed powerup @@ -283,7 +285,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 119 +#define MAXPTYPES 120 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -408,6 +410,7 @@ #define P_MOVINGCARD 116 #define P_FIVECARDS 117 #define P_CLOVER 118 +#define P_ACCORDION 119 // cards #define CARDFONTX 4 @@ -440,6 +443,7 @@ #define PW_CANNON 9 // fusion cannon #define PW_CANNONFIRE 10 // fusion cannon firing #define PW_PHONE 11 // skip level +#define PW_ACCORDION 12 // super long net // "virtual" powerup for bosses #define PW_RATSHAKE 20 // shake screen horizontally diff --git a/rc.c b/rc.c index a49155a..a2a673d 100644 --- a/rc.c +++ b/rc.c @@ -4181,9 +4181,19 @@ void dogravity(sprite_t *s) { } if (s->netting) { - s->netlen += s->netspeed; + if (s->powerup == PW_ACCORDION) { + if (s->netspeed > 0) { + s->netlen += s->netspeed; + } else { + s->netlen += (s->netspeed*2); + } + } else { + s->netlen += s->netspeed; + } + s->netting++; - if (s->netting % 2 == 0) { + + if ((s->powerup == PW_ACCORDION) || (s->netting % 2 == 0)) { if (s->netspeed > -NETSPEED) { s->netspeed--; } else { @@ -4988,6 +4998,12 @@ int dofruiteffect(sprite_t *s) { nextforcegoodcard = B_TRUE; forcegoodcard = B_TRUE; return B_TRUE; + } else if (s->id == P_ACCORDION) { + playfx(FX_POWERUP); + sprintf(tempm, "Extra Long Net!"); + addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM); + player->powerup = PW_ACCORDION; + return B_TRUE; } else if (s->id == P_HELP) { playfx(FX_POWERUP); // TODO: move other HELP text around if need be! @@ -6765,8 +6781,10 @@ void trytoshoot(sprite_t *pl) { pl->netting = 1; adjustx(pl, F_SHOOT); - if (pl->netbig) { - pl->netspeed = NETSPEED+3; + if (pl->powerup == PW_ACCORDION) { + pl->netspeed = ACCNETSPEED; + } else if (pl->netbig) { + pl->netspeed = BIGNETSPEED; } else { pl->netspeed = NETSPEED; } diff --git a/shared.c b/shared.c index 3596e63..79c630b 100644 --- a/shared.c +++ b/shared.c @@ -1271,6 +1271,9 @@ int loadimagesets(void) { loadspriteimage(P_CLOVER,F_WALK1, "sprites/clover.png"); imageset[P_CLOVER].numimages = 1; + loadspriteimage(P_ACCORDION,F_WALK1, "sprites/accordion.png"); + imageset[P_ACCORDION].numimages = 1; + loadspriteimage(P_BIGSPEED,F_WALK1, "sprites/bigspeed.png"); imageset[P_BIGSPEED].numimages = 1; @@ -1883,6 +1886,7 @@ int isfruit(int id) { case P_SPRAY: case P_CANNONPOWERUP: case P_CLOVER: + case P_ACCORDION: return FT_TEMP; /* flowers */ case P_FLOWERYELLOW: @@ -2492,7 +2496,7 @@ int loadlevellist(void) { int randompowerup(void) { int num; - num = rand() % 28; + num = rand() % 29; switch (num) { case 0: @@ -2552,6 +2556,8 @@ int randompowerup(void) { return getrandomcard(); case 27: return P_CLOVER; + case 28: + return P_ACCORDION; } } @@ -2680,6 +2686,7 @@ void setfruitinfo(void) { setinfo(P_LIFE, "Life", "Awards the player an extra life.", "extralife.png"); setinfo(P_UFO, "UFO", "Calls in a powerful meteor strike!", "ufo.png"); setinfo(P_TAP, "Tap", "The leaky tap will flood the level with water, allowing you to acces hard to reach areas.", "tap.png"); + setinfo(P_ACCORDION, "Accordion", "Makes your nets enormous", "accordion.png"); setinfo(P_CLOVER, "4-Leaf Clover", "Increases your luck...", "clover.png");