X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftitle.cpp;h=730dbf782b4065e36edd11496ba50a913ebfc94c;hb=8e7ccc8e3b34ee1adb6f3cf7c3bc49e07c59fcb0;hp=fef24cf6b887d4ba18328986bb8fc5cda453dabe;hpb=bab71f8f0b31552c94a6127398826fa4446060ad;p=supertux.git diff --git a/src/title.cpp b/src/title.cpp index fef24cf6b..730dbf782 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -37,13 +37,15 @@ #include "globals.h" #include "title.h" #include "screen/screen.h" -#include "screen/texture.h" +#include "screen/surface.h" #include "high_scores.h" #include "menu.h" #include "timer.h" #include "setup.h" #include "level.h" +#include "level_subset.h" #include "gameloop.h" +#include "worldmap.h" #include "leveleditor.h" #include "scene.h" #include "player.h" @@ -52,6 +54,7 @@ #include "sector.h" #include "tilemap.h" #include "resources.h" +#include "type.h" #include "gettext.h" static Surface* bkg_title; @@ -70,6 +73,8 @@ static GameSession* titlesession; static std::vector contrib_subsets; static LevelSubset* current_contrib_subset = 0; +static string_list_type worldmap_list; + static LevelEditor* leveleditor; void free_contrib_menu() @@ -84,6 +89,7 @@ void free_contrib_menu() void generate_contrib_menu() { + /** Generating contrib levels list by making use of Level Subset */ string_list_type level_subsets = dsubdirs("/levels", "info"); free_contrib_menu(); @@ -106,7 +112,7 @@ void generate_contrib_menu() string_list_free(&level_subsets); } -void check_contrib_menu() +void check_levels_contrib_menu() { static int current_subset = -1; @@ -129,7 +135,7 @@ void check_contrib_menu() 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) + for (int i = 0; i < subset.get_num_levels(); ++i) { Level* level = new Level; level->load(subset.get_level_filename(i)); @@ -171,6 +177,19 @@ void check_contrib_subset_menu() } } +void check_contrib_worldmap_menu() +{ + int index = contrib_worldmap_menu->check(); + if (index != -1) + { + WorldMapNS::WorldMap worldmap; + worldmap.loadmap(worldmap_list.item[index]); + worldmap.display(); + + Menu::set_current(main_menu); + } +} + void draw_demo(double frame_ratio) { Sector* world = titlesession->get_current_sector(); @@ -228,9 +247,26 @@ void title(void) titlesession = new GameSession(datadir + "/levels/misc/menu.stl", ST_GL_DEMO_GAME); /* Load images: */ - bkg_title = new Surface(datadir + "/images/background/arctis.jpg", IGNORE_ALPHA); - logo = new Surface(datadir + "/images/title/logo.png", USE_ALPHA); - img_choose_subset = new Surface(datadir + "/images/status/choose-level-subset.png", USE_ALPHA); + bkg_title = new Surface(datadir + "/images/background/arctis.jpg", false); + logo = new Surface(datadir + "/images/title/logo.png", true); + img_choose_subset = new Surface(datadir + "/images/status/choose-level-subset.png", true); + + /* Generating contrib maps by only using a string_list */ + worldmap_list = dfiles("levels/worldmap", NULL, NULL); + + contrib_worldmap_menu->additem(MN_LABEL, _("Contrib Worlds"), 0,0); + contrib_worldmap_menu->additem(MN_HL, "", 0,0); + for(int i = 0; i < worldmap_list.num_items; i++) + { + WorldMapNS::WorldMap worldmap; + worldmap.loadmap(worldmap_list.item[i]); + contrib_worldmap_menu->additem(MN_ACTION, worldmap.get_world_title(),0,0,i); + } + contrib_worldmap_menu->additem(MN_HL,"",0,0); + contrib_worldmap_menu->additem(MN_BACK,"Back",0,0); + + titlesession->get_current_sector()->activate(); + titlesession->set_current(); /* --- Main title loop: --- */ frame = 0; @@ -272,12 +308,12 @@ void title(void) context.draw_surface(logo, Vector(screen->w/2 - logo->w/2, 30), LAYER_FOREGROUND1+1); + context.draw_text(white_small_text, " SuperTux " VERSION "\n", Vector(0, screen->h - 70), LAYER_FOREGROUND1); context.draw_text(white_small_text, - _(" SuperTux " VERSION "\n" - "Copyright (c) 2003 SuperTux Devel Team\n" + _("Copyright (c) 2003 SuperTux Devel Team\n" "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n" "are welcome to redistribute it under certain conditions; see the file COPYING\n" - "for details.\n"), Vector(0, screen->h - 70), LAYER_FOREGROUND1); + "for details.\n"), Vector(0, screen->h - 70 + white_small_text->get_height()), LAYER_FOREGROUND1); /* Don't draw menu, if quit is true */ Menu* menu = Menu::current(); @@ -294,7 +330,9 @@ void title(void) // Start Game, ie. goto the slots menu update_load_save_game_menu(load_game_menu); break; - case MNID_CONTRIB: + case MNID_WORLDMAP_CONTRIB: + break; + case MNID_LEVELS_CONTRIB: // Contrib Menu puts("Entering contrib menu"); generate_contrib_menu(); @@ -304,9 +342,10 @@ void title(void) leveleditor->run(); delete leveleditor; Menu::set_current(main_menu); + update_time = st_get_ticks(); break; case MNID_CREDITS: - display_text_file("CREDITS", bkg_title, SCROLL_SPEED_CREDITS); + display_text_file("CREDITS", SCROLL_SPEED_CREDITS); Menu::set_current(main_menu); break; case MNID_QUITMAINMENU: @@ -348,12 +387,16 @@ void title(void) } else if(menu == contrib_menu) { - check_contrib_menu(); + check_levels_contrib_menu(); } else if (menu == contrib_subset_menu) { check_contrib_subset_menu(); } + else if(menu == contrib_worldmap_menu) + { + check_contrib_worldmap_menu(); + } } mouse_cursor->draw(context);