- [+] 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
This commit is contained in:
Rob Pearce 2013-08-14 11:27:35 +00:00
parent d9963652c8
commit 7937c776bc
2 changed files with 34 additions and 11 deletions

38
rc.c
View File

@ -198,7 +198,7 @@ SDL_Color greenish = {82, 125, 74, 0};
char *endtext[] = { char *endtext[] = {
"As the chest opens, a great light bursts forth...", "As the chest opens, a great light bursts forth...",
"A feast of purloined food rains from the sky!", "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", "and return in triumph to their castle",
"where a grand banquet awaits.", "where a grand banquet awaits.",
" ", " ",
@ -498,9 +498,11 @@ int main (int argc, char **argv) {
*/ */
if (levelcomplete == LV_CLEAR) { if (levelcomplete == LV_CLEAR) {
sprite_t *s2, *nexts; 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; levelcomplete = LV_WAIT;
playfx(FX_WINLEVEL);
// turn off certain powerups // turn off certain powerups
if (globpowerup == PW_CLOCK) { if (globpowerup == PW_CLOCK) {
Mix_ResumeMusic(); Mix_ResumeMusic();
@ -1278,9 +1280,12 @@ printf("timer = %d\n",timer);
tick(); tick();
} // end main loop } // end main loop
// clear screen // clear screen
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,black.r,black.g,black.b)); SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format,black.r,black.g,black.b));
stopmusic();
if (wanthiscores) { if (wanthiscores) {
// check for a hiscore, if so submit it // check for a hiscore, if so submit it
if (player) checkhiscores(player); if (player) checkhiscores(player);
@ -1422,11 +1427,10 @@ void tick(void) {
} else if (gtime == nexthurryup + 15) { // 15 secs after hurryup } else if (gtime == nexthurryup + 15) { // 15 secs after hurryup
if (!levelcomplete) { if (!levelcomplete) {
sprite_t *bc,*s2; sprite_t *bc,*s2;
int found; int found = B_FALSE;
// does cloud already exist? (could happen if someone // does cloud already exist? (could happen if someone
// picked up the whistle powerup) // picked up the whistle powerup)
for (s2 = sprite; s2 ; s2 = s2->next) { for (s2 = sprite; s2 ; s2 = s2->next) {
if (s2->id == P_BLACKCLOUD) { if (s2->id == P_BLACKCLOUD) {
found = B_TRUE; found = B_TRUE;
@ -2447,7 +2451,7 @@ void checkcollide(sprite_t *s) {
keepchecking = B_TRUE; keepchecking = B_TRUE;
/* check for colission with our net */ /* check for collision with our net */
if ((s->netting ) && (s->powerup != PW_RAYGUN)) { if ((s->netting ) && (s->powerup != PW_RAYGUN)) {
if ((isnettable(s2) && !s2->invuln) || (s->netsticky && isfruit(s2->id))){ if ((isnettable(s2) && !s2->invuln) || (s->netsticky && isfruit(s2->id))){
double nety; double nety;
@ -2471,7 +2475,7 @@ void checkcollide(sprite_t *s) {
ythresh = s2->img->h; ythresh = s2->img->h;
// check... // check...
if (ythresh > TILEH*2) { 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; ythresh = TILEH*2;
} }
@ -2480,7 +2484,7 @@ void checkcollide(sprite_t *s) {
if (netsleft > 1) { if (netsleft > 1) {
ythresh += ((int)s->img->h / (int)(netsleft+1) ); ythresh += ((int)s->img->h / (int)(netsleft+1) );
if (ythresh > TILEH*3) { 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; ythresh = TILEH*3;
} }
} }
@ -9555,6 +9559,9 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
endtexttimer = 0; endtexttimer = 0;
endtexty = 120; endtexty = 120;
stopmusic();
playmusic(hiscoremusic);
// kill all monsters // kill all monsters
for (s2 = sprite; s2 ; s2 = nexts) { for (s2 = sprite; s2 ; s2 = nexts) {
nexts = s2->next; nexts = s2->next;
@ -9571,6 +9578,8 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
tt = gettileat(tx*TILEW,ty*TILEH, NULL, NULL); tt = gettileat(tx*TILEW,ty*TILEH, NULL, NULL);
if (tt->id != T_BLANK) { if (tt->id != T_BLANK) {
sprite_t *sp; sprite_t *sp;
// clear layer 2 as well
curlevel->map2[ty * LEVELW + tx ] = getuniq(T_BLANK);
melttile(tx, ty, FOREVER); melttile(tx, ty, FOREVER);
sp = addsprite(fruittypes[curfruittype], sp = addsprite(fruittypes[curfruittype],
tx * TILEW + (TILEW/2), tx * TILEW + (TILEW/2),
@ -10729,7 +10738,7 @@ int addscore(sprite_t *s, long amt) {
s->score += amt; s->score += amt;
// each multiple of 100,000 // each multiple of 100,000
if (isplayer(s)) { if (isplayer(s) && !endgame) {
if ((s->score / 100000) > (oldscore / 100000)) { if ((s->score / 100000) > (oldscore / 100000)) {
extralife(s); extralife(s);
} }
@ -11189,12 +11198,21 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
char tempm[MIDBUFLEN]; char tempm[MIDBUFLEN];
char tempm2[BUFLEN]; char tempm2[BUFLEN];
int gotscore = fruit->score; int gotscore = fruit->score;
int modscore = gotscore; // default int modscore; // default
int i; int i;
SDL_Color *col, *bgcol; SDL_Color *col, *bgcol;
/* kill the fruit */ /* kill the fruit */
fruit->dead = D_FINAL; fruit->dead = D_FINAL;
// 100x points at endgame
if (endgame) {
gotscore *= 100;
}
modscore = gotscore; // default
/* give points to the player */ /* give points to the player */
for (i = 0; i < multiplier; i++) { for (i = 0; i < multiplier; i++) {
modscore = addscore(giveto, gotscore); modscore = addscore(giveto, gotscore);

View File

@ -1023,7 +1023,12 @@ sprite_t *addsprite(int id, int x, int y, char *name ) {
// initial fruits don't time out // initial fruits don't time out
#ifndef __EDITOR #ifndef __EDITOR
if ((levelcomplete != LV_NEXTLEV) && (levelcomplete != LV_INIT)) { 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 // random powerups stay for longer
if (!strcmp(s->name, "random_up")) { if (!strcmp(s->name, "random_up")) {
s->doomcount = 900; s->doomcount = 900;