diff --git a/data/sprites/cardc.png b/data/sprites/cardc.png index 799f38b..55936fc 100644 Binary files a/data/sprites/cardc.png and b/data/sprites/cardc.png differ diff --git a/data/sprites/cardd.png b/data/sprites/cardd.png index 3610f61..fa075d6 100644 Binary files a/data/sprites/cardd.png and b/data/sprites/cardd.png differ diff --git a/data/sprites/cardh.png b/data/sprites/cardh.png index 1981b7c..65f6f24 100644 Binary files a/data/sprites/cardh.png and b/data/sprites/cardh.png differ diff --git a/data/sprites/cards.png b/data/sprites/cards.png index 16e0093..71129d5 100644 Binary files a/data/sprites/cards.png and b/data/sprites/cards.png differ diff --git a/rc.c b/rc.c index 5b92bb9..8564223 100644 --- a/rc.c +++ b/rc.c @@ -32,6 +32,10 @@ Mix_Music *curmusic = NULL; // pointer to currently playing music char tempm[BUFLEN]; +// used to remember old level if we flood it +int savemap[LEVELW*LEVELH]; +int watertime; + int playedbell; int clocktime; @@ -285,10 +289,13 @@ int main (int argc, char **argv) { addoutlinetext(320,240,TEXTSIZE_LEVEL,"Level Complete!",&green,&black,LEVELWINDELAY); levelcomplete = LV_WAIT; playfx(FX_WINLEVEL); - // turn off clock powerup + // turn off clock and water powerups if (player->powerup == PW_CLOCK) { Mix_ResumeMusic(); player->powerup = B_FALSE; + } else if ((curlevel->iced == WATER_INPROGRESS) || (curlevel->iced == WATER_COMPLETE)) { + curlevel->iced = B_FALSE; + undoflood(); } } else if (levelcomplete == LV_WAIT) { int mcount = 0; @@ -642,27 +649,49 @@ void tick(void) { gtime++; // handle clock effect - if (player->powerup == PW_CLOCK) { - char tempm[SMALLBUFLEN]; - // text - if (clocktime > 0) { - sprintf(tempm, "%d",clocktime); - addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &yellow,&black,15); - // sound effect - playfx(FX_CLOCK); + if (levelcomplete == LV_INPROGRESS) { + if (player->powerup == PW_CLOCK) { + char tempm[SMALLBUFLEN]; + // text + if (clocktime > 0) { + sprintf(tempm, "%d",clocktime); + addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &yellow,&black,15); + // sound effect + playfx(FX_CLOCK); + } + // never reach hurryup time + nexthurryup++; + // decrement counter + clocktime--; + if (clocktime < 0) { + // finished! + Mix_ResumeMusic(); + player->powerup = B_FALSE; + } } - // never reach hurryup time - nexthurryup++; - // decrement counter - clocktime--; - if (clocktime < 0) { - // finished! - Mix_ResumeMusic(); - player->powerup = B_FALSE; + + // handle flood effect + if (curlevel->iced == WATER_COMPLETE) { + char tempm[SMALLBUFLEN]; + // text + if (watertime > 0) { + sprintf(tempm, "%d",watertime); + addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &cyan,&black,15); + } + // never reach hurryup time + nexthurryup++; + // decrement counter + watertime--; + if (watertime < 0) { + // finished! + curlevel->iced = B_FALSE; + undoflood(); + } } } + /* check for hurryup*/ if (!isbosslevel(curlevelnum)) { if (gtime == nexthurryup) { @@ -755,6 +784,7 @@ void tick(void) { void nextlevel(void) { char msg[SMALLBUFLEN]; sprite_t *cloudp; + int x,y; // remove the player removesprite(player); @@ -779,6 +809,14 @@ void nextlevel(void) { loadlevel(curworld,curlevelnum, B_TRUE); } + // remmeber layer 2 in case we replace it with water + for (y = 0 ; y < LEVELH; y++) { + for (x = 0 ; x < LEVELW; x++) { + savemap[y*LEVELW+x] = curlevel->map2[y*LEVELW+x]; + } + } + watertime = -1; + // do the moving to next level animation drawlevel(); @@ -1014,6 +1052,14 @@ void die(sprite_t *s) { } } + // undo water effect + if (s == player) { + if (curlevel->iced == WATER_COMPLETE) { + undoflood(); + curlevel->iced = B_FALSE; + } + } + // boss effects if (s == boss) { // stop screen shaking @@ -4712,6 +4758,8 @@ int dofruiteffect(sprite_t *s) { if (!curlevel->iced) { curlevel->iced = WATER_INPROGRESS; curlevel->icey = LEVELH-1; + // water for 20 seconds + watertime = 20; } return B_TRUE; } else if (s->id == P_SNOWMAN) { @@ -5597,7 +5645,7 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) { } } -// slowly change leve to water +// slowly change level to water void doflood(void) { int yy,xx,changed; int l2id; @@ -5661,6 +5709,18 @@ void doflood(void) { } } +// put flood effect back to normal +void undoflood(void) { + int x,y; + for (y = 0 ; y < LEVELH; y++) { + for (x = 0 ; x < LEVELW; x++) { + curlevel->map2[y*LEVELW+x] = savemap[y*LEVELW+x]; + drawtile(temps, x, y); + } + } + +} + int haspowerup(sprite_t *s, int pid) { switch (pid) { diff --git a/rc.h b/rc.h index 34a6895..92c642a 100644 --- a/rc.h +++ b/rc.h @@ -53,6 +53,7 @@ void addscore(sprite_t *s, int amt); void extralife(sprite_t *s); void doice(void); void doflood(void); +void undoflood(void); void checklevelend(void); void checksprites(void); void moveallsprites(void); diff --git a/shared.c b/shared.c index ee78dae..d5dd6d4 100644 --- a/shared.c +++ b/shared.c @@ -2641,6 +2641,8 @@ void setfruitinfo(void) { setinfo(P_GEMRED, "Red Gem", "", "gem-red.png"); setinfo(P_GEMPURPLE, "Purple Gem", "", "gem-purple.png"); + setinfo(P_FIRSTCARD, "Card", "Keep a look out for these useful items. Collect a full poker hand for a secret bonus!", "cardh.png"); + setinfo(P_SPEED, "Speed Up", "Makes you walk faster.", "speed.png"); setinfo(P_NUMNETS, "More Nets", "Increases the number of monsters you can catch simultaneously.", "numnets.png"); @@ -2724,6 +2726,11 @@ void dumpinfo(void) { spriteinfo[i].file, spriteinfo[i].name,spriteinfo[i].desc); } } + // card + printf("