From 7937c776bc2ca6995299dd2b7583557cf2b2c5a3 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Wed, 14 Aug 2013 11:27:35 +0000 Subject: [PATCH] - [+] bugfix - black cloud was never appearing. - [+] bugfix - super powerups should never disappear. - [+] during endgame, award 100x points for fruits and disable extra life at 100k - [+] remove ' ythresh too high' message --- rc.c | 38 ++++++++++++++++++++++++++++---------- shared.c | 7 ++++++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/rc.c b/rc.c index 94e5a7a..3efb9ae 100644 --- a/rc.c +++ b/rc.c @@ -198,7 +198,7 @@ SDL_Color greenish = {82, 125, 74, 0}; char *endtext[] = { "As the chest opens, a great light bursts forth...", "A feast of purloined food rains from the sky!", - "The dwarven couple eagerly gather their spoils", + "The dwarven couple eagerly gather the bounty", "and return in triumph to their castle", "where a grand banquet awaits.", " ", @@ -498,9 +498,11 @@ int main (int argc, char **argv) { */ if (levelcomplete == LV_CLEAR) { sprite_t *s2, *nexts; - addoutlinetext(320,240,TEXTSIZE_LEVEL,"Level Complete!",&green,&black,LEVELWINDELAY, TT_NORM); + if (!endgame) { + addoutlinetext(320,240,TEXTSIZE_LEVEL,"Level Complete!",&green,&black,LEVELWINDELAY, TT_NORM); + playfx(FX_WINLEVEL); + } levelcomplete = LV_WAIT; - playfx(FX_WINLEVEL); // turn off certain powerups if (globpowerup == PW_CLOCK) { Mix_ResumeMusic(); @@ -1278,9 +1280,12 @@ printf("timer = %d\n",timer); tick(); } // end main loop + // clear screen SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,black.r,black.g,black.b)); + stopmusic(); + if (wanthiscores) { // check for a hiscore, if so submit it if (player) checkhiscores(player); @@ -1422,11 +1427,10 @@ void tick(void) { } else if (gtime == nexthurryup + 15) { // 15 secs after hurryup if (!levelcomplete) { sprite_t *bc,*s2; - int found; + int found = B_FALSE; // does cloud already exist? (could happen if someone // picked up the whistle powerup) - for (s2 = sprite; s2 ; s2 = s2->next) { if (s2->id == P_BLACKCLOUD) { found = B_TRUE; @@ -2447,7 +2451,7 @@ void checkcollide(sprite_t *s) { keepchecking = B_TRUE; - /* check for colission with our net */ + /* check for collision with our net */ if ((s->netting ) && (s->powerup != PW_RAYGUN)) { if ((isnettable(s2) && !s2->invuln) || (s->netsticky && isfruit(s2->id))){ double nety; @@ -2471,7 +2475,7 @@ void checkcollide(sprite_t *s) { ythresh = s2->img->h; // check... if (ythresh > TILEH*2) { - printf("*DEBUG* ythresh too high: %0.0f\n",ythresh); + //printf("*DEBUG* ythresh too high: %0.0f\n",ythresh); ythresh = TILEH*2; } @@ -2480,7 +2484,7 @@ void checkcollide(sprite_t *s) { if (netsleft > 1) { ythresh += ((int)s->img->h / (int)(netsleft+1) ); if (ythresh > TILEH*3) { - printf("*DEBUG2* ythresh too high: %0.0f\n",ythresh); + //printf("*DEBUG2* ythresh too high: %0.0f\n",ythresh); ythresh = TILEH*3; } } @@ -9555,6 +9559,9 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) { endtexttimer = 0; endtexty = 120; + stopmusic(); + playmusic(hiscoremusic); + // kill all monsters for (s2 = sprite; s2 ; s2 = nexts) { nexts = s2->next; @@ -9571,6 +9578,8 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) { tt = gettileat(tx*TILEW,ty*TILEH, NULL, NULL); if (tt->id != T_BLANK) { sprite_t *sp; + // clear layer 2 as well + curlevel->map2[ty * LEVELW + tx ] = getuniq(T_BLANK); melttile(tx, ty, FOREVER); sp = addsprite(fruittypes[curfruittype], tx * TILEW + (TILEW/2), @@ -10729,7 +10738,7 @@ int addscore(sprite_t *s, long amt) { s->score += amt; // each multiple of 100,000 - if (isplayer(s)) { + if (isplayer(s) && !endgame) { if ((s->score / 100000) > (oldscore / 100000)) { extralife(s); } @@ -11189,12 +11198,21 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) { char tempm[MIDBUFLEN]; char tempm2[BUFLEN]; int gotscore = fruit->score; - int modscore = gotscore; // default + int modscore; // default int i; SDL_Color *col, *bgcol; /* kill the fruit */ fruit->dead = D_FINAL; + + + // 100x points at endgame + if (endgame) { + gotscore *= 100; + } + + modscore = gotscore; // default + /* give points to the player */ for (i = 0; i < multiplier; i++) { modscore = addscore(giveto, gotscore); diff --git a/shared.c b/shared.c index 44b6ec3..0117fcd 100644 --- a/shared.c +++ b/shared.c @@ -1023,7 +1023,12 @@ sprite_t *addsprite(int id, int x, int y, char *name ) { // initial fruits don't time out #ifndef __EDITOR if ((levelcomplete != LV_NEXTLEV) && (levelcomplete != LV_INIT)) { - if (isfruit(s->id)) { + int ftype; + ftype = isfruit(s->id); + if (ftype == FT_SUPER) { + // super powerups never time out. + s->doomcount = 0; + } else if (ftype) { // random powerups stay for longer if (!strcmp(s->name, "random_up")) { s->doomcount = 900;