super-tux-commit Mailing List for Super Tux (Page 97)
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: Ricardo C. <rm...@us...> - 2004-04-12 22:55:38
|
Update of /cvsroot/super-tux/supertux/data/levels/wansti In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9526/data/levels/wansti Modified Files: level1.stl level2.stl level3.stl level4.stl level5.stl Log Message: Just added authors name for these levels. Hope that they are correct, if not tell me :) Index: level1.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/wansti/level1.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- level1.stl 10 Apr 2004 21:22:01 -0000 1.1 +++ level1.stl 12 Apr 2004 22:41:45 -0000 1.2 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "Entrance to the Cave") + (author "Marek M") (width 500) (height 15) (background "arctis.png") Index: level4.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/wansti/level4.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- level4.stl 11 Apr 2004 22:16:51 -0000 1.2 +++ level4.stl 12 Apr 2004 22:41:45 -0000 1.3 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "The Shattered Bridge") + (author "Marek M") (width 500) (height 15) (background "ocean.png") Index: level3.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/wansti/level3.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- level3.stl 10 Apr 2004 21:22:01 -0000 1.1 +++ level3.stl 12 Apr 2004 22:41:45 -0000 1.2 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "The Escape") + (author "Marek M") (width 500) (height 15) (background "arctis.png") Index: level5.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/wansti/level5.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- level5.stl 11 Apr 2004 22:16:51 -0000 1.1 +++ level5.stl 12 Apr 2004 22:41:45 -0000 1.2 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "Into the Castle") + (author "Marek M") (width 500) (height 15) (background "ocean.png") Index: level2.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/wansti/level2.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- level2.stl 11 Apr 2004 22:16:51 -0000 1.2 +++ level2.stl 12 Apr 2004 22:41:45 -0000 1.3 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "A Path in the Clouds") + (author "Marek M") (width 500) (height 15) (background "arctis.png") |
From: Ricardo C. <rm...@us...> - 2004-04-12 22:55:37
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9526/data/levels/default Modified Files: level1.stl level2.stl level3.stl Log Message: Just added authors name for these levels. Hope that they are correct, if not tell me :) Index: level1.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/level1.stl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- level1.stl 10 Apr 2004 15:40:30 -0000 1.5 +++ level1.stl 12 Apr 2004 22:41:44 -0000 1.6 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "Antarctica 1") + (author "Bill Kendrick") (width 375) (height 15) (background "arctis.png") Index: level3.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/level3.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- level3.stl 26 Mar 2004 19:03:38 -0000 1.2 +++ level3.stl 12 Apr 2004 22:41:44 -0000 1.3 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "mondo") + (author "C Ratchet") (width 350) (height 15) (background "arctis.png") Index: level2.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/level2.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- level2.stl 26 Mar 2004 19:03:38 -0000 1.2 +++ level2.stl 12 Apr 2004 22:41:44 -0000 1.3 @@ -2,6 +2,7 @@ (supertux-level (version 1) (name "Antarctica 2") + (author "Bill Kendrick") (width 249) (height 15) (background "arctis.png") |
From: Ricardo C. <rm...@us...> - 2004-04-12 22:53:42
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9170/src Modified Files: gameloop.cpp level.cpp leveleditor.cpp level.h Log Message: Added "author" field for levels. Level editor setup config needs testing (not really related with this). Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- level.cpp 11 Apr 2004 20:46:31 -0000 1.31 +++ level.cpp 12 Apr 2004 22:39:33 -0000 1.32 @@ -194,6 +194,7 @@ Level::init_defaults() { name = "UnNamed"; + author = "UnNamed"; theme = "antarctica"; song_title = "Mortimers_chipdisko.mod"; bkgd_image = "arctis.png"; @@ -284,6 +285,7 @@ reader.read_int("bkgd_bottom_blue", &bkgd_bottom_blue); reader.read_float("gravity", &gravity); reader.read_string("name", &name); + reader.read_string("author", &author); reader.read_string("theme", &theme); reader.read_string("music", &song_title); reader.read_string("background", &bkgd_image); @@ -469,6 +471,7 @@ fprintf(fi," (version %d)\n", 1); fprintf(fi," (name \"%s\")\n", name.c_str()); + fprintf(fi," (author \"%s\")\n", author.c_str()); fprintf(fi," (theme \"%s\")\n", theme.c_str()); fprintf(fi," (music \"%s\")\n", song_title.c_str()); fprintf(fi," (background \"%s\")\n", bkgd_image.c_str()); @@ -537,6 +540,7 @@ free(fg_tiles[i]); name.clear(); + author.clear(); theme.clear(); song_title.clear(); bkgd_image.clear(); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- leveleditor.cpp 11 Apr 2004 20:46:31 -0000 1.44 +++ leveleditor.cpp 12 Apr 2004 22:39:33 -0000 1.45 @@ -205,7 +205,7 @@ { switch (level_settings_menu->check()) { - case 16: + case 17: apply_level_settings_menu(); Menu::set_current(leveleditor_menu); break; @@ -426,6 +426,7 @@ level_settings_menu->additem(MN_LABEL,"Level Settings",0,0); level_settings_menu->additem(MN_HL,"",0,0); level_settings_menu->additem(MN_TEXTFIELD,"Name ",0,0); + level_settings_menu->additem(MN_TEXTFIELD,"Author ",0,0); level_settings_menu->additem(MN_STRINGSELECT,"Theme ",0,0); level_settings_menu->additem(MN_STRINGSELECT,"Song ",0,0); level_settings_menu->additem(MN_STRINGSELECT,"Bg-Image",0,0); @@ -467,36 +468,37 @@ int i; level_settings_menu->item[2].change_input(le_current_level->name.c_str()); + level_settings_menu->item[3].change_input(le_current_level->author.c_str()); sprintf(str,"%d",le_current_level->width); - string_list_copy(level_settings_menu->item[3].list, dsubdirs("images/themes", "solid0.png")); - string_list_copy(level_settings_menu->item[4].list, dfiles("music/",NULL, "-fast")); - string_list_copy(level_settings_menu->item[5].list, dfiles("images/background",NULL, NULL)); - string_list_add_item(level_settings_menu->item[5].list,""); - if((i = string_list_find(level_settings_menu->item[3].list,le_current_level->theme.c_str())) != -1) + string_list_copy(level_settings_menu->item[4].list, dsubdirs("images/themes", "solid0.png")); + string_list_copy(level_settings_menu->item[5].list, dfiles("music/",NULL, "-fast")); + string_list_copy(level_settings_menu->item[6].list, dfiles("images/background",NULL, NULL)); + string_list_add_item(level_settings_menu->item[6].list,""); + if((i = string_list_find(level_settings_menu->item[4].list,le_current_level->theme.c_str())) != -1) level_settings_menu->item[3].list->active_item = i; - if((i = string_list_find(level_settings_menu->item[4].list,le_current_level->song_title.c_str())) != -1) + if((i = string_list_find(level_settings_menu->item[5].list,le_current_level->song_title.c_str())) != -1) level_settings_menu->item[4].list->active_item = i; - if((i = string_list_find(level_settings_menu->item[5].list,le_current_level->bkgd_image.c_str())) != -1) + if((i = string_list_find(level_settings_menu->item[6].list,le_current_level->bkgd_image.c_str())) != -1) level_settings_menu->item[5].list->active_item = i; - level_settings_menu->item[6].change_input(str); - sprintf(str,"%d",le_current_level->time_left); level_settings_menu->item[7].change_input(str); - sprintf(str,"%2.0f",le_current_level->gravity); + sprintf(str,"%d",le_current_level->time_left); level_settings_menu->item[8].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_top_red); + sprintf(str,"%2.0f",le_current_level->gravity); level_settings_menu->item[9].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_top_green); + sprintf(str,"%d",le_current_level->bkgd_top_red); level_settings_menu->item[10].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_top_blue); + sprintf(str,"%d",le_current_level->bkgd_top_green); level_settings_menu->item[11].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_bottom_red); + sprintf(str,"%d",le_current_level->bkgd_top_blue); level_settings_menu->item[12].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_bottom_green); + sprintf(str,"%d",le_current_level->bkgd_bottom_red); level_settings_menu->item[13].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_bottom_blue); + sprintf(str,"%d",le_current_level->bkgd_bottom_green); level_settings_menu->item[14].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_bottom_blue); + level_settings_menu->item[15].change_input(str); } void update_subset_settings_menu() @@ -511,16 +513,17 @@ i = false; le_current_level->name = level_settings_menu->item[2].input; + le_current_level->author = level_settings_menu->item[3].input; - if(le_current_level->bkgd_image.compare(string_list_active(level_settings_menu->item[5].list)) != 0) + if(le_current_level->bkgd_image.compare(string_list_active(level_settings_menu->item[6].list)) != 0) { - le_current_level->bkgd_image = string_list_active(level_settings_menu->item[5].list); + le_current_level->bkgd_image = string_list_active(level_settings_menu->item[6].list); i = true; } - if(le_current_level->theme.compare(string_list_active(level_settings_menu->item[3].list)) != 0) + if(le_current_level->theme.compare(string_list_active(level_settings_menu->item[4].list)) != 0) { - le_current_level->theme = string_list_active(level_settings_menu->item[3].list); + le_current_level->theme = string_list_active(level_settings_menu->item[4].list); i = true; } @@ -530,17 +533,17 @@ le_current_level->load_gfx(); } - le_current_level->song_title = string_list_active(level_settings_menu->item[4].list); + le_current_level->song_title = string_list_active(level_settings_menu->item[5].list); - le_current_level->change_size(atoi(level_settings_menu->item[6].input)); - le_current_level->time_left = atoi(level_settings_menu->item[7].input); - le_current_level->gravity = atof(level_settings_menu->item[8].input); - le_current_level->bkgd_top_red = atoi(level_settings_menu->item[9].input); - le_current_level->bkgd_top_green = atoi(level_settings_menu->item[10].input); - le_current_level->bkgd_top_blue = atoi(level_settings_menu->item[11].input); - le_current_level->bkgd_bottom_red = atoi(level_settings_menu->item[12].input); - le_current_level->bkgd_bottom_green = atoi(level_settings_menu->item[13].input); - le_current_level->bkgd_bottom_blue = atoi(level_settings_menu->item[14].input); + le_current_level->change_size(atoi(level_settings_menu->item[7].input)); + le_current_level->time_left = atoi(level_settings_menu->item[8].input); + le_current_level->gravity = atof(level_settings_menu->item[9].input); + le_current_level->bkgd_top_red = atoi(level_settings_menu->item[10].input); + le_current_level->bkgd_top_green = atoi(level_settings_menu->item[11].input); + le_current_level->bkgd_top_blue = atoi(level_settings_menu->item[12].input); + le_current_level->bkgd_bottom_red = atoi(level_settings_menu->item[13].input); + le_current_level->bkgd_bottom_green = atoi(level_settings_menu->item[14].input); + le_current_level->bkgd_bottom_blue = atoi(level_settings_menu->item[15].input); } void save_subset_settings_menu() Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- gameloop.cpp 12 Apr 2004 13:16:19 -0000 1.66 +++ gameloop.cpp 12 Apr 2004 22:39:32 -0000 1.67 @@ -142,8 +142,11 @@ sprintf(str, "%s", world->get_level()->name.c_str()); text_drawf(&gold_text, str, 0, 224, A_HMIDDLE, A_TOP, 1); + sprintf(str, "by %s", world->get_level()->author.c_str()); + text_drawf(&gold_text, str, 0, 256, A_HMIDDLE, A_TOP, 1); + sprintf(str, "TUX x %d", tux.lives); - text_drawf(&white_text, str, 0, 256, A_HMIDDLE, A_TOP, 1); + text_drawf(&white_text, str, 0, 288, A_HMIDDLE, A_TOP, 1); flipscreen(); Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- level.h 11 Apr 2004 20:46:31 -0000 1.26 +++ level.h 12 Apr 2004 22:39:33 -0000 1.27 @@ -56,6 +56,7 @@ texture_type img_bkgd; std::string name; + std::string author; std::string theme; std::string song_title; std::string bkgd_image; |
From: Ricardo C. <rm...@us...> - 2004-04-12 21:28:10
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21496/src Modified Files: setup.cpp texture.cpp Log Message: A first attempt to make a simple and clean way of an on the fly videomode change. But there is this problem: it seems to work on the first transition from SDL to OpenGL, but doesn't work well in the following transitions to OpenGL. I think it is not really related with the texture code, but with the st_video_setup_gl(). The way OpenGL is initialized. Ingo/Tobias, please give a look at this ;) Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- setup.cpp 12 Apr 2004 01:55:30 -0000 1.32 +++ setup.cpp 12 Apr 2004 21:14:17 -0000 1.33 @@ -373,6 +373,7 @@ options_menu->additem(MN_LABEL,"Options",0,0); options_menu->additem(MN_HL,"",0,0); + options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0); options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0); if(audio_device) { @@ -509,18 +510,27 @@ switch (options_menu->check()) { case 2: - if(use_fullscreen != options_menu->item[2].toggled) + if(use_gl != options_menu->item[2].toggled) { - use_fullscreen = !use_fullscreen; +#ifndef NOOPENGL + use_gl = !use_gl; st_video_setup(); +#endif } break; case 3: - if(use_sound != options_menu->item[3].toggled) - use_sound = !use_sound; + if(use_fullscreen != options_menu->item[3].toggled) + { + use_fullscreen = !use_fullscreen; + st_video_setup(); + } break; case 4: - if(use_music != options_menu->item[4].toggled) + if(use_sound != options_menu->item[4].toggled) + use_sound = !use_sound; + break; + case 5: + if(use_music != options_menu->item[5].toggled) { if(use_music) { @@ -540,8 +550,8 @@ } } break; - case 5: - if(show_fps != options_menu->item[5].toggled) + case 6: + if(show_fps != options_menu->item[6].toggled) show_fps = !show_fps; break; } Index: texture.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/texture.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- texture.cpp 3 Apr 2004 13:31:14 -0000 1.9 +++ texture.cpp 12 Apr 2004 21:14:17 -0000 1.10 @@ -17,6 +17,8 @@ #include "setup.h" #include "texture.h" +#define NO_TEXTURE 0 + void (*texture_load) (texture_type* ptexture, const std::string& file, int use_alpha); void (*texture_load_part)(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha); void (*texture_free) (texture_type* ptexture); @@ -137,6 +139,9 @@ void texture_draw_gl(texture_type* ptexture, float x, float y, Uint8 alpha, bool update) { +if(ptexture->gl_texture == NO_TEXTURE) + texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture); + float pw = power_of_two(ptexture->w); float ph = power_of_two(ptexture->h); @@ -168,6 +173,9 @@ void texture_draw_bg_gl(texture_type* ptexture, Uint8 alpha, bool update) { +if(ptexture->gl_texture == NO_TEXTURE) + texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture); + float pw = power_of_two(ptexture->w); float ph = power_of_two(ptexture->h); @@ -196,6 +204,9 @@ void texture_draw_part_gl(texture_type* ptexture,float sx, float sy, float x, float y, float w, float h, Uint8 alpha, bool update) { +if(ptexture->gl_texture == NO_TEXTURE) + texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture); + float pw = power_of_two(ptexture->w); float ph = power_of_two(ptexture->h); @@ -254,6 +265,7 @@ ptexture->w = ptexture->sdl_surface->w; ptexture->h = ptexture->sdl_surface->h; + ptexture->gl_texture = NO_TEXTURE; } void texture_load_part_sdl(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha) @@ -416,5 +428,9 @@ void texture_free_sdl(texture_type* ptexture) { SDL_FreeSurface(ptexture->sdl_surface); +#ifndef NOOPENGL + if(ptexture->gl_texture != NO_TEXTURE) + glDeleteTextures(1, &ptexture->gl_texture); +#endif } |
From: Ingo R. <gr...@us...> - 2004-04-12 19:11:29
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25398 Modified Files: badguy.cpp resources.cpp resources.h special.cpp special.h world.cpp Log Message: - commited MatzeB's update patch Index: resources.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- resources.h 11 Apr 2004 14:55:59 -0000 1.2 +++ resources.h 12 Apr 2004 18:57:36 -0000 1.3 @@ -10,8 +10,6 @@ extern texture_type img_box_full; extern texture_type img_box_empty; -extern texture_type img_mints; -extern texture_type img_coffee; extern texture_type img_super_bkgd; extern texture_type img_red_glow; Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- special.cpp 11 Apr 2004 16:23:08 -0000 1.14 +++ special.cpp 12 Apr 2004 18:57:36 -0000 1.15 @@ -10,6 +10,7 @@ // // +#include <assert.h> #include "SDL.h" #include "defines.h" #include "special.h" @@ -23,12 +24,9 @@ texture_type img_bullet; texture_type img_golden_herring; -bitmask* bm_bullet; - -void create_special_bitmasks() -{ - bm_bullet = bitmask_create_SDL(img_bullet.sdl_surface); -} +texture_type img_growup; +texture_type img_iceflower; +texture_type img_1up; void Bullet::init(float x, float y, float xm, int dir) @@ -53,6 +51,21 @@ } void +Bullet::remove_me() +{ + std::vector<Bullet>& bullets = World::current()->bullets; + for(std::vector<Bullet>::iterator i = bullets.begin(); + i != bullets.end(); ++i) { + if( & (*i) == this) { + bullets.erase(i); + return; + } + } + + assert(false); +} + +void Bullet::action(double frame_ratio) { base.x = base.x + base.xm * frame_ratio; @@ -75,7 +88,7 @@ issolid(base.x + 4, base.y + 2) || issolid(base.x, base.y + 2)) { - World::current()->bullets.erase(static_cast<std::vector<Bullet>::iterator>(this)); + remove_me(); } } @@ -95,101 +108,112 @@ Bullet::collision(int c_object) { if(c_object == CO_BADGUY) { - std::vector<Bullet>::iterator i; - - for(i = World::current()->bullets.begin(); i != World::current()->bullets.end(); ++i) - { - if(&(*i) == this) - { - World::current()->bullets.erase(i); - return; - } - } + remove_me(); } } void Upgrade::init(float x_, float y_, int dir_, int kind_) { + kind = kind_; + dir = dir_; + base.width = 32; base.height = 0; - kind = kind_; base.x = x_; base.y = y_; + old_base = base; - if(dir_ == LEFT) - base.xm = -2; - else - base.xm = 2; + physic.reset(); + physic.enable_gravity(false); - base.ym = -2; - base.height = 0; - old_base = base; + if(kind == UPGRADE_1UP || kind == UPGRADE_HERRING) { + physic.set_velocity(dir == LEFT ? -1 : 1, 4); + physic.enable_gravity(true); + base.height = 32; + } else if (kind == UPGRADE_ICEFLOWER) { + // nothing + } else { + physic.set_velocity(dir == LEFT ? -2 : 2, 0); + } +} + +void +Upgrade::remove_me() +{ + std::vector<Upgrade>& upgrades = World::current()->upgrades; + for(std::vector<Upgrade>::iterator i = upgrades.begin(); + i != upgrades.end(); ++i) { + if( & (*i) == this) { + upgrades.erase(i); + return; + } + } + + assert(false); } void Upgrade::action(double frame_ratio) { - if (base.height < 32) - { + if (kind == UPGRADE_ICEFLOWER || kind == UPGRADE_GROWUP) { + if (base.height < 32) { /* Rise up! */ - base.height = base.height + 0.7 * frame_ratio; if(base.height > 32) base.height = 32; - } - else - { - /* Move around? */ - - if (kind == UPGRADE_MINTS || - kind == UPGRADE_HERRING) - { - base.x = base.x + base.xm * frame_ratio; - base.y = base.y + base.ym * frame_ratio; - - collision_swept_object_map(&old_base,&base); - - /* Off the screen? Kill it! */ - if (base.x < scroll_x - base.width) - World::current()->upgrades.erase(static_cast<std::vector<Upgrade>::iterator>(this)); - if (base.y > screen->h) - World::current()->upgrades.erase(static_cast<std::vector<Upgrade>::iterator>(this)); + return; + } + } - if (issolid(base.x + 1, base.y + 32.) || - issolid(base.x + 31., base.y + 32.)) - { - if (base.ym > 0) - { - if (kind == UPGRADE_MINTS) - { - base.ym = 0; - } - else if (kind == UPGRADE_HERRING) - { - base.ym = -8; - } + /* Off screen? Kill it! */ + if(base.x < scroll_x - base.width || base.y > screen->h) { + remove_me(); + return; + } - base.y = (int)(base.y / 32) * 32; - } - } - else - base.ym = base.ym + GRAVITY * frame_ratio; + /* Move around? */ + physic.apply(frame_ratio, base.x, base.y); + if(kind == UPGRADE_GROWUP) { + collision_swept_object_map(&old_base, &base); + } - if (issolid(base.x - 1, (int) base.y)) - { - if(base.xm < 0) - base.xm = -base.xm; - } - else if (issolid(base.x + base.width, (int) base.y)) - { - if(base.xm > 0) - base.xm = -base.xm; - } + // fall down? + if(kind == UPGRADE_GROWUP || kind == UPGRADE_HERRING) { + // falling? + if(physic.get_velocity_y() != 0) { + if(issolid(base.x, base.y + base.height)) { + base.y = int(base.y / 32) * 32; + old_base = base; + if(kind == UPGRADE_GROWUP) { + physic.enable_gravity(false); + physic.set_velocity(dir == LEFT ? -2 : 2, 0); + } else if(kind == UPGRADE_HERRING) { + physic.set_velocity(dir == LEFT ? -2 : 2, 3); } + } + } else { + if((physic.get_velocity_x() < 0 + && !issolid(base.x+base.width, base.y + base.height)) + || (physic.get_velocity_x() > 0 + && !issolid(base.x, base.y + base.height))) { + physic.enable_gravity(true); + physic.set_velocity(0, physic.get_velocity_y()); + } + } + } + // horizontal bounce? + if(kind == UPGRADE_GROWUP || kind == UPGRADE_HERRING) { + if ( (physic.get_velocity_x() < 0 + && issolid(base.x, (int) base.y + base.height/2)) + || (physic.get_velocity_x() > 0 + && issolid(base.x + base.width, (int) base.y + base.height/2))) { + physic.set_velocity(-physic.get_velocity_x(),physic.get_velocity_y()); + dir = dir == LEFT ? RIGHT : LEFT; } + } } void @@ -205,23 +229,25 @@ dest.w = 32; dest.h = (int)base.height; - if (kind == UPGRADE_MINTS) - texture_draw_part(&img_mints,0,0,dest.x,dest.y,dest.w,dest.h); - else if (kind == UPGRADE_COFFEE) - texture_draw_part(&img_coffee,0,0,dest.x,dest.y,dest.w,dest.h); + if (kind == UPGRADE_GROWUP) + texture_draw_part(&img_growup,0,0,dest.x,dest.y,dest.w,dest.h); + else if (kind == UPGRADE_ICEFLOWER) + texture_draw_part(&img_iceflower,0,0,dest.x,dest.y,dest.w,dest.h); else if (kind == UPGRADE_HERRING) texture_draw_part(&img_golden_herring,0,0,dest.x,dest.y,dest.w,dest.h); + else if (kind == UPGRADE_1UP) + texture_draw_part(&img_1up, 0, 0, dest.x, dest.y, dest.w, dest.h); } else { - if (kind == UPGRADE_MINTS) + if (kind == UPGRADE_GROWUP) { - texture_draw(&img_mints, + texture_draw(&img_growup, base.x - scroll_x, base.y); } - else if (kind == UPGRADE_COFFEE) + else if (kind == UPGRADE_ICEFLOWER) { - texture_draw(&img_coffee, + texture_draw(&img_iceflower, base.x - scroll_x, base.y); } else if (kind == UPGRADE_HERRING) @@ -229,6 +255,10 @@ texture_draw(&img_golden_herring, base.x - scroll_x, base.y); } + else if (kind == UPGRADE_1UP) + { + texture_draw(&img_1up, base.x - scroll_x, base.y); + } } } @@ -245,11 +275,9 @@ /* p_c_object is CO_PLAYER, so assign it to pplayer */ pplayer = (Player*) p_c_object; - World::current()->upgrades.erase(static_cast<std::vector<Upgrade>::iterator>(this)); - /* Affect the player: */ - if (kind == UPGRADE_MINTS) + if (kind == UPGRADE_GROWUP) { play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER); pplayer->size = BIG; @@ -262,7 +290,7 @@ pplayer->duck = true; } } - else if (kind == UPGRADE_COFFEE) + else if (kind == UPGRADE_ICEFLOWER) { play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); pplayer->got_coffee = true; @@ -278,7 +306,39 @@ play_current_music(); } } - break; + else if (kind == UPGRADE_1UP) + { + if(pplayer->lives < MAX_LIVES) { + pplayer->lives++; + play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); + } + } + + remove_me(); + return; } } +void load_special_gfx() +{ + texture_load(&img_growup, datadir + "/images/shared/egg.png", USE_ALPHA); + texture_load(&img_iceflower, datadir + "/images/shared/iceflower.png", + USE_ALPHA); + texture_load(&img_golden_herring, datadir + + "/images/shared/star.png", USE_ALPHA); + texture_load(&img_1up, datadir + "/images/shared/1up.png", + USE_ALPHA); + + texture_load(&img_bullet, datadir + "/images/shared/bullet.png", + USE_ALPHA); +} + +void free_special_gfx() +{ + texture_free(&img_growup); + texture_free(&img_iceflower); + texture_free(&img_1up); + texture_free(&img_golden_herring); + texture_free(&img_bullet); +} + Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- badguy.cpp 12 Apr 2004 13:16:06 -0000 1.30 +++ badguy.cpp 12 Apr 2004 18:57:24 -0000 1.31 @@ -233,7 +233,8 @@ { Player& tux = *World::current()->get_tux(); - fall(); + if(dying == DYING_NOT) + fall(); /* Move left/right: */ if (mode == NORMAL || mode == KICK) Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- world.cpp 11 Apr 2004 20:46:31 -0000 1.22 +++ world.cpp 12 Apr 2004 18:57:37 -0000 1.23 @@ -465,10 +465,12 @@ else col_side = LEFT; + int posx = ((int)(x+1) / 32) * 32; + int posy = (int)(y/32) * 32 - 32; switch(tile->data) { case 1: // Box with a distro! - add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); + add_bouncy_distro(posx, posy); play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); player_status.score = player_status.score + SCORE_DISTRO; player_status.distros++; @@ -476,14 +478,18 @@ case 2: // Add an upgrade! if (tux.size == SMALL) /* Tux is small, add mints! */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_MINTS); - else /* Tux is big, add coffee: */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_COFFEE); + add_upgrade(posx, posy, col_side, UPGRADE_GROWUP); + else /* Tux is big, add an iceflower: */ + add_upgrade(posx, posy, col_side, UPGRADE_ICEFLOWER); play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); break; case 3: // Add a golden herring - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_HERRING); + add_upgrade(posx, posy, col_side, UPGRADE_HERRING); + break; + + case 4: // Add a 1up extra + add_upgrade(posx, posy, col_side, UPGRADE_1UP); break; default: break; Index: special.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- special.h 11 Apr 2004 15:28:26 -0000 1.12 +++ special.h 12 Apr 2004 18:57:36 -0000 1.13 @@ -22,26 +22,40 @@ #include "texture.h" #include "collision.h" #include "player.h" +#include "physic.h" /* Upgrade types: */ enum { - UPGRADE_MINTS, - UPGRADE_COFFEE, - UPGRADE_HERRING + UPGRADE_GROWUP, + UPGRADE_ICEFLOWER, + UPGRADE_HERRING, + UPGRADE_1UP }; +void load_special_gfx(); +void free_special_gfx(); + class Upgrade { - public: +public: int kind; + int dir; base_type base; base_type old_base; + Physic physic; void init(float x, float y, int dir, int kind); void action(double frame_ratio); void draw(); void collision(void* p_c_object, int c_object); + +private: + /** removes the Upgrade from the global upgrade list. Note that after this + * call the class doesn't exist anymore! So don't use any member variables + * anymore then + */ + void remove_me(); }; class Bullet @@ -54,13 +68,13 @@ void action(double frame_ratio); void draw(); void collision(int c_object); -}; - -extern texture_type img_bullet; -extern bitmask* bm_bullet; - -void create_special_bitmasks(); -extern texture_type img_golden_herring; +private: + /** removes the Upgrade from the global upgrade list. Note that after this + * call the class doesn't exist anymore! So don't use any member variables + * anymore then + */ + void remove_me(); +}; #endif /*SUPERTUX_SPECIAL_H*/ Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- resources.cpp 11 Apr 2004 15:07:29 -0000 1.6 +++ resources.cpp 12 Apr 2004 18:57:36 -0000 1.7 @@ -15,8 +15,6 @@ texture_type img_box_full; texture_type img_box_empty; -texture_type img_mints; -texture_type img_coffee; texture_type img_red_glow; /* Load graphics/sounds shared between all levels: */ @@ -244,20 +242,12 @@ load_badguy_gfx(); /* Upgrades: */ - - texture_load(&img_mints, datadir + "/images/shared/mints.png", USE_ALPHA); - texture_load(&img_coffee, datadir + "/images/shared/coffee.png", USE_ALPHA); - + load_special_gfx(); /* Weapons: */ - - texture_load(&img_bullet, datadir + "/images/shared/bullet.png", USE_ALPHA); - texture_load(&img_red_glow, datadir + "/images/shared/red-glow.png", USE_ALPHA); - - /* Distros: */ texture_load(&img_distro[0], datadir + "/images/shared/distro-0.png", USE_ALPHA); @@ -277,12 +267,6 @@ texture_load(&tux_life, datadir + "/images/shared/tux-life.png", USE_ALPHA); - /* Herring: */ - - texture_load(&img_golden_herring, datadir + "/images/shared/golden-herring.png", - USE_ALPHA); - - /* Sound effects: */ /* if (use_sound) // this will introduce SERIOUS bugs here ! because "load_sound" @@ -305,6 +289,8 @@ { int i; + free_special_gfx(); + for (i = 0; i < 3; i++) { texture_free(&tux_right[i]); @@ -345,9 +331,6 @@ for (i = 0; i < 2; i++) texture_free(&img_flag[i]); - texture_free(&img_mints); - texture_free(&img_coffee); - for (i = 0; i < 4; i++) { texture_free(&img_distro[i]); @@ -355,8 +338,6 @@ texture_free(&img_cloud[1][i]); } - texture_free(&img_golden_herring); - for (i = 0; i < NUM_SOUNDS; i++) free_chunk(sounds[i]); |
From: Ingo R. <gr...@us...> - 2004-04-12 18:58:03
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22950 Added Files: star.png iceflower.png egg.png 1up.png Log Message: - new extras --- NEW FILE: 1up.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: star.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: iceflower.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: egg.png --- (This appears to be a binary file; contents omitted.) |
From: Ingo R. <gr...@us...> - 2004-04-12 13:30:16
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18542 Modified Files: badguy.cpp defines.h gameloop.cpp player.cpp player.h Log Message: commited MatzeB's slider patch Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- player.cpp 11 Apr 2004 23:06:29 -0000 1.32 +++ player.cpp 12 Apr 2004 13:16:19 -0000 1.33 @@ -74,7 +74,7 @@ base.y = 240; base.xm = 0; base.ym = 0; - old_base = base; + previous_base = old_base = base; dir = RIGHT; duck = false; @@ -142,8 +142,8 @@ base.y = 240; base.xm = 0; base.ym = 0; - old_base = base; - previous_base = base; + previous_base = old_base = base; + duck = false; dying = DYING_NOT; @@ -164,20 +164,28 @@ /* --- HANDLE TUX! --- */ - if(!dying) + if(dying == DYING_NOT) handle_input(); /* Move tux: */ previous_base = base; + duck = false; physic.apply(frame_ratio, base.x, base.y); - - if (!dying) - { - - collision_swept_object_map(&old_base,&base); + if(dying == DYING_NOT) { + collision_swept_object_map(&old_base, &base); + // special exception for cases where we're stuck under tiles after + // being ducked. In this case we drift out + if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y + && collision_object_map(&base)) { + base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1); + previous_base = old_base = base; + } keep_in_bounds(); + } + if (dying == DYING_NOT) + { /* Land: */ @@ -245,11 +253,8 @@ jumping = false; } } - } - safe_timer.check(); - /* ---- DONE HANDLING TUX! --- */ @@ -280,10 +285,6 @@ play_current_music(); } - /* Handle skidding: */ - - // timer_check(&skidding_timer); // disabled - /* End of level? */ if (base.x >= World::current()->get_level()->endpos && World::current()->get_level()->endpos != 0) @@ -291,6 +292,27 @@ player_status.next_level = 1; } + /* Duck! */ + if (input.down == DOWN && size == BIG && !duck) + { + duck = true; + base.height = 32; + base.y += 32; + // changing base size confuses collision otherwise + old_base = previous_base = base; + } + else if(input.down == UP && size == BIG && duck) + { + duck = false; + base.y -= 32; + base.height = 64; + old_base = previous_base = base; + } + + // check some timers + skidding_timer.check(); + invincible_timer.check(); + safe_timer.check(); } bool @@ -310,107 +332,74 @@ } void -Player::handle_horizontal_input(int newdir) +Player::handle_horizontal_input() { - if(duck) - return; - float vx = physic.get_velocity_x(); float vy = physic.get_velocity_y(); - dir = newdir; - - // skid if we're too fast - if(dir != newdir && on_ground() && fabs(physic.get_velocity_x()) > SKID_XM - && !skidding_timer.started()) - { - skidding_timer.start(SKID_TIME); - play_sound(sounds[SND_SKID], SOUND_CENTER_SPEAKER); - return; - } + float ax = physic.get_acceleration_x(); + float ay = physic.get_acceleration_y(); - if ((newdir ? (vx < 0) : (vx > 0)) && !isice(base.x, base.y + base.height) && - !skidding_timer.started()) - { - //vx = 0; - } + float dirsign = 0; + if(!duck && input.left == DOWN && input.right == UP) { + dir = LEFT; + dirsign = -1; + } else if(!duck && input.left == UP && input.right == DOWN) { + dir = RIGHT; + dirsign = 1; + } - /* Facing the direction we're jumping? Go full-speed: */ - if (input.fire == UP) - { - if(vx >= MAX_WALK_XM) { + if (input.fire == UP) { + ax = dirsign * WALK_ACCELERATION_X; + // limit speed + if(vx >= MAX_WALK_XM && dirsign > 0) { vx = MAX_WALK_XM; - physic.set_acceleration(0, 0); // enough speedup - } else if(vx <= -MAX_WALK_XM) { + ax = 0; + } else if(vx <= -MAX_WALK_XM && dirsign < 0) { vx = -MAX_WALK_XM; - physic.set_acceleration(0, 0); + ax = 0; } - physic.set_acceleration(newdir ? 0.02 : -0.02, 0); - if(fabs(vx) < 1) // set some basic run speed - vx = newdir ? 1 : -1; -#if 0 - vx += ( newdir ? WALK_SPEED : -WALK_SPEED) * frame_ratio; - - if(newdir) - { - if (vx > MAX_WALK_XM) - vx = MAX_WALK_XM; - } - else - { - if (vx < -MAX_WALK_XM) - vx = -MAX_WALK_XM; - } -#endif - } - else if ( input.fire == DOWN) - { - if(vx >= MAX_RUN_XM) { + } else { + ax = dirsign * RUN_ACCELERATION_X; + // limit speed + if(vx >= MAX_RUN_XM && dirsign > 0) { vx = MAX_RUN_XM; - physic.set_acceleration(0, 0); // enough speedup - } else if(vx <= -MAX_RUN_XM) { + ax = 0; + } else if(vx <= -MAX_RUN_XM && dirsign < 0) { vx = -MAX_RUN_XM; - physic.set_acceleration(0, 0); + ax = 0; } - physic.set_acceleration(newdir ? 0.03 : -0.03, 0); - if(fabs(vx) < 1) // set some basic run speed - vx = newdir ? 1 : -1; + } -#if 0 - vx = vx + ( newdir ? RUN_SPEED : -RUN_SPEED) * frame_ratio; + // we can reach WALK_SPEED without any acceleration + if(dirsign != 0 && fabs(vx) < WALK_SPEED) { + vx = dirsign * WALK_SPEED; + } - if(newdir) - { - if (vx > MAX_RUN_XM) - vx = MAX_RUN_XM; - } - else - { - if (vx < -MAX_RUN_XM) - vx = -MAX_RUN_XM; - } -#endif - } - else - { -#if 0 - /* Not facing the direction we're jumping? - Go half-speed: */ - vx = vx + ( newdir ? (WALK_SPEED / 2) : -(WALK_SPEED / 2)) * frame_ratio; + // changing directions? + 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); + ax *= 2.5; + } else { + ax *= 2; + } + } - if(newdir) - { - if (vx > MAX_WALK_XM / 2) - vx = MAX_WALK_XM / 2; - } - else - { - if (vx < -MAX_WALK_XM / 2) - vx = -MAX_WALK_XM / 2; - } -#endif - } - + // we get slower when not pressing any keys + if(dirsign == 0) { + if(fabs(vx) < WALK_SPEED) { + vx = 0; + ax = 0; + } else if(vx < 0) { + ax = WALK_ACCELERATION_X * 1.5; + } else { + ax = WALK_ACCELERATION_X * -1.5; + } + } + physic.set_velocity(vx, vy); + physic.set_acceleration(ax, ay); } void @@ -418,7 +407,7 @@ { if(input.up == DOWN) { - if (on_ground()) + if (on_ground() && !duck) { // jump physic.set_velocity(physic.get_velocity_x(), 5.5); @@ -442,30 +431,8 @@ void Player::handle_input() { - /* Handle key and joystick state: */ - if(duck == false) - { - if (input.right == DOWN && input.left == UP) - { - handle_horizontal_input(RIGHT); - } - else if (input.left == DOWN && input.right == UP) - { - handle_horizontal_input(LEFT); - } - else - { - float vx = physic.get_velocity_x(); - if(fabs(vx) < 0.01) { - physic.set_velocity(0, physic.get_velocity_y()); - physic.set_acceleration(0, 0); - } else if(vx < 0) { - physic.set_acceleration(0.1, 0); - } else { - physic.set_acceleration(-0.1, 0); - } - } - } + /* Handle horizontal movement: */ + handle_horizontal_input(); /* Jump/jumping? */ @@ -481,47 +448,7 @@ World::current()->add_bullet(base.x, base.y, physic.get_velocity_x(), dir); } - - /* Duck! */ - - if (input.down == DOWN) - { - if (size == BIG && duck != true) - { - duck = true; - base.height = 32; - base.y += 32; - } - } - else - { - if (size == BIG && duck) - { - /* Make sure we're not standing back up into a solid! */ - base.height = 64; - base.y -= 32; - - if (!collision_object_map(&base) /*issolid(base.x + 16, base.y - 16)*/) - { - duck = false; - base.height = 64; - old_base.y -= 32; - old_base.height = 64; - } - else - { - base.height = 32; - base.y += 32; - } - } - else - { - duck = false; - } - } - - /* (Tux): */ - + /* tux animations: */ if(!frame_timer.check()) { frame_timer.start(25); @@ -543,6 +470,22 @@ } } + /* Duck! */ + if (input.down == DOWN && size == BIG && !duck) + { + duck = true; + base.height = 32; + base.y += 32; + // changing base size confuses collision otherwise + old_base = previous_base = base; + } + else if(input.down == UP && size == BIG && duck) + { + duck = false; + base.y -= 32; + base.height = 64; + old_base = previous_base = base; + } } void @@ -647,16 +590,20 @@ { if (invincible_timer.started()) { - /* Draw cape: */ + float capex = base.x + (base.width - bigcape_right[0].w) / 2; + capex -= scroll_x; + float capey = base.y + (base.height - bigcape_right[0].h) / 2; + + /* Draw cape (just not in ducked mode since that looks silly): */ if (dir == RIGHT) { texture_draw(&bigcape_right[global_frame_counter % 2], - base.x- scroll_x - 8, base.y); + capex, capey); } else { texture_draw(&bigcape_left[global_frame_counter % 2], - base.x-scroll_x - 8, base.y); + capex, capey); } } @@ -871,14 +818,12 @@ size = SMALL; base.height = 32; + duck = false; safe_timer.start(TUX_SAFE_TIME); } else { - if(size == BIG) - duck = true; - physic.enable_gravity(true); physic.set_acceleration(0, 0); physic.set_velocity(0, 7); Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- player.h 11 Apr 2004 16:38:58 -0000 1.24 +++ player.h 12 Apr 2004 13:16:19 -0000 1.25 @@ -135,7 +135,7 @@ bool under_solid(); private: - void handle_horizontal_input(int dir); + void handle_horizontal_input(); void handle_vertical_input(); void remove_powerups(); }; Index: defines.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/defines.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- defines.h 22 Mar 2004 15:47:31 -0000 1.12 +++ defines.h 12 Apr 2004 13:16:07 -0000 1.13 @@ -76,6 +76,8 @@ #define GRAVITY 1.0 #define YM_FOR_JUMP 6.0 +#define WALK_ACCELERATION_X 0.02 +#define RUN_ACCELERATION_X 0.03 #define KILL_BOUNCE_YM 8.0 #define SKID_XM 2.0 Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- gameloop.cpp 11 Apr 2004 17:39:46 -0000 1.65 +++ gameloop.cpp 12 Apr 2004 13:16:19 -0000 1.66 @@ -614,7 +614,7 @@ } } - else + else if(tux.dying == DYING_NOT) tux.kill(KILL); /* Calculate frames per second */ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- badguy.cpp 11 Apr 2004 23:06:29 -0000 1.29 +++ badguy.cpp 12 Apr 2004 13:16:06 -0000 1.30 @@ -269,6 +269,7 @@ base.x -= 24; else base.x += 24; + old_base = base; mode=KICK; set_texture(img_laptop_flat_left, img_laptop_flat_right, 1); |
From: Ingo R. <gr...@us...> - 2004-04-12 13:00:07
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13258 Modified Files: Makefile.am Added Files: sprite.cpp sprite.h Log Message: - added simple sprite class Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Makefile.am 11 Apr 2004 11:52:29 -0000 1.15 +++ Makefile.am 12 Apr 2004 12:46:18 -0000 1.16 @@ -1,7 +1,74 @@ bin_PROGRAMS = supertux supertux_SOURCES = \ -badguy.cpp badguy.h bitmask.cpp bitmask.h button.cpp button.h collision.cpp collision.h configfile.cpp configfile.h defines.h gameloop.cpp gameloop.h globals.cpp globals.h high_scores.cpp high_scores.h intro.cpp intro.h level.cpp level.h leveleditor.cpp leveleditor.h lispreader.cpp lispreader.h menu.cpp menu.h particlesystem.cpp particlesystem.h physic.cpp physic.h player.cpp player.h scene.cpp scene.h screen.cpp screen.h setup.cpp setup.h sound.cpp sound.h special.cpp special.h supertux.cpp supertux.h text.cpp text.h texture.cpp texture.h timer.cpp timer.h title.cpp title.h type.cpp type.h world.cpp world.h worldmap.cpp worldmap.h tile.h tile.cpp mousecursor.cpp mousecursor.h resources.h resources.cpp gameobjs.h gameobjs.cpp +badguy.cpp \ +badguy.h \ +bitmask.cpp \ +bitmask.h \ +button.cpp \ +button.h \ +collision.cpp \ +collision.h \ +configfile.cpp \ +configfile.h \ +defines.h \ +gameloop.cpp \ +gameloop.h \ +globals.cpp \ +globals.h \ +high_scores.cpp \ +high_scores.h \ +intro.cpp \ +intro.h \ +level.cpp \ +level.h \ +leveleditor.cpp \ +leveleditor.h \ +lispreader.cpp \ +lispreader.h \ +menu.cpp \ +menu.h \ +particlesystem.cpp \ +particlesystem.h \ +physic.cpp \ +physic.h \ +player.cpp \ +player.h \ +scene.cpp \ +scene.h \ +screen.cpp \ +screen.h \ +setup.cpp \ +setup.h \ +sound.cpp \ +sound.h \ +special.cpp \ +special.h \ +supertux.cpp \ +supertux.h \ +text.cpp \ +text.h \ +texture.cpp \ +texture.h \ +timer.cpp \ +timer.h \ +title.cpp \ +title.h \ +type.cpp \ +type.h \ +world.cpp \ +world.h \ +worldmap.cpp \ +worldmap.h \ +tile.h \ +tile.cpp \ +mousecursor.cpp \ +mousecursor.h \ +resources.h \ +resources.cpp \ +gameobjs.h \ +gameobjs.cpp \ +sprite.h \ +sprite.cpp # EOF # -noinst_HEADERS = --- NEW FILE: sprite.cpp --- // $Id: sprite.cpp,v 1.1 2004/04/12 12:46:18 grumbel Exp $ // // SuperTux // Copyright (C) 2004 Ingo Ruhnke <gr...@gm...> // // 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 <iostream> #include "globals.h" #include "sprite.h" Sprite::Sprite(lisp_object_t* cur) { init_defaults(); LispReader reader(cur); reader.read_int("x-hotspot", &x_hotspot); reader.read_int("y-hotspot", &y_hotspot); reader.read_float("fps", &fps); std::vector<std::string> images; reader.read_string_vector("images", &images); surfaces.resize(images.size()); for(std::vector<std::string>::size_type i = 0; i < images.size(); ++i) { texture_load(&surfaces[i], datadir + "/images/" + images[i], USE_ALPHA); } } void Sprite::init_defaults() { x_hotspot = 0; y_hotspot = 0; fps = 15; time = 0; frame_delay = 1000.0f/fps; } void Sprite::update(float delta) { time += 10*delta; //std::cout << "Delta: " << delta << std::endl; } void Sprite::draw(int x, int y) { unsigned int frame = static_cast<int>(fmodf(time, surfaces.size()*frame_delay)/frame_delay); /* std::cout << "Frame: " << frame << " " << time << " " << surfaces.size() << " " << frame_delay << " " << static_cast<int>(fmodf(time, surfaces.size()*frame_delay)/frame_delay) << std::endl;*/ if (frame < surfaces.size()) texture_draw(&surfaces[frame], x - x_hotspot, y - y_hotspot); } /* EOF */ --- NEW FILE: sprite.h --- // $Id: sprite.h,v 1.1 2004/04/12 12:46:18 grumbel Exp $ // // SuperTux // Copyright (C) 2004 Ingo Ruhnke <gr...@gm...> // // 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 HEADER_SPRITE_HXX #define HEADER_SPRITE_HXX #include <string> #include <vector> #include "lispreader.h" #include "texture.h" class Sprite { private: int x_hotspot; int y_hotspot; /** Frames per second */ float fps; /** Number of seconds that a frame is displayed until it is switched to the next frame */ float frame_delay; float time; std::vector<texture_type> surfaces; void init_defaults(); public: /** cur has to be a pointer to data in the form of ((x-hotspot 5) (y-hotspot 10) ...) */ Sprite(lisp_object_t* cur); /** Update the sprite and process to the next frame */ void update(float delta); void draw(int x, int y); }; #endif /* Local Variables: */ /* mode:c++ */ /* End */ |
From: Ingo R. <gr...@us...> - 2004-04-12 02:09:16
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11968 Modified Files: menu.cpp menu.h setup.cpp worldmap.cpp Log Message: - added menu to worldmap Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- menu.cpp 11 Apr 2004 20:28:10 -0000 1.32 +++ menu.cpp 12 Apr 2004 01:55:30 -0000 1.33 @@ -38,6 +38,7 @@ Menu* main_menu = 0; Menu* game_menu = 0; +Menu* worldmap_menu = 0; Menu* options_menu = 0; Menu* options_controls_menu = 0; Menu* highscore_menu = 0; Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- worldmap.cpp 11 Apr 2004 14:44:19 -0000 1.22 +++ worldmap.cpp 12 Apr 2004 01:55:30 -0000 1.23 @@ -283,72 +283,82 @@ void WorldMap::get_input() { - SDL_Event event; - enter_level = false; input_direction = NONE; - + + SDL_Event event; while (SDL_PollEvent(&event)) { - switch(event.type) + if(show_menu) { - case SDL_QUIT: - quit = true; - break; - - case SDL_KEYDOWN: - switch(event.key.keysym.sym) + current_menu->event(event); + } + else + { + switch(event.type) { - case SDLK_ESCAPE: + case SDL_QUIT: quit = true; break; - case SDLK_LCTRL: - case SDLK_RETURN: - enter_level = true; - break; - default: - break; - } - break; - case SDL_JOYAXISMOTION: - switch(event.jaxis.axis) - { - case JOY_X: - if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) - input_direction = WEST; - else if (event.jaxis.value > JOYSTICK_DEAD_ZONE) - input_direction = EAST; + case SDL_KEYDOWN: + switch(event.key.keysym.sym) + { + case SDLK_ESCAPE: + Menu::set_current(worldmap_menu); + show_menu = !show_menu; + break; + case SDLK_LCTRL: + case SDLK_RETURN: + enter_level = true; + break; + default: + break; + } break; - case JOY_Y: - if (event.jaxis.value > JOYSTICK_DEAD_ZONE) - input_direction = SOUTH; - else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) - input_direction = NORTH; + + case SDL_JOYAXISMOTION: + switch(event.jaxis.axis) + { + case JOY_X: + if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) + input_direction = WEST; + else if (event.jaxis.value > JOYSTICK_DEAD_ZONE) + input_direction = EAST; + break; + case JOY_Y: + if (event.jaxis.value > JOYSTICK_DEAD_ZONE) + input_direction = SOUTH; + else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) + input_direction = NORTH; + break; + } break; - } - break; - case SDL_JOYBUTTONDOWN: - if (event.jbutton.button == JOY_B) - enter_level = true; - break; + case SDL_JOYBUTTONDOWN: + if (event.jbutton.button == JOY_B) + enter_level = true; + break; - default: - break; + default: + break; + } } } - Uint8 *keystate = SDL_GetKeyState(NULL); + if (!show_menu) + { + Uint8 *keystate = SDL_GetKeyState(NULL); - if (keystate[SDLK_LEFT]) - input_direction = WEST; - else if (keystate[SDLK_RIGHT]) - input_direction = EAST; - else if (keystate[SDLK_UP]) - input_direction = NORTH; - else if (keystate[SDLK_DOWN]) - input_direction = SOUTH; + if (keystate[SDLK_LEFT]) + input_direction = WEST; + else if (keystate[SDLK_RIGHT]) + input_direction = EAST; + else if (keystate[SDLK_UP]) + input_direction = NORTH; + else if (keystate[SDLK_DOWN]) + input_direction = SOUTH; + } } Point @@ -434,6 +444,22 @@ tux->set_direction(input_direction); tux->update(0.33f); } + + if(show_menu) + { + if(current_menu == worldmap_menu) + { + switch (worldmap_menu->check()) + { + case 2: // Return to game + menu_reset(); + break; + case 5: // Quit Worldmap + quit = true; + break; + } + } + } } Tile* @@ -462,7 +488,6 @@ } tux->draw(); - flipscreen(); } void @@ -477,6 +502,10 @@ draw(); get_input(); update(); + + menu_process_current(); + flipscreen(); + SDL_Delay(20); } Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- menu.h 11 Apr 2004 20:28:11 -0000 1.31 +++ menu.h 12 Apr 2004 01:55:30 -0000 1.32 @@ -120,6 +120,7 @@ extern Menu* contrib_subset_menu; extern Menu* main_menu; extern Menu* game_menu; +extern Menu* worldmap_menu; extern Menu* options_menu; extern Menu* options_controls_menu; extern Menu* highscore_menu; Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- setup.cpp 11 Apr 2004 20:28:11 -0000 1.31 +++ setup.cpp 12 Apr 2004 01:55:30 -0000 1.32 @@ -361,6 +361,7 @@ highscore_menu = new Menu(); contrib_menu = new Menu(); contrib_subset_menu = new Menu(); + worldmap_menu = new Menu(); main_menu->set_pos(screen->w/2, 335); main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu); @@ -423,6 +424,13 @@ game_menu->additem(MN_HL,"",0,0); game_menu->additem(MN_ACTION,"Quit Game",0,0); + worldmap_menu->additem(MN_LABEL,"Worldmap Menu",0,0); + worldmap_menu->additem(MN_HL,"",0,0); + worldmap_menu->additem(MN_ACTION,"Return To Game",0,0); + worldmap_menu->additem(MN_GOTO,"Options",0,options_menu); + worldmap_menu->additem(MN_HL,"",0,0); + worldmap_menu->additem(MN_ACTION,"Quit Game",0,0); + highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0); } |
From: Ingo R. <gr...@us...> - 2004-04-12 01:49:42
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8827/data/images/shared Added Files: mrbombx-left-1.png mrbombx-right-1.png tux-duck.png Log Message: - some new gfx --- NEW FILE: mrbombx-right-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrbombx-left-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tux-duck.png --- (This appears to be a binary file; contents omitted.) |
From: Ingo R. <gr...@us...> - 2004-04-12 01:43:21
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7919 Modified Files: NEWS Log Message: - some new news Index: NEWS =================================================================== RCS file: /cvsroot/super-tux/supertux/NEWS,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- NEWS 22 Mar 2004 21:06:33 -0000 1.5 +++ NEWS 12 Apr 2004 01:29:36 -0000 1.6 @@ -7,6 +7,7 @@ * automagic detection of the datafile location, no more requirement to run 'make install' * Win32 port + * config file support Super Tux 0.0.6 (16 Mar 04) =========================== |
From: Ingo R. <gr...@us...> - 2004-04-12 01:42:45
|
Update of /cvsroot/super-tux/supertux/contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7866/contrib Modified Files: levelconverter-0.0.6_0.0.7.py Log Message: bug fix in the converter, in case anybody still cares Index: levelconverter-0.0.6_0.0.7.py =================================================================== RCS file: /cvsroot/super-tux/supertux/contrib/levelconverter-0.0.6_0.0.7.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- levelconverter-0.0.6_0.0.7.py 27 Mar 2004 19:36:58 -0000 1.8 +++ levelconverter-0.0.6_0.0.7.py 12 Apr 2004 01:29:02 -0000 1.9 @@ -7,9 +7,9 @@ ['0', "enemy0", 0], ['1', "enemy1", 1], ['2', "enemy2", 2], - ['x', "brick0.png", 77], + ['x', "brick0.png", 105], ['X', "brick0.png", 77], - ['y', "brick1.png", 78], + ['y', "brick1.png", 104], ['Y', "brick1.png", 78], ['A', "box-full.png", 83], ['B', "box-full.png", 102], |
From: Ingo R. <gr...@us...> - 2004-04-12 01:42:09
|
Update of /cvsroot/super-tux/supertux/data/images/worldmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7746/data/images/worldmap Added Files: leveldot_green.png leveldot_red.png Log Message: - missing gfx --- NEW FILE: leveldot_red.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: leveldot_green.png --- (This appears to be a binary file; contents omitted.) |
From: Ingo R. <gr...@us...> - 2004-04-11 23:20:12
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17828 Modified Files: badguy.cpp player.cpp Log Message: - tweaked scroll behaviour a little bit - added collision rects in debug mode Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- player.cpp 11 Apr 2004 16:33:11 -0000 1.31 +++ player.cpp 11 Apr 2004 23:06:29 -0000 1.32 @@ -722,7 +722,6 @@ else { /* Tux has coffee! */ - if (!duck) { if (!skidding_timer.started()) @@ -785,6 +784,9 @@ if(dying) text_drawf(&gold_text,"Penguins can fly !:",0,0,A_HMIDDLE,A_VMIDDLE,1); + + if (debug_mode) + fillrect(base.x - scroll_x, base.y, 32, 32, 75,75,75, 150); } void @@ -917,42 +919,54 @@ Level* plevel = World::current()->get_level(); /* Keep tux in bounds: */ - if (base.x< 0) - base.x= 0; - else if(base.x< scroll_x) - base.x= scroll_x; - else if (base.x< 160 + scroll_x && scroll_x > 0 && debug_mode) - { - scroll_x = base.x- 160; - /*base.x+= 160;*/ - - if(scroll_x < 0) - scroll_x = 0; - - } - else if (base.x > screen->w / 2 + scroll_x - && scroll_x < ((World::current()->get_level()->width * 32) - screen->w)) - { - // FIXME: Scrolling needs to be handled by a seperate View - // class, doing it as a player huck is ugly - - // Scroll the screen in past center: - scroll_x = base.x - screen->w / 2; - - if (scroll_x > ((plevel->width * 32) - screen->w)) - scroll_x = ((plevel->width * 32) - screen->w); + if (base.x < 0) + { // Lock Tux to the size of the level, so that he doesn't fall of + // on the left side + base.x = 0; } - else if (base.x> 608 + scroll_x) - { - /* ... unless there's no more to scroll! */ - - /*base.x= 608 + scroll_x;*/ + else if (base.x < scroll_x) + { + base.x = scroll_x; } /* Keep in-bounds, vertically: */ - if (base.y > screen->h) { kill(KILL); } + + int scroll_threshold = screen->w/2 - 80; + if (debug_mode) + { + scroll_x += screen->w/2; + // Backscrolling for debug mode + if (scroll_x < base.x - 80) + scroll_x = base.x - 80; + else if (scroll_x > base.x + 80) + scroll_x = base.x + 80; + scroll_x -= screen->w/2; + + if(scroll_x < 0) + scroll_x = 0; + } + else + { + if (base.x > scroll_threshold + scroll_x + && scroll_x < ((World::current()->get_level()->width * 32) - screen->w)) + { + // FIXME: Scrolling needs to be handled by a seperate View + // class, doing it as a player huck is ugly + + // Scroll the screen in past center: + scroll_x = base.x - scroll_threshold; + + // Lock the scrolling to the levelsize, so that we don't + // scroll over the right border + if (scroll_x > 32 * plevel->width - screen->w) + scroll_x = 32 * plevel->width - screen->w; + } + } } + +// EOF // + Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- badguy.cpp 11 Apr 2004 16:23:07 -0000 1.28 +++ badguy.cpp 11 Apr 2004 23:06:29 -0000 1.29 @@ -742,6 +742,9 @@ texture_type* texture = (dir == LEFT) ? &texture_left[frame] : &texture_right[frame]; texture_draw(texture, base.x - scroll_x, base.y); + + if (debug_mode) + fillrect(base.x - scroll_x, base.y, 32, 32, 75,0,75, 150); } void |
From: Ricardo C. <rm...@us...> - 2004-04-11 22:44:30
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11236/src Modified Files: title.cpp Log Message: Fixed a simple bug that was not letting levelsets to be added. Added a levelset for Wansti! These levels are great :) Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- title.cpp 11 Apr 2004 20:28:11 -0000 1.39 +++ title.cpp 11 Apr 2004 22:30:48 -0000 1.40 @@ -76,8 +76,8 @@ for (int i = 0; i < level_subsets.num_items; ++i) { st_subset subset; - subset.load(level_subsets.item[0]); - contrib_menu->additem(MN_GOTO, subset.title.c_str(), 0, contrib_subset_menu); + subset.load(level_subsets.item[i]); + contrib_menu->additem(MN_GOTO, subset.title.c_str(), i, contrib_subset_menu); contrib_subsets.push_back(subset); } |
From: Ricardo C. <rm...@us...> - 2004-04-11 22:29:10
|
Update of /cvsroot/super-tux/supertux/data/levels/wansti In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8393/data/levels/wansti Removed Files: boss1-grumbel-newmusic.stl Log Message: What's this level doing here?! --- boss1-grumbel-newmusic.stl DELETED --- |
From: Ricardo C. <rm...@us...> - 2004-04-11 21:19:47
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27735/src Modified Files: screen.cpp Log Message: Made drawgradient() to use our fillrect(), instead of SDL thingies and thus the code is much clear now. Index: screen.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- screen.cpp 11 Apr 2004 20:46:31 -0000 1.4 +++ screen.cpp 11 Apr 2004 21:06:05 -0000 1.5 @@ -74,17 +74,10 @@ { #endif - SDL_Rect r; - r.x = 0; - r.w = 640; - r.h = 2; - for(float y = 0; y < 480; y += 2) - { - r.y = (int)y; - - SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, (int)(((float)(top_r-bot_r)/640) * y + top_r), (int)(((float)(top_g-bot_g)/640) * y + top_g), (int)(((float)(top_b-bot_b)/640) * y + top_b))); - } + fillrect(0, (int)y, 640, 2, (int)(((float)(top_r-bot_r)/640) * y + top_r), + (int)(((float)(top_g-bot_g)/640) * y + top_g), + (int)(((float)(top_b-bot_b)/640) * y + top_b), 255); /* calculates the color for each line, based in the generic equation for functions: y = mx + b */ #ifndef NOOPENGL |
From: Ricardo C. <rm...@us...> - 2004-04-11 21:00:15
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23026/src Modified Files: gameobjs.cpp level.cpp leveleditor.cpp level.h screen.cpp screen.h world.cpp Log Message: Added support for gradients :) Changed bkgd_* to bkgd_top_* and bkgd_bottom_* (being * either r, b or g) This change includes both code and level files. Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- leveleditor.cpp 11 Apr 2004 17:39:46 -0000 1.43 +++ leveleditor.cpp 11 Apr 2004 20:46:31 -0000 1.44 @@ -205,7 +205,7 @@ { switch (level_settings_menu->check()) { - case 13: + case 16: apply_level_settings_menu(); Menu::set_current(leveleditor_menu); break; @@ -432,9 +432,12 @@ level_settings_menu->additem(MN_NUMFIELD,"Length ",0,0); level_settings_menu->additem(MN_NUMFIELD,"Time ",0,0); level_settings_menu->additem(MN_NUMFIELD,"Gravity",0,0); - level_settings_menu->additem(MN_NUMFIELD,"Red ",0,0); - level_settings_menu->additem(MN_NUMFIELD,"Green ",0,0); - level_settings_menu->additem(MN_NUMFIELD,"Blue ",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Top Red ",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Top Green ",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Top Blue ",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Bottom Red ",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Bottom Green",0,0); + level_settings_menu->additem(MN_NUMFIELD,"Bottom Blue",0,0); level_settings_menu->additem(MN_HL,"",0,0); level_settings_menu->additem(MN_ACTION,"Apply Changes",0,0); @@ -482,12 +485,18 @@ level_settings_menu->item[7].change_input(str); sprintf(str,"%2.0f",le_current_level->gravity); level_settings_menu->item[8].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_red); + sprintf(str,"%d",le_current_level->bkgd_top_red); level_settings_menu->item[9].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_green); - level_settings_menu->item[10].change_input(str); - sprintf(str,"%d",le_current_level->bkgd_blue); - level_settings_menu->item[11].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_top_green); + level_settings_menu->item[10].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_top_blue); + level_settings_menu->item[11].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_bottom_red); + level_settings_menu->item[12].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_bottom_green); + level_settings_menu->item[13].change_input(str); + sprintf(str,"%d",le_current_level->bkgd_bottom_blue); + level_settings_menu->item[14].change_input(str); } void update_subset_settings_menu() @@ -526,9 +535,12 @@ le_current_level->change_size(atoi(level_settings_menu->item[6].input)); le_current_level->time_left = atoi(level_settings_menu->item[7].input); le_current_level->gravity = atof(level_settings_menu->item[8].input); - le_current_level->bkgd_red = atoi(level_settings_menu->item[9].input); - le_current_level->bkgd_green = atoi(level_settings_menu->item[10].input); - le_current_level->bkgd_blue = atoi(level_settings_menu->item[11].input); + le_current_level->bkgd_top_red = atoi(level_settings_menu->item[9].input); + le_current_level->bkgd_top_green = atoi(level_settings_menu->item[10].input); + le_current_level->bkgd_top_blue = atoi(level_settings_menu->item[11].input); + le_current_level->bkgd_bottom_red = atoi(level_settings_menu->item[12].input); + le_current_level->bkgd_bottom_green = atoi(level_settings_menu->item[13].input); + le_current_level->bkgd_bottom_blue = atoi(level_settings_menu->item[14].input); } void save_subset_settings_menu() @@ -686,7 +698,8 @@ } else { - clearscreen(le_current_level->bkgd_red, le_current_level->bkgd_green, le_current_level->bkgd_blue); + drawgradient(le_current_level->bkgd_top_red, le_current_level->bkgd_top_green, le_current_level->bkgd_top_blue, + le_current_level->bkgd_bottom_red, le_current_level->bkgd_bottom_green, le_current_level->bkgd_bottom_blue); } /* clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); */ Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- gameobjs.cpp 11 Apr 2004 16:23:07 -0000 1.6 +++ gameobjs.cpp 11 Apr 2004 20:46:31 -0000 1.7 @@ -139,7 +139,8 @@ { fillrect(base.x - scroll_x, base.y, 32,32, - plevel->bkgd_red, plevel->bkgd_green, plevel->bkgd_blue, 0); + plevel->bkgd_top_red, plevel->bkgd_top_green, plevel->bkgd_top_blue, 0); +// FIXME: doesn't respect the gradient, futhermore is this necessary at all?? } else { Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- level.cpp 11 Apr 2004 14:44:19 -0000 1.30 +++ level.cpp 11 Apr 2004 20:46:31 -0000 1.31 @@ -200,9 +200,12 @@ width = 21; time_left = 100; gravity = 10.; - bkgd_red = 0; - bkgd_green = 0; - bkgd_blue = 0; + bkgd_top_red = 0; + bkgd_top_green = 0; + bkgd_top_blue = 0; + bkgd_bottom_red = 0; + bkgd_bottom_green = 0; + bkgd_bottom_blue = 0; endpos = 0; for(int i = 0; i < 15; ++i) @@ -273,9 +276,12 @@ reader.read_int("version", &version); reader.read_int("width", &width); reader.read_int("time", &time_left); - reader.read_int("bkgd_red", &bkgd_red); - reader.read_int("bkgd_green", &bkgd_green); - reader.read_int("bkgd_blue", &bkgd_blue); + reader.read_int("bkgd_top_red", &bkgd_top_red); + reader.read_int("bkgd_top_green", &bkgd_top_green); + reader.read_int("bkgd_top_blue", &bkgd_top_blue); + reader.read_int("bkgd_bottom_red", &bkgd_bottom_red); + reader.read_int("bkgd_bottom_green", &bkgd_bottom_green); + reader.read_int("bkgd_bottom_blue", &bkgd_bottom_blue); reader.read_float("gravity", &gravity); reader.read_string("name", &name); reader.read_string("theme", &theme); @@ -467,9 +473,12 @@ fprintf(fi," (music \"%s\")\n", song_title.c_str()); fprintf(fi," (background \"%s\")\n", bkgd_image.c_str()); fprintf(fi," (particle_system \"%s\")\n", particle_system.c_str()); - fprintf(fi," (bkgd_red %d)\n", bkgd_red); - fprintf(fi," (bkgd_green %d)\n", bkgd_green); - fprintf(fi," (bkgd_blue %d)\n", bkgd_blue); + fprintf(fi," (bkgd_top_red %d)\n", bkgd_top_red); + fprintf(fi," (bkgd_top_green %d)\n", bkgd_top_green); + fprintf(fi," (bkgd_top_blue %d)\n", bkgd_top_blue); + fprintf(fi," (bkgd_bottom_red %d)\n", bkgd_bottom_red); + fprintf(fi," (bkgd_bottom_green %d)\n", bkgd_bottom_green); + fprintf(fi," (bkgd_bottom_blue %d)\n", bkgd_bottom_blue); fprintf(fi," (time %d)\n", time_left); fprintf(fi," (width %d)\n", width); fprintf(fi," (gravity %2.1f)\n", gravity); Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- level.h 11 Apr 2004 14:44:19 -0000 1.25 +++ level.h 11 Apr 2004 20:46:31 -0000 1.26 @@ -64,9 +64,12 @@ unsigned int* ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/ unsigned int* fg_tiles[15]; /* Tiles in the foreground */ int time_left; - int bkgd_red; - int bkgd_green; - int bkgd_blue; + int bkgd_top_red; + int bkgd_top_green; + int bkgd_top_blue; + int bkgd_bottom_red; + int bkgd_bottom_green; + int bkgd_bottom_blue; int width; int endpos; float gravity; Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- world.cpp 11 Apr 2004 17:16:17 -0000 1.21 +++ world.cpp 11 Apr 2004 20:46:31 -0000 1.22 @@ -134,7 +134,8 @@ } else { - clearscreen(level->bkgd_red, level->bkgd_green, level->bkgd_blue); + drawgradient(level->bkgd_top_red, level->bkgd_top_green, level->bkgd_top_blue, + level->bkgd_bottom_red, level->bkgd_bottom_green, level->bkgd_bottom_blue); } /* Draw particle systems (background) */ Index: screen.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- screen.h 21 Mar 2004 20:31:47 -0000 1.14 +++ screen.h 11 Apr 2004 20:46:31 -0000 1.15 @@ -26,6 +26,7 @@ void drawline(int x1, int y1, int x2, int y2, int r, int g, int b, int a); void clearscreen(int r, int g, int b); +void drawgradient(int top_r, int top_g, int top_b, int bot_r, int bot_g, int bot_b); void fillrect(float x, float y, float w, float h, int r, int g, int b, int a); void updatescreen(void); void flipscreen(void); Index: screen.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- screen.cpp 21 Mar 2004 18:04:20 -0000 1.3 +++ screen.cpp 11 Apr 2004 20:46:31 -0000 1.4 @@ -54,6 +54,45 @@ #endif } +/* --- DRAWS A VERTICAL GRADIENT --- */ + +void drawgradient(int top_r, int top_g, int top_b, int bot_r, int bot_g, int bot_b) +{ +#ifndef NOOPENGL + if(use_gl) + { + glBegin(GL_QUADS); + glColor3ub(top_r, top_g, top_b); + glVertex2f(0, 0); + glVertex2f(640, 0); + glColor3ub(bot_r, bot_g, bot_b); + glVertex2f(640, 480); + glVertex2f(0, 480); + glEnd(); + } + else + { +#endif + + SDL_Rect r; + r.x = 0; + r.w = 640; + r.h = 2; + + for(float y = 0; y < 480; y += 2) + { + r.y = (int)y; + + SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, (int)(((float)(top_r-bot_r)/640) * y + top_r), (int)(((float)(top_g-bot_g)/640) * y + top_g), (int)(((float)(top_b-bot_b)/640) * y + top_b))); + } +/* calculates the color for each line, based in the generic equation for functions: y = mx + b */ + +#ifndef NOOPENGL + + } +#endif +} + /* 'Stolen' from the SDL documentation. * Set the pixel at (x, y) to the given value * NOTE: The surface must be locked before calling this! |
From: Ricardo C. <rm...@us...> - 2004-04-11 21:00:13
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23026/data/levels/default Modified Files: level4.stl Log Message: Added support for gradients :) Changed bkgd_* to bkgd_top_* and bkgd_bottom_* (being * either r, b or g) This change includes both code and level files. Index: level4.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/level4.stl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- level4.stl 26 Mar 2004 23:19:34 -0000 1.3 +++ level4.stl 11 Apr 2004 20:46:31 -0000 1.4 @@ -6,9 +6,12 @@ (height 15) (background "") (music "Mortimers_chipdisko.mod") - (bkgd_red 100) - (bkgd_green 230) - (bkgd_blue 140) + (bkgd_top_red 120) + (bkgd_top_green 120) + (bkgd_top_blue 160) + (bkgd_bottom_red 215) + (bkgd_bottom_green 215) + (bkgd_bottom_blue 250) (time 190) (gravity 10.0) (particle_system "clouds") |
From: Ingo R. <gr...@us...> - 2004-04-11 20:41:53
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19818 Modified Files: menu.cpp menu.h setup.cpp title.cpp Log Message: - added contrib menu generator Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- menu.cpp 11 Apr 2004 17:48:12 -0000 1.31 +++ menu.cpp 11 Apr 2004 20:28:10 -0000 1.32 @@ -44,6 +44,7 @@ Menu* load_game_menu = 0; Menu* save_game_menu = 0; Menu* contrib_menu = 0; +Menu* contrib_subset_menu = 0; Menu* current_menu = 0; @@ -70,7 +71,7 @@ /* Return a pointer to a new menu item */ MenuItem* -MenuItem::create(MenuItemKind kind_, char *text_, int init_toggle_, Menu* target_menu_) +MenuItem::create(MenuItemKind kind_, const char *text_, int init_toggle_, Menu* target_menu_) { MenuItem *pnew_item = new MenuItem; @@ -151,9 +152,9 @@ } void -Menu::additem(MenuItemKind kind_, char *text_, int toggle_, Menu* menu_) +Menu::additem(MenuItemKind kind_, const std::string& text_, int toggle_, Menu* menu_) { - additem(MenuItem::create(kind_, text_, toggle_, menu_)); + additem(MenuItem::create(kind_, text_.c_str(), toggle_, menu_)); } /* Add an item to a menu */ @@ -164,6 +165,12 @@ delete pmenu_item; } +void +Menu::clear() +{ + item.clear(); +} + /* Process actions done on the menu */ void Menu::action() @@ -333,6 +340,7 @@ int effect_offset = 0; { int effect_time = 0; + if(effect.check()) effect_time = effect.get_left() / 4; Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- title.cpp 11 Apr 2004 17:39:47 -0000 1.38 +++ title.cpp 11 Apr 2004 20:28:11 -0000 1.39 @@ -10,6 +10,7 @@ April 11, 2000 - March 15, 2004 */ +#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -56,6 +57,94 @@ void display_credits(); +std::vector<st_subset> contrib_subsets; +std::string current_contrib_subset; + +void update_contrib_menu() +{ + // FIXME: Hack to update only once + static bool up_to_date = false; + + if (!up_to_date) + { + string_list_type level_subsets = dsubdirs("/levels", "info"); + + contrib_menu->clear(); + contrib_menu->additem(MN_LABEL,"Contrib Levels",0,0); + contrib_menu->additem(MN_HL,"",0,0); + + for (int i = 0; i < level_subsets.num_items; ++i) + { + st_subset subset; + subset.load(level_subsets.item[0]); + contrib_menu->additem(MN_GOTO, subset.title.c_str(), 0, contrib_subset_menu); + contrib_subsets.push_back(subset); + } + + contrib_menu->additem(MN_HL,"",0,0); + contrib_menu->additem(MN_BACK,"Back",0,0); + + string_list_free(&level_subsets); + up_to_date = true; + } +} + +void check_contrib_menu() +{ + static int current_subset = -1; + + int index = contrib_menu->check(); + if (index != -1) + { + index -= 2; // FIXME: Hack + if (index >= 0 && index <= int(contrib_subsets.size())) + { + if (current_subset != index) + { + current_subset = index; + // FIXME: This shouln't be busy looping + st_subset& subset = contrib_subsets[index]; + + current_contrib_subset = subset.name; + + std::cout << "Updating the contrib subset menu..." << subset.levels << std::endl; + + contrib_subset_menu->clear(); + + contrib_subset_menu->additem(MN_LABEL, subset.title, 0,0); + contrib_subset_menu->additem(MN_HL,"",0,0); + for (int i = 1; i <= subset.levels; ++i) + { + Level level; + level.load(subset.name, i); + contrib_subset_menu->additem(MN_ACTION, level.name, 0, 0); + } + contrib_subset_menu->additem(MN_HL,"",0,0); + contrib_subset_menu->additem(MN_BACK, "Back", 0, 0); + } + } + else + { + // Back button + } + } +} + +void check_contrib_subset_menu() +{ + int index = contrib_subset_menu->check(); + if (index != -1) + { + index -= 1; // FIXME: Hack + std::cout << "Sarting level: " << index << std::endl; + GameSession session(current_contrib_subset, index, ST_GL_PLAY); + session.run(); + menu_reset(); + Menu::set_current(main_menu); + show_menu = 1; + } +} + void draw_background() { /* Draw the title background: */ @@ -129,16 +218,12 @@ walking = false; tux->draw(); - - /* DEMO end */ } /* --- TITLE SCREEN --- */ bool title(void) { - string_list_type level_subsets; st_subset subset; - level_subsets = dsubdirs("/levels", "info"); random_timer.init(true); walking = true; @@ -241,6 +326,9 @@ { #if 0 case 0: + string_list_type level_subsets; + level_subsets = dsubdirs("/levels", "info"); + // Quick Play // FIXME: obsolete done = 0; @@ -324,6 +412,7 @@ break; case 1: // Contrib Menu + update_contrib_menu(); break; case 3: done = true; @@ -357,7 +446,11 @@ } else if(current_menu == contrib_menu) { - + check_contrib_menu(); + } + else if (current_menu == contrib_subset_menu) + { + check_contrib_subset_menu(); } mouse_cursor->draw(); @@ -377,8 +470,7 @@ texture_free(&bkg_title); texture_free(&logo); - string_list_free(&level_subsets); - + /* Return to main! */ return done; } Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- setup.cpp 11 Apr 2004 17:39:47 -0000 1.30 +++ setup.cpp 11 Apr 2004 20:28:11 -0000 1.31 @@ -360,6 +360,7 @@ game_menu = new Menu(); highscore_menu = new Menu(); contrib_menu = new Menu(); + contrib_subset_menu = new Menu(); main_menu->set_pos(screen->w/2, 335); main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu); @@ -369,14 +370,6 @@ main_menu->additem(MN_ACTION,"Credits",0,0); main_menu->additem(MN_ACTION,"Quit",0,0); - contrib_menu->additem(MN_LABEL,"Contrib Levels",0,0); - contrib_menu->additem(MN_HL,"",0,0); - contrib_menu->additem(MN_ACTION, "Some Levelset", 0, 0); - contrib_menu->additem(MN_ACTION, "Someother Levelset", 0, 0); - contrib_menu->additem(MN_ACTION, "Yet another Levelset", 0, 0); - contrib_menu->additem(MN_HL,"",0,0); - contrib_menu->additem(MN_BACK,"Back",0,0); - options_menu->additem(MN_LABEL,"Options",0,0); options_menu->additem(MN_HL,"",0,0); options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0); Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- menu.h 11 Apr 2004 17:48:12 -0000 1.30 +++ menu.h 11 Apr 2004 20:28:11 -0000 1.31 @@ -50,7 +50,7 @@ void change_text (const char *text); void change_input(const char *text); - static MenuItem* create(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); + static MenuItem* create(MenuItemKind kind, const char *text, int init_toggle, Menu* target_menu); }; class Menu @@ -76,8 +76,11 @@ ~Menu(); void additem(MenuItem* pmenu_item); - void additem(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); + void additem(MenuItemKind kind, const std::string& text, int init_toggle, Menu* target_menu); void action (); + + /** Remove all entries from the menu */ + void clear(); /** Check, if the value of the active menu item has changed. */ int check (); @@ -114,6 +117,7 @@ extern texture_type arrow_right; extern Menu* contrib_menu; +extern Menu* contrib_subset_menu; extern Menu* main_menu; extern Menu* game_menu; extern Menu* options_menu; @@ -136,5 +140,5 @@ #endif /*SUPERTUX_MENU_H*/ /* Local Variables: */ -/* mode:c++ */ +/* mode: c++ */ /* End */ |
From: Ricardo C. <rm...@us...> - 2004-04-11 19:25:44
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6387/src Removed Files: supertux.h Log Message: Removed supertux.h (its useless). global definitions go to defines.h --- supertux.h DELETED --- |
From: Ricardo C. <rm...@us...> - 2004-04-11 19:24:23
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6185/src Modified Files: supertux.cpp Log Message: Included supertux.h stuff into it. Index: supertux.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/supertux.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- supertux.cpp 11 Apr 2004 17:04:03 -0000 1.9 +++ supertux.cpp 11 Apr 2004 19:10:41 -0000 1.10 @@ -10,7 +10,19 @@ April 11, 2000 - March 15, 2004 */ -#include "supertux.h" + +#include <sys/types.h> +#include <ctype.h> + +#include "defines.h" +#include "globals.h" +#include "setup.h" +#include "intro.h" +#include "title.h" +#include "gameloop.h" +#include "leveleditor.h" +#include "screen.h" +#include "worldmap.h" #include "resources.h" int main(int argc, char * argv[]) |
From: Ingo R. <gr...@us...> - 2004-04-11 18:01:53
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24629 Modified Files: menu.cpp menu.h Log Message: - turned some pointer-foo into a std::vector Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- menu.cpp 11 Apr 2004 17:39:47 -0000 1.30 +++ menu.cpp 11 Apr 2004 17:48:12 -0000 1.31 @@ -122,15 +122,14 @@ /* Free a menu and all its items */ Menu::~Menu() { - if(num_items != 0 && item != NULL) + if(item.size() != 0) { - for(int i = 0; i < num_items; ++i) + for(unsigned int i = 0; i < item.size(); ++i) { free(item[i].text); free(item[i].input); string_list_free(item[i].list); } - free(item); } } @@ -140,10 +139,8 @@ pos_y = screen->h/2; last_menu = 0; arrange_left = 0; - num_items = 0; active_item = 0; last_menu = 0; - item = NULL; effect.init(false); } @@ -163,17 +160,15 @@ void Menu::additem(MenuItem* pmenu_item) { - ++num_items; - item = (MenuItem*)realloc(item, sizeof(MenuItem) * num_items); - memcpy(&item[num_items-1], pmenu_item, sizeof(MenuItem)); - free(pmenu_item); + item.push_back(*pmenu_item); + delete pmenu_item; } /* Process actions done on the menu */ void Menu::action() { - if(num_items != 0 && item != NULL) + if(item.size() != 0) { switch(menuaction) { @@ -181,11 +176,11 @@ if (active_item > 0) --active_item; else - active_item = num_items-1; + active_item = int(item.size())-1; break; case MENU_ACTION_DOWN: - if(active_item < num_items-1) + if(active_item < int(item.size())-1) ++active_item; else active_item = 0; @@ -297,7 +292,7 @@ if(menuaction != MENU_ACTION_UP && menuaction != MENU_ACTION_DOWN) menuaction = MENU_ACTION_DOWN; - if(num_items > 1) + if(item.size() > 1) action(); } } @@ -305,7 +300,7 @@ int Menu::check() { - if(num_items != 0 && item != NULL) + if (item.size() != 0) { if((item[active_item].kind == MN_ACTION || item[active_item].kind == MN_TEXTFIELD @@ -477,7 +472,7 @@ /* The width of the menu has to be more than the width of the text with the most characters */ int menu_width = 0; - for(int i = 0; i < num_items; ++i) + for(unsigned int i = 0; i < item.size(); ++i) { int w = strlen(item[i].text) + (item[i].input ? strlen(item[i].input) + 1 : 0) + strlen(string_list_active(item[i].list)); if( w > menu_width ) @@ -493,7 +488,7 @@ int Menu::height() { - return ((num_items) * 24); + return item.size() * 24; } /* Draw the current menu. */ @@ -505,11 +500,11 @@ /* Draw a transparent background */ fillrect(pos_x - menu_width/2, - pos_y - 24*num_items/2 - 10, + pos_y - 24*item.size()/2 - 10, menu_width,menu_height + 20, 150,180,200,125); - for(int i = 0; i < num_items; ++i) + for(unsigned int i = 0; i < item.size(); ++i) { draw_item(i, menu_width, menu_height); } Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- menu.h 11 Apr 2004 17:39:47 -0000 1.29 +++ menu.h 11 Apr 2004 17:48:12 -0000 1.30 @@ -14,6 +14,7 @@ #define SUPERTUX_MENU_H #include <SDL.h> +#include <vector> #include "texture.h" #include "timer.h" #include "type.h" @@ -59,7 +60,6 @@ int pos_x; int pos_y; - int num_items; Menu* last_menu; int width(); int height(); @@ -68,7 +68,7 @@ Timer effect; int arrange_left; int active_item; - MenuItem* item; + std::vector<MenuItem> item; static void set_current(Menu* pmenu); |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23327 Modified Files: button.cpp gameloop.cpp high_scores.cpp leveleditor.cpp menu.cpp menu.h setup.cpp title.cpp Log Message: - turned menu_item_type into a class Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- menu.cpp 11 Apr 2004 16:33:11 -0000 1.29 +++ menu.cpp 11 Apr 2004 17:39:47 -0000 1.30 @@ -69,20 +69,25 @@ } /* Return a pointer to a new menu item */ -menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu) +MenuItem* +MenuItem::create(MenuItemKind kind_, char *text_, int init_toggle_, Menu* target_menu_) { - menu_item_type *pnew_item = (menu_item_type*) malloc(sizeof(menu_item_type)); - pnew_item->kind = kind; - pnew_item->text = (char*) malloc(sizeof(char) * (strlen(text) + 1)); - strcpy(pnew_item->text,text); - if(kind == MN_TOGGLE) - pnew_item->toggled = init_toggle; + MenuItem *pnew_item = new MenuItem; + + pnew_item->kind = kind_; + pnew_item->text = (char*) malloc(sizeof(char) * (strlen(text_) + 1)); + strcpy(pnew_item->text, text_); + + if(kind_ == MN_TOGGLE) + pnew_item->toggled = init_toggle_; else pnew_item->toggled = false; - pnew_item->target_menu = target_menu; + + pnew_item->target_menu = target_menu_; pnew_item->input = (char*) malloc(sizeof(char)); pnew_item->input[0] = '\0'; - if(kind == MN_STRINGSELECT) + + if(kind_ == MN_STRINGSELECT) { pnew_item->list = (string_list_type*) malloc(sizeof(string_list_type)); string_list_init(pnew_item->list); @@ -92,22 +97,25 @@ return pnew_item; } -void menu_item_change_text(menu_item_type* pmenu_item,const char *text) +void +MenuItem::change_text(const char *text_) { - if(text) + if (text_) { - free(pmenu_item->text); - pmenu_item->text = (char*) malloc(sizeof(char )*(strlen(text)+1)); - strcpy(pmenu_item->text,text); + free(text); + text = (char*) malloc(sizeof(char )*(strlen(text_)+1)); + strcpy(text, text_); } } -void menu_item_change_input(menu_item_type* pmenu_item,const char *text) + +void +MenuItem::change_input(const char *text_) { if(text) { - free(pmenu_item->input); - pmenu_item->input = (char*) malloc(sizeof(char )*(strlen(text)+1)); - strcpy(pmenu_item->input,text); + free(input); + input = (char*) malloc(sizeof(char )*(strlen(text_)+1)); + strcpy(input, text_); } } @@ -146,18 +154,18 @@ } void -Menu::additem(MenuItemKind kind, char *text, int toggle, Menu* menu) +Menu::additem(MenuItemKind kind_, char *text_, int toggle_, Menu* menu_) { - additem(menu_item_create(kind, text, toggle, menu)); + additem(MenuItem::create(kind_, text_, toggle_, menu_)); } /* Add an item to a menu */ void -Menu::additem(menu_item_type* pmenu_item) +Menu::additem(MenuItem* pmenu_item) { ++num_items; - item = (menu_item_type*)realloc(item, sizeof(menu_item_type) * num_items); - memcpy(&item[num_items-1],pmenu_item,sizeof(menu_item_type)); + item = (MenuItem*)realloc(item, sizeof(MenuItem) * num_items); + memcpy(&item[num_items-1], pmenu_item, sizeof(MenuItem)); free(pmenu_item); } @@ -280,7 +288,7 @@ } } - menu_item_type& new_item = item[active_item]; + MenuItem& new_item = item[active_item]; if(new_item.kind == MN_DEACTIVE || new_item.kind == MN_LABEL || new_item.kind == MN_HL) @@ -324,10 +332,9 @@ int menu_width, int menu_height) { - int font_width = 16; - - const menu_item_type& pitem = item[index]; + const MenuItem& pitem = item[index]; + int font_width = 16; int effect_offset = 0; { int effect_time = 0; @@ -536,7 +543,8 @@ } /* Check for menu event */ -void menu_event(SDL_Event& event) +void +Menu::event(SDL_Event& event) { SDLKey key; switch(event.type) @@ -579,7 +587,7 @@ menu_change = true; break; case SDLK_SPACE: - if(current_menu->item[current_menu->active_item].kind == MN_TEXTFIELD) + if(item[active_item].kind == MN_TEXTFIELD) { menuaction = MENU_ACTION_INPUT; menu_change = true; @@ -625,10 +633,10 @@ case SDL_MOUSEBUTTONDOWN: x = event.motion.x; y = event.motion.y; - if(x > current_menu->pos_x - current_menu->width()/2 && - x < current_menu->pos_x + current_menu->width()/2 && - y > current_menu->pos_y - current_menu->height()/2 && - y < current_menu->pos_y + current_menu->height()/2) + if(x > pos_x - width()/2 && + x < pos_x + width()/2 && + y > pos_y - height()/2 && + y < pos_y + height()/2) { menuaction = MENU_ACTION_HIT; } @@ -636,12 +644,12 @@ case SDL_MOUSEMOTION: x = event.motion.x; y = event.motion.y; - if(x > current_menu->pos_x - current_menu->width()/2 && - x < current_menu->pos_x + current_menu->width()/2 && - y > current_menu->pos_y - current_menu->height()/2 && - y < current_menu->pos_y + current_menu->height()/2) + if(x > pos_x - width()/2 && + x < pos_x + width()/2 && + y > pos_y - height()/2 && + y < pos_y + height()/2) { - current_menu->active_item = (y - (current_menu->pos_y - current_menu->height()/2)) / 24; + active_item = (y - (pos_y - height()/2)) / 24; menu_change = true; mouse_cursor->set_state(MC_LINK); } Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- setup.cpp 11 Apr 2004 14:44:19 -0000 1.29 +++ setup.cpp 11 Apr 2004 17:39:47 -0000 1.30 @@ -445,7 +445,7 @@ pmenu->item[i].kind = MN_ACTION; else pmenu->item[i].kind = MN_ACTION; - menu_item_change_text(&pmenu->item[i], tmp.c_str()); + pmenu->item[i].change_text(tmp.c_str()); } } Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- menu.h 11 Apr 2004 16:38:58 -0000 1.28 +++ menu.h 11 Apr 2004 17:39:47 -0000 1.29 @@ -36,24 +36,24 @@ class Menu; -struct menu_item_type - { - MenuItemKind kind; - int toggled; - char *text; - char *input; - string_list_type* list; - Menu* target_menu; -}; +class MenuItem +{ +public: + MenuItemKind kind; + int toggled; + char *text; + char *input; + string_list_type* list; + Menu* target_menu; -menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); -void menu_item_change_text (menu_item_type* pmenu_item, const char *text); -void menu_item_change_input(menu_item_type* pmenu_item, const char *text); + void change_text (const char *text); + void change_input(const char *text); + + static MenuItem* create(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); +}; class Menu { -friend void menu_event(SDL_Event& event); - private: // position of the menu (ie. center of the menu, not top/left) int pos_x; @@ -68,14 +68,14 @@ Timer effect; int arrange_left; int active_item; - menu_item_type *item; + MenuItem* item; static void set_current(Menu* pmenu); Menu(); ~Menu(); - void additem(menu_item_type* pmenu_item); + void additem(MenuItem* pmenu_item); void additem(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); void action (); @@ -84,6 +84,9 @@ void draw (); void draw_item(int index, int menu_width, int menu_height); void set_pos(int x, int y, float rw = 0, float rh = 0); + + /* Check for a menu event */ + void event(SDL_Event& event); }; @@ -103,7 +106,12 @@ extern MenuAction menuaction; extern bool show_menu; extern bool menu_change; -extern texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right; + +extern texture_type checkbox; +extern texture_type checkbox_checked; +extern texture_type back; +extern texture_type arrow_left; +extern texture_type arrow_right; extern Menu* contrib_menu; extern Menu* main_menu; @@ -125,9 +133,6 @@ /* "Calculate" and draw the menu */ void menu_process_current(void); -/* Check for a menu event */ -void menu_event(SDL_Event& event); - #endif /*SUPERTUX_MENU_H*/ /* Local Variables: */ Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- leveleditor.cpp 11 Apr 2004 17:16:17 -0000 1.42 +++ leveleditor.cpp 11 Apr 2004 17:39:46 -0000 1.43 @@ -282,7 +282,7 @@ le_set_defaults(); le_current_level->load_gfx(); le_world.activate_bad_guys(); - menu_item_change_input(&subset_new_menu->item[2],""); + subset_new_menu->item[2].change_input(""); show_menu = true; break; } @@ -463,7 +463,7 @@ char str[80]; int i; - menu_item_change_input(&level_settings_menu->item[2], le_current_level->name.c_str()); + level_settings_menu->item[2].change_input(le_current_level->name.c_str()); sprintf(str,"%d",le_current_level->width); string_list_copy(level_settings_menu->item[3].list, dsubdirs("images/themes", "solid0.png")); @@ -477,23 +477,23 @@ if((i = string_list_find(level_settings_menu->item[5].list,le_current_level->bkgd_image.c_str())) != -1) level_settings_menu->item[5].list->active_item = i; - menu_item_change_input(&level_settings_menu->item[6], str); + level_settings_menu->item[6].change_input(str); sprintf(str,"%d",le_current_level->time_left); - menu_item_change_input(&level_settings_menu->item[7], str); + level_settings_menu->item[7].change_input(str); sprintf(str,"%2.0f",le_current_level->gravity); - menu_item_change_input(&level_settings_menu->item[8], str); + level_settings_menu->item[8].change_input(str); sprintf(str,"%d",le_current_level->bkgd_red); - menu_item_change_input(&level_settings_menu->item[9], str); + level_settings_menu->item[9].change_input(str); sprintf(str,"%d",le_current_level->bkgd_green); - menu_item_change_input(&level_settings_menu->item[10], str); + level_settings_menu->item[10].change_input(str); sprintf(str,"%d",le_current_level->bkgd_blue); - menu_item_change_input(&level_settings_menu->item[11], str); + level_settings_menu->item[11].change_input(str); } void update_subset_settings_menu() { - menu_item_change_input(&subset_settings_menu->item[2], le_level_subset.title.c_str()); - menu_item_change_input(&subset_settings_menu->item[3], le_level_subset.description.c_str()); + subset_settings_menu->item[2].change_input(le_level_subset.title.c_str()); + subset_settings_menu->item[3].change_input(le_level_subset.description.c_str()); } void apply_level_settings_menu() @@ -750,7 +750,7 @@ while(SDL_PollEvent(&event)) { if(show_menu) - menu_event(event); + current_menu->event(event); else mouse_cursor->set_state(MC_NORMAL); Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- title.cpp 11 Apr 2004 17:10:48 -0000 1.37 +++ title.cpp 11 Apr 2004 17:39:47 -0000 1.38 @@ -187,7 +187,7 @@ while (SDL_PollEvent(&event)) { - menu_event(event); + current_menu->event(event); if (event.type == SDL_QUIT) { done = true; Index: high_scores.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/high_scores.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- high_scores.cpp 3 Apr 2004 13:31:14 -0000 1.8 +++ high_scores.cpp 11 Apr 2004 17:39:46 -0000 1.9 @@ -115,7 +115,7 @@ while(SDL_PollEvent(&event)) if(event.type == SDL_KEYDOWN) - menu_event(event); + current_menu->event(event); switch (highscore_menu->check()) { Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- gameloop.cpp 11 Apr 2004 17:16:17 -0000 1.64 +++ gameloop.cpp 11 Apr 2004 17:39:46 -0000 1.65 @@ -170,7 +170,7 @@ { /* Check for menu-events, if the menu is shown */ if(show_menu) - menu_event(event); + current_menu->event(event); switch(event.type) { Index: button.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/button.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- button.cpp 11 Apr 2004 16:38:58 -0000 1.12 +++ button.cpp 11 Apr 2004 17:39:46 -0000 1.13 @@ -68,7 +68,7 @@ bkgd = NULL; } -void Button::change_icon(std::string icon_file, int mw, int mh) +void Button::change_icon(std::string icon_file, int /*mw*/, int /*mh*/) { char filename[1024]; |
From: Ingo R. <gr...@us...> - 2004-04-11 17:29:58
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19551 Modified Files: gameloop.cpp leveleditor.cpp world.cpp Log Message: - moved the global_world into the leveleditors namespace Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- world.cpp 11 Apr 2004 15:28:26 -0000 1.20 +++ world.cpp 11 Apr 2004 17:16:17 -0000 1.21 @@ -33,8 +33,6 @@ World* World::current_ = 0; -World global_world; - World::World() { // FIXME: Move this to action and draw and everywhere else where the Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- gameloop.cpp 11 Apr 2004 16:58:05 -0000 1.63 +++ gameloop.cpp 11 Apr 2004 17:16:17 -0000 1.64 @@ -65,7 +65,7 @@ //assert(!"Don't call me"); current_ = this; - world = new World; // &::global_world; + world = new World; fps_timer.init(true); frame_timer.init(true); @@ -81,7 +81,7 @@ current_ = this; - world = new World; // &::global_world; + world = new World; fps_timer.init(true); frame_timer.init(true); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- leveleditor.cpp 11 Apr 2004 16:58:05 -0000 1.41 +++ leveleditor.cpp 11 Apr 2004 17:16:17 -0000 1.42 @@ -85,6 +85,7 @@ static int pos_x, cursor_x, cursor_y, fire; static int le_level; static Level* le_current_level; +static World le_world; static st_subset le_level_subset; static int le_show_grid; static int le_frame; @@ -241,7 +242,7 @@ le_level_subset.load(level_subsets.item[i-2]); leveleditor_menu->item[3].kind = MN_GOTO; le_level = 1; - global_world.arrays_free(); + le_world.arrays_free(); le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { @@ -250,7 +251,7 @@ } le_set_defaults(); le_current_level->load_gfx(); - global_world.activate_bad_guys(); + le_world.activate_bad_guys(); show_menu = true; } break; @@ -271,7 +272,7 @@ le_level_subset.load(subset_new_menu->item[2].input); leveleditor_menu->item[3].kind = MN_GOTO; le_level = 1; - global_world.arrays_free(); + le_world.arrays_free(); le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { @@ -280,7 +281,7 @@ } le_set_defaults(); le_current_level->load_gfx(); - global_world.activate_bad_guys(); + le_world.activate_bad_guys(); menu_item_change_input(&subset_new_menu->item[2],""); show_menu = true; break; @@ -539,7 +540,7 @@ void le_goto_level(int levelnb) { - global_world.arrays_free(); + le_world.arrays_free(); le_current_level->cleanup(); if(le_current_level->load(le_level_subset.name.c_str(), levelnb) != 0) @@ -556,7 +557,7 @@ le_current_level->free_gfx(); le_current_level->load_gfx(); - global_world.activate_bad_guys(); + le_world.activate_bad_guys(); } void le_quit(void) @@ -592,7 +593,7 @@ { le_current_level->free_gfx(); le_current_level->cleanup(); - global_world.arrays_free(); + le_world.arrays_free(); } } @@ -723,12 +724,12 @@ } /* Draw the Bad guys: */ - for (i = 0; i < global_world.bad_guys.size(); ++i) + for (i = 0; i < le_world.bad_guys.size(); ++i) { /* to support frames: img_bsod_left[(frame / 5) % 4] */ scroll_x = pos_x; - global_world.bad_guys[i].draw(); + le_world.bad_guys[i].draw(); } @@ -1117,16 +1118,16 @@ xx = ((int)x / 32); /* if there is a bad guy over there, remove it */ - for(i = 0; i < global_world.bad_guys.size(); ++i) - if(xx == global_world.bad_guys[i].base.x/32 && yy == global_world.bad_guys[i].base.y/32) - global_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&global_world.bad_guys[i])); + for(i = 0; i < le_world.bad_guys.size(); ++i) + if(xx == le_world.bad_guys[i].base.x/32 && yy == le_world.bad_guys[i].base.y/32) + le_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&le_world.bad_guys[i])); if(c == '0') /* if it's a bad guy */ - global_world.add_bad_guy(xx*32, yy*32, BAD_BSOD); + le_world.add_bad_guy(xx*32, yy*32, BAD_BSOD); else if(c == '1') - global_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); + le_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); else if(c == '2') - global_world.add_bad_guy(xx*32, yy*32, BAD_MONEY); + le_world.add_bad_guy(xx*32, yy*32, BAD_MONEY); break; case SQUARE: @@ -1157,10 +1158,10 @@ y2 /= 32; /* if there is a bad guy over there, remove it */ - for(i = 0; i < global_world.bad_guys.size(); ++i) - if(global_world.bad_guys[i].base.x/32 >= x1 && global_world.bad_guys[i].base.x/32 <= x2 - && global_world.bad_guys[i].base.y/32 >= y1 && global_world.bad_guys[i].base.y/32 <= y2) - global_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&global_world.bad_guys[i])); + for(i = 0; i < le_world.bad_guys.size(); ++i) + if(le_world.bad_guys[i].base.x/32 >= x1 && le_world.bad_guys[i].base.x/32 <= x2 + && le_world.bad_guys[i].base.y/32 >= y1 && le_world.bad_guys[i].base.y/32 <= y2) + le_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&le_world.bad_guys[i])); for(xx = x1; xx <= x2; xx++) for(yy = y1; yy <= y2; yy++) @@ -1168,11 +1169,11 @@ le_current_level->change(xx*32, yy*32, tm, c); if(c == '0') // if it's a bad guy - global_world.add_bad_guy(xx*32, yy*32, BAD_BSOD); + le_world.add_bad_guy(xx*32, yy*32, BAD_BSOD); else if(c == '1') - global_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); + le_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); else if(c == '2') - global_world.add_bad_guy(xx*32, yy*32, BAD_MONEY); + le_world.add_bad_guy(xx*32, yy*32, BAD_MONEY); } break; default: @@ -1189,9 +1190,9 @@ session.run(); Menu::set_current(leveleditor_menu); - global_world.arrays_free(); + le_world.arrays_free(); le_current_level->load_gfx(); - global_world.activate_bad_guys(); + le_world.activate_bad_guys(); } void le_showhelp() |