X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftitle.cpp;h=94ccc5a0af2940e224c58c8797ae2c814b0037ed;hb=c3f9468882de1fd44f41ccfa7dae6d776bf306a7;hp=2abc6e35f83facbe9ed3cc0e76ccc1206adbcd3d;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/title.cpp b/src/title.cpp index 2abc6e35f..94ccc5a0a 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -59,6 +59,7 @@ #include "control/joystickkeyboardcontroller.hpp" #include "control/codecontroller.hpp" #include "main.hpp" +#include "exceptions.hpp" static Surface* bkg_title; static Surface* logo; @@ -82,7 +83,7 @@ static int current_subset = -1; */ void resume_demo() { - player_status.reset(); + player_status->reset(); titlesession->get_current_sector()->activate("main"); titlesession->set_current(); @@ -181,6 +182,7 @@ void check_levels_contrib_menu() if(subset.has_worldmap) { WorldMapNS::WorldMap worldmap; worldmap.set_map_filename(subset.get_worldmap_filename()); + sound_manager->stop_music(); // some fading fadeout(256); @@ -227,10 +229,11 @@ void check_contrib_subset_menu() int index = contrib_subset_menu->check(); if (index != -1) { if (contrib_subset_menu->get_item_by_id(index).kind == MN_ACTION) { + sound_manager->stop_music(); GameSession session( current_contrib_subset->get_level_filename(index), ST_GL_PLAY); session.run(); - player_status.reset(); + player_status->reset(); Menu::set_current(main_menu); resume_demo(); } @@ -283,9 +286,9 @@ void title() titlesession = new GameSession("levels/misc/menu.stl", ST_GL_DEMO_GAME); /* Load images: */ - bkg_title = new Surface("images/background/arctis.jpg", false); - logo = new Surface("images/engine/menu/logo.png", true); - //img_choose_subset = new Surface("images/status/choose-level-subset.png", true); + bkg_title = new Surface("images/background/arctis.jpg"); + logo = new Surface("images/engine/menu/logo.png"); + //img_choose_subset = new Surface("images/status/choose-level-subset.png"); titlesession->get_current_sector()->activate("main"); titlesession->set_current(); @@ -308,7 +311,7 @@ void title() // Calculate the movement-factor Uint32 ticks = SDL_GetTicks(); float elapsed_time = float(ticks - lastticks) / 1000.; - global_time += elapsed_time; + game_time += elapsed_time; lastticks = ticks; // 40fps is minimum if(elapsed_time > .04) @@ -326,21 +329,21 @@ void title() } main_controller->process_event(event); if (event.type == SDL_QUIT) - throw std::runtime_error("Received window close"); + throw graceful_shutdown(); } /* Draw the background: */ draw_demo(elapsed_time); if (Menu::current() == main_menu) - context.draw_surface(logo, Vector(SCREEN_WIDTH/2 - logo->w/2, 30), + context.draw_surface(logo, Vector(SCREEN_WIDTH/2 - logo->get_width()/2, 30), LAYER_FOREGROUND1+1); context.draw_text(white_small_text, " SuperTux " PACKAGE_VERSION "\n", Vector(0, SCREEN_HEIGHT - 50), LEFT_ALLIGN, LAYER_FOREGROUND1); context.draw_text(white_small_text, _( -"Copyright (c) 2005 SuperTux Devel Team\n" +"Copyright (c) 2006 SuperTux Devel Team\n" "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n" "redistribute it under certain conditions; see the file COPYING for details.\n" ), @@ -377,9 +380,11 @@ void title() } #endif case MNID_CREDITS: + sound_manager->stop_music(); fadeout(500); sound_manager->play_music("music/credits.ogg"); display_text_file("credits.txt"); + sound_manager->stop_music(); fadeout(500); Menu::set_current(main_menu); break;