X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fworldmap%2Fworldmap.cpp;h=cf48384e50194895673ecca1ae2a014ed1b87ac7;hb=accd4212a21bdce9ab9ad9e802d949a1828e2987;hp=bb012d9b30dca28797c29baa8e7be3d5e6b6df59;hpb=d7f25606f0a2bb011c9fcf3eaf4498076f40f503;p=supertux.git diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index bb012d9b3..cf48384e5 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -54,6 +54,7 @@ #include "main.hpp" #include "spawn_point.hpp" #include "file_system.hpp" +#include "physfs/physfs_stream.hpp" #include "tile_manager.hpp" #include "tile_set.hpp" #include "gui/menu.hpp" @@ -705,7 +706,7 @@ WorldMap::update(float delta) if (level->pos == tux->get_tile_pos()) { try { Vector shrinkpos = Vector(level->pos.x*32 + 16 - camera_offset.x, - level->pos.y*32 + 16 - camera_offset.y); + level->pos.y*32 + 8 - camera_offset.y); std::string levelfile = levels_path + level->get_name(); // update state and savegame @@ -939,6 +940,15 @@ WorldMap::setup() throw SquirrelError(global_vm, "Couldn't set worldmap in roottable"); sq_pop(global_vm, 1); + //Run default.nut just before init script + try { + IFileStream in(levels_path + "/default.nut"); + run_script(in, "WorldMap::default.nut"); + } catch(std::exception& ) { + // doesn't exist or erroneous; do nothing + } + + if(init_script != "") { std::istringstream in(init_script); run_script(in, "WorldMap::init");