X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fintro.c;h=b0db71c3f104c164d070f74fd095f477bf03b859;hb=d5b8b9238d97594bed04626c9629913de781251a;hp=2e106acb4f6c7a53eba097e180b3617e17e2a08c;hpb=43ae91e84ae574464a2ff634daa8a16e253b47fa;p=supertux.git diff --git a/src/intro.c b/src/intro.c index 2e106acb4..b0db71c3f 100644 --- a/src/intro.c +++ b/src/intro.c @@ -2,12 +2,12 @@ intro.c Super Tux - Intro Screen - + by Bill Kendrick bill@newbreedsoftware.com http://www.newbreedsoftware.com/supertux/ - April 11, 2000 - April 23, 2000 + April 11, 2000 - February 1st, 2004 */ #include @@ -52,11 +52,9 @@ int intro(void) int done, i, quit, j, scene; int * height, * height_speed; timer_type timer; - - + /* Load sprite images: */ - - texture_load(&bkgd, DATA_PREFIX "/images/intro/intro.png", IGNORE_ALPHA); + texture_load(&bkgd, DATA_PREFIX "/images/intro/intro.png", IGNORE_ALPHA); texture_load(&gown_sit, DATA_PREFIX "/images/intro/gown-sit.png", USE_ALPHA); texture_load(&gown_lookup, DATA_PREFIX "/images/intro/gown-lookup.png", USE_ALPHA); texture_load(&gown_upset, DATA_PREFIX "/images/intro/gown-upset.png", USE_ALPHA); @@ -71,8 +69,8 @@ int intro(void) /* Allocate buffer for height array: */ - height = malloc(sizeof(int) * (gown_upset.w)); - height_speed = malloc(sizeof(int) * (gown_upset.w)); + height = (int*) malloc(sizeof(int) * (gown_upset.w)); + height_speed = (int*) malloc(sizeof(int) * (gown_upset.w)); /* Initialize height arrays: */ @@ -94,6 +92,7 @@ int intro(void) scene = 0; i = 0; + timer_init(&timer,NO); timer_start(&timer,10000); while (timer_check(&timer) && !done && !quit) @@ -138,7 +137,7 @@ int intro(void) texture_draw(&tux_sit, 270, 400, UPDATE); texture_draw(&gown_sit, 320, 400, UPDATE); - drawcenteredtext(intro_text[0], 456, letters_blue, UPDATE, 1); + text_drawf(&white_text, intro_text[0], 0, -8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE); } @@ -147,15 +146,15 @@ int intro(void) ++scene; /* Helicopter begins to fly in: */ - erasecenteredtext(intro_text[0], 456, bkgd.sdl_surface, NO_UPDATE, 1); - drawcenteredtext(intro_text[1], 456, letters_red, NO_UPDATE, 1); + erasecenteredtext(&white_text, intro_text[0], 454, &bkgd, NO_UPDATE, 1); + text_drawf(&white_text, intro_text[1], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE); } if (timer_get_gone(&timer) >= 2000 && timer_get_gone(&timer) < 4000) { /* Helicopter flying in: */ - texture_draw_part(&bkgd, 0, 32, screen->w, (copter[0].h), NO_UPDATE); + texture_draw_part(&bkgd,0,32, 0, 32, screen->w, (copter[0].h), NO_UPDATE); texture_draw(&copter[i % 2], (float)(timer_get_gone(&timer) - 2000) / 5 - (copter[0].w), 32, @@ -186,7 +185,7 @@ int intro(void) if (timer_get_gone(&timer) >= 4000 && timer_get_gone(&timer) < 8000) { /* Helicopter sits: */ - texture_draw_part(&bkgd, 0, 32, screen->w, (copter[0].h), NO_UPDATE); + texture_draw_part(&bkgd,0,32, 0, 32, screen->w, (copter[0].h), NO_UPDATE); texture_draw(&copter[i % 2], 400 - (copter[0].w), 32, NO_UPDATE); update_rect(screen, 0, 32, screen->w, (copter[0].h)); @@ -201,20 +200,20 @@ int intro(void) texture_draw(&tux_upset, 270, 400, UPDATE); - erasecenteredtext(intro_text[1], 456, bkgd.sdl_surface, UPDATE, 1); - drawcenteredtext(intro_text[2], 456, letters_red, UPDATE, 1); + erasecenteredtext(&white_text, intro_text[1], 454, &bkgd, UPDATE, 1); + text_drawf(&white_text, intro_text[2], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE); } - if (timer_get_gone(&timer) >= 5000) + if (timer_get_gone(&timer) >= 5000 && timer_get_gone(&timer) <= 8000) { /* Beam gown up! */ texture_draw_part(&bkgd, - 320, + 310, 32 + (copter[0].h), 310, 32 + (copter[0].h), - (gown_upset.w), - 368 + (gown_upset.h) - (copter[0].h), NO_UPDATE); + (gown_upset.w) + 20, + 376 + (gown_upset.h) - (copter[0].h), NO_UPDATE); for (j = 0; j < (gown_upset.sdl_surface -> w); j++) @@ -232,31 +231,36 @@ int intro(void) dest.w = src.w; dest.h = src.h; - SDL_BlitSurface(gown_upset.sdl_surface, &src, screen, &dest); - - height[j] = height[j] - height_speed[j]; + texture_draw_part(&gown_upset,src.x,src.y,dest.x,dest.y,dest.w,dest.h,NO_UPDATE); - if ((i % 2) == 0) - height_speed[j]++; + height[j] = 400 + rand() % 10 - (int)(300. * ((float)(timer_get_gone(&timer) - 5000)/(float)3000.)); + if(height[j] < 105) + height[j] = 105; } update_rect(screen, - 320, + 310, 32 + (copter[0].h), - (gown_upset.w), + (gown_upset.w) + 20, 400 + (gown_upset.h) - (copter[0].h)); } if (timer_get_gone(&timer) >= 8000 && scene == 5) { + texture_draw_part(&bkgd, + 310, 32 + (copter[0].h), 310, + 32 + (copter[0].h), + (gown_upset.w) + 20, + 368 + (gown_upset.h) - (copter[0].h), NO_UPDATE); + ++scene; /* Tux gets mad! */ texture_draw(&tux_mad, 270, 400, UPDATE); - erasecenteredtext(intro_text[2], 456, bkgd.sdl_surface, UPDATE, 1); - drawcenteredtext(intro_text[3], 456, letters_gold, UPDATE, 1); + erasecenteredtext(&white_text, intro_text[2], 454, &bkgd, UPDATE, 1); + text_drawf(&white_text, intro_text[3], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE); } @@ -264,7 +268,7 @@ int intro(void) { /* Helicopter starting to speed off: */ - texture_draw_part(&bkgd, 0, 32, screen->w, (copter_squish.h), NO_UPDATE); + texture_draw_part(&bkgd, 0, 32, 0, 32, screen->w, (copter_squish.h), NO_UPDATE); texture_draw(&copter_squish, 400 - (copter[0].w), 32, @@ -278,7 +282,7 @@ int intro(void) { /* Helicopter speeding off: */ - texture_draw_part(&bkgd, 0, 32, screen->w, (copter_stretch.h), NO_UPDATE); + texture_draw_part(&bkgd, 0, 32, 0, 32, screen->w, (copter_stretch.h), NO_UPDATE); texture_draw(&copter_stretch, (timer_get_gone(&timer) - 8250) /*(i - (8250 / FPS)) * 30*/ + 400 - (copter[0].w),