From 4296d6296263ca2e2e58f58ae41cbb908f952973 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 25 Nov 2008 01:00:57 +0000 Subject: [PATCH] Added new powerup: umbrella --- data/sprites/bigumbrella.png | Bin 0 -> 665 bytes data/sprites/umbrella.png | Bin 0 -> 578 bytes defs.h | 11 ++++-- rc.c | 34 +++++++++++++++++- shared.c | 67 +++++++++++++++++++++++++++++++++-- website/img/umbrella.png | Bin 0 -> 1028 bytes website/info.html | 5 +-- 7 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 data/sprites/bigumbrella.png create mode 100644 data/sprites/umbrella.png create mode 100644 website/img/umbrella.png diff --git a/data/sprites/bigumbrella.png b/data/sprites/bigumbrella.png new file mode 100644 index 0000000000000000000000000000000000000000..964704b0dcef89da75ab6905a2185b30744bff73 GIT binary patch literal 665 zcmV;K0%rY*P)P000vR1^@s6Wpbtk00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru*b5l~HVEuH(9Zw>0wzgB zK~y-)?bESqQ&AKK@b8>^?|XS^u+PROtx<=F0R@ZLZWi1G#Yrg$+QmVUg3?70*3=E2R@+3$n2=hPfn;_ zI<(hu=G2)=U!i|WhtVb0e6*9aimlIUabx_Pcg`hg(q6aSbj3RNJSmuksilwpkCFQ( zI9spOrU&Dp38ljl8wSWDPrFDqHgIyR0oDrMdAQ8N=N5UMzxRQ;du{Q<%AUx*FbX4U zo5#w-kA|zq6|)AI!5Sc95DB_F-%zO!LKzM51Y!b200EqJsfzToZYg+tW$tzU8}dL$ z^+52dc4YW`wNe8SgPEZ;fi;6!0W8QmZN#-h&;|zGFdHLnL z^`FSY{>p{G%G*jDAMPvlV>izr;z0~J?_j+H5kLeeRu~v4fK33UH2^_Sh+sm4Vh}(n zh7JwV%&vBJJJ+wiS@=ZF6ZP@Ut<9(Hw9|ldLn49{ga`r_K!E^wC=did7{`!S0tJF% z17iO1F7k-TBg}Gyfk9j?BZx~|t=!(yF0{)tJFSZVFroFG9JmpAzwAJnFf|1Ld72|o zRR|-dSS)mt?ImK>7Nt^VniMa9;KjD0veju?)=S#B^!-fZ00000NkvXXu0mjfUV9{H literal 0 HcmV?d00001 diff --git a/data/sprites/umbrella.png b/data/sprites/umbrella.png new file mode 100644 index 0000000000000000000000000000000000000000..be54a2fb10aa721a8080067211d1b3052eb85356 GIT binary patch literal 578 zcmV-I0=@l-P)q%KX8`A_k0fLX#9o6qbJjI2M_H% z26N!~?WvDVnSL}oS#i%+SGRVWq2C*q_cu_F{qb^s;tB_;Q$)hO&KHE^X%uT^MEy-9 z(eSPF{!TA#mM*+_>30;)Ytx!6lNA=xhzX zX{?Vuh0{NOc!CXunyM?&@Dl)>DHXN<-lx2vtOYX<7N=LvUw>bKR$H}3Gy1&I)oP=g zzu)Pu<6n?=OLmh}7%~5af9A%KW-v0Lv|Cc{4{{?rVWCljv|F;!sO>8M15%Tur2s+H QfdBvi07*qoM6N<$g5~G{7XSbN literal 0 HcmV?d00001 diff --git a/defs.h b/defs.h index 509a1cb..b2a1c17 100644 --- a/defs.h +++ b/defs.h @@ -160,6 +160,7 @@ #define SLUGINVULNTIME 50 // how long a new slug stays invulnerable for #define SHIELDTIME 600 // how long a shield lasts #define FALLSPEED 4 // terminal velocity of falling sprites +#define UMBFALLSPEED 1 // terminal velocity of falling sprites with umbrella #define SMALLNETSPEED 6 // how fast the player's net moves with skull #define NETSPEED 9 // how fast the player's net moves #define BIGNETSPEED 12 // how fast the player's net moves with bignet @@ -383,7 +384,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 150 +#define MAXPTYPES 152 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -539,6 +540,8 @@ #define P_BADMAGNET 147 #define P_JETPACK 148 #define P_CAMERA 149 +#define P_UMBRELLA 150 +#define P_BIGUMBRELLA 151 #define FLY_FLYTIME 150 @@ -861,6 +864,8 @@ typedef struct sprite_s { int netsticky; // can net pick up powerups? int powerup; // what temp powerup does the player have? + int cancelumb; // cancelled the umbrella? + int oncloud; // on cloud at end of level? int permspeed; // got the permenant speed powerup? @@ -869,6 +874,7 @@ typedef struct sprite_s { int permsticky; // got the permenant sticky net powerup? int permdoublejump;// got the permenant dbljump powerup? int permarmour;// got the permenant armour powerup? + int permumbrella;// got the permenant umbrella powerup? int permmask; // got the permenant scuba mask powerup? int ontramp; // on a trampoline? @@ -878,6 +884,7 @@ typedef struct sprite_s { // player permenant powerups int armour; // does the player have armour? + int umbrella; // does the player have umbrella? int gemboost; // how many extra gems do you get in a bonus int netbig; // have we collected a BIG NET powerup? int hasbell; // got a bell ? @@ -933,7 +940,7 @@ typedef struct sprite_s { int falling; // are we falling? int dropping; // are we purposely dropping through solid ground? int dropx,dropy;// coords of tile we dropped from - int fallspeed; // how fast are we falling? + double fallspeed; // how fast are we falling? int jumping; // are we jumping? double jumpdir; //which way are we jumping? int jumpspeed; // how fast we are moving upwards diff --git a/rc.c b/rc.c index ee941bc..6fb8d74 100644 --- a/rc.c +++ b/rc.c @@ -129,6 +129,7 @@ int poweruptypes[] = { P_NUMNETS, P_GEMBOOST, P_HELMET, + P_UMBRELLA, P_WINGBOOTS, -1 }; @@ -1557,7 +1558,7 @@ void die(sprite_t *s) { Mix_ResumeMusic(); } - // turn off some powerups + // turn off some global powerups switch (globpowerup) { case PW_CLOCK: case PW_SPRAYUP: @@ -1567,6 +1568,10 @@ void die(sprite_t *s) { break; } + // lose normal powerups immediately + s->powerup = PW_NONE; + s->umbrella = B_FALSE; + resethurryup(curlevel); if (curmusic == fastmusic) { playmusic(normalmusic); @@ -6369,6 +6374,10 @@ void dogravity(sprite_t *s) { if (!s->jumptimer) { s->jumpdir = 0; } + // reset umbrella + if (s->umbrella) { + s->cancelumb = B_FALSE; + } if (s->falling && s->iced) { // when an iced monster hits the ground, it smashes @@ -6428,6 +6437,7 @@ void dogravity(sprite_t *s) { // constant speed - we are flying down, not falling s->y += getspeed(s); } else { + double termvel; if (isinwater(s) && !s->iced) { if (s->hasmask) { @@ -6441,9 +6451,17 @@ void dogravity(sprite_t *s) { s->y += s->fallspeed; } + if (s->umbrella && !s->cancelumb) { + termvel = UMBFALLSPEED; + } else { + termvel = FALLSPEED; + } + if ((timer % 10 == 0) && (s->fallspeed < FALLSPEED)) { s->fallspeed++; } + + if (s->fallspeed > termvel) s->fallspeed = termvel; } //} //} @@ -7441,6 +7459,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); pp->powerup = PW_JETPACK; return B_TRUE; + } else if (s->id == P_UMBRELLA) { + playfx(FX_POWERUP); + sprintf(tempm, "Umbrella!"); + addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM); + pp->umbrella = B_TRUE; + return B_TRUE; } else if (s->id == P_BADMAGNET) { playfx(FX_SKULL); sprintf(tempm, "Repel fruits!"); @@ -9403,6 +9427,7 @@ if (cheat) { player->netsticky = B_TRUE; player->doublejump = B_TRUE; player->hasbell = B_TRUE; + player->umbrella = B_TRUE; player->hasmask = B_TRUE; addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM); } @@ -9414,6 +9439,7 @@ if (cheat) { player2->doublejump = B_TRUE; player2->hasbell = B_TRUE; player2->hasmask = B_TRUE; + player2->umbrella = B_TRUE; addoutlinetext(player2->x,player2->y - player2->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM); } toggletimer = 80; @@ -11468,6 +11494,12 @@ void doplayermovement(sprite_t *pl) { pl->x = ladderx; } } + + if (pl->falling && !pl->swimming) { + if (pl->umbrella) { + pl->cancelumb = B_TRUE; + } + } } // Jump if (keydown(pnum,KEY_JUMP)) { diff --git a/shared.c b/shared.c index 811b26c..3d358dd 100644 --- a/shared.c +++ b/shared.c @@ -673,6 +673,19 @@ void setdefaults(sprite_t *s) { } else { s->armour = B_FALSE; } + + if (s->permumbrella) { + s->umbrella = B_TRUE; + if (s == player) { + s->id = P_ARMOUR; + } else { + s->id = P_ARMOUR2; + } + } else { + s->umbrella = B_FALSE; + } + + } else { if (s->id == P_PLATFORM) { s->speed = PLATFORM_MAXSPEED; @@ -684,6 +697,7 @@ void setdefaults(sprite_t *s) { s->armour = B_FALSE; s->netsticky = B_FALSE; s->doublejump = B_FALSE; + s->umbrella = B_FALSE; s->netbig = B_FALSE; s->netmax = 1; } @@ -701,7 +715,7 @@ void setdefaults(sprite_t *s) { s->hasbell = B_FALSE; s->gemboost = 1; - s->powerup = 0; + s->powerup = PW_NONE; // player-only states s->netting = 0; s->netcaught = 0; @@ -716,6 +730,8 @@ void setdefaults(sprite_t *s) { s->jumpspeed = 0; s->jumpdir = 1; s->useddoublejump = B_FALSE; + s->cancelumb = B_FALSE; + if (s->id != P_RANDOM) { // random gets timer1 set during addsprite() s->timer1 = 0; @@ -883,6 +899,7 @@ sprite_t *addsprite(int id, int x, int y, char *name ) { s->permdoublejump = B_FALSE; s->permarmour = B_FALSE; s->permmask = B_FALSE; + s->permumbrella = B_FALSE; s->lostlife = B_FALSE; @@ -1551,6 +1568,7 @@ int loadimagesets(void) { 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; @@ -1563,6 +1581,12 @@ int loadimagesets(void) { loadspriteimage(P_JETPACK,F_WALK1, "sprites/jetpack.png"); imageset[P_JETPACK].numimages = 1; + loadspriteimage(P_UMBRELLA,F_WALK1, "sprites/umbrella.png"); + imageset[P_UMBRELLA].numimages = 1; + + loadspriteimage(P_BIGUMBRELLA,F_WALK1, "sprites/bigumbrella.png"); + imageset[P_BIGUMBRELLA].numimages = 1; + loadspriteimage(P_CAMERA,F_WALK1, "sprites/camera.png"); imageset[P_CAMERA].numimages = 1; @@ -2429,6 +2453,7 @@ int isfruit(int id) { case P_HELMET: case P_MASKPOWERUP: case P_WINGBOOTS: + case P_UMBRELLA: return FT_PERM; /* one-off level only powerups */ case P_BOXING: @@ -2521,6 +2546,7 @@ int iseffect(int id) { // these last ones aren't REALLY effects since they never have a sprite allocated case P_WINGLEFT: case P_WINGRIGHT: + case P_BIGUMBRELLA: case P_SMALLANCHOR: return B_TRUE; } @@ -3106,7 +3132,7 @@ int loadlevellist(void) { int randompowerup(void) { int num; - num = rand() % 43; + num = rand() % 44; switch (num) { case 0: @@ -3201,6 +3227,8 @@ int randompowerup(void) { return P_JETPACK; case 42: return P_CAMERA; + case 43: + return P_UMBRELLA; } } @@ -3352,6 +3380,7 @@ void setfruitinfo(void) { setinfo(P_MAGNET, "Magnet", "Collecting this powerup will align the magnetic forces of the earth in your favour, attracting all nearby fruits towards you.", "magnet.png"); setinfo(P_BADMAGNET, "Red Skull", "This skull curses you and will repel fruits away from you, denying you access to them!", "badmagnet.png"); setinfo(P_JETPACK, "Jetpack", "For the remainder of the current level, the jetpack's thrust will add to your jumping ability!", "jetpack.png"); + setinfo(P_UMBRELLA, "Umbrella", "Slows your descent giving you more time to contemplate your rat eradication quest.", "umbrella.png"); setinfo(P_CAMERA, "Camera", "Creates a bright flash of light, blinding all enemies.", "camera.png"); setinfo(P_ZAPPOWERUP, "Bug Zapper", "Zaps nearby enemies with miniature bolts of lightning", "zapper.png"); setinfo(P_SKULL, "Green Skull", "Avoid these at all costs! The green skull will shrink your net to miniscule proportions for the remainder of the level.", "skull.png"); @@ -3959,6 +3988,10 @@ void drawplayer(sprite_t *s, SDL_Rect *where) { wingarea.y -= 9; } + if (s == player2) { + wingarea.x -= (4 * s->dir); + } + // when climbing, show "left" wing twice instead // when swimming, only show left wing if (!s->climbing && !s->swimming) { @@ -3968,6 +4001,8 @@ void drawplayer(sprite_t *s, SDL_Rect *where) { } #endif + + if ((levelcomplete == LV_CLOUDLOOP) || (levelcomplete == LV_NEXTLEV)) { s->img = imageset[s->id].img[F_SHOOT]; } @@ -4023,6 +4058,34 @@ void drawplayer(sprite_t *s, SDL_Rect *where) { doblit(imageset[P_WINGLEFT].img[wingframe], screen, &wingarea); } } + + + // draw umbrella + if (s->umbrella && !s->cancelumb) { + if (!s->swimming && !s->climbing) { + SDL_Rect umarea; + if (s->netting) { + if (s->dir == D_RIGHT) { + umarea.x = s->x - 11 - 10; + } else { + umarea.x = s->x - 11 + 10; + } + umarea.y = s->y - s->img->h - 2; + } else if (s->falling) { + if (s->dir == D_RIGHT) { + umarea.x = s->x - 11 - 8; + } else { + umarea.x = s->x - 11 + 8; + } + umarea.y = s->y - s->img->h - 9; + } else { + umarea.x = s->x - 11; + umarea.y = s->y - s->img->h - 2; + } + doblit(imageset[P_BIGUMBRELLA].img[F_WALK1], screen, &umarea); + } + } + #endif } diff --git a/website/img/umbrella.png b/website/img/umbrella.png new file mode 100644 index 0000000000000000000000000000000000000000..95bc158fbb75eef4a14f078c2376feb6a2dd4608 GIT binary patch literal 1028 zcmV+f1pE7mP)P-puUo{pIjo>=+x00|bJC{D`DTl?J7YkV2C(orRzaO=yrPkq}A| z1tdU7G^rznCP|ZYQ3yp6>6%E6j1=2QfX(^-c4uA+cCB~A?%mqTN>4L8yF1@E-+S}s zEn#mL74!js3;Lxeob`?mUPQnr!uusa9ykF|-aUDsPPFWi$|YiEtT+SBT4_Fk%&gbC zDXxMpSak-dQT% z0t$fsT$%Sz%*}t@Sw8xXHX+CmND*8zf(a9}mgm6^ugqF(566H0{QT+luYUjI5r9!@ z+F1E)%tUl>-etf(Zj1vKOzS*AZINWOn;kibmiGC7;m_fvdZT#wGtkVTgJqLa2aBqmFf(e0TB3U#|7y_$7cofMJdj41kSX{Zg%ZdiCl0L$%|q+S>dS z%>9trJpj%EsIP#2N{q&KR72b!K%0PX#{CNb+~qL5#pC#IOZ0E0RgXVgY@NOHWb^wJ zFf)Jq=0<&>f#|r_ovyXp0O}fO63}>)Xz4J~$=|+t@A4ZL9)B@nb}@6Jh|p9@zp(Zh zfE{5y(U&Uh#zI~mfCbRCb{#-Hy|)084d!PX%#Q(}=Ugw#BaYd7%;h{#C4iE&-%DLag5*e$$RtmSwqQoUKRhxJ zl}-SmMl8m*1OXP$M#6?^JC%UEoLEsT#fb*V@rzD|?I59bgg!9H^90UuM zkaAogT^4)5KKO(JD(5VBUf}IY%eT+0yd=?2B7)& znJrp*bTDzJL;098&4_2oEIlH$LEE0qApPn zQbDBzFK;-{*RD)WSXKcE&IK9M$y2UuRjf;b`-KbVC?IP
HoneyCoats your net in a layer of sticky honey, allowing it to pick up fruits from afar.
Scuba MaskAllows you to move fast underwater.
Winged BootsThese magical boots cause you to grow wings, allowing to you jump again while in mid-air! -
CardKeep a look out for these useful items. Collect a full poker hand for a secret bonus! -Temporary Powerups +
UmbrellaSlows your descent giving you more time to contemplate your rat eradication quest. +
CardKeep a look out for these useful items. Collect a full poker hand for a secret bonus! + Temporary Powerups
Boxing GloveYour net will punch monsters, killing them instantly.
Diamond FlowerTransforms all flowers on the level into diamonds.
Rainbow FlowerTransforms all flowers on the level into gems, and turns itself into an extra-long stream of gems.