[Super-tux-commit] supertux/src Makefile.am,1.19,1.20 intro.cpp,1.15,1.16 intro.h,1.3,1.4 music_mana
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-25 18:34:32
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4882 Modified Files: Makefile.am intro.cpp intro.h music_manager.cpp player.cpp setup.cpp Log Message: - added intro text Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Makefile.am 24 Apr 2004 14:49:03 -0000 1.19 +++ Makefile.am 25 Apr 2004 14:27:49 -0000 1.20 @@ -11,6 +11,8 @@ collision.h \ configfile.cpp \ configfile.h \ +intro.cpp \ +intro.h \ defines.h \ gameloop.cpp \ gameloop.h \ Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- setup.cpp 24 Apr 2004 17:48:49 -0000 1.55 +++ setup.cpp 25 Apr 2004 14:27:49 -0000 1.56 @@ -50,6 +50,7 @@ #include "scene.h" #include "worldmap.h" #include "resources.h" +#include "intro.h" #include "music_manager.h" #include "player.h" @@ -490,10 +491,17 @@ if(slot != -1 && load_game_menu->get_item(slot).kind == MN_ACTION) { - WorldMapNS::WorldMap worldmap; - char slotfile[1024]; snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1); + + if (access(slotfile, F_OK) != 0) + { + std::cout << "Draw intro" << std::endl; + draw_intro(); + } + std::cout << "XXXDraw intro" << std::endl; + + WorldMapNS::WorldMap worldmap; // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); Index: intro.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/intro.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- intro.cpp 20 Apr 2004 11:09:33 -0000 1.15 +++ intro.cpp 25 Apr 2004 14:27:49 -0000 1.16 @@ -17,6 +17,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -32,6 +33,7 @@ #include "globals.h" #include "intro.h" #include "screen.h" +#include "text.h" #include "texture.h" #include "timer.h" @@ -43,268 +45,47 @@ }; -/* --- INTRO --- */ - -int intro(void) +void draw_intro() { - SDL_Event event; - texture_type bkgd, copter_squish, copter_stretch, beam, - gown_sit, gown_lookup, gown_upset, - tux_sit, tux_upset, tux_mad; - texture_type copter[2]; - SDL_Rect src, dest; - int done, i, quit, j, scene; - int * height, * height_speed; - Timer timer; - - /* Load sprite images: */ - texture_load(&bkgd, datadir + "/images/intro/intro.png", IGNORE_ALPHA); - texture_load(&gown_sit, datadir + "/images/intro/gown-sit.png", USE_ALPHA); - texture_load(&gown_lookup, datadir + "/images/intro/gown-lookup.png", USE_ALPHA); - texture_load(&gown_upset, datadir + "/images/intro/gown-upset.png", USE_ALPHA); - texture_load(&tux_sit, datadir + "/images/intro/tux-sit.png", USE_ALPHA); - texture_load(&tux_upset, datadir + "/images/intro/tux-upset.png", USE_ALPHA); - texture_load(&tux_mad, datadir + "/images/intro/tux-mad.png", USE_ALPHA); - texture_load(&copter[0], datadir + "/images/intro/copter1.png", USE_ALPHA); - texture_load(&copter[1], datadir + "/images/intro/copter2.png", USE_ALPHA); - texture_load(&copter_squish, datadir + "/images/intro/copter-squish.png", USE_ALPHA); - texture_load(&copter_stretch, datadir + "/images/intro/copter-stretch.png", USE_ALPHA); - texture_load(&beam, datadir + "/images/intro/beam.png", USE_ALPHA); - - /* Allocate buffer for height array: */ - - height = (int*) malloc(sizeof(int) * (gown_upset.w)); - height_speed = (int*) malloc(sizeof(int) * (gown_upset.w)); - - - /* Initialize height arrays: */ - - for (j = 0; j < (gown_upset.w); j++) - { - height[j] = 400; - height_speed[j] = (rand() % 10) + 1; - } - - /* Display background: */ - - texture_draw_bg(&bkgd, 255, UPDATE); - - /* Animation: */ - - done = 0; - quit = 0; - scene = 0; - i = 0; - - timer.init(false); - timer.start(10000); + bool done = false; - while (timer.check() && !done && !quit) + while (!done) { + SDL_Event event; + drawgradient(Color(155, 200, 255), Color(255, 255, 255)); + gold_text->draw_align("Gwen gets captured!", screen->w/2, 15, A_HMIDDLE, A_TOP); - done = wait_for_event(event,0); - if(done == 2) - { - quit = 1; - done = 0; - } - - - /* Display background: */ - - /* Draw things: */ - - if (timer.get_gone() < 2000 && scene == 0) - { - ++scene; - /* Gown and tux sitting: */ - - texture_draw(&tux_sit, 270, 400, 255, UPDATE); - texture_draw(&gown_sit, 320, 400, 255, UPDATE); - - text_drawf(&white_text, intro_text[0], 0, -8, A_HMIDDLE, A_BOTTOM, 0); - } - - - if (timer.get_gone() >= 2000 && scene == 1) - { - ++scene; - /* Helicopter begins to fly in: */ - - 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); - } - - - if (timer.get_gone() >= 2000 && timer.get_gone() < 4000) - { - /* Helicopter flying in: */ - texture_draw_part(&bkgd,0,32, 0, 32, screen->w, (copter[0].h)); - - texture_draw(&copter[i % 2], - (float)(timer.get_gone() - 2000) / 5 - (copter[0].w), 32); - - update_rect(screen, 0, 32, screen->w, (copter[0].h)); - } - - - if (timer.get_gone() >= 2500 && scene == 2) - { - ++scene; - /* Gown notices something... */ - - texture_draw(&gown_lookup, 320, 400, 255, UPDATE); - } - - - if (timer.get_gone() >= 3500 && scene == 3) - { - ++scene; - /* Gown realizes it's bad! */ - - texture_draw(&gown_upset, 320, 400, 255, UPDATE); - } - - - if (timer.get_gone() >= 4000 && timer.get_gone() < 8000) - { - /* Helicopter sits: */ - texture_draw_part(&bkgd,0,32, 0, 32, screen->w, (copter[0].h)); - - texture_draw(&copter[i % 2], 400 - (copter[0].w), 32); - update_rect(screen, 0, 32, screen->w, (copter[0].h)); - } - - - if (timer.get_gone() >= 5000 && scene == 4) - { - ++scene; - /* Tux realizes something's happening: */ - - texture_draw(&tux_upset, 270, 400, 255, UPDATE); - - - erasecenteredtext(&white_text, intro_text[1], 454, &bkgd, UPDATE, 1); - text_drawf(&white_text, intro_text[2], 0,-8, A_HMIDDLE, A_BOTTOM, 0); - } - - - if (timer.get_gone() >= 5000 && timer.get_gone() <= 8000) - { - /* Beam gown up! */ - - texture_draw_part(&bkgd, - 310, 32 + (copter[0].h), 310, - 32 + (copter[0].h), - (gown_upset.w) + 20, - 376 + (gown_upset.h) - (copter[0].h)); - - - for (j = 0; j < (gown_upset.sdl_surface -> w); j++) - { - texture_draw(&beam, 320 + j - ((beam.w) / 2), height[j]); - - src.x = j; - src.y = 0; - src.w = 1; - src.h = (gown_upset.h); - - dest.x = 320 + j; - dest.y = height[j]; - dest.w = src.w; - dest.h = src.h; - - texture_draw_part(&gown_upset,src.x,src.y,dest.x,dest.y,dest.w,dest.h); - - height[j] = 400 + rand() % 10 - (int)(300. * ((float)(timer.get_gone() - 5000)/(float)3000.)); - if(height[j] < 105) - height[j] = 105; - } - - update_rect(screen, - 310, - 32 + (copter[0].h), - (gown_upset.w) + 20, - 400 + (gown_upset.h) - (copter[0].h)); - } - - - if (timer.get_gone() >= 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)); - - ++scene; - /* Tux gets mad! */ - - texture_draw(&tux_mad, 270, 400, UPDATE); - - erasecenteredtext(&white_text, intro_text[2], 454, &bkgd, UPDATE, 1); - text_drawf(&white_text, intro_text[3], 0,-8, A_HMIDDLE, A_BOTTOM, 0); - } - - - if (timer.get_gone() >= 8000 && timer.get_gone() <= 8250) - { - /* Helicopter starting to speed off: */ - - texture_draw_part(&bkgd, 0, 32, 0, 32, screen->w, (copter_squish.h)); - - texture_draw(&copter_squish, - 400 - (copter[0].w), 32); - - update_rect(screen, 0, 32, screen->w, (copter_squish.h)); - } - - - if (timer.get_gone() >= 8250) - { - /* Helicopter speeding off: */ - - texture_draw_part(&bkgd, 0, 32, 0, 32, screen->w, (copter_stretch.h)); - - texture_draw(&copter_stretch, - (timer.get_gone() - 8250) /*(i - (8250 / FPS)) * 30*/ + 400 - (copter[0].w), - 32); + white_text->draw + ("\n" // + "Tux and Gwen were out having a nice\n" + "picnic on the ice fields of Antarctica.\n" + "Suddenly, a creature jumped from\n" + "behind an ice bush, there was a flash,\n" + "and Tux fell asleep!\n" + "\n" // + "When Tux wakes up, he finds that Gwen\n" + "is missing. Where she lay before now\n" + "lies a letter. \"Tux, my arch enemy!\"\n" + "says the letter. \"I have captured\n" + "your beautiful Gwen and have taken her\n" + "to my fortress. The path to my fortress\n" + "is littered with my minions. Give up on the\n" + "thought of trying to reclaim her, you\n" + "haven't a chance! -Nolok\"\n" + "\n" + "Tux looks and see Nolok's fortress in\n" + "the distance. Determined to save his\n" + "beloved Gwen, he begins his journey.", + -5, 30); - update_rect(screen, 0, 32, screen->w, (copter_stretch.h)); - } + white_small_text->draw_align("Press any button to continue!", + screen->w/2, screen->h - 20, A_HMIDDLE, A_TOP); flipscreen(); + SDL_Delay(100); - ++i; - /* Pause: */ - SDL_Delay(20); + done = wait_for_event(event,0); } - - - /* Free surfaces: */ - - delete bkgd; - delete gown_sit; - delete gown_lookup; - delete gown_upset; - delete tux_sit; - delete tux_upset; - delete tux_mad; - delete copter[0]; - delete copter[1]; - delete copter_squish; - delete copter_stretch; - delete beam; - - - /* Free array buffers: */ - - free(height); - free(height_speed); - - - /* Return to main! */ - - return(quit); } + Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- player.cpp 24 Apr 2004 13:12:12 -0000 1.60 +++ player.cpp 25 Apr 2004 14:27:49 -0000 1.61 @@ -31,6 +31,7 @@ Surface* tux_life; std::vector<Surface*> tux_right; std::vector<Surface*> tux_left; + Surface* smalltux_jump_left; Surface* smalltux_jump_right; Surface* smalltux_stand_left; @@ -38,33 +39,31 @@ Sprite* smalltux_gameover; Sprite* smalltux_skid_left; Sprite* smalltux_skid_right; - Sprite* smalltux_kick_left; Sprite* smalltux_kick_right; Sprite* smalltux_grab_left; Sprite* smalltux_grab_right; - Sprite* smalltux_star; -Sprite* largetux_star; - -Sprite* largetux_kick_left; -Sprite* largetux_kick_right; -Sprite* largetux_grab_left; -Sprite* largetux_grab_right; - -Sprite* largetux_stand_left; -Sprite* largetux_stand_right; +Sprite* largetux_star; +Sprite* largetux_kick_left; +Sprite* largetux_kick_right; +Sprite* largetux_grab_left; +Sprite* largetux_grab_right; +Sprite* largetux_stand_left; +Sprite* largetux_stand_right; Sprite* bigtux_right; Sprite* bigtux_left; Sprite* bigtux_right_jump; Sprite* bigtux_left_jump; Sprite* ducktux_right; Sprite* ducktux_left; + Surface* skidtux_right; Surface* skidtux_left; Surface* firetux_right[3]; Surface* firetux_left[3]; + Surface* bigfiretux_right[3]; Surface* bigfiretux_left[3]; Surface* bigfiretux_right_jump; @@ -73,6 +72,7 @@ Surface* duckfiretux_left; Surface* skidfiretux_right; Surface* skidfiretux_left; + Surface* cape_right[2]; Surface* cape_left[2]; Index: intro.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/intro.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- intro.h 20 Apr 2004 11:09:33 -0000 1.3 +++ intro.h 25 Apr 2004 14:27:49 -0000 1.4 @@ -17,7 +17,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -int intro(void); +void draw_intro(); /* Local Variables: */ /* mode:c++ */ Index: music_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/music_manager.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- music_manager.cpp 24 Apr 2004 14:49:03 -0000 1.1 +++ music_manager.cpp 25 Apr 2004 14:27:49 -0000 1.2 @@ -24,7 +24,7 @@ #include "setup.h" MusicManager::MusicManager() - : music_enabled(true) + : current_music(0), music_enabled(true) { } MusicManager::~MusicManager() |