From a67b8515c76a769d3bac55a520d7edb93de0e388 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sat, 22 Nov 2008 00:21:22 +0000 Subject: [PATCH] Added new powerup: anchor --- data/levels/level99.dat | 69 ++++++++++++++++++---------------- data/sprites/anchor.png | Bin 0 -> 930 bytes data/sprites/armor2caught.png | Bin 593 -> 593 bytes data/sprites/smallanchor.png | Bin 0 -> 775 bytes defs.h | 7 +++- globals.h | 2 + rc.c | 33 ++++++++++++++-- shared.c | 25 +++++++++++- 8 files changed, 97 insertions(+), 39 deletions(-) create mode 100644 data/sprites/anchor.png create mode 100644 data/sprites/smallanchor.png diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 0d35194..3515d7f 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -4,29 +4,33 @@ hurryup 30 help endhelp monsters -0 19 22 -1 26 22 -1 10 22 -1 10 21 -1 12 22 -1 12 21 -1 37 9 -1 26 9 -1 30 9 -1 33 9 -1 20 9 -1 11 9 -1 16 9 -1 7 9 -1 3 9 -134 4 22 -1 36 27 -1 30 27 -1 17 27 -1 13 27 -1 8 27 +0 4 18 +134 27 17 +23 8 18 +6 28 5 +6 15 8 +6 6 5 +7 15 1 +7 22 1 +7 34 1 +18 21 28 +18 21 28 +18 21 28 +18 21 28 +18 21 28 +18 21 28 +18 9 28 +18 9 28 +18 9 28 +18 9 28 +18 9 28 +18 32 28 +18 32 28 +18 32 28 +18 32 28 endmonsters exitdir 1 +44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 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, 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, 4,0,0,0,0,0,0,0,0,0,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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,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, -4,0,0,0,0,0,0,0,0,0,0,0,0,69,68,68,68,68,68,68,68,68,68,68,68,68,68,0,70,0,0,0,0,0,0,0,69,70,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,0,0,68,0,0,68,68,68,70,0,0,4, -4,0,0,0,0,0,0,0,52,52,52,52,52,52,52,0,0,0,0,0,0,0,0,0,44,44,44,44,44,44,52,0,0,0,0,0,0,0,0,4, -1,0,0,0,0,0,0,0,52,0,0,0,0,0,52,0,0,0,0,0,0,0,0,0,44,0,0,0,0,0,52,0,0,0,0,0,0,0,0,4, -4,0,0,0,0,0,0,0,44,0,0,0,0,0,52,0,0,0,0,0,0,0,0,0,44,0,0,0,52,0,44,0,0,0,0,0,0,0,0,4, -4,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,0,0,44,44,44,44,44,44,44,69,68,68,68,68,68,68,70,4, +4,0,0,0,0,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 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, 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, 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, -4,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,4, 4,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,4, +4,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,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,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,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, +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, +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, +4,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,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,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,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, +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, 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 diff --git a/data/sprites/anchor.png b/data/sprites/anchor.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed5a644d0a9b56e2d32a6e29e950e87cfc04efd GIT binary patch literal 930 zcmV;T16}-yP)BK={gLuos7W_r0Zx6^yipDRg8xzT>RbIxYJkTT$Kv}QV2ydb<^edj_i-J^+pbNXyW;`yQ`;jLqnTP^O=YVE`dqz7-3!f zyFZ%E!pq|ajD4p4>FiSFb-X=l?TLld$;#aHJ5TgJN;WnTl(tglgA_c}tS=(~fQg9- z=w~%^+*mzZU3H$$I}pcev~4Zj*C{u4D9B{Zqc;Qa%SBcQKU4$K^jrt2Cnc;h~);KOUeFjvbnA?!iLZJYMlQHs;BF3j? zD%N?I%rha&3TfMxpDwI?nT)6@X*b_3Ui&@X+tvB@@K|QW>~<-?vo-nanyrp~Ws@t0rk!eX(T|Sj_D5<`Ynbyl2YmPLk3|n{;~;Ak@YPoiJo4ns#Xs~b z+<=3Y_&Y{;Jm0|N7p9keML*mbZ7EgiF1jy~qmL!_mTl*YI^(-M07wu9JH2)A2?8P{ zl#mKVq8C69Kf7>y@vnO?dt;NCs=YkWm;4;ByN)LKV3i32NeP|=m{;`D5;oo-p~$PH zh1=!-{CH>1dSG}tsnKq!gi{y<;{HqyR9JpA2h&i{?k>dOaK4?07*qoM6N<$ Ef<&gS_W%F@ literal 0 HcmV?d00001 diff --git a/data/sprites/armor2caught.png b/data/sprites/armor2caught.png index 05ec42baa97f6130632023a86171b32345b86752..f7fc1a92a0dbe4508a7b4af6e3e6197cb22d0a8d 100644 GIT binary patch delta 18 acmcb}a*<_12s@LS;llY*2R253V*~&}76(iK delta 18 Zcmcb}a*<_12s@*pu}27_^2X?Ii~u)}1-<|P diff --git a/data/sprites/smallanchor.png b/data/sprites/smallanchor.png new file mode 100644 index 0000000000000000000000000000000000000000..b0b8329d63e42add07705b97ba775c6879979f1f GIT binary patch literal 775 zcmV+i1Ni)jP){lQCLtsuFJtu^^GKs6<$>6>BzP zXK$&jY^111WfmSuB}%C@GjwzwozBb5-1~o6h=w7~>MXwBIp<5h!_ZK-4o0cp^6xZF zjwd6hyb4;6rWR=F) zlljGWe{4*bygZX44y~NFfa%ylt7)l9RxN6ISA)NIfHY+^`PZpqpAsbiZvo)-nP_u7 zncnYb$l8wcVohh))Wh*{{MRD@SeD6c)3g{7CL^GY5CG7Bfto7LDFOtr4Mxq~{oDW2 z@Jj<*&Q8pHyB}WHHUD68@+Vj=GYHowrKDN{S{ML;b0d9Zx4+!+CQ}=vA(M<6L|w|x z&aB?r-30(}J;9Zf0i~o6N+_-JIN!gG^!o~(hF7^dm#zp4KrTyq}}J zDp$g_Tu+!vNmlcGXt#s|sN=J_??*nAL>ny&`N}a!ApmhyRLYS(v0bQ1?UrkzSQE;Y zlm?p&le8E*lE_tJ6W{7GUDr7_(6`0S&(1yaN%v$$sFB4?HZ7V$c7V~r583bCAx5VM zd46NAP`WXZtOTcP^tuc3jGP+o^;PHQnO7~JNY&NllGKr)Wi0M+(4NW^X^4{|W3b+O z#!NyP*O=eF2f$s9+=2D$>};tLs|oM4l=4us@_fx&phjphON={dX55Bp$G?1?ul|u$ z0NB^Fi53=8tyQ6hTq!ParSgokn|biKww&BtBDwrpKLBK+I3PUUogM%H002ovPDHLk FV1jsdZ2$lO literal 0 HcmV?d00001 diff --git a/defs.h b/defs.h index 46ba840..c69ea49 100644 --- a/defs.h +++ b/defs.h @@ -361,7 +361,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 144 +#define MAXPTYPES 146 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -511,6 +511,8 @@ #define P_SUNDAE 141 #define P_CAKE 142 #define P_CHOCOLATE 143 +#define P_ANCHOR 144 +#define P_SMALLANCHOR 145 #define FLY_FLYTIME 150 @@ -570,6 +572,7 @@ #define PW_GUNNER 13 // machine gunner #define PW_WHISTLE 14 // whistle #define PW_CANDLE 15 // candle +#define PW_ANCHOR 16 // anchor // "virtual" powerup for bosses #define PW_RATSHAKE 20 // shake screen horizontally #define PW_SNAILSHAKE 21 // shake screen vertically @@ -981,6 +984,8 @@ extern int deck[]; extern int forcegoodcard; extern int nextforcegoodcard; +extern int globpowerup; + extern char *datadir; #endif diff --git a/globals.h b/globals.h index 11c4aa7..dba3cd5 100644 --- a/globals.h +++ b/globals.h @@ -11,6 +11,8 @@ int maxlevid; int want1up,want2up; +int globpowerup; + int gamemode; // easy or hard? int showhelp; // show help text? diff --git a/rc.c b/rc.c index a4dcebf..dced039 100644 --- a/rc.c +++ b/rc.c @@ -35,7 +35,6 @@ SDL_Surface *credittext; int lockcredits = B_FALSE; -int globpowerup; int globtimer; int introstate; @@ -463,7 +462,7 @@ int main (int argc, char **argv) { if (!paused) { /********************************************** * Special effects #1 - ones which change the level by - * modifiying tiles, etc. + * modifiying tiles, etc, or by moving sprites. */ if (globpowerup != PW_CLOCK) { // for each animated tile on the level... @@ -1812,6 +1811,12 @@ void checkfruitcollide (sprite_t *s) { s2->id = fruittypes[curfruittype]; s2->score = getpoints(s2->id); + // stop jumping etc + s2->jumping = B_FALSE; + s2->jumpspeed = 0; + s2->antigrav = 0; + s2->falling = 0; + /* increment fruit type */ curfruittype++; if (fruittypes[curfruittype] == -1) { @@ -2191,6 +2196,17 @@ int movesprite(sprite_t *s) { s->invuln--; } + // anchor weighs down flying enemies + if (ismonster(s->id) && s->flies && !s->dead && (globpowerup == PW_ANCHOR)) { + if (s->id != P_BLACKCLOUD) { + if (!isonground(s)) { + // move down + s->y += 3; + } + } + } + + if (s->caughtby) { if (s->caughtby->slamming) { @@ -2403,7 +2419,12 @@ int movesprite(sprite_t *s) { s->jumptimer--; if (s->jumptimer == 0) { s->jumping = 1; - s->jumpspeed = s->willjumpspeed; + if (globpowerup == PW_ANCHOR) { + // jump very low + s->jumpspeed = 1; + } else { + s->jumpspeed = s->willjumpspeed; + } if (s->jumpdir != 0) s->dir = s->jumpdir; return B_FALSE; } else if (s->jumptimer % 20 == 0) { @@ -7223,6 +7244,12 @@ 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); globpowerup = PW_CANDLE; return B_TRUE; + } else if (s->id == P_ANCHOR) { + playfx(FX_MORPH); + sprintf(tempm, "Anchor!"); + addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM); + globpowerup = PW_ANCHOR; + return B_TRUE; } else if (s->id == P_WAND) { sprite_t *s2; diff --git a/shared.c b/shared.c index afffc97..bf62b00 100644 --- a/shared.c +++ b/shared.c @@ -1538,6 +1538,12 @@ int loadimagesets(void) { loadspriteimage(P_WHISTLE,F_WALK1, "sprites/whistle.png"); imageset[P_WHISTLE].numimages = 1; + loadspriteimage(P_ANCHOR,F_WALK1, "sprites/anchor.png"); + imageset[P_ANCHOR].numimages = 1; + + loadspriteimage(P_SMALLANCHOR,F_WALK1, "sprites/smallanchor.png"); + imageset[P_SMALLANCHOR].numimages = 1; + loadspriteimage(P_ZAPPOWERUP,F_WALK1, "sprites/zapper.png"); imageset[P_ZAPPOWERUP].numimages = 1; @@ -2212,6 +2218,16 @@ void drawsprite(sprite_t *s) { } + // anchor + if (globpowerup == PW_ANCHOR) { + if (ismonster(s->id) && !s->caughtby && !s->dead) { + SDL_Rect newarea; + newarea = area; + newarea.y += (s->img->h / 3); + SDL_BlitSurface(imageset[P_SMALLANCHOR].img[0], NULL, screen, &newarea); + } + } + /* caughtby lines */ @@ -2414,6 +2430,7 @@ int isfruit(int id) { case P_SKULL: case P_GNOME: case P_WAND: + case P_ANCHOR: case P_CANDLE: case P_WHISTLE: case P_RANDOM: @@ -2471,10 +2488,11 @@ int iseffect(int id) { case P_MASK: case P_MOVINGCARD: case P_FIVECARDS: - // these last two aren't REALLY effects since they never have a sprite allocated + case P_PLATFORM: + // these last ones aren't REALLY effects since they never have a sprite allocated case P_WINGLEFT: case P_WINGRIGHT: - case P_PLATFORM: + case P_SMALLANCHOR: return B_TRUE; } @@ -3144,6 +3162,8 @@ int randompowerup(void) { return P_WHISTLE; case 37: return P_CANDLE; + case 38: + return P_ANCHOR; } } @@ -3291,6 +3311,7 @@ void setfruitinfo(void) { setinfo(P_WAND, "Magic Wand", "A wave of the magic wand will magically polymorph all monsters into weaker ones. Anything which can't become weaker will be instantly destroyed!", "wand.png"); setinfo(P_WHISTLE, "Whistle", "Produces an extremely loud, shrill whistling noise which wakes the black cloud of doom! In its angered state, the black cloud will slaughter both friend and foe alike.", "whistle.png"); setinfo(P_CANDLE, "Candle", "Once collected, the candle will cause all enemy corpses to burst into flames, igniting any other enemy which they touch.", "candle.png"); + setinfo(P_ANCHOR, "Anchor", "The extremely heavy anchor will weigh down enemies, preventing them from jumping or flying.", "anchor.png"); setinfo(P_ZAPPOWERUP, "Bug Zapper", "Zaps nearby enemies with miniature bolts of lightning", "zapper.png"); setinfo(P_SKULL, "Skull", "Avoid these at all costs! The skull will cause you to lose all net powerups.", "skull.png"); setinfo(P_CLOVER, "4-Leaf Clover", "Increases your luck...", "clover.png");