diff --git a/rc.c b/rc.c index 30393f1..d412f0f 100644 --- a/rc.c +++ b/rc.c @@ -552,6 +552,15 @@ int main (int argc, char **argv) { + // warning for cloud + if ((gtime >= nexthurryup + 10) && (gtime < nexthurryup+15)) { // 15 secs after hurryup + if (timer % 4 == 0) { + // add puffs + puffin(-1, 320 + (rand() % (TILEW*4)) - (TILEW*2), + 240 + (rand() % (TILEH*2)) - TILEH, "cloudwarn", rand() % 5); + } + } + // poker effect // this must come last as it clears the screen and blanks out other sprites if (levelcomplete == LV_DOPOKER) { @@ -824,7 +833,9 @@ void tick(void) { } } else if (gtime == nexthurryup + 15) { // 15 secs after hurryup if (!levelcomplete) { - addsprite(P_BLACKCLOUD, 320,240,"cloud"); + sprite_t *bc; + bc = addsprite(P_BLACKCLOUD, 320,240,"cloud"); + makeinvuln(bc); addoutlinetext(320,240,TEXTSIZE_HURRY, "Too slow!", &red,&black,HURRYDELAY, TT_NORM); playfx(FX_TOOSLOW); } @@ -2938,51 +2949,66 @@ if (s->id == P_PUFF) printf("PUFF WITH DOOMCOUNT!\n"); s->y--; } } else { - if ((s->xs == -99) || (s->ys == -99)) { - s->ys = 0.5; - s->xs = 1; - } + if (!s->invuln) { + if ((s->xs == -99) || (s->ys == -99)) { + if (player->y > s->y) { + s->ys = 0.5; + } else { + s->ys = -0.5; + } + if (player->x > s->x) { + s->xs = 1; + } else { + s->xs = -1; + } + } - s->x += s->xs; - s->y += s->ys; + s->x += s->xs; + s->y += s->ys; - if (s->x >= (640 - s->img->w/2)) { - s->xs = -s->xs; - s->x = 640 - s->img->w/2; - } - if (s->x <= (s->img->w/2)) { - s->xs = -s->xs; - s->x = s->img->w/2; - } - if (s->y >= (480 - s->img->h)) { - s->ys = -s->ys; - s->y = 480 - s->img->h; - } - if (s->y <= (s->img->h)) { - s->ys = -s->ys; - s->y = s->img->h; - } + if (s->x >= (640 - s->img->w/2)) { + s->xs = -s->xs; + s->x = 640 - s->img->w/2; + } + if (s->x <= (s->img->w/2)) { + s->xs = -s->xs; + s->x = s->img->w/2; + } + //if (s->y >= (480 - s->img->h)) { + if (s->y >= 480-1) { + s->ys = -s->ys; + //s->y = 480 - s->img->h; + s->y = 480-1; + } + if (s->y <= (s->img->h)) { + s->ys = -s->ys; + s->y = s->img->h; + } - if (timer % CLOUDGROWSPEED == 0) { - //int w,h; - SDL_Surface *ts, *cloudim; + //if (timer % CLOUDGROWSPEED == 0) { + if (1) { + double growamt; + //int w,h; + SDL_Surface *ts, *cloudim; - cloudim = imageset[P_BLACKCLOUD].img[F_WALK1]; - //w = s->img->w; - //h = s->img->h; - //ts = rotozoomSurfaceXY(s->img,0, 1.1 , 1.1 ,0); - s->size += CLOUDGROWAMT; -//printf("grow, now %0.2f\n",s->size); - // TODO: free old first? depends if we ever use a preset one - ts = rotozoomSurfaceXY(cloudim,0,s->size, s->size, 0); - SDL_FreeSurface(s->img); - s->img = ts; + cloudim = imageset[P_BLACKCLOUD].img[F_WALK1]; + //w = s->img->w; + //h = s->img->h; + //ts = rotozoomSurfaceXY(s->img,0, 1.1 , 1.1 ,0); + growamt = ((double)CLOUDGROWAMT / (double)CLOUDGROWSPEED); + s->size += growamt; + //printf("grow, now %0.2f\n",s->size); + // TODO: free old first? depends if we ever use a preset one + ts = rotozoomSurfaceXY(cloudim,0,s->size, s->size, 0); + SDL_FreeSurface(s->img); + s->img = ts; - s->y += 2; + s->y += growamt; - } + } + } // end if !s->invuln } }