tux = new Tux(this);
add_object(tux);
- leveldot_green
- = new Surface(datadir + "/images/tiles/worldmap/leveldot_green.png", true);
- leveldot_red
- = new Surface(datadir + "/images/tiles/worldmap/leveldot_red.png", true);
- messagedot
- = new Surface(datadir + "/images/tiles/worldmap/messagedot.png", true);
- teleporterdot
- = new Surface(datadir + "/images/tiles/worldmap/teleporterdot.png", true);
+ leveldot_green= new Surface("images/tiles/worldmap/leveldot_green.png", true);
+ leveldot_red = new Surface("images/tiles/worldmap/leveldot_red.png", true);
+ messagedot = new Surface("images/tiles/worldmap/messagedot.png", true);
+ teleporterdot = new Surface("images/tiles/worldmap/teleporterdot.png", true);
name = "<no title>";
music = "salcon.mod";
try {
lisp::Parser parser;
- std::string filename = get_resource_filename(map_filename);
- std::auto_ptr<lisp::Lisp> root (parser.parse(filename));
+ std::auto_ptr<lisp::Lisp> root (parser.parse(map_filename));
const lisp::Lisp* lisp = root->get_lisp("supertux-worldmap");
if(!lisp)
- throw new std::runtime_error("file isn't a supertux-worldmap file.");
+ throw std::runtime_error("file isn't a supertux-worldmap file.");
clear_objects();
lisp::ListIterator iter(lisp);
try {
lisp::Parser parser;
- std::auto_ptr<lisp::Lisp> root (
- parser.parse(get_resource_filename(levels_path + level.name)));
+ std::auto_ptr<lisp::Lisp> root (parser.parse(levels_path + level.name));
const lisp::Lisp* level_lisp = root->get_lisp("supertux-level");
if(!level_lisp)
if (special_tile->teleport_dest != Vector(-1,-1))
{
// TODO: an animation, camera scrolling or a fading would be a nice touch
- sound_manager->play_sound("warp");
+ sound_manager->play("warp");
tux->back_direction = D_NONE;
tux->set_tile_pos(special_tile->teleport_dest);
SDL_Delay(1000);
// do a shriking fade to the level
shrink_fade(Vector((level->pos.x*32 + 16 + offset.x),
(level->pos.y*32 + 16 + offset.y)), 500);
- GameSession session(get_resource_filename(levels_path + level->name),
+ GameSession session(levels_path + level->name,
ST_GL_LOAD_LEVEL_FILE, &level->statistics);
switch (session.run())
break;
}
- sound_manager->play_music(song);
+ sound_manager->play_music(std::string("music/") + music);
Menu::set_current(0);
if (!savegame_file.empty())
savegame(savegame_file);
std::auto_ptr<ScriptInterpreter> interpreter
(new ScriptInterpreter(levels_path));
std::istringstream in(level->extro_script);
- interpreter->load_script(in, "level-extro-script");
- interpreter->start_script();
+ interpreter->run_script(in, "level-extro-script");
add_object(interpreter.release());
} catch(std::exception& e) {
std::cerr << "Couldn't run level-extro-script:" << e.what() << "\n";
}
}
/* Display a passive message in the map, if needed */
- if(passive_message_timer.check())
+ if(passive_message_timer.started())
context.draw_text(gold_text, passive_message,
Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - white_text->get_height() - 60),
CENTER_ALLIGN, LAYER_FOREGROUND1);
quit = false;
- song = sound_manager->load_music(datadir + "/music/" + music);
- sound_manager->play_music(song);
+ sound_manager->play_music(std::string("music/") + music);
if(!intro_displayed && intro_script != "") {
try {
std::auto_ptr<ScriptInterpreter> interpreter
(new ScriptInterpreter(levels_path));
std::istringstream in(intro_script);
- interpreter->load_script(in, "worldmap-intro-script");
- interpreter->start_script();
+ interpreter->run_script(in, "worldmap-intro-script");
add_object(interpreter.release());
} catch(std::exception& e) {
std::cerr << "Couldn't execute worldmap-intro-script: "
context.pop_transform();
get_input();
update(elapsed_time);
+ sound_manager->update();
if(Menu::current()) {
Menu::current()->draw(context);
if(filename == "")
return;
- std::ofstream file(filename.c_str(), std::ios::out);
- lisp::Writer writer(file);
+ lisp::Writer writer(filename);
int nb_solved_levels = 0, total_levels = 0;
for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) {