[Super-tux-commit] supertux/src defines.h,1.27,1.28 intro.cpp,1.18,1.19 text.cpp,1.17,1.18 text.h,1.
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-04-29 02:39:24
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29487/src Modified Files: defines.h intro.cpp text.cpp text.h title.cpp worldmap.cpp Log Message: Made display_text_file() to get the scroll speed as an argument. This way we can make the intro slower than the credits, for instance. It was just impossible to read them. Anyway, you can easily change their speed in defines.h . Also fixes a bug that was making the text to take while before starting to be displayed. Index: text.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/text.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- text.cpp 28 Apr 2004 13:18:54 -0000 1.17 +++ text.cpp 28 Apr 2004 14:58:24 -0000 1.18 @@ -221,22 +221,23 @@ /* --- SCROLL TEXT FUNCTION --- */ -#define MAX_VEL 10 -#define SPEED 1 -#define SCROLL 60 +#define MAX_VEL 10 +#define SPEED_INC 1.0 +#define SCROLL 60 #define ITEMS_SPACE 4 -void display_text_file(const std::string& file, const std::string& surface) +void display_text_file(const std::string& file, const std::string& surface, float scroll_speed) { Surface* sur = new Surface(datadir + surface, IGNORE_ALPHA); - display_text_file(file, sur); + display_text_file(file, sur, scroll_speed); delete sur; } -void display_text_file(const std::string& file, Surface* surface) +void display_text_file(const std::string& file, Surface* surface, float scroll_speed) { int done; - int scroll, speed; + int scroll; + float speed; int y; int length; FILE* fi; @@ -265,7 +266,7 @@ scroll = 0; - speed = 2; + speed = scroll_speed; done = 0; length = names.num_items; @@ -283,10 +284,10 @@ switch(event.key.keysym.sym) { case SDLK_UP: - speed -= SPEED; + speed -= SPEED_INC; break; case SDLK_DOWN: - speed += SPEED; + speed += SPEED_INC; break; case SDLK_SPACE: case SDLK_RETURN: @@ -321,19 +322,19 @@ switch(names.item[i][0]) { case ' ': - white_small_text->drawf(names.item[i]+1, 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); + white_small_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); y += white_small_text->h+ITEMS_SPACE; break; case ' ': - white_text->drawf(names.item[i]+1, 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); + white_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); y += white_text->h+ITEMS_SPACE; break; case '-': - white_big_text->drawf(names.item[i]+1, 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 3); + white_big_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 3); y += white_big_text->h+ITEMS_SPACE; break; default: - blue_text->drawf(names.item[i], 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); + blue_text->drawf(names.item[i], 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1); y += blue_text->h+ITEMS_SPACE; break; } @@ -341,10 +342,10 @@ flipscreen(); - if(60+screen->h+y-scroll < 0 && 20+60+screen->h+y-scroll < 0) + if(screen->h+y-scroll < 0 && 20+screen->h+y-scroll < 0) done = 1; - scroll += speed; + scroll += (int)speed; if(scroll < 0) scroll = 0; Index: defines.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/defines.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- defines.h 27 Apr 2004 18:55:57 -0000 1.27 +++ defines.h 28 Apr 2004 14:58:24 -0000 1.28 @@ -89,6 +89,11 @@ #define KICKING_TIME 200 +/* Scrolling text speed */ + +#define SCROLL_SPEED_CREDITS 2.0 +#define SCROLL_SPEED_MESSAGE 1.0 + /* Debugging */ #ifdef DEBUG Index: text.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/text.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- text.h 27 Apr 2004 15:15:18 -0000 1.14 +++ text.h 28 Apr 2004 14:58:24 -0000 1.15 @@ -24,8 +24,8 @@ #include <string> #include "texture.h" -void display_text_file(const std::string& file, const std::string& surface); -void display_text_file(const std::string& file, Surface* surface); +void display_text_file(const std::string& file, const std::string& surface, float scroll_speed); +void display_text_file(const std::string& file, Surface* surface, float scroll_speed); /* Kinds of texts. */ enum { Index: intro.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/intro.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- intro.cpp 26 Apr 2004 17:35:08 -0000 1.18 +++ intro.cpp 28 Apr 2004 14:58:24 -0000 1.19 @@ -33,6 +33,6 @@ void draw_intro() { -display_text_file("intro.txt", "/images/background/arctis2.jpg"); +display_text_file("intro.txt", "/images/background/arctis2.jpg", SCROLL_SPEED_MESSAGE); } Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- title.cpp 28 Apr 2004 13:18:54 -0000 1.65 +++ title.cpp 28 Apr 2004 14:58:24 -0000 1.66 @@ -313,7 +313,7 @@ Menu::set_current(main_menu); break; case MNID_CREDITS: - display_text_file("CREDITS", bkg_title); + display_text_file("CREDITS", bkg_title, SCROLL_SPEED_CREDITS); Menu::set_current(main_menu); break; case MNID_QUITMAINMENU: Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- worldmap.cpp 28 Apr 2004 14:02:02 -0000 1.62 +++ worldmap.cpp 28 Apr 2004 14:58:24 -0000 1.63 @@ -683,9 +683,9 @@ if (!level->extro_filename.empty()) { // Display final credits and go back to the main menu display_text_file(level->extro_filename, - "/images/background/extro.jpg"); + "/images/background/extro.jpg", SCROLL_SPEED_MESSAGE); display_text_file("CREDITS", - "/images/background/oiltux.jpg"); + "/images/background/oiltux.jpg", SCROLL_SPEED_CREDITS); quit = true; } } |