super-tux-commit Mailing List for Super Tux (Page 4)
Brought to you by:
wkendrick
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(94) |
Apr
(500) |
May
(531) |
Jun
(196) |
Jul
(224) |
Aug
(193) |
Sep
(117) |
Oct
(115) |
Nov
(319) |
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
|
Mar
(105) |
Apr
(41) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(7) |
Oct
(12) |
Nov
(26) |
Dec
(39) |
2009 |
Jan
(6) |
Feb
(15) |
Mar
(10) |
Apr
(25) |
May
(29) |
Jun
(21) |
Jul
(26) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
From: S.Groundwater <gro...@us...> - 2005-03-31 02:53:07
|
Update of /cvsroot/super-tux/supertux/data/images/background In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28152 Modified Files: arctis_dark.jpg Log Message: fixed missing bottom/ pixels Index: arctis_dark.jpg =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/background/arctis_dark.jpg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsPVSkIh and /tmp/cvsiP7W1h differ |
From: S.Groundwater <gro...@us...> - 2005-03-31 02:29:02
|
Update of /cvsroot/super-tux/supertux/contrib/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13622/contrib/images/shared Added Files: hatch-1.png hatch-2.png hatch-3.png hatch-4.png hatch-5.png Log Message: hatch animation graphics --- NEW FILE: hatch-5.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hatch-4.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hatch-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hatch-3.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hatch-2.png --- (This appears to be a binary file; contents omitted.) |
From: S.Groundwater <gro...@us...> - 2005-03-31 02:24:44
|
Update of /cvsroot/super-tux/supertux/contrib/images/shared/hatch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11203/contrib/images/shared/hatch Log Message: Directory /cvsroot/super-tux/supertux/contrib/images/shared/hatch added to the repository |
From: Ryan F. <sik...@us...> - 2005-03-30 23:30:06
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6813 Added Files: supertux.xpm Removed Files: SuperTux.xpm Log Message: Fixed case on file. Please try to keep things lowercase.. remember that most operating systems are case sensitive. --- NEW FILE: supertux.xpm --- /* XPM */ static char * supertux_xpm[] = { "32 32 65 1", " c None", ". c #020400", "+ c #10120F", "@ c #1E1D02", "# c #1A1B19", "$ c #262827", "% c #333534", "& c #413517", "* c #3C342A", "= c #424341", "- c #514714", "; c #52492B", "> c #444A4F", ", c #3D4D60", "' c #51524F", ") c #5C5E5B", "! c #5A646F", "~ c #696648", "{ c #7A6A1D", "] c #55708B", "^ c #8E6635", "/ c #7D7232", "( c #70716E", "_ c #597E9E", ": c #978123", "< c #908234", "[ c #6D8297", "} c #A3783C", "| c #838481", "1 c #9C8E14", "2 c #9A9072", "3 c #BF8940", "4 c #939490", "5 c #A79D3A", "6 c #929799", "7 c #84A2BB", "8 c #72A6DC", "9 c #AC9B7E", "0 c #6BA7F2", "a c #BFA525", "b c #6DB1F1", "c c #B9A960", "d c #A7A7A1", "e c #8AB7E1", "f c #A1BBA6", "g c #88BBF1", "h c #DFB23E", "i c #9EB9CE", "j c #D3C30E", "k c #CEBE46", "l c #B3C396", "m c #DAC437", "n c #C2C985", "o c #C0C2BF", "p c #A2CBF4", "q c #ECCB2C", "r c #E5DA1D", "s c #CDCDB4", "t c #B7D4ED", "u c #D0D2CF", "v c #D3DAE1", "w c #C7E2F7", "x c #DFE1DD", "y c #EAECE9", "z c #FAFCF9", " ", " gg ", " gppg ", " eppeeg ", " e7[!,]_8 ", " ])'=%#..$, ", " [>)'=$+++.._ ", " 7!''=%#%|6!.,8 ", " p!>)>=$$>v|.+#78 ", " pi%=''=%#'u..&:knlf ", " pw7$=>=>%##'%:amqqqmmm ", " ptt]#%=%%$...+^3hhqhhhk ", " twt7%#%%$.#....*^}}9di7g ", " pwwt,#%=%$.......#*'ebbbb0 ", " twwt6$$>%$#......=|d67ggbgb0 ", " twww7,%===%#.....$4vzzxegbbbb0 ", " pwww[$=>==$#..+#=|xzzzzvebbbb0 ", " twv>%='=%$...$'4uyzzzzzi8bb0 ", " pt,%'>=%#...#>|vyzzzzziei8 ", " ps~%''%$######$(yzzzzzunrk ", " ch/''=$###$$$##6yzzzzsmj1 ", " cam^'%%##.#)!)=6vyzzzdk: ", " <ah/=%$#..(oooovxyyx2< ", " ;/am^=%$..!douvouvvu2 ", " .#;<am<%#..$6vuuvuuu2 ", " .+$-:qr{-@..$(ddd4d4 ", " ..#-:ajjm1...##$*; ", " {{:11<[]]'&-{ ", " gppppg ", " gppg ", " gg ", " "}; --- SuperTux.xpm DELETED --- |
From: S.Groundwater <gro...@us...> - 2005-03-30 22:28:29
|
Update of /cvsroot/super-tux/supertux/data/images/background In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1752/data/images/background Added Files: arctis_dark.jpg Log Message: added dark arctis interior backgroung 800x600 --- NEW FILE: arctis_dark.jpg --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2005-03-30 20:50:53
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2594/data/images Modified Files: supertux.strf Log Message: fixed door sprite after shrinking it... Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- supertux.strf 30 Mar 2005 03:01:59 -0000 1.35 +++ supertux.strf 30 Mar 2005 20:50:21 -0000 1.36 @@ -1282,12 +1282,12 @@ (action (name "default") (x-offset 0) - (y-offset 64) + (y-offset 0) (images "shared/door-1.png")) (action (name "open") (x-offset 0) - (y-offset 64) + (y-offset 0) (images "shared/door-1.png" "shared/door-2.png" "shared/door-3.png" |
From: Matze B. <mat...@us...> - 2005-03-30 20:41:30
|
Update of /cvsroot/super-tux/supertux/data/images/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29287 Added Files: infoblock.png Log Message: new editor image for infoblock --- NEW FILE: infoblock.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2005-03-30 18:42:20
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28383/data/images/shared Modified Files: door-1.png door-2.png door-3.png door-4.png door-5.png door-6.png door-7.png door-8.png Removed Files: secretarea.png sequencetrigger.png spawnpoint.png Log Message: some new editor images --- spawnpoint.png DELETED --- Index: door-7.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-7.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsfI4dVB and /tmp/cvsUvJ8DX differ Index: door-8.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-8.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsLwqhFh and /tmp/cvswF3SpF differ --- secretarea.png DELETED --- Index: door-2.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-2.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsBnuwU7 and /tmp/cvsvy2Rkw differ Index: door-3.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-3.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsrssBmU and /tmp/cvspUDoUq differ Index: door-1.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-1.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsTLTroJ and /tmp/cvshFjMht differ Index: door-6.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-6.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvswX8Uk9 and /tmp/cvstENZmX differ --- sequencetrigger.png DELETED --- Index: door-4.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-4.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvs7e9wpi and /tmp/cvsx2tXKk differ Index: door-5.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/door-5.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsu5TAaM and /tmp/cvsv8EXYU differ |
From: Matze B. <mat...@us...> - 2005-03-30 18:41:05
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28383/data/levels/test Modified Files: sectors.stl Log Message: some new editor images Index: sectors.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/sectors.stl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sectors.stl 2 Dec 2004 01:41:55 -0000 1.3 +++ sectors.stl 30 Mar 2005 18:40:11 -0000 1.4 @@ -6,7 +6,6 @@ (sector (name "main") (gravity 10) - (music "supertux-1.ogg") (camera (mode "normal") ) @@ -60,7 +59,6 @@ ) (sector (name "another_world") - (music "supertux-2.ogg") ;(particles-snow) (tilemap (width 200) |
From: Matze B. <mat...@us...> - 2005-03-30 18:40:15
|
Update of /cvsroot/super-tux/supertux/data/images/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28383/data/images/editor Added Files: background.png clouds.png rain.png secretarea.png sequencetrigger.png snow.png spawnpoint.png Log Message: some new editor images --- NEW FILE: rain.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spawnpoint.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snow.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: secretarea.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: background.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sequencetrigger.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: clouds.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2005-03-30 18:38:43
|
Update of /cvsroot/super-tux/supertux/data/images/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27387/data/images/editor Log Message: Directory /cvsroot/super-tux/supertux/data/images/editor added to the repository |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:33
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/lib/video Modified Files: drawing_context.cpp drawing_context.h font.cpp font.h Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- font.cpp 5 Dec 2004 16:57:12 -0000 1.18 +++ font.cpp 30 Mar 2005 12:00:53 -0000 1.19 @@ -119,10 +119,11 @@ } void -Font::draw(const std::string& text, const Vector& pos_, int allignment, Uint32 drawing_effect, int alpha) +Font::draw(const std::string& text, const Vector& pos_, FontAlignment alignment, + uint32_t drawing_effect, uint8_t alpha) const { /* Cut lines changes into seperate strings, needed to support center/right text - allignments with break lines. + alignments with break lines. Feel free to replace this hack with a more elegant solution */ char temp[1024]; @@ -141,11 +142,11 @@ temp[text.copy(temp, l - i, i)] = '\0'; - // calculate X positions based on the allignment type + // calculate X positions based on the alignment type Vector pos = Vector(pos_); - if(allignment == CENTER_ALLIGN) + if(alignment == CENTER_ALLIGN) pos.x -= get_text_width(temp) / 2; - else if(allignment == RIGHT_ALLIGN) + else if(alignment == RIGHT_ALLIGN) pos.x -= get_text_width(temp); draw_text(temp, pos + Vector(0,y), drawing_effect, alpha); @@ -156,7 +157,8 @@ } void -Font::draw_text(const std::string& text, const Vector& pos, Uint32 drawing_effect, int alpha) +Font::draw_text(const std::string& text, const Vector& pos, + uint32_t drawing_effect, uint8_t alpha) const { if(shadowsize > 0) draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize), @@ -167,7 +169,7 @@ void Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos, - Uint32 drawing_effect, int alpha) + uint32_t drawing_effect, uint8_t alpha) const { SurfaceImpl* impl = pchars->impl; @@ -197,170 +199,3 @@ } } -/* --- SCROLL TEXT FUNCTION --- */ - -#define MAX_VEL 10 -#define SPEED_INC 0.01 -#define SCROLL 60 -#define ITEMS_SPACE 4 - -void SuperTux::display_text_file(const std::string& file, float scroll_speed, - Font* heading_font, Font* normal_font, Font* small_font, - Font* reference_font) -{ - std::string text; - std::string background_file; - std::vector<std::string> names; - - std::string filename = datadir + "/" + file; - lisp::Parser parser; - try { - std::auto_ptr<lisp::Lisp> root (parser.parse(filename)); - - const lisp::Lisp* text_lisp = root->get_lisp("supertux-text"); - if(!text_lisp) - throw std::runtime_error("File isn't a supertux-text file"); - - if(!text_lisp->get("text", text)) - throw std::runtime_error("file doesn't contain a text field"); - if(!text_lisp->get("background", background_file)) - throw std::runtime_error("file doesn't contain a background file"); - } catch(std::exception& e) { - std::cerr << "Couldn't load file '" << filename << "': " << e.what() << - "\n"; - return; - } - - // Split text string lines into a vector - names.clear(); - std::string::size_type i, l; - i = 0; - while(true) - { - l = text.find("\n", i); - - if(l == std::string::npos) - { - char temp[1024]; - temp[text.copy(temp, text.size() - i, i)] = '\0'; - names.push_back(temp); - break; - } - - char temp[1024]; - temp[text.copy(temp, l-i, i)] = '\0'; - names.push_back(temp); - - i = l+1; - } - - // load background image - Surface* background = new Surface(datadir + "/images/background/" + background_file, false); - - int done = 0; - float scroll = 0; - float speed = scroll_speed / 50; - float left_border = 50; - - DrawingContext context; - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - - Uint32 lastticks = SDL_GetTicks(); - while(!done) - { - /* in case of input, exit */ - SDL_Event event; - while(SDL_PollEvent(&event)) - switch(event.type) - { - case SDL_KEYDOWN: - switch(event.key.keysym.sym) - { - case SDLK_UP: - speed -= SPEED_INC; - break; - case SDLK_DOWN: - speed += SPEED_INC; - break; - case SDLK_SPACE: - case SDLK_RETURN: - if(speed >= 0) - scroll += SCROLL; - break; - case SDLK_ESCAPE: - done = 1; - break; - default: - break; - } - break; - case SDL_QUIT: - done = 1; - break; - default: - break; - } - - if(speed > MAX_VEL) - speed = MAX_VEL; - else if(speed < -MAX_VEL) - speed = -MAX_VEL; - - /* draw the credits */ - context.draw_surface(background, Vector(0,0), 0); - - float y = 0; - for(size_t i = 0; i < names.size(); i++) { - if(names[i].size() == 0) { - y += normal_font->get_height() + ITEMS_SPACE; - continue; - } - - Font* font = 0; - bool center = true; - switch(names[i][0]) - { - case ' ': font = small_font; break; - case '\t': font = normal_font; break; - case '-': font = heading_font; break; - case '*': font = reference_font; break; - case '#': font = normal_font; center = false; break; - default: - break; - } - - if(font) { - if(center) { - context.draw_text(font, - names[i].substr(1, names[i].size()-1), - Vector(screen->w/2, screen->h + y - scroll), - CENTER_ALLIGN, LAYER_FOREGROUND1); - } else { - context.draw_text(font, - names[i].substr(1, names[i].size()-1), - Vector(left_border, screen->h + y - scroll), - LEFT_ALLIGN, LAYER_FOREGROUND1); - } - } - - y += font->get_height() + ITEMS_SPACE; - } - - context.do_drawing(); - - if(screen->h+y-scroll < 0 && 20+screen->h+y-scroll < 0) - done = 1; - - Uint32 ticks = SDL_GetTicks(); - scroll += speed * (ticks - lastticks); - lastticks = ticks; - if(scroll < 0) - scroll = 0; - - SDL_Delay(10); - } - - SDL_EnableKeyRepeat(0, 0); // disables key repeating - delete background; -} - Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- drawing_context.cpp 24 Nov 2004 14:10:24 -0000 1.13 +++ drawing_context.cpp 30 Mar 2005 12:00:52 -0000 1.14 @@ -39,7 +39,7 @@ void DrawingContext::draw_surface(const Surface* surface, const Vector& position, - int layer, Uint32 drawing_effect) + int layer, uint32_t drawing_effect) { assert(surface != 0); @@ -63,7 +63,7 @@ void DrawingContext::draw_surface_part(const Surface* surface, const Vector& source, - const Vector& size, const Vector& dest, int layer, Uint32 drawing_effect) + const Vector& size, const Vector& dest, int layer, uint32_t drawing_effect) { assert(surface != 0); @@ -101,9 +101,9 @@ } void -DrawingContext::draw_text(Font* font, const std::string& text, - const Vector& position, int allignment, int layer, - Uint32 drawing_effect) +DrawingContext::draw_text(const Font* font, const std::string& text, + const Vector& position, FontAlignment alignment, int layer, + uint32_t drawing_effect) { DrawingRequest request; @@ -117,18 +117,18 @@ TextRequest* textrequest = new TextRequest; textrequest->font = font; textrequest->text = text; - textrequest->allignment = allignment; + textrequest->alignment = alignment; request.request_data = textrequest; drawingrequests.push_back(request); } void -DrawingContext::draw_center_text(Font* font, const std::string& text, - const Vector& position, int layer, Uint32 drawing_effect) +DrawingContext::draw_center_text(const Font* font, const std::string& text, + const Vector& position, int layer, uint32_t drawing_effect) { -draw_text(font, text, Vector(position.x + screen->w/2, position.y), - CENTER_ALLIGN, layer, drawing_effect); + draw_text(font, text, Vector(position.x + screen->w/2, position.y), + CENTER_ALLIGN, layer, drawing_effect); } void @@ -240,7 +240,8 @@ { TextRequest* textrequest = (TextRequest*) request.request_data; - textrequest->font->draw(textrequest->text, request.pos, textrequest->allignment, request.drawing_effect, request.alpha); + textrequest->font->draw(textrequest->text, request.pos, + textrequest->alignment, request.drawing_effect, request.alpha); delete textrequest; } Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- drawing_context.h 24 Nov 2004 14:10:24 -0000 1.12 +++ drawing_context.h 30 Mar 2005 12:00:53 -0000 1.13 @@ -21,18 +21,19 @@ #include <vector> #include <string> +#include <stdint.h> #include "SDL.h" #include "math/vector.h" #include "video/screen.h" #include "video/surface.h" +#include "video/font.h" namespace SuperTux { class Surface; - class Font; // some constants for predefined layer values enum { @@ -59,23 +60,23 @@ ~DrawingContext(); /// Adds a drawing request for a surface into the request list. - void draw_surface(const Surface* surface, const Vector& position, int layer, - Uint32 drawing_effect = NONE_EFFECT); + void draw_surface(const Surface* surface, const Vector& position, + int layer, uint32_t drawing_effect = NONE_EFFECT); /// Adds a drawing request for part of a surface. void draw_surface_part(const Surface* surface, const Vector& source, const Vector& size, const Vector& dest, int layer, - Uint32 drawing_effect = NONE_EFFECT); + uint32_t drawing_effect = NONE_EFFECT); /// Draws a text. - void draw_text(Font* font, const std::string& text, const Vector& position, - int allignment, int layer, - Uint32 drawing_effect = NONE_EFFECT); + void draw_text(const Font* font, const std::string& text, + const Vector& position, FontAlignment alignment, int layer, + uint32_t drawing_effect = NONE_EFFECT); /// Draws text on screen center (feed Vector.x with a 0). /// This is the same as draw_text() with a screen->w/2 position and - /// allignment set to LEFT_ALLIGN - void draw_center_text(Font* font, const std::string& text, + /// alignment set to LEFT_ALLIGN + void draw_center_text(const Font* font, const std::string& text, const Vector& position, int layer, - Uint32 drawing_effect = NONE_EFFECT); + uint32_t drawing_effect = NONE_EFFECT); /// Draws a color gradient onto the whole screen */ void draw_gradient(Color from, Color to, int layer); /// Fills a rectangle. @@ -87,7 +88,7 @@ const Vector& get_translation() const { return transform.translation; } - Uint32 get_drawing_effect() const + uint32_t get_drawing_effect() const { return transform.drawing_effect; } void set_translation(const Vector& newtranslation) @@ -108,7 +109,7 @@ { public: Vector translation; - Uint32 drawing_effect; + uint32_t drawing_effect; float zoom; int alpha; @@ -140,9 +141,9 @@ struct TextRequest { - Font* font; + const Font* font; std::string text; - int allignment; + FontAlignment alignment; }; struct GradientRequest @@ -163,7 +164,7 @@ Vector pos; int layer; - Uint32 drawing_effect; + uint32_t drawing_effect; float zoom; int alpha; Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- font.h 24 Nov 2004 14:10:24 -0000 1.10 +++ font.h 30 Mar 2005 12:00:53 -0000 1.11 @@ -22,6 +22,7 @@ #define SUPERTUX_FONT_H #include <string> +#include <stdint.h> #include "video/surface.h" #include "math/vector.h" @@ -29,7 +30,7 @@ namespace SuperTux { - enum { + enum FontAlignment { LEFT_ALLIGN, CENTER_ALLIGN, RIGHT_ALLIGN @@ -45,7 +46,8 @@ NUM // only images for numbers }; - Font(const std::string& file, FontType type, int w, int h, int shadowsize=2); + Font(const std::string& file, FontType type, int w, int h, + int shadowsize=2); ~Font(); /** returns the width of a given text. (Note that I won't add a normal @@ -69,17 +71,17 @@ /** Draws the given text to the screen. Also needs the position. * Type of alignment, drawing effect and alpha are optional. */ void draw(const std::string& text, const Vector& pos, - int allignment = LEFT_ALLIGN, - Uint32 drawing_effect = NONE_EFFECT, int alpha = 255); + FontAlignment allignment = LEFT_ALLIGN, + uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const; private: friend class DrawingContext; void draw_text(const std::string& text, const Vector& pos, - Uint32 drawing_effect = NONE_EFFECT, int alpha = 255); + uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const; void draw_chars(Surface* pchars, const std::string& text, - const Vector& position, Uint32 drawing_effect, int alpha); + const Vector& position, uint32_t drawing_effect, uint8_t alpha) const; Surface* chars; Surface* shadow_chars; @@ -93,12 +95,6 @@ /// the number of the last character that is represented in the font int last_char; }; - - - /** Reads a text file (using LispReader, so it as to be in its formatting) - and displays it in a StarTrek fashion */ - void display_text_file(const std::string& file, float scroll_speed, Font* heading_font, Font* normal_font, Font* small_font, Font* reference_font ); - } //namespace SuperTux #endif /*SUPERTUX_FONT_H*/ |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:31
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/data/levels/test Modified Files: bonusblock.stl Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics Index: bonusblock.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/bonusblock.stl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- bonusblock.stl 25 Mar 2005 20:39:32 -0000 1.14 +++ bonusblock.stl 30 Mar 2005 12:00:52 -0000 1.15 @@ -55,7 +55,7 @@ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )) (tilemap - (layer "main") + (layer "interactive") (solid #t) (speed 1.000000) (width 30) @@ -135,6 +135,15 @@ (path )) + (infoblock + (x 128) + (y 800) + (message (_ +"-Info +#This is an info block +#(WOW GREAT) +#This rocks")) + ) ) ) |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:30
|
Update of /cvsroot/super-tux/supertux/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/data Modified Files: credits.txt Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics Index: credits.txt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/credits.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- credits.txt 5 Dec 2004 17:04:42 -0000 1.3 +++ credits.txt 30 Mar 2005 12:00:50 -0000 1.4 @@ -1,6 +1,7 @@ ; Credits text (supertux-text (background "oiltux.jpg") + (speed 1.5) (text (_ "-- SuperTux - Milestone 1 |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:12
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/src Modified Files: gameloop.cpp gameloop.h title.cpp title.h worldmap.cpp Added Files: textscroller.cpp textscroller.h Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics --- NEW FILE: textscroller.h --- #ifndef __TEXTSCROLLER_H__ #define __TEXTSCROLLER_H__ #include <vector> #include <string> namespace SuperTux { class DrawingContext; } using namespace SuperTux; /** This class is displaying a box with information text inside the game */ class InfoBox { public: InfoBox(const std::string& text); ~InfoBox(); void draw(DrawingContext& context); void scrolldown(); void scrollup(); void pagedown(); void pageup(); private: size_t firstline; std::vector<std::string> lines; }; /** Reads a text file (using LispReader, so it as to be in its formatting) * and scroll it over the screen * (this call blocks until all text scrolled through or the user aborted the * textscrolling) */ void display_text_file(const std::string& file); #endif Index: title.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- title.h 13 Mar 2005 23:45:02 -0000 1.7 +++ title.h 30 Mar 2005 12:00:57 -0000 1.8 @@ -31,14 +31,7 @@ MNID_QUITMAINMENU }; -/* Scrolling text speed */ - -#define SCROLL_SPEED_CREDITS 1.5 -#define SCROLL_SPEED_MESSAGE 1.0 - -void title(void); +void title(); #endif //SUPERTUX_TITLE_H -// EOF // - Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- gameloop.h 30 Mar 2005 01:52:12 -0000 1.68 +++ gameloop.h 30 Mar 2005 12:00:55 -0000 1.69 @@ -22,6 +22,7 @@ #ifndef SUPERTUX_GAMELOOP_H #define SUPERTUX_GAMELOOP_H +#include <SDL.h> #include "timer.h" #include "statistics.h" @@ -79,6 +80,7 @@ const std::string& spawnpointname); void set_reset_point(const std::string& sectorname, const Vector& pos); + void display_info_box(const std::string& text); Sector* get_current_sector() { return currentsector; } @@ -95,12 +97,12 @@ void levelintro(); void drawstatus(DrawingContext& context); void drawendscreen(); - void drawresultscreen(void); + void drawresultscreen(); + void draw_pause(); void on_escape_press(); void process_menu(); - Uint32 fps_ticks; Timer2 endsequence_timer; Level* level; Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.141 retrieving revision 1.142 diff -u -d -r1.141 -r1.142 --- title.cpp 30 Mar 2005 01:52:13 -0000 1.141 +++ title.cpp 30 Mar 2005 12:00:56 -0000 1.142 @@ -60,6 +60,7 @@ #include "resources.h" #include "app/gettext.h" #include "misc.h" +#include "textscroller.h" static Surface* bkg_title; static Surface* logo; @@ -387,7 +388,7 @@ fadeout(500); credits_music = SoundManager::get()->load_music(datadir + "/music/credits.ogg"); SoundManager::get()->play_music(credits_music); - display_text_file("credits.txt", SCROLL_SPEED_CREDITS, white_big_text , white_text, white_small_text, blue_text ); + display_text_file("credits.txt"); fadeout(500); Menu::set_current(main_menu); break; Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.140 retrieving revision 1.141 diff -u -d -r1.140 -r1.141 --- worldmap.cpp 25 Mar 2005 20:39:53 -0000 1.140 +++ worldmap.cpp 30 Mar 2005 12:00:58 -0000 1.141 @@ -44,6 +44,7 @@ #include "resources.h" #include "misc.h" #include "player_status.h" +#include "textscroller.h" #define map_message_TIME 2.8 @@ -835,8 +836,7 @@ if (!level->extro_filename.empty()) { // Display a text file std::string filename = levels_path + level->extro_filename; - display_text_file(filename, SCROLL_SPEED_MESSAGE, - white_big_text , white_text, white_small_text, blue_text ); + display_text_file(filename); } if (!level->next_worldmap.empty()) @@ -1040,8 +1040,7 @@ if(!intro_displayed && intro_filename != "") { std::string filename = levels_path + intro_filename; - display_text_file(filename, SCROLL_SPEED_MESSAGE, - white_big_text, white_text, white_small_text, blue_text); + display_text_file(filename); intro_displayed = true; } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.214 retrieving revision 1.215 diff -u -d -r1.214 -r1.215 --- gameloop.cpp 30 Mar 2005 01:52:12 -0000 1.214 +++ gameloop.cpp 30 Mar 2005 12:00:53 -0000 1.215 @@ -62,6 +62,7 @@ #include "statistics.h" #include "timer.h" #include "object/fireworks.h" +#include "textscroller.h" GameSession* GameSession::current_ = 0; @@ -103,15 +104,6 @@ last_keys.clear(); -#if 0 - Vector tux_pos = Vector(-1,-1); - if (currentsector) - { - // Tux has lost a life, so we try to respawn him at the nearest reset point - tux_pos = currentsector->player->base; - } -#endif - delete level; currentsector = 0; @@ -571,11 +563,10 @@ GameSession::action(float elapsed_time) { // advance timers - if (exit_status == ES_NONE && !currentsector->player->growing_timer.check()) - { - // Update Tux and the World - currentsector->action(elapsed_time); - } + if(!currentsector->player->growing_timer.started()) { + // Update Tux and the World + currentsector->action(elapsed_time); + } // respawning in new sector? if(newsector != "" && newspawnpoint != "") { @@ -594,46 +585,46 @@ drawstatus(*context); if(game_pause) - { - int x = screen->h / 20; - for(int i = 0; i < x; ++i) - { - context->draw_filled_rect( - Vector(i % 2 ? (pause_menu_frame * i)%screen->w : - -((pause_menu_frame * i)%screen->w) - ,(i*20+pause_menu_frame)%screen->h), - Vector(screen->w,10), - Color(20,20,20, rand() % 20 + 1), LAYER_FOREGROUND1+1); - } - context->draw_filled_rect( - Vector(0,0), Vector(screen->w, screen->h), - Color(rand() % 50, rand() % 50, rand() % 50, 128), LAYER_FOREGROUND1); - context->draw_text(blue_text, _("PAUSE - Press 'P' To Play"), - Vector(screen->w/2, 230), CENTER_ALLIGN, LAYER_FOREGROUND1+2); - - char str1[60]; - char str2[124]; - sprintf(str1, _("Playing: ")); - sprintf(str2, level->name.c_str()); - - context->draw_text(blue_text, str1, - Vector((screen->w - (blue_text->get_text_width(str1) + white_text->get_text_width(str2)))/2, 340), - LEFT_ALLIGN, LAYER_FOREGROUND1+2); - context->draw_text(white_text, str2, - Vector(((screen->w - (blue_text->get_text_width(str1) + white_text->get_text_width(str2)))/2)+blue_text->get_text_width(str1), 340), - LEFT_ALLIGN, LAYER_FOREGROUND1+2); - } + draw_pause(); - if(Menu::current()) - { - Menu::current()->draw(*context); - mouse_cursor->draw(*context); - } + if(Menu::current()) { + Menu::current()->draw(*context); + mouse_cursor->draw(*context); + } context->do_drawing(); } void +GameSession::draw_pause() +{ + int x = screen->h / 20; + for(int i = 0; i < x; ++i) { + context->draw_filled_rect( + Vector(i % 2 ? (pause_menu_frame * i)%screen->w : + -((pause_menu_frame * i)%screen->w) + ,(i*20+pause_menu_frame)%screen->h), + Vector(screen->w,10), + Color(20,20,20, rand() % 20 + 1), LAYER_FOREGROUND1+1); + } + context->draw_filled_rect( + Vector(0,0), Vector(screen->w, screen->h), + Color(rand() % 50, rand() % 50, rand() % 50, 128), LAYER_FOREGROUND1); + context->draw_text(blue_text, _("PAUSE - Press 'P' To Play"), + Vector(screen->w/2, 230), CENTER_ALLIGN, LAYER_FOREGROUND1+2); + + const char* str1 = _("Playing: "); + const char* str2 = level->get_name().c_str(); + + context->draw_text(blue_text, str1, + Vector((screen->w - (blue_text->get_text_width(str1) + white_text->get_text_width(str2)))/2, 340), + LEFT_ALLIGN, LAYER_FOREGROUND1+2); + context->draw_text(white_text, str2, + Vector(((screen->w - (blue_text->get_text_width(str1) + white_text->get_text_width(str2)))/2)+blue_text->get_text_width(str1), 340), + LEFT_ALLIGN, LAYER_FOREGROUND1+2); +} + +void GameSession::process_menu() { Menu* menu = Menu::current(); @@ -781,6 +772,29 @@ } void +GameSession::display_info_box(const std::string& text) +{ + InfoBox* box = new InfoBox(text); + + bool running = true; + while(running) { + SDL_Event event; + while (SDL_PollEvent(&event)) { + switch(event.type) { + case SDL_KEYDOWN: + running = false; + break; + } + } + + box->draw(*context); + draw(); + } + + delete box; +} + +void GameSession::start_sequence(const std::string& sequencename) { if(sequencename == "endsequence" || sequencename == "fireworks") { --- NEW FILE: textscroller.cpp --- #include <config.h> #include "textscroller.h" #include <stdexcept> #include "resources.h" #include "video/font.h" #include "video/drawing_context.h" #include "app/globals.h" #include "lisp/parser.h" #include "lisp/lisp.h" static const float DEFAULT_SPEED = 1.0; static const float MAX_VEL = 10; static const float SPEED_INC = 0.01; static const float SCROLL = 60; static const float ITEMS_SPACE = 4; static void split_text(const std::string& text, std::vector<std::string>& lines) { // Split text string lines into a vector lines.clear(); std::string::size_type i, l; i = 0; while(true) { l = text.find("\n", i); if(l == std::string::npos) { lines.push_back(text.substr(i, text.size()-i)); break; } lines.push_back(text.substr(i, l-i)); i = l+1; } } void display_text_file(const std::string& file) { const Font* heading_font = white_big_text; const Font* normal_font = white_text; const Font* small_font = white_small_text; const Font* reference_font = blue_text; float speed = DEFAULT_SPEED; std::string text; std::string background_file; std::vector<std::string> lines; std::string filename = datadir + "/" + file; lisp::Parser parser; try { std::auto_ptr<lisp::Lisp> root (parser.parse(filename)); const lisp::Lisp* text_lisp = root->get_lisp("supertux-text"); if(!text_lisp) throw std::runtime_error("File isn't a supertux-text file"); if(!text_lisp->get("text", text)) throw std::runtime_error("file doesn't contain a text field"); if(!text_lisp->get("background", background_file)) throw std::runtime_error("file doesn't contain a background file"); text_lisp->get("speed", speed); } catch(std::exception& e) { std::cerr << "Couldn't load file '" << filename << "': " << e.what() << "\n"; return; } // Split text string lines into a vector split_text(text, lines); // load background image Surface* background = new Surface( get_resource_filename("images/background/" + background_file), false); int done = 0; float scroll = 0; speed /= 50.0; float left_border = 50; DrawingContext context; SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); Uint32 lastticks = SDL_GetTicks(); while(!done) { /* in case of input, exit */ SDL_Event event; while(SDL_PollEvent(&event)) switch(event.type) { case SDL_KEYDOWN: switch(event.key.keysym.sym) { case SDLK_UP: speed -= SPEED_INC; break; case SDLK_DOWN: speed += SPEED_INC; break; case SDLK_SPACE: case SDLK_RETURN: if(speed >= 0) scroll += SCROLL; break; case SDLK_ESCAPE: done = 1; break; default: break; } break; case SDL_QUIT: done = 1; break; default: break; } if(speed > MAX_VEL) speed = MAX_VEL; else if(speed < -MAX_VEL) speed = -MAX_VEL; /* draw the credits */ context.draw_surface(background, Vector(0,0), 0); float y = 0; for(size_t i = 0; i < lines.size(); i++) { const std::string& line = lines[i]; if(line.size() == 0) { y += normal_font->get_height() + ITEMS_SPACE; continue; } const Font* font = 0; bool center = true; switch(line[0]) { case ' ': font = small_font; break; case '\t': font = normal_font; break; case '-': font = heading_font; break; case '*': font = reference_font; break; case '#': font = normal_font; center = false; break; default: std::cerr << "Warning: text contains an unformated line.\n"; font = normal_font; center = false; break; } if(center) { context.draw_text(font, line.substr(1, line.size()-1), Vector(screen->w/2, screen->h + y - scroll), CENTER_ALLIGN, LAYER_FOREGROUND1); } else { context.draw_text(font, line.substr(1, line.size()-1), Vector(left_border, screen->h + y - scroll), LEFT_ALLIGN, LAYER_FOREGROUND1); } y += font->get_height() + ITEMS_SPACE; } context.do_drawing(); if(screen->h+y-scroll < 0 && 20+screen->h+y-scroll < 0) done = 1; Uint32 ticks = SDL_GetTicks(); scroll += speed * (ticks - lastticks); lastticks = ticks; if(scroll < 0) scroll = 0; SDL_Delay(10); } SDL_EnableKeyRepeat(0, 0); // disables key repeating delete background; } InfoBox::InfoBox(const std::string& text) : firstline(0) { split_text(text, lines); } InfoBox::~InfoBox() { } void InfoBox::draw(DrawingContext& context) { const Font* heading_font = white_big_text; const Font* normal_font = white_text; const Font* small_font = white_small_text; const Font* reference_font = blue_text; float x1 = 200; float y1 = 100; float width = 400; float height = 200; context.draw_filled_rect(Vector(x1, y1), Vector(width, height), Color(150, 180, 200, 125), LAYER_GUI-1); float y = y1; for(size_t i = firstline; i < lines.size(); ++i) { const std::string& line = lines[i]; if(y >= y1 + height) break; if(line.size() == 0) { y += normal_font->get_height() + ITEMS_SPACE; continue; } const Font* font = 0; bool center = true; switch(line[0]) { case ' ': font = small_font; break; case '\t': font = normal_font; break; case '-': font = heading_font; break; case '*': font = reference_font; break; case '#': font = normal_font; center = false; break; default: std::cerr << "Warning: text contains an unformated line.\n"; font = normal_font; center = false; break; } if(center) { context.draw_text(font, line.substr(1, line.size()-1), Vector(screen->w/2, y), CENTER_ALLIGN, LAYER_GUI); } else { context.draw_text(font, line.substr(1, line.size()-1), Vector(x1, y), LEFT_ALLIGN, LAYER_GUI); } y += font->get_height() + ITEMS_SPACE; } } void InfoBox::scrollup() { if(firstline > 0) firstline--; } void InfoBox::scrolldown() { if(firstline < lines.size()-1) firstline++; } void InfoBox::pageup() { } void InfoBox::pagedown() { } |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:11
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/src/object Modified Files: block.cpp block.h invisible_block.cpp Added Files: infoblock.cpp infoblock.h Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics --- NEW FILE: infoblock.h --- #ifndef __INFOBLOCK_H__ #define __INFOBLOCK_H__ #include "block.h" class InfoBlock : public Block { public: InfoBlock(const lisp::Lisp& lisp); virtual ~InfoBlock(); protected: virtual void hit(Player& player); std::string message; }; #endif Index: block.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/block.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- block.cpp 25 Mar 2005 20:39:55 -0000 1.9 +++ block.cpp 30 Mar 2005 12:01:01 -0000 1.10 @@ -7,6 +7,7 @@ #include "special/sprite.h" #include "special/sprite_manager.h" #include "video/drawing_context.h" +#include "lisp/lisp.h" #include "gameobjs.h" #include "specialriser.h" #include "growup.h" @@ -22,13 +23,11 @@ static const float BOUNCY_BRICK_SPEED=90; static const float EPSILON = .0001; -Block::Block(const Vector& pos, Sprite* newsprite) +Block::Block(Sprite* newsprite) : sprite(newsprite), bouncing(false), bounce_dir(0), bounce_offset(0) { - bbox.set_pos(pos); bbox.set_size(32, 32.1); flags |= FLAG_SOLID; - original_y = pos.y; } Block::~Block() @@ -97,10 +96,49 @@ //--------------------------------------------------------------------------- -BonusBlock::BonusBlock(const Vector& pos, int newdata) - : Block(pos, sprite_manager->create("bonusblock")), data(newdata) +BonusBlock::BonusBlock(const Vector& pos, int data) + : Block(sprite_manager->create("bonusblock")) { + bbox.set_pos(pos); sprite->set_action("default"); + switch(data) { + case 1: contents = CONTENT_COIN; break; + case 2: contents = CONTENT_FIREGROW; break; + case 3: contents = CONTENT_STAR; break; + case 4: contents = CONTENT_1UP; break; + case 5: contents = CONTENT_ICEGROW; break; + default: + std::cerr << "Invalid box contents!\n"; + contents = CONTENT_COIN; + break; + } +} + +BonusBlock::BonusBlock(const lisp::Lisp& lisp) + : Block(sprite_manager->create("bonusblock")) +{ + Vector pos; + lisp.get("x", pos.x); + lisp.get("y", pos.y); + bbox.set_pos(pos); + + std::string contentstring; + contents = CONTENT_COIN; + if(lisp.get("contents", contentstring)) { + if(contentstring == "coin") { + contents = CONTENT_COIN; + } else if(contentstring == "firegrow") { + contents = CONTENT_FIREGROW; + } else if(contentstring == "icegrow") { + contents = CONTENT_ICEGROW; + } else if(contentstring == "star") { + contents = CONTENT_STAR; + } else if(contentstring == "1up") { + contents = CONTENT_1UP; + } else { + std::cerr << "Invalid box contents '" << contentstring << "'.\n"; + } + } } void @@ -119,13 +157,13 @@ Sector* sector = Sector::current(); Player& player = *(sector->player); - switch(data) { - case 1: // coin + switch(contents) { + case CONTENT_COIN: Sector::current()->add_object(new BouncyCoin(get_pos())); player.get_status().incCoins(); break; - case 2: // grow/fireflower + case CONTENT_FIREGROW: if(player.size == SMALL) { SpecialRiser* riser = new SpecialRiser( new GrowUp(get_pos() + Vector(0, -32))); @@ -138,7 +176,7 @@ SoundManager::get()->play_sound(IDToSound(SND_UPGRADE)); break; - case 5: // grow/iceflower + case CONTENT_ICEGROW: if(player.size == SMALL) { SpecialRiser* riser = new SpecialRiser( new GrowUp(get_pos() + Vector(0, -32))); @@ -151,11 +189,11 @@ SoundManager::get()->play_sound(IDToSound(SND_UPGRADE)); break; - case 3: // star + case CONTENT_STAR: sector->add_object(new Star(get_pos() + Vector(0, -32))); break; - case 4: // 1up + case CONTENT_1UP: sector->add_object(new OneUp(get_pos())); break; @@ -167,14 +205,15 @@ sprite->set_action("empty"); } -//IMPLEMENT_FACTORY(BonusBlock, "bonusblock") +IMPLEMENT_FACTORY(BonusBlock, "bonusblock") //--------------------------------------------------------------------------- Brick::Brick(const Vector& pos, int data) - : Block(pos, sprite_manager->create("brick")), breakable(false), + : Block(sprite_manager->create("brick")), breakable(false), coin_counter(0) { + bbox.set_pos(pos); if(data == 1) coin_counter = 5; else Index: invisible_block.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/invisible_block.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- invisible_block.cpp 20 Dec 2004 21:24:27 -0000 1.3 +++ invisible_block.cpp 30 Mar 2005 12:01:02 -0000 1.4 @@ -8,8 +8,9 @@ #include "object_factory.h" InvisibleBlock::InvisibleBlock(const Vector& pos) - : Block(pos, sprite_manager->create("invisibleblock")), visible(false) + : Block(sprite_manager->create("invisibleblock")), visible(false) { + bbox.set_pos(pos); flags &= ~FLAG_SOLID; } Index: block.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/block.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- block.h 30 Mar 2005 01:52:14 -0000 1.4 +++ block.h 30 Mar 2005 12:01:01 -0000 1.5 @@ -2,6 +2,7 @@ #define __BLOCK_H__ #include "special/moving_object.h" +#include "lisp/lisp.h" namespace SuperTux { class Sprite; @@ -13,7 +14,7 @@ class Block : public MovingObject { public: - Block(const Vector& pos, Sprite* sprite); + Block(Sprite* sprite = 0); ~Block(); virtual HitResponse collision(GameObject& other, const CollisionHit& hit); @@ -35,6 +36,7 @@ { public: BonusBlock(const Vector& pos, int data); + BonusBlock(const lisp::Lisp& lisp); void try_open(); @@ -42,7 +44,15 @@ virtual void hit(Player& player); private: - int data; + enum Contents { + CONTENT_COIN, + CONTENT_FIREGROW, + CONTENT_ICEGROW, + CONTENT_STAR, + CONTENT_1UP + }; + + Contents contents; }; class Brick : public Block --- NEW FILE: infoblock.cpp --- #include <config.h> #include "infoblock.h" #include "gameloop.h" #include "resources.h" #include "special/sprite_manager.h" #include "object_factory.h" #include "lisp/lisp.h" InfoBlock::InfoBlock(const lisp::Lisp& lisp) : Block(sprite_manager->create("bonusblock")) { Vector pos; lisp.get("x", pos.x); lisp.get("y", pos.y); bbox.set_pos(pos); if(!lisp.get("message", message)) { std::cerr << "No message in InfoBlock!\n"; } } InfoBlock::~InfoBlock() { } void InfoBlock::hit(Player& ) { GameSession::current()->display_info_box(message); start_bounce(); } IMPLEMENT_FACTORY(InfoBlock, "infoblock") |
From: Matze B. <mat...@us...> - 2005-03-30 12:01:00
|
Update of /cvsroot/super-tux/supertux/data/images/shared/bell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1392/data/images/shared/bell Added Files: bell-l.png bell-m.png bell-r.png Log Message: -Some cleanups in text scrolling code -Added the (temporary) bell graphics which I forgot yesterday -Implemented an infoblock object (the textbox isn't finished yet) and it also needs new graphics --- NEW FILE: bell-r.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bell-m.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bell-l.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2005-03-30 11:59:19
|
Update of /cvsroot/super-tux/supertux/data/images/shared/bell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1105/data/images/shared/bell Log Message: Directory /cvsroot/super-tux/supertux/data/images/shared/bell added to the repository |
From: Matze B. <mat...@us...> - 2005-03-30 03:04:50
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22229/src/object Modified Files: unstable_tile.cpp Log Message: shorten unstable time Index: unstable_tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/unstable_tile.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- unstable_tile.cpp 30 Mar 2005 03:02:01 -0000 1.1 +++ unstable_tile.cpp 30 Mar 2005 03:04:42 -0000 1.2 @@ -9,8 +9,8 @@ #include "special/sprite_manager.h" #include "special/sprite.h" -static const float CRACKTIME = 1; -static const float FALLTIME = 1.5; +static const float CRACKTIME = 0.3; +static const float FALLTIME = 0.8; UnstableTile::UnstableTile(const lisp::Lisp& lisp) : hit(false), falling(false) |
From: Matze B. <mat...@us...> - 2005-03-30 03:02:09
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20982/src/object Added Files: unstable_tile.cpp unstable_tile.h Log Message: added unstable_tile object --- NEW FILE: unstable_tile.cpp --- #include <config.h> #include "unstable_tile.h" #include "lisp/lisp.h" #include "object_factory.h" #include "player.h" #include "sector.h" #include "resources.h" #include "special/sprite_manager.h" #include "special/sprite.h" static const float CRACKTIME = 1; static const float FALLTIME = 1.5; UnstableTile::UnstableTile(const lisp::Lisp& lisp) : hit(false), falling(false) { lisp.get("x", bbox.p1.x); lisp.get("y", bbox.p1.y); bbox.set_size(32, 32); sprite = sprite_manager->create("unstable_tile"); flags |= FLAG_SOLID; } UnstableTile::~UnstableTile() { delete sprite; } HitResponse UnstableTile::collision(GameObject& other, const CollisionHit& hitdata) { if(hitdata.normal.y < 0.8) return FORCE_MOVE; Player* player = dynamic_cast<Player*> (&other); if(player) hit = true; return FORCE_MOVE; } void UnstableTile::draw(DrawingContext& context) { Vector pos = get_pos(); // shacking if(timer.get_timegone() > CRACKTIME) { pos.x += (rand() % 6) - 3; } sprite->draw(context, pos, LAYER_TILES); } void UnstableTile::action(float elapsed_time) { if(falling) { movement = physic.get_movement(elapsed_time); if(!Sector::current()->inside(bbox)) { remove_me(); return; } } else if(hit) { if(timer.check()) { falling = true; physic.enable_gravity(true); flags &= ~FLAG_SOLID; timer.stop(); } else if(!timer.started()) { timer.start(FALLTIME); } } else { timer.stop(); } hit = false; } IMPLEMENT_FACTORY(UnstableTile, "unstable_tile"); --- NEW FILE: unstable_tile.h --- #ifndef __UNSTABLE_TILE_H__ #define __UNSTABLE_TILE_H__ #include "special/moving_object.h" #include "lisp/lisp.h" #include "math/physic.h" #include "timer.h" namespace SuperTux { class Sprite; } class Player; using namespace SuperTux; /** A tile that starts falling down if tux stands to long on it */ class UnstableTile : public MovingObject { public: UnstableTile(const lisp::Lisp& lisp); ~UnstableTile(); HitResponse collision(GameObject& other, const CollisionHit& hit); void action(float elapsed_time); void draw(DrawingContext& context); private: Physic physic; Sprite* sprite; Timer2 timer; bool hit; bool falling; }; #endif |
From: Matze B. <mat...@us...> - 2005-03-30 03:02:08
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20982/src Modified Files: timer.h Log Message: added unstable_tile object Index: timer.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/timer.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- timer.h 23 Nov 2004 22:51:03 -0000 1.19 +++ timer.h 30 Mar 2005 03:02:00 -0000 1.20 @@ -21,6 +21,9 @@ * successfull check */ bool check(); + /** stop the timer */ + void stop() + { start(0); } /** returns the period of the timer or 0 if it isn't started */ float get_period() const |
From: Matze B. <mat...@us...> - 2005-03-30 03:02:08
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20982/data/images Modified Files: supertux.strf Log Message: added unstable_tile object Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- supertux.strf 30 Mar 2005 01:52:11 -0000 1.34 +++ supertux.strf 30 Mar 2005 03:01:59 -0000 1.35 @@ -1396,6 +1396,11 @@ ) ) ) + + (sprite (name "unstable_tile") + (action + (images "shared/unstable_tile.png")) + ) ) ;; EOF ;; |
From: Matze B. <mat...@us...> - 2005-03-30 03:02:08
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20982/data/images/shared Added Files: unstable_tile.png Log Message: added unstable_tile object --- NEW FILE: unstable_tile.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2005-03-30 01:52:53
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13952/lib/special Modified Files: moving_object.h Log Message: added a bell object which is a new better way to do reset points Index: moving_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/moving_object.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- moving_object.h 25 Mar 2005 20:39:48 -0000 1.7 +++ moving_object.h 30 Mar 2005 01:52:12 -0000 1.8 @@ -63,10 +63,18 @@ return movement; } + /** places the moving object at a specific position. Be carefull when + * using this function. There are no collision detection checks performed + * here so bad things could happen. + */ + virtual void set_pos(const Vector& pos) + { + bbox.set_pos(pos); + } + protected: friend class Sector; friend class CollisionGrid; - friend class FlipLevelTransformer; /** The bounding box of the object (as used for collision detection, this * isn't necessarily the bounding box for graphics) |
From: Matze B. <mat...@us...> - 2005-03-30 01:52:53
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13952/data/levels/test Modified Files: verticalforest.stl Log Message: added a bell object which is a new better way to do reset points Index: verticalforest.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/verticalforest.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- verticalforest.stl 16 Mar 2005 11:35:14 -0000 1.2 +++ verticalforest.stl 30 Mar 2005 01:52:11 -0000 1.3 @@ -931,6 +931,8 @@ (reset-points ) (objects + (bell (x 609) (y 6500)) + (bell (x 543) (y 3655)) ) ) |