super-tux-commit Mailing List for Super Tux (Page 59)
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: Matze B. <mat...@us...> - 2004-06-02 20:07:18
|
Update of /cvsroot/super-tux/supertux/data/images/fonts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9997/fonts Log Message: Directory /cvsroot/super-tux/supertux/data/images/fonts added to the repository |
From: Matze B. <mat...@us...> - 2004-06-02 20:07:13
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9831/screen Modified Files: font.cpp font.h Log Message: cleaned up font drawing code and added support for latin1 font of litespeed Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/font.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- font.cpp 30 May 2004 01:08:50 -0000 1.1 +++ font.cpp 2 Jun 2004 20:06:56 -0000 1.2 @@ -26,50 +26,40 @@ #include "font.h" #include "drawing_context.h" -Font::Font(const std::string& file, int kind_, int w_, int h_, int shadowsize_) +Font::Font(const std::string& file, FontType ntype, int nw, int nh, + int nshadowsize) + : chars(0), shadow_chars(0), type(ntype), w(nw), h(nh), + shadowsize(nshadowsize) { - kind = kind_; - w = w_; - h = h_; - shadowsize = shadowsize_; - - int mx, my; - SDL_Surface *conv; - int pixels; - int i; - - if(kind == TEXT_TEXT) - { - mx = 26; - my = 3; - } - else if(kind == TEXT_NUM) - { - mx = 10; - my = 1; - } - else - { - mx = 0; - my = 0; - } - chars = new Surface(file, USE_ALPHA); - + + switch(type) { + case TEXT: + first_char = 32; + break; + case NUM: + first_char = 48; + break; + } + last_char = first_char + (chars->h / h) * 16; + if(last_char > 127) // we have left out some control chars at 128-159 + last_char += 32; + printf("Chars: %d-%d.\n", first_char, last_char); + // Load shadow font. - conv = SDL_DisplayFormatAlpha(chars->impl->get_sdl_surface()); - pixels = conv->w * conv->h; - SDL_LockSurface(conv); - for(i = 0; i < pixels; ++i) - { + if(shadowsize > 0) { + SDL_Surface* conv = SDL_DisplayFormatAlpha(chars->impl->get_sdl_surface()); + int pixels = conv->w * conv->h; + SDL_LockSurface(conv); + for(int i = 0; i < pixels; ++i) { Uint32 *p = (Uint32 *)conv->pixels + i; *p = *p & conv->format->Amask; } - SDL_UnlockSurface(conv); - SDL_SetAlpha(conv, SDL_SRCALPHA, 128); - shadow_chars = new Surface(conv, USE_ALPHA); - - SDL_FreeSurface(conv); + SDL_UnlockSurface(conv); + SDL_SetAlpha(conv, SDL_SRCALPHA, 128); + shadow_chars = new Surface(conv, USE_ALPHA); + SDL_FreeSurface(conv); + } } Font::~Font() @@ -93,7 +83,7 @@ void Font::draw(const std::string& text, const Vector& pos) { - if(shadowsize != 0) + if(shadowsize > 0) draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize)); draw_chars(chars, text, pos); @@ -102,48 +92,32 @@ void Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos) { - size_t i, j; - SurfaceImpl* impl = pchars->impl; - int x = int(pos.x); - int y = int(pos.y); - if(kind == TEXT_TEXT) - { - for( i = 0, j = 0; i < text.size(); ++i,++j) - { - if( text[i] >= ' ' && text[i] <= '/') - impl->draw_part((int)(text[i] - ' ')*w, 0 , x+(j*w), y, w, h, 255); - else if( text[i] >= '0' && text[i] <= '?') - impl->draw_part((int)(text[i] - '0')*w, h*1, x+(j*w), y, w, h, 255); - else if ( text[i] >= '@' && text[i] <= 'O') - impl->draw_part((int)(text[i] - '@')*w, h*2, x+(j*w), y, w, h, 255); - else if ( text[i] >= 'P' && text[i] <= '_') - impl->draw_part((int)(text[i] - 'P')*w, h*3, x+(j*w), y, w, h, 255); - else if ( text[i] >= '`' && text[i] <= 'o') - impl->draw_part((int)(text[i] - '`')*w, h*4, x+(j*w), y, w, h, 255); - else if ( text[i] >= 'p' && text[i] <= '~') - impl->draw_part((int)(text[i] - 'p')*w, h*5, x+(j*w), y, w, h, 255); - else if ( text[i] == '\n') - { - y += h + 2; - j = 0; - } - } + Vector p = pos; + for(size_t i = 0; i < text.size(); ++i) + { + int c = (unsigned char) text[i]; + if(c > 127) // correct for the 32 controlchars at 128-159 + c -= 32; + // a non-printable character? + if(c == '\n') { + p.x = pos.x; + p.y += h + 2; + continue; } - else if(kind == TEXT_NUM) - { - for( i = 0, j = 0; i < text.size(); ++i, ++j) - { - if ( text[i] >= '0' && text[i] <= '9') - impl->draw_part((int)(text[i] - '0')*w, 0, x+(j*w), y, w, h, 255); - else if ( text[i] == '\n') - { - y += h + 2; - j = 0; - } - } + if(c == ' ' || c < first_char || c > last_char) { + p.x += w; + continue; } + + int index = c - first_char; + int source_x = (index % 16) * w; + int source_y = (index / 16) * h; + + impl->draw_part(source_x, source_y, p.x, p.y, w, h, 255); + p.x += w; + } } /* --- SCROLL TEXT FUNCTION --- */ Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/font.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- font.h 30 May 2004 01:08:50 -0000 1.1 +++ font.h 2 Jun 2004 20:06:56 -0000 1.2 @@ -28,27 +28,25 @@ 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 { - TEXT_TEXT, - TEXT_NUM -}; - /* Text type */ class Font { public: - Surface* chars; - Surface* shadow_chars; - int kind; - int w; - int h; - int shadowsize; -public: - Font(const std::string& file, int kind, int w, int h, int shadowsize = 2); + /* Kinds of texts. */ + enum FontType { + TEXT, // images for all characters + NUM // only images for numbers + }; + + Font(const std::string& file, FontType type, int w, int h, int shadowsize=2); ~Font(); + /** returns the height of the font */ float get_height() const; + /** returns the width of a given text. (Note that I won't add a normal + * get_width function here, as we might switch to variable width fonts in the + * future. + */ float get_text_width(const std::string& text) const; private: @@ -57,6 +55,18 @@ void draw(const std::string& text, const Vector& pos); void draw_chars(Surface* pchars, const std::string& text, const Vector& position); + + Surface* chars; + Surface* shadow_chars; + FontType type; + int w; + int h; + int shadowsize; + + /// the number of the first character that is represented in the font + int first_char; + /// the number of the last character that is represented in the font + int last_char; }; #endif /*SUPERTUX_TEXT_H*/ |
From: Matze B. <mat...@us...> - 2004-06-02 20:07:13
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9831 Modified Files: gameloop.cpp setup.cpp worldmap.cpp Log Message: cleaned up font drawing code and added support for latin1 font of litespeed Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- worldmap.cpp 31 May 2004 22:13:15 -0000 1.80 +++ worldmap.cpp 2 Jun 2004 20:06:56 -0000 1.81 @@ -864,8 +864,8 @@ context.draw_text(gold_text, str, Vector(screen->w - gold_text->get_text_width(str) - tux_life->w, 0), LAYER_FOREGROUND1); - context.draw_surface(tux_life, Vector(screen->w - gold_text->w, 0), - LAYER_FOREGROUND1); + context.draw_surface(tux_life, Vector(screen->w - + gold_text->get_text_width("9"), 0), LAYER_FOREGROUND1); } else { Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.143 retrieving revision 1.144 diff -u -d -r1.143 -r1.144 --- gameloop.cpp 31 May 2004 22:13:15 -0000 1.143 +++ gameloop.cpp 2 Jun 2004 20:06:55 -0000 1.144 @@ -720,12 +720,14 @@ sprintf(str, "%d", player_status.distros); context.draw_text(white_text, "COINS", - Vector(screen->w - white_text->w*9, 0), LAYER_FOREGROUND1); + Vector(screen->w - white_text->get_text_width("COINS "), 0), + LAYER_FOREGROUND1); context.draw_text(gold_text, str, - Vector(screen->w - gold_text->w*2, 0), LAYER_FOREGROUND1); + Vector(screen->w - gold_text->get_text_width("99"), 0),LAYER_FOREGROUND1); context.draw_text(white_text, "LIVES", - Vector(screen->w - white_text->w*9, 20), LAYER_FOREGROUND1); + Vector(screen->w - white_text->get_text_width("LIVES "), 20), + LAYER_FOREGROUND1); if (player_status.lives >= 5) { sprintf(str, "%dx", player_status.lives); @@ -746,7 +748,8 @@ { sprintf(str, "%2.1f", fps_fps); context.draw_text(white_text, "FPS", - Vector(screen->w - white_text->w*9, 40), LAYER_FOREGROUND1); + Vector(screen->w - white_text->get_text_width("FPS "), 40), + LAYER_FOREGROUND1); context.draw_text(gold_text, str, Vector(screen->w-4*16, 40), LAYER_FOREGROUND1); } Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- setup.cpp 31 May 2004 23:47:05 -0000 1.91 +++ setup.cpp 2 Jun 2004 20:06:56 -0000 1.92 @@ -584,19 +584,26 @@ /* Load global images: */ - black_text = new Font(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); - gold_text = new Font(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); - silver_text = new Font(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18); - blue_text = new Font(datadir + "/images/status/letters-blue.png", TEXT_TEXT, - 16,18, 3); - red_text = new Font(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); - green_text = new Font(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18); - white_text = new Font(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); + black_text = new Font(datadir + "/images/status/letters-black.png", + Font::TEXT, 16,18); + gold_text = new Font(datadir + "/images/status/letters-gold.png", + Font::TEXT, 16,18); + silver_text = new Font(datadir + "/images/status/letters-silver.png", + Font::TEXT, 16,18); + blue_text = new Font(datadir + "/images/status/letters-blue.png", + Font::TEXT, 16, 18, 3); + red_text = new Font(datadir + "/images/status/letters-red.png", + Font::TEXT, 16,18); + green_text = new Font(datadir + "/images/status/letters-green.png", + Font::TEXT, 16,18); + white_text = new Font(datadir + "/images/fonts/letters-white.png", + Font::TEXT, 16,18); white_small_text = new Font(datadir + - "/images/status/letters-white-small.png", TEXT_TEXT, 8,9, 1); - white_big_text = new Font(datadir + "/images/status/letters-white-big.png", - TEXT_TEXT, 20,22, 3); - yellow_nums = new Font(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); + "/images/status/letters-white-small.png", Font::TEXT, 8,9, 1); + white_big_text = new Font(datadir + "/images/fonts/letters-white-big.png", + Font::TEXT, 20,22, 3); + yellow_nums = new Font(datadir + "/images/status/numbers.png", + Font::TEXT, 32,32); /* Load GUI/menu images: */ checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA); |
From: Ryan F. <sik...@us...> - 2004-06-01 21:30:03
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27956 Modified Files: TODO Log Message: - updated TODO Index: TODO =================================================================== RCS file: /cvsroot/super-tux/supertux/TODO,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- TODO 1 Jun 2004 21:12:29 -0000 1.59 +++ TODO 1 Jun 2004 21:29:54 -0000 1.60 @@ -25,6 +25,7 @@ [H] Make sure there are no invalid tile numbers in the level files - Tile 6 occurs in world1/level5.stl as well as other levels +[H] Worldmap needs to allow multiple maps [H] Change resolution to 800x600 - Levels need to be updated to resolution (half of the levels have been already updated) |
From: Ryan F. <sik...@us...> - 2004-06-01 21:12:38
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24503 Modified Files: TODO Log Message: - updated TODO Index: TODO =================================================================== RCS file: /cvsroot/super-tux/supertux/TODO,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- TODO 28 May 2004 22:57:31 -0000 1.58 +++ TODO 1 Jun 2004 21:12:29 -0000 1.59 @@ -23,13 +23,15 @@ [?] Default keyboard setup should change. Up will be needed for other features like going through doors and looking up, etc. +[H] Make sure there are no invalid tile numbers in the level files + - Tile 6 occurs in world1/level5.stl as well as other levels [H] Change resolution to 800x600 - Levels need to be updated to resolution (half of the levels have been already updated) [H] Buttjump related things ? Right now only breaks bricks beneath tux - what else should it break - - Breaks 1 box too much at the left when tux is facing left. - Should kill enemies with a certain range + - Done--now needs to be tweaked - Animation (need images) ? Should disable Tux's movement temporarily (1 second?) [H] Tux should fall while walking in tiles that have a space between. |
From: Ryan F. <sik...@us...> - 2004-06-01 21:09:48
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23803 Modified Files: badguy.cpp collision.cpp sector.cpp Log Message: - fixed some crashes where there was an invalid tile number - some tiles need to be fixed (ie, there is no tile 6 but level5 and others contain it) Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- badguy.cpp 1 Jun 2004 06:58:34 -0000 1.103 +++ badguy.cpp 1 Jun 2004 21:09:37 -0000 1.104 @@ -644,7 +644,8 @@ // go in wait mode when back in water if(dying == DYING_NOT - && gettile(base.x, base.y+ base.height)->attributes & Tile::WATER + && gettile(base.x, base.y + base.height) + && gettile(base.x, base.y + base.height)->attributes & Tile::WATER && physic.get_velocity_y() <= 0 && mode == NORMAL) { mode = FISH_WAIT; Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- collision.cpp 31 May 2004 02:40:29 -0000 1.26 +++ collision.cpp 1 Jun 2004 21:09:37 -0000 1.27 @@ -55,7 +55,7 @@ for(int x = starttilex; x*32 < max_x; ++x) { for(int y = starttiley; y*32 < max_y; ++y) { Tile* tile = tilemap.get_tile(x, y); - if(tile->attributes & Tile::SOLID) + if(tile && tile->attributes & Tile::SOLID) return true; } } Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sector.cpp 31 May 2004 22:13:15 -0000 1.3 +++ sector.cpp 1 Jun 2004 21:09:37 -0000 1.4 @@ -618,6 +618,13 @@ Sector::trybreakbrick(const Vector& pos, bool small) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + if (tile->attributes & Tile::BRICK) { if (tile->data > 0) @@ -674,6 +681,14 @@ Sector::tryemptybox(const Vector& pos, Direction col_side) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::FULLBOX)) return; @@ -730,6 +745,14 @@ Sector::trygrabdistro(const Vector& pos, int bounciness) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::COIN)) return; |
From: Ricardo C. <rm...@us...> - 2004-06-01 14:47:53
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4519/src Modified Files: player.cpp Log Message: Draw player above enemies in the dying sequence. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- player.cpp 31 May 2004 22:13:15 -0000 1.134 +++ player.cpp 1 Jun 2004 14:47:31 -0000 1.135 @@ -694,7 +694,7 @@ { if (dying == DYING_SQUISHED) { - smalltux_gameover->draw(context, pos, LAYER_OBJECTS); + smalltux_gameover->draw(context, pos, LAYER_OBJECTS+1); } else { |
From: Ryan F. <sik...@us...> - 2004-06-01 06:58:59
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8083 Modified Files: badguy.cpp Log Message: - a couple small fixes Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- badguy.cpp 31 May 2004 22:13:15 -0000 1.102 +++ badguy.cpp 1 Jun 2004 06:58:34 -0000 1.103 @@ -584,7 +584,8 @@ // start shaking when tux is below the stalactite and at least 40 pixels // near if(tux.base.x + 32 > base.x - RANGE && tux.base.x < base.x + 32 + RANGE - && tux.base.y + tux.base.height > base.y) { + && tux.base.y + tux.base.height > base.y + && tux.dying == DYING_NOT) { timer.start(SHAKETIME); mode = STALACTITE_SHAKING; } @@ -823,7 +824,7 @@ fall(); - if (mode == BGM_BIG) + if (mode == BGM_BIG && tux.dying == DYING_NOT) { if ((tux.base.x + tux.base.width/2 > base.x + base.width/2) && v_dir == LEFT) { |
From: Ricardo C. <rm...@us...> - 2004-05-31 23:47:14
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv368/src Modified Files: menu.cpp menu.h setup.cpp title.cpp Log Message: confirm_dialog now accepts a background, instead of doing the screen capture hack. Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- menu.cpp 31 May 2004 02:40:30 -0000 1.75 +++ menu.cpp 31 May 2004 23:47:05 -0000 1.76 @@ -65,10 +65,8 @@ Menu* Menu::current_ = 0; /* just displays a Yes/No text that can be used to confirm stuff */ -bool confirm_dialog(std::string text) +bool confirm_dialog(Surface *background, std::string text) { - // TODO -#if 0 //Surface* cap_screen = Surface::CaptureScreen(); Menu* dialog = new Menu; @@ -80,6 +78,8 @@ Menu::set_current(dialog); + DrawingContext context; + while(true) { SDL_Event event; @@ -89,9 +89,9 @@ dialog->event(event); } - //cap_screen->draw(0,0); + context.draw_surface(background, Vector(0,0), LAYER_BACKGROUND0); - dialog->draw(); + dialog->draw(context); dialog->action(); switch (dialog->check()) @@ -112,11 +112,11 @@ break; } - mouse_cursor->draw(); - flipscreen(); + mouse_cursor->draw(context); + context.do_drawing(); SDL_Delay(25); } -#endif + return false; } Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- title.cpp 31 May 2004 02:40:30 -0000 1.91 +++ title.cpp 31 May 2004 23:47:05 -0000 1.92 @@ -322,7 +322,7 @@ char str[1024]; sprintf(str,"Are you sure you want to delete slot %d?", slot); - if(confirm_dialog(str)) + if(confirm_dialog(bkg_title, str)) { sprintf(str,"%s/slot%d.stsg", st_save_dir, slot); printf("Removing: %s\n",str); Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- setup.cpp 31 May 2004 22:13:15 -0000 1.90 +++ setup.cpp 31 May 2004 23:47:05 -0000 1.91 @@ -508,7 +508,7 @@ } // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000); - fadeout(200); + fadeout(256); WorldMapNS::WorldMap worldmap; // Load the game or at least set the savegame_file variable Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- menu.h 30 May 2004 01:08:49 -0000 1.64 +++ menu.h 31 May 2004 23:47:05 -0000 1.65 @@ -93,7 +93,7 @@ MNID_APPLY }; -bool confirm_dialog(std::string text); +bool confirm_dialog(Surface* background, std::string text); /* Kinds of menu items */ enum MenuItemKind { |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12269 Modified Files: Makefile.am badguy.cpp gameloop.cpp level.cpp leveleditor.cpp moving_object.h musicref.cpp musicref.h physic.cpp physic.h player.cpp resources.cpp resources.h sector.cpp setup.cpp sound.cpp sound.h special.cpp worldmap.cpp Added Files: sound_manager.cpp sound_manager.h Removed Files: music_manager.cpp music_manager.h Log Message: introduce a new SoundManager class and merged MusicManager with it. Using this class we can create real stereo effects based on player position, without adding strange hacks to badguy.cpp Index: resources.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- resources.h 29 Apr 2004 15:18:27 -0000 1.10 +++ resources.h 31 May 2004 22:13:15 -0000 1.11 @@ -23,7 +23,7 @@ #include "musicref.h" class SpriteManager; -class MusicManager; +class SoundManager; extern Surface* img_waves[3]; extern Surface* img_water; @@ -38,7 +38,7 @@ extern MusicRef level_end_song; extern SpriteManager* sprite_manager; -extern MusicManager* music_manager; +extern SoundManager* sound_manager; void loadshared(); void unloadshared(); --- NEW FILE: sound_manager.h --- // $Id: sound_manager.h,v 1.1 2004/05/31 22:13:15 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __SOUND_MANAGER_H__ #define __SOUND_MANAGER_H__ #include "vector.h" #include <SDL_mixer.h> #include <string> #include <map> class MusicRef; class MovingObject; /** This class handles all sounds that are played */ class SoundManager { public: SoundManager(); ~SoundManager(); void play_sound(Mix_Chunk* sound); void play_sound(Mix_Chunk* sound, const Vector& pos); void play_sound(Mix_Chunk* sound, const MovingObject* object); MusicRef load_music(const std::string& file); bool exists_music(const std::string& filename); void play_music(const MusicRef& music, int loops = -1); void halt_music(); void enable_music(bool enable); private: // music part friend class MusicRef; class MusicResource { public: ~MusicResource(); SoundManager* manager; Mix_Music* music; int refcount; }; void free_music(MusicResource* music); std::map<std::string, MusicResource> musics; MusicResource* current_music; bool music_enabled; }; #endif Index: physic.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/physic.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- physic.cpp 31 May 2004 02:40:30 -0000 1.13 +++ physic.cpp 31 May 2004 22:13:15 -0000 1.14 @@ -122,7 +122,7 @@ } void -Physic::apply(float frame_ratio, float &x, float &y) +Physic::apply(float elapsed_time, float &x, float &y) { float gravity = Sector::current()->gravity; float grav; @@ -131,8 +131,15 @@ else grav = 0; - x += vx * frame_ratio + ax * frame_ratio * frame_ratio; - y += vy * frame_ratio + (ay + grav) * frame_ratio * frame_ratio; - vx += ax * frame_ratio; - vy += (ay + grav) * frame_ratio; + x += vx * elapsed_time + ax * elapsed_time * elapsed_time; + y += vy * elapsed_time + (ay + grav) * elapsed_time * elapsed_time; + vx += ax * elapsed_time; + vy += (ay + grav) * elapsed_time; +} + +void +Physic::apply(Vector& vector, float elapsed_time) +{ + apply(elapsed_time, vector.x, vector.y); } + Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- special.cpp 31 May 2004 02:40:30 -0000 1.53 +++ special.cpp 31 May 2004 22:13:15 -0000 1.54 @@ -265,7 +265,7 @@ if(kind != UPGRADE_GROWUP) return; - play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_BUMP_UPGRADE], Vector(base.x, base.y)); // determine new direction if (player->base.x + player->base.width/2 > base.x + base.width/2) @@ -308,30 +308,30 @@ if (kind == UPGRADE_GROWUP) { - play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_EXCELLENT]); pplayer->grow(true); } else if (kind == UPGRADE_FIREFLOWER) { - play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_COFFEE]); pplayer->grow(true); pplayer->got_power = pplayer->FIRE_POWER; } else if (kind == UPGRADE_ICEFLOWER) { - play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_COFFEE]); pplayer->grow(true); pplayer->got_power = pplayer->ICE_POWER; } else if (kind == UPGRADE_FIREFLOWER) { - play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_COFFEE]); pplayer->grow(true); pplayer->got_power = pplayer->FIRE_POWER; } else if (kind == UPGRADE_HERRING) { - play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_HERRING]); pplayer->invincible_timer.start(TUX_INVINCIBLE_TIME); Sector::current()->play_music(HERRING_MUSIC); } @@ -339,7 +339,7 @@ { if(player_status.lives < MAX_LIVES) { player_status.lives++; - play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_LIFEUP]); } } Index: sound.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sound.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- sound.cpp 16 May 2004 16:33:21 -0000 1.16 +++ sound.cpp 31 May 2004 22:13:15 -0000 1.17 @@ -17,7 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - #include "defines.h" #include "globals.h" #include "sound.h" @@ -66,13 +65,6 @@ if (Mix_AllocateChannels(8) != 8) return -2; - /* reserve some channels and register panning effects */ - if (Mix_ReserveChannels(SOUND_RESERVED_CHANNELS) != SOUND_RESERVED_CHANNELS) - return -3; - - /* prepare the spanning effects */ - Mix_SetPanning( SOUND_LEFT_SPEAKER, 230, 24 ); - Mix_SetPanning( SOUND_RIGHT_SPEAKER, 24, 230 ); return 0; } @@ -82,8 +74,6 @@ void close_audio( void ) { if (audio_device) { - Mix_UnregisterAllEffects( SOUND_LEFT_SPEAKER ); - Mix_UnregisterAllEffects( SOUND_RIGHT_SPEAKER ); Mix_CloseAudio(); } } @@ -104,31 +94,6 @@ return(snd); } -/* --- PLAY A SOUND ON LEFT OR RIGHT OR CENTER SPEAKER --- */ - -void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker) -{ - /* this won't call the function if the user has disabled sound - * either via menu or via command-line option - */ - if(!audio_device || !use_sound) - return; - - Mix_PlayChannel( whichSpeaker, snd, 0); - - /* prepare for panning effects for next call */ - switch (whichSpeaker) { - case SOUND_LEFT_SPEAKER: - Mix_SetPanning( SOUND_LEFT_SPEAKER, 230, 24 ); - break; - case SOUND_RIGHT_SPEAKER: - Mix_SetPanning( SOUND_RIGHT_SPEAKER, 24, 230 ); - break; - default: // keep the compiler happy - break; - } -} - void free_chunk(Mix_Chunk *chunk) { Mix_FreeChunk( chunk ); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 --- gameloop.cpp 31 May 2004 13:43:30 -0000 1.142 +++ gameloop.cpp 31 May 2004 22:13:15 -0000 1.143 @@ -55,7 +55,6 @@ #include "resources.h" #include "background.h" #include "tilemap.h" -#include "music_manager.h" GameSession* GameSession::current_ = 0; @@ -145,7 +144,7 @@ void GameSession::levelintro(void) { - music_manager->halt_music(); + sound_manager->halt_music(); char str[60]; @@ -459,7 +458,7 @@ { end_sequence = ENDSEQUENCE_RUNNING; last_x_pos = -1; - music_manager->play_music(level_end_song, 0); + sound_manager->play_music(level_end_song, 0); endsequence_timer.start(7000); // 5 seconds until we finish the map tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) } @@ -689,7 +688,7 @@ Sector::current()->add_bouncy_brick(Vector(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32)); - play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_BRICK], Vector(x, y)); } /* (Status): */ --- music_manager.cpp DELETED --- Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- player.cpp 31 May 2004 13:43:30 -0000 1.133 +++ player.cpp 31 May 2004 22:13:15 -0000 1.134 @@ -31,6 +31,7 @@ #include "tilemap.h" #include "camera.h" #include "gameobjs.h" +#include "resources.h" #include "interactive_object.h" #include "screen/screen.h" @@ -413,7 +414,7 @@ if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) { if(fabs(vx)>SKID_XM && !skidding_timer.check()) { skidding_timer.start(SKID_TIME); - play_sound(sounds[SND_SKID], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_SKID]); ax *= 2.5; } else { ax *= 2; @@ -480,9 +481,9 @@ jumping = true; can_jump = false; if (size == SMALL) - play_sound(sounds[SND_JUMP], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_JUMP]); else - play_sound(sounds[SND_BIGJUMP], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_BIGJUMP]); } // Let go of jump key else if(input.up == UP && jumping && physic.get_velocity_y() > 0) @@ -668,7 +669,7 @@ if(player_status.lives < MAX_LIVES) ++player_status.lives; /*We want to hear the sound even, if MAX_LIVES is reached*/ - play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_LIFEUP]); } } @@ -906,7 +907,7 @@ if(dying) return; - play_sound(sounds[SND_HURT], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_HURT]); physic.set_velocity_x(0); Index: physic.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/physic.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- physic.h 20 Apr 2004 17:58:00 -0000 1.13 +++ physic.h 31 May 2004 22:13:15 -0000 1.14 @@ -63,6 +63,9 @@ /** applies the physical simulation to given x and y coordinates */ void apply(float frame_ratio, float &x, float &y); + /** applies the physical simulation to given x and y coordinates */ + void apply(Vector& vector, float frame_ratio); + private: /// horizontal and vertical acceleration float ax, ay; Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -r1.101 -r1.102 --- badguy.cpp 31 May 2004 13:43:28 -0000 1.101 +++ badguy.cpp 31 May 2004 22:13:15 -0000 1.102 @@ -356,7 +356,7 @@ tux.kick_timer.start(KICKING_TIME); set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); - play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_KICK], this); } } @@ -366,15 +366,7 @@ check_horizontal_bump(); if(mode == KICK && changed != dir) { - float scroll_x = Sector::current()->camera->get_translation().x; - - /* handle stereo sound (number 10 should be tweaked...)*/ - if (base.x < scroll_x + screen->w/2 - 10) - play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER); - else if (base.x > scroll_x + screen->w/2 + 10) - play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER); - else - play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_RICOCHET], get_pos()); } } @@ -568,16 +560,7 @@ dying = DYING_NOT; // now the bomb hurts timer.start(EXPLODETIME); - float scroll_x = Sector::current()->camera->get_translation().x; - - /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates... - if (base.x < scroll_x + screen->w/2 - 10) - play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER); - else if (base.x > scroll_x + screen->w/2 + 10) - play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER); - else - play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER); - + sound_manager->play_sound(sounds[SND_EXPLODE], this); } else if(mode == BOMB_EXPLODE) { remove_me(); return; @@ -1054,7 +1037,8 @@ Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); + + sound_manager->play_sound(sounds[SND_SQUISH], get_pos()); player_status.score_multiplier++; dying = DYING_SQUISHED; @@ -1074,7 +1058,7 @@ make_player_jump(player); Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_SQUISH], get_pos()); player_status.score_multiplier++; return; @@ -1082,7 +1066,7 @@ if (mode == NORMAL || mode == KICK) { /* Flatten! */ - play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_STOMP], get_pos()); mode = FLAT; set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x(0); @@ -1090,7 +1074,7 @@ timer.start(4000); } else if (mode == FLAT) { /* Kick! */ - play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_KICK], this); if (player->base.x < base.x + (base.width/2)) { physic.set_velocity_x(5); @@ -1191,7 +1175,7 @@ score * player_status.score_multiplier); /* Play death sound: */ - play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_FALL], this); } void @@ -1354,7 +1338,7 @@ /* Get kicked if were flat */ if (mode == FLAT && !dying) { - play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_KICK], this); // Hit from left side if (player->base.x < base.x) { Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- Makefile.am 31 May 2004 13:43:28 -0000 1.31 +++ Makefile.am 31 May 2004 22:13:14 -0000 1.32 @@ -46,8 +46,6 @@ menu.h \ mousecursor.cpp \ mousecursor.h \ -music_manager.cpp \ -music_manager.h \ musicref.cpp \ musicref.h \ particlesystem.cpp \ @@ -62,6 +60,8 @@ setup.h \ sound.cpp \ sound.h \ +sound_manager.h \ +sound_manager.cpp \ special.cpp \ special.h \ sprite.h \ Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- resources.cpp 31 May 2004 02:40:30 -0000 1.35 +++ resources.cpp 31 May 2004 22:13:15 -0000 1.36 @@ -25,6 +25,7 @@ #include "special.h" #include "resources.h" #include "sprite_manager.h" +#include "sound_manager.h" #include "setup.h" Surface* img_waves[3]; @@ -39,7 +40,7 @@ MusicRef level_end_song; SpriteManager* sprite_manager = 0; -MusicManager* music_manager = 0; +SoundManager* sound_manager = 0; /* Load graphics/sounds shared between all levels: */ void loadshared() @@ -47,8 +48,8 @@ int i; sprite_manager = new SpriteManager(datadir + "/supertux.strf"); - music_manager = new MusicManager(); - music_manager->enable_music(use_music); + sound_manager = new SoundManager(); + sound_manager->enable_music(use_music); /* Tuxes: */ smalltux_star = sprite_manager->load("smalltux-star"); @@ -214,8 +215,8 @@ sounds[i] = load_sound(datadir + soundfilenames[i]); /* Herring song */ - herring_song = music_manager->load_music(datadir + "/music/SALCON.MOD"); - level_end_song = music_manager->load_music(datadir + "/music/tux-leveldone.mod"); + herring_song = sound_manager->load_music(datadir + "/music/SALCON.MOD"); + level_end_song = sound_manager->load_music(datadir + "/music/tux-leveldone.mod"); } @@ -251,8 +252,8 @@ delete sprite_manager; sprite_manager = 0; - delete music_manager; - music_manager = 0; + delete sound_manager; + sound_manager = 0; } /* EOF */ Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sector.cpp 31 May 2004 13:43:30 -0000 1.2 +++ sector.cpp 31 May 2004 22:13:15 -0000 1.3 @@ -33,7 +33,7 @@ #include "particlesystem.h" #include "tile.h" #include "tilemap.h" -#include "music_manager.h" +#include "sound_manager.h" #include "gameloop.h" #include "resources.h" #include "interactive_object.h" @@ -608,7 +608,7 @@ throw std::runtime_error("wrong bullet type."); add_object(new_bullet); - play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_SHOOT]); return true; } @@ -643,7 +643,7 @@ solids->change_at(pos, tile->next_tile); } - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_DISTRO]); player_status.score = player_status.score + SCORE_DISTRO; player_status.distros++; return true; @@ -659,7 +659,7 @@ (int)(pos.y / 32) * 32), tile); /* Get some score: */ - play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_BRICK]); player_status.score = player_status.score + SCORE_BRICK; return true; @@ -689,7 +689,7 @@ { case 1: // Box with a distro! add_bouncy_distro(Vector(posx, posy)); - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_DISTRO]); player_status.score = player_status.score + SCORE_DISTRO; player_status.distros++; break; @@ -699,7 +699,7 @@ add_upgrade(Vector(posx, posy), col_side, UPGRADE_GROWUP); else /* Tux is big, add a fireflower: */ add_upgrade(Vector(posx, posy), col_side, UPGRADE_FIREFLOWER); - play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_UPGRADE]); break; case 5: // Add an ice flower upgrade! @@ -707,7 +707,7 @@ add_upgrade(Vector(posx, posy), col_side, UPGRADE_GROWUP); else /* Tux is big, add an iceflower: */ add_upgrade(Vector(posx, posy), col_side, UPGRADE_ICEFLOWER); - play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_UPGRADE]); break; case 3: // Add a golden herring @@ -734,7 +734,7 @@ return; solids->change_at(pos, tile->next_tile); - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + sound_manager->play_sound(sounds[SND_DISTRO]); if (bounciness == BOUNCE) { @@ -778,7 +778,7 @@ char* song_path; char* song_subtitle; - level_song = music_manager->load_music(datadir + "/music/" + song_title); + level_song = sound_manager->load_music(datadir + "/music/" + song_title); song_path = (char *) malloc(sizeof(char) * datadir.length() + strlen(song_title.c_str()) + 8 + 5); @@ -786,10 +786,10 @@ strcpy(strstr(song_subtitle, "."), "\0"); sprintf(song_path, "%s/music/%s-fast%s", datadir.c_str(), song_subtitle, strstr(song_title.c_str(), ".")); - if(!music_manager->exists_music(song_path)) { + if(!sound_manager->exists_music(song_path)) { level_song_fast = level_song; } else { - level_song_fast = music_manager->load_music(song_path); + level_song_fast = sound_manager->load_music(song_path); } free(song_subtitle); free(song_path); @@ -801,16 +801,16 @@ currentmusic = type; switch(currentmusic) { case HURRYUP_MUSIC: - music_manager->play_music(level_song_fast); + sound_manager->play_music(level_song_fast); break; case LEVEL_MUSIC: - music_manager->play_music(level_song); + sound_manager->play_music(level_song); break; case HERRING_MUSIC: - music_manager->play_music(herring_song); + sound_manager->play_music(herring_song); break; default: - music_manager->halt_music(); + sound_manager->halt_music(); break; } } --- NEW FILE: sound_manager.cpp --- // $Id: sound_manager.cpp,v 1.1 2004/05/31 22:13:15 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "sound_manager.h" #include <math.h> #include <assert.h> #include "musicref.h" #include "setup.h" #include "sector.h" #include "camera.h" #include "sound.h" #include "globals.h" #include "moving_object.h" SoundManager::SoundManager() : current_music(0), music_enabled(true) { } SoundManager::~SoundManager() { if(audio_device) Mix_HaltMusic(); } void SoundManager::play_sound(Mix_Chunk* sound) { if(!audio_device || !use_sound) return; Mix_PlayChannel(-1, sound, 0); } void SoundManager::play_sound(Mix_Chunk* sound, const MovingObject* object) { // TODO keep track of the object later and move the sound along with the // object. play_sound(sound, object->get_pos()); } void SoundManager::play_sound(Mix_Chunk* sound, const Vector& pos) { if(!audio_device || !use_sound) return; // TODO make sure this formula is good float distance = Sector::current()->player->get_pos().x - pos.x; int loud = int(255.0/float(screen->w*2) * fabsf(distance)); if(loud > 255) return; int chan = Mix_PlayChannel(-1, sound, 0); if(chan < 0) return; Mix_SetDistance(chan, loud); // very bad way to do this... if(distance > 100) Mix_SetPanning(chan, 230, 24); else if(distance < -100) Mix_SetPanning(chan, 24, 230); } MusicRef SoundManager::load_music(const std::string& file) { if(!audio_device) return MusicRef(0); if(!exists_music(file)) st_abort("Couldn't load musicfile ", file.c_str()); std::map<std::string, MusicResource>::iterator i = musics.find(file); assert(i != musics.end()); return MusicRef(& (i->second)); } bool SoundManager::exists_music(const std::string& file) { if(!audio_device) return true; // song already loaded? std::map<std::string, MusicResource>::iterator i = musics.find(file); if(i != musics.end()) { return true; } Mix_Music* song = Mix_LoadMUS(file.c_str()); if(song == 0) return false; // insert into music list std::pair<std::map<std::string, MusicResource>::iterator, bool> result = musics.insert( std::make_pair<std::string, MusicResource> (file, MusicResource())); MusicResource& resource = result.first->second; resource.manager = this; resource.music = song; return true; } void SoundManager::free_music(MusicResource* ) { // TODO free music, currently we can't do this since SDL_mixer seems to have // some bugs if you load/free alot of mod files. } void SoundManager::play_music(const MusicRef& musicref, int loops) { if(!audio_device) return; if(musicref.music == 0 || current_music == musicref.music) return; if(current_music) current_music->refcount--; current_music = musicref.music; current_music->refcount++; if(music_enabled) Mix_PlayMusic(current_music->music, loops); } void SoundManager::halt_music() { if(!audio_device) return; Mix_HaltMusic(); if(current_music) { current_music->refcount--; if(current_music->refcount == 0) free_music(current_music); current_music = 0; } } void SoundManager::enable_music(bool enable) { if(!audio_device) return; if(enable == music_enabled) return; music_enabled = enable; if(music_enabled == false) { Mix_HaltMusic(); } else { Mix_PlayMusic(current_music->music, -1); } } SoundManager::MusicResource::~MusicResource() { // don't free music buggy SDL_Mixer crashs for some mod files // Mix_FreeMusic(music); } Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- worldmap.cpp 31 May 2004 02:40:30 -0000 1.79 +++ worldmap.cpp 31 May 2004 22:13:15 -0000 1.80 @@ -31,6 +31,7 @@ #include "setup.h" #include "sector.h" #include "worldmap.h" +#include "sound_manager.h" #include "resources.h" namespace WorldMapNS { @@ -690,8 +691,8 @@ if (!level->extro_filename.empty()) { MusicRef theme = - music_manager->load_music(datadir + "/music/theme.mod"); - music_manager->play_music(theme); + sound_manager->load_music(datadir + "/music/theme.mod"); + sound_manager->play_music(theme); // Display final credits and go back to the main menu display_text_file(level->extro_filename, "/images/background/extro.jpg", SCROLL_SPEED_MESSAGE); @@ -745,7 +746,7 @@ break; } - music_manager->play_music(song); + sound_manager->play_music(song); Menu::set_current(0); if (!savegame_file.empty()) savegame(savegame_file); @@ -901,8 +902,8 @@ quit = false; - song = music_manager->load_music(datadir + "/music/" + music); - music_manager->play_music(song); + song = sound_manager->load_music(datadir + "/music/" + music); + sound_manager->play_music(song); unsigned int last_update_time; unsigned int update_time; Index: sound.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sound.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- sound.h 26 Apr 2004 12:21:22 -0000 1.28 +++ sound.h 31 May 2004 22:13:15 -0000 1.29 @@ -36,14 +36,6 @@ HERRING_MUSIC }; -/* panning effects: terrible :-) ! */ -enum Sound_Speaker { - SOUND_LEFT_SPEAKER = 0, - SOUND_RIGHT_SPEAKER = 1, - SOUND_RESERVED_CHANNELS = 2, // 2 channels reserved for left/right speaker - SOUND_CENTER_SPEAKER = -1 -}; - /* Sound files: */ enum { SND_JUMP, @@ -82,6 +74,5 @@ Mix_Chunk * load_sound(const std::string& file); void free_chunk(Mix_Chunk*chunk); -void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker); #endif /*SUPERTUX_SOUND_H*/ Index: moving_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/moving_object.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- moving_object.h 31 May 2004 13:43:30 -0000 1.3 +++ moving_object.h 31 May 2004 22:13:15 -0000 1.4 @@ -39,6 +39,9 @@ virtual void collision(const MovingObject& other_object, int collision_type) = 0; + Vector get_pos() const + { return Vector(base.x, base.y); } + base_type base; base_type old_base; Index: musicref.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/musicref.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- musicref.cpp 24 Apr 2004 14:49:03 -0000 1.1 +++ musicref.cpp 31 May 2004 22:13:15 -0000 1.2 @@ -24,7 +24,7 @@ { } -MusicRef::MusicRef(MusicManager::MusicResource* newmusic) +MusicRef::MusicRef(SoundManager::MusicResource* newmusic) : music(newmusic) { if(music) @@ -50,7 +50,7 @@ MusicRef& MusicRef::operator =(const MusicRef& other) { - MusicManager::MusicResource* oldres = music; + SoundManager::MusicResource* oldres = music; music = other.music; if(music) music->refcount++; Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- setup.cpp 31 May 2004 14:08:11 -0000 1.89 +++ setup.cpp 31 May 2004 22:13:15 -0000 1.90 @@ -51,7 +51,7 @@ #include "worldmap.h" #include "resources.h" #include "intro.h" -#include "music_manager.h" +#include "sound_manager.h" #include "player.h" @@ -558,7 +558,7 @@ if(use_music != options_menu->isToggled(MNID_MUSIC)) { use_music = !use_music; - music_manager->enable_music(use_music); + sound_manager->enable_music(use_music); } break; case MNID_SHOWFPS: Index: musicref.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/musicref.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- musicref.h 24 Apr 2004 14:49:04 -0000 1.1 +++ musicref.h 31 May 2004 22:13:15 -0000 1.2 @@ -19,7 +19,7 @@ #ifndef HEADER_MUSIC_RESOURCE_H #define HEADER_MUSIC_RESOURCE_H -#include "music_manager.h" +#include "sound_manager.h" /** This class holds a reference to a music file and maintains a correct * refcount for that file. @@ -34,10 +34,10 @@ MusicRef& operator= (const MusicRef& other); private: - friend class MusicManager; - MusicRef(MusicManager::MusicResource* music); + friend class SoundManager; + MusicRef(SoundManager::MusicResource* music); - MusicManager::MusicResource* music; + SoundManager::MusicResource* music; }; #endif Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- leveleditor.cpp 30 May 2004 01:08:48 -0000 1.128 +++ leveleditor.cpp 31 May 2004 22:13:15 -0000 1.129 @@ -43,7 +43,6 @@ #include "button.h" #include "tile.h" #include "resources.h" -#include "music_manager.h" #include "background.h" // TODO --- music_manager.h DELETED --- Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- level.cpp 31 May 2004 02:40:30 -0000 1.88 +++ level.cpp 31 May 2004 22:13:15 -0000 1.89 @@ -36,7 +36,6 @@ #include "tile.h" #include "lispreader.h" #include "resources.h" -#include "music_manager.h" #include "gameobjs.h" #include "lispwriter.h" |
From: Matze B. <mat...@us...> - 2004-05-31 14:10:36
|
Update of /cvsroot/super-tux/supertux/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9652/data Modified Files: supertux.strf Log Message: forgot to checkin sprite changes Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/supertux.strf,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- supertux.strf 27 May 2004 16:58:16 -0000 1.39 +++ supertux.strf 31 May 2004 14:10:27 -0000 1.40 @@ -681,6 +681,13 @@ (x-hotspot 0) (y-hotspot 0) (images "shared/walkingtree-left-small-1.png")) - ) + + ; Door + (sprite (name "door") + (y-hotspot 0) + (y-hotspot 0) + (images "shared/door.png") + ) +) ;; EOF ;; |
From: Ricardo C. <rm...@us...> - 2004-05-31 14:08:24
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9074/src/screen Modified Files: screen.cpp screen.h Log Message: Do a black fade-in when selecting slot. To make it really looking good, we would had to have access to the screen. Dunno how we can do this with OpenGL. Index: screen.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/screen.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- screen.h 30 May 2004 01:08:50 -0000 1.1 +++ screen.h 31 May 2004 14:08:10 -0000 1.2 @@ -36,10 +36,8 @@ void drawline(int x1, int y1, int x2, int y2, int r, int g, int b, int a); void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255); -void shrink_fade(const Vector& point, float fade_time); -//void black_fade(Surface* surface, int seconds, bool fade_out); -void fade(const std::string& surface, int seconds, bool fade_out); -void update_rect(SDL_Surface *scr, Sint32 x, Sint32 y, Sint32 w, Sint32 h); -void fadeout(); + +void fadeout(int fade_time); +void shrink_fade(const Vector& point, int fade_time); #endif /*SUPERTUX_SCREEN_H*/ Index: screen.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/screen.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- screen.cpp 30 May 2004 01:08:50 -0000 1.1 +++ screen.cpp 31 May 2004 14:08:10 -0000 1.2 @@ -288,8 +288,24 @@ } -void fadeout() +#define LOOP_DELAY 20.0 + +void fadeout(int fade_time) { + float alpha_inc = 256 / (fade_time / LOOP_DELAY); + float alpha = 256; + + while(alpha > 0) + { + alpha -= alpha_inc; + fillrect(0, 0, screen->w, screen->h, 0,0,0, (int)alpha_inc); // left side + + DrawingContext context; // ugly... + context.do_drawing(); + + SDL_Delay(int(LOOP_DELAY)); + } + fillrect(0, 0, screen->w, screen->h, 0, 0, 0, 255); DrawingContext context; @@ -298,13 +314,12 @@ context.do_drawing(); } -#define LOOP_DELAY 20.0 -void shrink_fade(const Vector& point, float fade_time) +void shrink_fade(const Vector& point, int fade_time) { - float left_inc = point.x / (fade_time / LOOP_DELAY); - float right_inc = (screen->w - point.x) / (fade_time / LOOP_DELAY); - float up_inc = point.y / (fade_time / LOOP_DELAY); - float down_inc = (screen->h - point.y) / (fade_time / LOOP_DELAY); + float left_inc = point.x / ((float)fade_time / LOOP_DELAY); + float right_inc = (screen->w - point.x) / ((float)fade_time / LOOP_DELAY); + float up_inc = point.y / ((float)fade_time / LOOP_DELAY); + float down_inc = (screen->h - point.y) / ((float)fade_time / LOOP_DELAY); float left_cor = 0, right_cor = 0, up_cor = 0, down_cor = 0; |
From: Ricardo C. <rm...@us...> - 2004-05-31 14:08:23
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9074/src Modified Files: setup.cpp Log Message: Do a black fade-in when selecting slot. To make it really looking good, we would had to have access to the screen. Dunno how we can do this with OpenGL. Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- setup.cpp 31 May 2004 13:43:30 -0000 1.88 +++ setup.cpp 31 May 2004 14:08:11 -0000 1.89 @@ -508,7 +508,7 @@ } // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000); - fadeout(); + fadeout(200); WorldMapNS::WorldMap worldmap; // Load the game or at least set the savegame_file variable |
From: Matze B. <mat...@us...> - 2004-05-31 13:43:50
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4137/src Modified Files: Makefile.am badguy.cpp configfile.cpp gameloop.cpp gameloop.h moving_object.cpp moving_object.h player.cpp player.h sector.cpp sector.h setup.cpp vector.cpp vector.h Added Files: door.cpp door.h interactive_object.cpp interactive_object.h Log Message: a first implementation of doors to switch between sectors Index: moving_object.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/moving_object.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- moving_object.cpp 20 May 2004 23:07:25 -0000 1.2 +++ moving_object.cpp 31 May 2004 13:43:30 -0000 1.3 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "moving_object.h" MovingObject::MovingObject() Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- player.h 31 May 2004 02:40:30 -0000 1.66 +++ player.h 31 May 2004 13:43:30 -0000 1.67 @@ -52,6 +52,7 @@ { public: int jump; + int activate; int duck; int left; int right; @@ -71,6 +72,7 @@ int down; int fire; int old_fire; + int activate; }; void player_input_init(player_input_type* pplayer_input); --- NEW FILE: door.h --- // $Id: door.h,v 1.1 2004/05/31 13:43:30 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __DOOR_H__ #define __DOOR_H__ #include <string> #include "interactive_object.h" #include "serializable.h" class Sprite; class LispReader; class Door : public InteractiveObject, public Serializable { public: Door(LispReader& reader); virtual ~Door(); virtual void write(LispWriter& writer); virtual void action(float elapsed_time); virtual void draw(DrawingContext& context); virtual void interaction(InteractionType type); private: Sprite* sprite; std::string target_sector; std::string target_spawnpoint; }; #endif Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sector.cpp 31 May 2004 02:40:30 -0000 1.1 +++ sector.cpp 31 May 2004 13:43:30 -0000 1.2 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "sector.h" #include <memory> @@ -18,6 +36,8 @@ #include "music_manager.h" #include "gameloop.h" #include "resources.h" +#include "interactive_object.h" +#include "door.h" Sector* Sector::_current = 0; @@ -78,6 +98,7 @@ reader.read_string("name", sp->name); reader.read_float("x", sp->pos.x); reader.read_float("y", sp->pos.y); + spawnpoints.push_back(sp); } else if(token == "tilemap") { TileMap* tilemap = new TileMap(reader); add_object(tilemap); @@ -103,12 +124,17 @@ CloudParticleSystem* partsys = new CloudParticleSystem(); partsys->parse(reader); add_object(partsys); + } else if(token == "door") { + add_object(new Door(reader)); + } else { + std::cerr << "Unknown object type '" << token << "'.\n"; } } if(!camera) { - std::cerr << "sector does not contain a camera.\n"; + std::cerr << "sector '" << name << "' does not contain a camera.\n"; camera = new Camera(this); + add_object(camera); } if(!solids) throw std::runtime_error("sector does not contain a solid tile layer."); @@ -264,9 +290,10 @@ FlyingPlatform* flying_platform = dynamic_cast<FlyingPlatform*> (object); if(flying_platform) flying_platforms.push_back(flying_platform); - Background* background = dynamic_cast<Background*> (object); - if(background) - this->background = background; + InteractiveObject* interactive_object + = dynamic_cast<InteractiveObject*> (object); + if(interactive_object) + interactive_objects.push_back(interactive_object); gameobjects.push_back(object); } @@ -338,6 +365,13 @@ std::remove(bullets.begin(), bullets.end(), bullet), bullets.end()); } + InteractiveObject* interactive_object = + dynamic_cast<InteractiveObject*> (*i); + if(interactive_object) { + interactive_objects.erase( + std::remove(interactive_objects.begin(), interactive_objects.end(), + interactive_object), interactive_objects.end()); + } Upgrade* upgrade = dynamic_cast<Upgrade*> (*i); if(upgrade) { upgrades.erase( Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- setup.cpp 30 May 2004 01:08:49 -0000 1.87 +++ setup.cpp 31 May 2004 13:43:30 -0000 1.88 @@ -424,6 +424,8 @@ options_keys_menu->additem(MN_CONTROLFIELD_KB,"Right move", 0,0, 0,&keymap.right); options_keys_menu->additem(MN_CONTROLFIELD_KB,"Jump", 0,0, 0,&keymap.jump); options_keys_menu->additem(MN_CONTROLFIELD_KB,"Duck", 0,0, 0,&keymap.duck); + options_keys_menu->additem(MN_CONTROLFIELD_KB,"Activate", 0, 0, 0, + &keymap.activate); options_keys_menu->additem(MN_CONTROLFIELD_KB,"Power/Run", 0,0, 0,&keymap.fire); options_keys_menu->additem(MN_HL,"",0,0); options_keys_menu->additem(MN_BACK,"Back",0,0); Index: moving_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/moving_object.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- moving_object.h 20 May 2004 23:07:25 -0000 1.2 +++ moving_object.h 31 May 2004 13:43:30 -0000 1.3 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __MOVING_OBJECT_H__ #define __MOVING_OBJECT_H__ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -r1.100 -r1.101 --- badguy.cpp 31 May 2004 13:02:21 -0000 1.100 +++ badguy.cpp 31 May 2004 13:43:28 -0000 1.101 @@ -989,12 +989,9 @@ else sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); - if(debug_mode) // draw hotpoint - { - float scroll_x = context.get_translation().x; - float scroll_y = context.get_translation().y; - fillrect(base.x - scroll_x, base.y - scroll_y, base.width, base.height, 75,0,75, 150); - } + if(debug_mode) + context.draw_filled_rect(Vector(base.x, base.y), + Vector(base.width, base.height), Color(75,0,75, 150), LAYER_OBJECTS+1); } void Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.141 retrieving revision 1.142 diff -u -d -r1.141 -r1.142 --- gameloop.cpp 31 May 2004 02:40:30 -0000 1.141 +++ gameloop.cpp 31 May 2004 13:43:30 -0000 1.142 @@ -316,6 +316,19 @@ switch(key) { + case SDLK_a: + if(debug_mode) + { + char buf[160]; + snprintf(buf, sizeof(buf), "P: %4.1f,%4.1f", + tux.base.x, tux.base.y); + context->draw_text(white_text, buf, + Vector(0, screen->h - white_text->get_height()), + LAYER_FOREGROUND1); + context->do_drawing(); + SDL_Delay(1000); + } + break; case SDLK_p: if(!Menu::current()) { @@ -334,13 +347,7 @@ case SDLK_TAB: if(debug_mode) { - tux.size = !tux.size; - if(tux.size == BIG) - { - tux.base.height = 64; - } - else - tux.base.height = 32; + tux.grow(false); } break; case SDLK_END: @@ -437,19 +444,9 @@ Player* tux = currentsector->player; /* End of level? */ - int endpos = (currentsector->solids->get_width() - 5) * 32; Tile* endtile = collision_goal(tux->base); - // fallback in case the other endpositions don't trigger - if (!end_sequence && tux->base.x >= endpos) - { - end_sequence = ENDSEQUENCE_WAITING; - last_x_pos = -1; - music_manager->play_music(level_end_song, 0); - endsequence_timer.start(7000); - tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) - } - else if(end_sequence && !endsequence_timer.check()) + if(end_sequence && !endsequence_timer.check()) { exit_status = ES_LEVEL_FINISHED; return; @@ -491,6 +488,15 @@ // Update Tux and the World currentsector->action(frame_ratio); } + + // respawning in new sector? + if(newsector != "" && newspawnpoint != "") { + Sector* sector = level->get_sector(newsector); + currentsector = sector; + currentsector->activate(newspawnpoint); + currentsector->play_music(LEVEL_MUSIC); + newsector = newspawnpoint = ""; + } } void @@ -670,6 +676,13 @@ return exit_status; } +void +GameSession::respawn(const std::string& sector, const std::string& spawnpoint) +{ + newsector = sector; + newspawnpoint = spawnpoint; +} + /* Bounce a brick: */ void bumpbrick(float x, float y) { Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- gameloop.h 31 May 2004 02:40:30 -0000 1.51 +++ gameloop.h 31 May 2004 13:43:30 -0000 1.52 @@ -72,6 +72,10 @@ bool game_pause; std::string levelname; + + // the sector and spawnpoint we shoudl spawn after this frame + std::string newsector; + std::string newspawnpoint; public: enum ExitStatus { ES_NONE, ES_LEVEL_FINISHED, ES_GAME_OVER, ES_LEVEL_ABORT }; private: @@ -93,6 +97,8 @@ { current_ = this; } static GameSession* current() { return current_; } + void respawn(const std::string& sectorname, + const std::string& spawnpointname); Sector* get_current_sector() { return currentsector; } Index: vector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/vector.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- vector.h 30 May 2004 01:08:49 -0000 1.3 +++ vector.h 31 May 2004 13:43:30 -0000 1.4 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __VECTOR_HPP__ #define __VECTOR_HPP__ Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sector.h 31 May 2004 02:40:30 -0000 1.1 +++ sector.h 31 May 2004 13:43:30 -0000 1.2 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __SECTOR_H__ #define __SECTOR_H__ @@ -10,6 +28,7 @@ #include "screen/drawing_context.h" class GameObject; +class InteractiveObject; class Background; class Player; class Camera; @@ -125,6 +144,8 @@ std::vector<Bullet*> bullets; public: // ugly + typedef std::vector<InteractiveObject*> InteractiveObjects; + InteractiveObjects interactive_objects; typedef std::vector<GameObject*> GameObjects; GameObjects gameobjects; --- NEW FILE: interactive_object.cpp --- // $Id: interactive_object.cpp,v 1.1 2004/05/31 13:43:30 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "interactive_object.h" InteractiveObject::InteractiveObject() { } InteractiveObject::~InteractiveObject() { } Index: configfile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/configfile.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- configfile.cpp 31 May 2004 02:40:29 -0000 1.5 +++ configfile.cpp 31 May 2004 13:43:30 -0000 1.6 @@ -100,6 +100,7 @@ reader.read_int ("joystick-deadzone", joystick_keymap.dead_zone); reader.read_int ("keyboard-jump", keymap.jump); + reader.read_int ("keyboard-activate", keymap.activate); reader.read_int ("keyboard-duck", keymap.duck); reader.read_int ("keyboard-left", keymap.left); reader.read_int ("keyboard-right", keymap.right); --- NEW FILE: door.cpp --- // $Id: door.cpp,v 1.1 2004/05/31 13:43:30 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "door.h" #include "lispreader.h" #include "lispwriter.h" #include "gameloop.h" #include "resources.h" #include "sprite.h" #include "sprite_manager.h" #include "screen/drawing_context.h" Door::Door(LispReader& reader) { reader.read_float("x", area.x); reader.read_float("y", area.y); area.width = 32; area.height = 64; reader.read_string("sector", target_sector); reader.read_string("spawnpoint", target_spawnpoint); sprite = sprite_manager->load("door"); } void Door::write(LispWriter& writer) { writer.start_list("door"); writer.write_float("x", area.x); writer.write_float("y", area.y); writer.write_float("width", area.width); writer.write_float("height", area.height); writer.write_string("sector", target_sector); writer.write_string("spawnpoint", target_spawnpoint); writer.end_list("door"); } Door::~Door() { } void Door::action(float ) { } void Door::draw(DrawingContext& context) { sprite->draw(context, Vector(area.x, area.y), LAYER_TILES); } void Door::interaction(InteractionType type) { if(type == INTERACTION_ACTIVATE) { GameSession::current()->respawn(target_sector, target_spawnpoint); } } Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- player.cpp 31 May 2004 02:40:30 -0000 1.132 +++ player.cpp 31 May 2004 13:43:30 -0000 1.133 @@ -31,6 +31,7 @@ #include "tilemap.h" #include "camera.h" #include "gameobjs.h" +#include "interactive_object.h" #include "screen/screen.h" // behavior definitions: @@ -57,7 +58,8 @@ PlayerKeymap::PlayerKeymap() { - keymap.jump = SDLK_UP; + keymap.jump = SDLK_SPACE; + keymap.activate = SDLK_UP; keymap.duck = SDLK_DOWN; keymap.left = SDLK_LEFT; keymap.right = SDLK_RIGHT; @@ -73,6 +75,7 @@ pplayer_input->right = UP; pplayer_input->up = UP; pplayer_input->old_up = UP; + pplayer_input->activate = UP; } Player::Player() @@ -156,6 +159,23 @@ input.fire = state; return true; } + else if(key == keymap.activate) + { + input.activate = state; + + if(state == DOWN) { + /** check for interactive objects */ + for(Sector::InteractiveObjects::iterator i + = Sector::current()->interactive_objects.begin(); + i != Sector::current()->interactive_objects.end(); ++i) { + if(rectcollision(base, (*i)->get_area())) { + (*i)->interaction(INTERACTION_ACTIVATE); + } + } + } + + return true; + } else return false; } @@ -751,12 +771,9 @@ largetux_star->draw(context, pos, LAYER_OBJECTS + 2); } -#if 0 // TODO if (debug_mode) - fillrect(base.x - viewport.get_translation().x, - base.y - viewport.get_translation().y, - base.width, base.height, 75,75,75, 150); -#endif + context.draw_filled_rect(Vector(base.x, base.y), + Vector(base.width, base.height), Color(75,75,75, 150), LAYER_OBJECTS+1); } void --- NEW FILE: interactive_object.h --- // $Id: interactive_object.h,v 1.1 2004/05/31 13:43:30 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Matthias Braun <ma...@br... // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __INTERACTIVE_OBJECT_H__ #define __INTERACTIVE_OBJECT_H__ #include "game_object.h" #include "type.h" enum InteractionType { INTERACTION_TOUCH, INTERACTION_ACTIVATE // more to come }; /** This class is the base class for all objects you can interact with in some * way. There are several interaction types defined like touch and activate */ class InteractiveObject : public GameObject { public: InteractiveObject(); virtual ~InteractiveObject(); /** this function is called when an interaction has taken place */ virtual void interaction(InteractionType type) = 0; const base_type& get_area() const { return area; } protected: base_type area; }; #endif Index: vector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/vector.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vector.cpp 25 May 2004 00:28:24 -0000 1.1 +++ vector.cpp 31 May 2004 13:43:30 -0000 1.2 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "vector.h" #include <math.h> Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- Makefile.am 31 May 2004 02:40:29 -0000 1.30 +++ Makefile.am 31 May 2004 13:43:28 -0000 1.31 @@ -17,10 +17,14 @@ bitmask.h \ button.cpp \ button.h \ +camera.cpp \ +camera.h \ collision.cpp \ collision.h \ configfile.cpp \ configfile.h \ +door.cpp \ +door.h \ intro.cpp \ intro.h \ defines.h \ @@ -30,6 +34,8 @@ globals.h \ high_scores.cpp \ high_scores.h \ +interactive_object.cpp \ +interactive_object.h \ level.cpp \ level.h \ leveleditor.cpp \ @@ -38,6 +44,12 @@ lispreader.h \ menu.cpp \ menu.h \ +mousecursor.cpp \ +mousecursor.h \ +music_manager.cpp \ +music_manager.h \ +musicref.cpp \ +musicref.h \ particlesystem.cpp \ particlesystem.h \ physic.cpp \ @@ -52,6 +64,10 @@ sound.h \ special.cpp \ special.h \ +sprite.h \ +sprite.cpp \ +sprite_manager.cpp \ +sprite_manager.h \ supertux.cpp \ timer.cpp \ timer.h \ @@ -63,22 +79,10 @@ worldmap.h \ tile.h \ tile.cpp \ -mousecursor.cpp \ -mousecursor.h \ resources.h \ resources.cpp \ gameobjs.h \ gameobjs.cpp \ -sprite.h \ -sprite.cpp \ -sprite_manager.cpp \ -sprite_manager.h \ -music_manager.cpp \ -music_manager.h \ -musicref.cpp \ -musicref.h \ -camera.cpp \ -camera.h \ game_object.cpp \ game_object.h \ drawable.h \ @@ -92,6 +96,6 @@ vector.cpp \ vector.h \ sector.cpp \ -sector.h +sector.h # EOF # |
From: Matze B. <mat...@us...> - 2004-05-31 13:43:41
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4137/src/screen Modified Files: drawing_context.cpp drawing_context.h Log Message: a first implementation of doors to switch between sectors Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- drawing_context.cpp 31 May 2004 13:02:20 -0000 1.4 +++ drawing_context.cpp 31 May 2004 13:43:31 -0000 1.5 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <assert.h> #include "drawing_context.h" @@ -116,7 +134,7 @@ request.type = FILLRECT; request.layer = layer; - request.pos = topleft; + request.pos = transform.apply(topleft); FillRectRequest* fillrectrequest = new FillRectRequest; fillrectrequest->size = size; Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- drawing_context.h 31 May 2004 13:02:21 -0000 1.2 +++ drawing_context.h 31 May 2004 13:43:31 -0000 1.3 @@ -1,3 +1,21 @@ +// $Id$ +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Matthias Braun <ma...@br... +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __DRAWINGCONTEXT_H__ #define __DRAWINGCONTEXT_H__ |
From: Matze B. <mat...@us...> - 2004-05-31 13:43:36
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4137/data/images/shared Added Files: door.png Log Message: a first implementation of doors to switch between sectors --- NEW FILE: door.png --- (This appears to be a binary file; contents omitted.) |
From: Ricardo C. <rm...@us...> - 2004-05-31 13:02:47
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28560/src/screen Modified Files: drawing_context.cpp drawing_context.h texture.cpp texture.h Log Message: Added support for drawing effects again. We really need a include.h file with major includes, or we could just put the includes into the defines.h. Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- drawing_context.cpp 30 May 2004 15:25:01 -0000 1.3 +++ drawing_context.cpp 31 May 2004 13:02:20 -0000 1.4 @@ -17,7 +17,7 @@ void DrawingContext::draw_surface(const Surface* surface, const Vector& position, - int layer) + int layer, uint32_t drawing_effect) { assert(surface != 0); @@ -27,13 +27,14 @@ request.layer = layer; request.request_data = const_cast<Surface*> (surface); request.pos = transform.apply(position); + request.drawing_effect = drawing_effect; drawingrequests.push_back(request); } void DrawingContext::draw_surface_part(const Surface* surface, const Vector& source, - const Vector& size, const Vector& dest, int layer) + const Vector& size, const Vector& dest, int layer, uint32_t drawing_effect) { assert(surface != 0); @@ -42,6 +43,7 @@ request.type = SURFACE_PART; request.layer = layer; request.pos = transform.apply(dest); + request.drawing_effect = drawing_effect; SurfacePartRequest* surfacepartrequest = new SurfacePartRequest(); surfacepartrequest->size = size; @@ -133,7 +135,8 @@ surfacepartrequest->surface->impl->draw_part( surfacepartrequest->source.x, surfacepartrequest->source.y, request.pos.x, request.pos.y, - surfacepartrequest->size.x, surfacepartrequest->size.y, 255); + surfacepartrequest->size.x, surfacepartrequest->size.y, 255, + request.drawing_effect); delete surfacepartrequest; } @@ -271,7 +274,7 @@ case SURFACE: { const Surface* surface = (const Surface*) i->request_data; - surface->impl->draw(i->pos.x, i->pos.y, 255); + surface->impl->draw(i->pos.x, i->pos.y, 255, i->drawing_effect); break; } case SURFACE_PART: Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/drawing_context.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- drawing_context.h 30 May 2004 01:08:50 -0000 1.1 +++ drawing_context.h 31 May 2004 13:02:21 -0000 1.2 @@ -1,9 +1,11 @@ #ifndef __DRAWINGCONTEXT_H__ #define __DRAWINGCONTEXT_H__ +#include <stdint.h> #include <vector> #include <string> #include "vector.h" +#include "screen.h" #include <SDL.h> class Surface; @@ -50,10 +52,12 @@ ~DrawingContext(); /** Adds a drawing request for a surface into the request list */ - void draw_surface(const Surface* surface, const Vector& position, int layer); + 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); + const Vector& size, const Vector& dest, int layer, + uint32_t drawing_effect = NONE_EFFECT); /** draws a text */ void draw_text(Font* font, const std::string& text, const Vector& position, int layer); @@ -126,6 +130,7 @@ struct DrawingRequest { int layer; + uint32_t drawing_effect; RequestType type; Vector pos; Index: texture.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/texture.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- texture.h 30 May 2004 20:42:24 -0000 1.2 +++ texture.h 31 May 2004 13:02:21 -0000 1.3 @@ -27,6 +27,7 @@ #include <SDL_opengl.h> #endif +#include <stdint.h> #include <list> #include "screen.h" #include "vector.h" @@ -38,6 +39,16 @@ class SurfaceOpenGL; class DrawingContext; +/// bitset for drawing effects +enum { + /** Draw the Surface upside down */ + NONE_EFFECT = 0x0000, + /** Draw the Surface upside down */ + VERTICAL_FLIP = 0x0001, + /** Draw the Surface with alpha equal to 128 */ + SEMI_TRANSPARENT = 0x0002 + }; + /** This class holds all the data necessary to construct a surface */ class SurfaceData { @@ -105,8 +116,8 @@ virtual ~SurfaceImpl(); /** Return 0 on success, -2 if surface needs to be reloaded */ - virtual int draw(float x, float y, Uint8 alpha) = 0; - virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha) = 0; + virtual int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT) = 0; + virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, uint32_t effect = NONE_EFFECT) = 0; #if 0 virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, bool update) = 0; #endif @@ -123,8 +134,8 @@ SurfaceSDL(const std::string& file, int x, int y, int w, int h, int use_alpha); virtual ~SurfaceSDL(); - int draw(float x, float y, Uint8 alpha); - int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha); + int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT); + int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, uint32_t effect = NONE_EFFECT); #if 0 int draw_stretched(float x, float y, int w, int h, Uint8 alpha); #endif @@ -142,8 +153,8 @@ SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, int use_alpha); virtual ~SurfaceOpenGL(); - int draw(float x, float y, Uint8 alpha); - int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha); + int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT); + int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, uint32_t effect = NONE_EFFECT); #if 0 int draw_stretched(float x, float y, int w, int h, Uint8 alpha); #endif Index: texture.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/texture.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- texture.cpp 30 May 2004 01:08:50 -0000 1.1 +++ texture.cpp 31 May 2004 13:02:21 -0000 1.2 @@ -448,11 +448,14 @@ } int -SurfaceOpenGL::draw(float x, float y, Uint8 alpha) +SurfaceOpenGL::draw(float x, float y, Uint8 alpha, uint32_t effect) { float pw = power_of_two(w); float ph = power_of_two(h); + if(effect & SEMI_TRANSPARENT) + alpha = 128; + glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -462,13 +465,35 @@ glBindTexture(GL_TEXTURE_2D, gl_texture); glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(x, y); - glTexCoord2f((float)w / pw, 0); - glVertex2f((float)w+x, y); - glTexCoord2f((float)w / pw, (float)h / ph); glVertex2f((float)w+x, (float)h+y); - glTexCoord2f(0, (float)h / ph); - glVertex2f(x, (float)h+y); + + if(effect & VERTICAL_FLIP) + { + glTexCoord2f(0, 0); + glVertex2f(x, (float)h+y); + + glTexCoord2f((float)w / pw, 0); + glVertex2f((float)w+x, (float)h+y); + + glTexCoord2f((float)w / pw, (float)h / ph); + glVertex2f((float)w+x, y); + + glTexCoord2f(0, (float)h / ph); + glVertex2f(x, y); + } + else + { + glTexCoord2f(0, 0); + glVertex2f(x, y); + + glTexCoord2f((float)w / pw, 0); + glVertex2f((float)w+x, y); + + glTexCoord2f((float)w / pw, (float)h / ph); + glVertex2f((float)w+x, (float)h+y); + + glTexCoord2f(0, (float)h / ph); + glVertex2f(x, (float)h+y); + } glEnd(); glDisable(GL_TEXTURE_2D); @@ -478,11 +503,14 @@ } int -SurfaceOpenGL::draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha) +SurfaceOpenGL::draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, uint32_t effect) { float pw = power_of_two(int(this->w)); float ph = power_of_two(int(this->h)); + if(effect & SEMI_TRANSPARENT) + alpha = 128; + glBindTexture(GL_TEXTURE_2D, gl_texture); glEnable(GL_BLEND); @@ -494,14 +522,36 @@ glBegin(GL_QUADS); - glTexCoord2f(sx / pw, sy / ph); - glVertex2f(x, y); - glTexCoord2f((float)(sx + w) / pw, sy / ph); - glVertex2f(w+x, y); - glTexCoord2f((sx+w) / pw, (sy+h) / ph); - glVertex2f(w +x, h+y); - glTexCoord2f(sx / pw, (float)(sy+h) / ph); - glVertex2f(x, h+y); + + if(effect & VERTICAL_FLIP) + { + glTexCoord2f(sx / pw, sy / ph); + glVertex2f(x, y); + + glTexCoord2f((float)(sx + w) / pw, sy / ph); + glVertex2f(w+x, y); + + glTexCoord2f((sx+w) / pw, (sy+h) / ph); + glVertex2f(w +x, h+y); + + glTexCoord2f(sx / pw, (float)(sy+h) / ph); + glVertex2f(x, h+y); + } + else + { + glTexCoord2f(sx / pw, (float)(sy+h) / ph); + glVertex2f(x, h+y); + + glTexCoord2f((sx+w) / pw, (sy+h) / ph); + glVertex2f(w +x, h+y); + + glTexCoord2f((float)(sx + w) / pw, sy / ph); + glVertex2f(w+x, y); + + glTexCoord2f(sx / pw, sy / ph); + glVertex2f(x, y); + } + glEnd(); glDisable(GL_TEXTURE_2D); @@ -569,7 +619,7 @@ } int -SurfaceSDL::draw(float x, float y, Uint8 alpha) +SurfaceSDL::draw(float x, float y, Uint8 alpha, uint32_t effect) { SDL_Rect dest; @@ -578,6 +628,17 @@ dest.w = w; dest.h = h; + if(effect & SEMI_TRANSPARENT) + alpha = 128; + + if(effect & VERTICAL_FLIP) // FIXME: feel free to replace this hack + { + for(float sy = 0; sy < h; sy++) + if(draw_part(0, sy, x, y+(h-sy), w, 1, alpha, NONE_EFFECT) == -2) + return -2; + return 0; + } + if(alpha != 255) { /* Create a Surface, make it using colorkey, blit surface into temp, apply alpha @@ -610,7 +671,7 @@ } int -SurfaceSDL::draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha) +SurfaceSDL::draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, uint32_t effect) { SDL_Rect src, dest; @@ -624,6 +685,17 @@ dest.w = (int)w; dest.h = (int)h; + if(effect & SEMI_TRANSPARENT) + alpha = 128; + + if(effect & VERTICAL_FLIP) // FIXME: feel free to replace this hack + { + for(float sy_ = sy; sy_ < h; sy_++) + if(draw_part(sx, sy_, x, y+(h-sy_), w, 1, alpha, NONE_EFFECT) == -2) + return -2; + return 0; + } + if(alpha != 255) { /* Create a Surface, make it using colorkey, blit surface into temp, apply alpha |
From: Ricardo C. <rm...@us...> - 2004-05-31 13:02:46
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28560/src Modified Files: badguy.cpp sprite.cpp sprite.h Log Message: Added support for drawing effects again. We really need a include.h file with major includes, or we could just put the includes into the defines.h. Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- badguy.cpp 31 May 2004 02:40:29 -0000 1.99 +++ badguy.cpp 31 May 2004 13:02:21 -0000 1.100 @@ -984,19 +984,17 @@ if(sprite == 0) return; - sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); -#if 0 - Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right; if(dying == DYING_FALLING && physic.get_velocity_y() < 0) - sprite->draw(viewport.world2screen(Vector(base.x, base.y)), SD_VERTICAL_FLIP); + sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS, VERTICAL_FLIP); else - sprite->draw(viewport.world2screen(Vector(base.x, base.y))); -#endif + sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); - float scroll_x = context.get_translation().x; - float scroll_y = context.get_translation().y; - if(debug_mode) + if(debug_mode) // draw hotpoint + { + float scroll_x = context.get_translation().x; + float scroll_y = context.get_translation().y; fillrect(base.x - scroll_x, base.y - scroll_y, base.width, base.height, 75,0,75, 150); + } } void Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sprite.cpp 31 May 2004 02:40:30 -0000 1.13 +++ sprite.cpp 31 May 2004 13:02:21 -0000 1.14 @@ -75,7 +75,7 @@ void Sprite::draw(DrawingContext& context, const Vector& pos, int layer, - int special_drawing) + uint32_t drawing_effect) { time = SDL_GetTicks(); unsigned int frame = get_current_frame(); @@ -84,15 +84,7 @@ { Surface* surface = surfaces[frame]; -#if 0 // TODO - if(special_drawing == SD_SEMI_TRANSPARENT) - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 128); - if(special_drawing == SD_VERTICAL_FLIP) - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 255, true); - else - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot); -#endif - context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer); + context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer, drawing_effect); } } Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- sprite.h 30 May 2004 01:08:49 -0000 1.10 +++ sprite.h 31 May 2004 13:02:21 -0000 1.11 @@ -26,8 +26,6 @@ #include "screen/texture.h" #include "vector.h" -enum SpecialDrawing { SD_NONE, SD_VERTICAL_FLIP, SD_SEMI_TRANSPARENT }; - class Sprite { private: @@ -59,7 +57,7 @@ /** Update the sprite and process to the next frame */ void update(float delta); void draw(DrawingContext& context, const Vector& pos, int layer, - int special_drawing = SD_NONE); + uint32_t drawing_effect = NONE_EFFECT); int get_current_frame() const; float get_fps() { return fps; } ; |
From: Matze B. <mat...@us...> - 2004-05-31 02:40:59
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28724/data/levels/test Modified Files: level10.stl level4.stl level5.stl level7.stl Added Files: level11.stl Log Message: big refactoring of level and world class. A level is now basically a set of sectors (or sublevels). The Sector class has been merged with the old world class. Also I've rewritten some parts of the load/save code and changed the fileformat a bit to support several sectors. On the way I fixed some bugs (and maybe introduce new ones...) Index: level4.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/level4.stl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- level4.stl 15 May 2004 14:16:15 -0000 1.4 +++ level4.stl 31 May 2004 02:40:18 -0000 1.5 @@ -6,7 +6,7 @@ (music "Mortimers_chipdisko.mod") (background "") (particle_system "") - (bkgd_speed 50) + (bkgd_speed 0.5) (bkgd_red_top 0) (bkgd_green_top 0) (bkgd_blue_top 255) Index: level10.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/level10.stl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- level10.stl 25 May 2004 23:24:10 -0000 1.8 +++ level10.stl 31 May 2004 02:40:17 -0000 1.9 @@ -6,7 +6,7 @@ (music "forest.mod") (background "cave2.jpg") (particle_system "") - (bkgd_speed 50) + (bkgd_speed 0.5) (bkgd_red_top 150) (bkgd_green_top 200) (bkgd_blue_top 255) Index: level5.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/level5.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- level5.stl 17 May 2004 06:27:12 -0000 1.2 +++ level5.stl 31 May 2004 02:40:18 -0000 1.3 @@ -6,8 +6,8 @@ (music "Mortimers_chipdisko.mod") (background "") (particle_system "") - (bkgd_speed 50) - (bkgd_red_top 150) + (bkgd_speed 0.5) + (bkgd_red_top 50) (bkgd_green_top 150) (bkgd_blue_top 150) (bkgd_red_bottom 150) --- NEW FILE: level11.stl --- (supertux-level (version 2) (name "Sector Test") (author "Matthias Braun") (time 500) (sector (name "main") (gravity 10) (camera (mode "normal") ) (playerspawn (name "main") (x 100) (y 170) ) (tilemap (layer "interactive") (solid #t) (speed 1.) (width 50) (height 15) (tiles 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 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 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 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 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 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 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 48 0 0 0 0 0 0 0 48 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 0 0 0 0 0 0 0 0 0 0 0 27 28 28 28 28 28 28 28 29 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 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 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 48 0 0 48 0 0 0 0 0 0 48 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 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 48 48 48 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 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 0 0 0 0 48 0 0 0 0 0 0 0 48 0 0 0 48 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 8 8 8 8 48 0 0 0 0 7 8 8 48 76 76 76 48 8 8 8 8 8 8 48 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 28 28 28 28 28 28 28 28 28 28 28 28 28 28 48 75 75 75 48 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 10 11 11 11 11 11 11 11 11 11 11 11 11 11 48 48 48 48 48 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ) ) (background (image "arctis.jpg") (speed 0.5) ) (fish (x 509) (y 181)) (flyingsnowball (x 941) (y 222)) (spiky (x 656) (y 306)) (snowball (x 259) (y 303)) (stalactite (x 1159) (y 288)) (stalactite (x 1235) (y 288)) (laptop (x 1198) (y 186)) (mriceblock (x 323) (y 74)) ) ) Index: level7.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/level7.stl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- level7.stl 13 May 2004 12:47:34 -0000 1.3 +++ level7.stl 31 May 2004 02:40:18 -0000 1.4 @@ -6,7 +6,7 @@ (music "Mortimers_chipdisko.mod") (background "") (particle_system "") - (bkgd_speed 50) + (bkgd_speed 0.5) (bkgd_red_top 150) (bkgd_green_top 150) (bkgd_blue_top 150) |
From: Matze B. <mat...@us...> - 2004-05-31 02:40:56
|
Update of /cvsroot/super-tux/supertux/data/levels/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28724/data/levels/misc Modified Files: menu.stl Log Message: big refactoring of level and world class. A level is now basically a set of sectors (or sublevels). The Sector class has been merged with the old world class. Also I've rewritten some parts of the load/save code and changed the fileformat a bit to support several sectors. On the way I fixed some bugs (and maybe introduce new ones...) Index: menu.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/misc/menu.stl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- menu.stl 16 May 2004 18:11:08 -0000 1.8 +++ menu.stl 31 May 2004 02:40:16 -0000 1.9 @@ -6,7 +6,7 @@ (music "theme.mod") (background "arctis.jpg") (particle_system "") - (bkgd_speed "2") + (bkgd_speed 0.5) (bkgd_red_top 0) (bkgd_green_top 0) (bkgd_blue_top 0) |
From: Matze B. <mat...@us...> - 2004-05-31 02:40:47
|
Update of /cvsroot/super-tux/supertux/data/levels/world1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28724/data/levels/world1 Modified Files: level10.stl Log Message: big refactoring of level and world class. A level is now basically a set of sectors (or sublevels). The Sector class has been merged with the old world class. Also I've rewritten some parts of the load/save code and changed the fileformat a bit to support several sectors. On the way I fixed some bugs (and maybe introduce new ones...) Index: level10.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/world1/level10.stl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- level10.stl 16 May 2004 09:48:49 -0000 1.16 +++ level10.stl 31 May 2004 02:40:19 -0000 1.17 @@ -89,7 +89,10 @@ (point (x 7889) (y 327)) ) (objects - (mriceblock (x 613) (y 367)) + (mriceblock + (x 613) + (y 367) + ) (mrbomb (x 5833) (y 353)) (mrbomb (x 6091) (y 334)) (money (x 6640) (y 288)) |
From: Ryan F. <sik...@us...> - 2004-05-30 23:00:08
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26471 Modified Files: player.cpp Log Message: - butt jump now kills nearby badguys Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- player.cpp 30 May 2004 01:08:49 -0000 1.130 +++ player.cpp 30 May 2004 23:00:00 -0000 1.131 @@ -467,22 +467,43 @@ /* In case the player has pressed Down while in a certain range of air, enable butt jump action */ if (input.down == DOWN && !butt_jump) - if(tiles_on_air(TILES_FOR_BUTTJUMP)) + if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping) butt_jump = true; /* When Down is not held anymore, disable butt jump */ if(butt_jump && input.down == UP) butt_jump = false; + // Do butt jump if (butt_jump && on_ground() && size == BIG) { - if(World::current()->trybreakbrick(base.x, base.y + base.height, false) - || World::current()->trybreakbrick( - base.x + base.width, base.y + base.height, false)) { - // make tux jumping a little bit again after breaking the bricks - physic.set_velocity_y(2); + butt_jump = false; + + // Break bricks beneath Tux + if(World::current()->trybreakbrick(base.x + 1, base.y + base.height, false) + || World::current()->trybreakbrick( + base.x + base.width - 1, base.y + base.height, false)) + { + physic.set_velocity_y(2); + butt_jump = true; + } + + // Kill nearby badguys + std::vector<GameObject*> gameobjects = World::current()->gameobjects; + for (std::vector<GameObject*>::iterator i = gameobjects.begin(); + i != gameobjects.end(); + i++) + { + BadGuy* badguy = dynamic_cast<BadGuy*> (*i); + if(badguy) + { + if (fabsf(base.x - badguy->base.x) < 300 && + fabsf(base.y - badguy->base.y) < 300 && + (issolid(badguy->base.x + 1, badguy->base.y + badguy->base.height) || + issolid(badguy->base.x + badguy->base.width - 1, badguy->base.y + badguy->base.height))) + badguy->kill_me(25); + } } -// butt_jump = false; // comment this, in case you won't to disable the continued use of buttjump } if ( (issolid(base.x + base.width / 2, base.y + base.height + 64) || |
From: Matze B. <mat...@us...> - 2004-05-30 20:42:33
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4428/screen Modified Files: texture.h Log Message: try to fix opengl warnings Index: texture.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/texture.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- texture.h 30 May 2004 01:08:50 -0000 1.1 +++ texture.h 30 May 2004 20:42:24 -0000 1.2 @@ -134,7 +134,7 @@ class SurfaceOpenGL : public SurfaceImpl { public: - unsigned gl_texture; + GLuint gl_texture; public: SurfaceOpenGL(SDL_Surface* surf, int use_alpha); |
From: Ryan F. <sik...@us...> - 2004-05-30 20:33:30
|
Update of /cvsroot/super-tux/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2843 Modified Files: cvswrappers Log Message: - added common binary files to cvswrappers Index: cvswrappers =================================================================== RCS file: /cvsroot/super-tux/CVSROOT/cvswrappers,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cvswrappers 13 Dec 2002 16:24:01 -0000 1.1 +++ cvswrappers 30 May 2004 20:33:20 -0000 1.2 @@ -21,3 +21,28 @@ # and value is a single-quote delimited value. # For example: #*.gif -k 'b' +*.avi -k 'b' -m 'COPY' +*.bin -k 'b' -m 'COPY' +*.bz -k 'b' -m 'COPY' +*.bz2 -k 'b' -m 'COPY' +*.exe -k 'b' -m 'COPY' +*.gif -k 'b' -m 'COPY' +*.gz -k 'b' -m 'COPY' +*.jpg -k 'b' -m 'COPY' +*.jpeg -k 'b' -m 'COPY' +*.mod -k 'b' -m 'COPY' +*.mov -k 'b' -m 'COPY' +*.mp3 -k 'b' -m 'COPY' +*.mpg -k 'b' -m 'COPY' +*.ogg -k 'b' -m 'COPY' +*.pdf -k 'b' -m 'COPY' +*.png -k 'b' -m 'COPY' +*.tar -k 'b' -m 'COPY' +*.tbz -k 'b' -m 'COPY' +*.tgz -k 'b' -m 'COPY' +*.tif -k 'b' -m 'COPY' +*.tiff -k 'b' -m 'COPY' +*.wav -k 'b' -m 'COPY' +*.xbm -k 'b' -m 'COPY' +*.xcf -k 'b' -m 'COPY' +*.zip -k 'b' -m 'COPY' |
From: Matze B. <mat...@us...> - 2004-05-30 17:54:32
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8191 Modified Files: tile.h Log Message: forgot stdint.h Index: tile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- tile.h 30 May 2004 12:57:56 -0000 1.24 +++ tile.h 30 May 2004 17:54:23 -0000 1.25 @@ -24,6 +24,7 @@ #include <set> #include <map> #include <vector> +#include <stdint.h> #include "screen/texture.h" #include "globals.h" #include "lispreader.h" |