X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fworldmap.cpp;h=299fff515e07703a2759ddd83f5b5b3e2a8adc42;hb=2d97548e5cded4b201bbc10d6cec6232df03e9a4;hp=360cc3cc0d45351253f98c7c8c3f95a6856f8640;hpb=4c53a552c13dbe9d587e34e3cf48e82877d09288;p=supertux.git diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 360cc3cc0..299fff515 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -17,6 +17,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#include + #include #include #include @@ -38,8 +40,9 @@ #include "resources.h" #include "app/gettext.h" #include "misc.h" +#include "scene.h" -#define map_message_TIME 2800 +#define map_message_TIME 2.8 Menu* worldmap_menu = 0; @@ -176,8 +179,8 @@ TileManager::TileManager() tile->images.push_back(image); } - tile->anim_speed = 25; - reader.read_int("anim-speed", tile->anim_speed); + tile->anim_fps = 1; + reader.read_float("anim-fps", tile->anim_fps); if (id >= int(tiles.size())) @@ -359,7 +362,7 @@ Tux::action(float delta) { if(special_tile && !special_tile->map_message.empty() && !special_tile->passive_message) - worldmap->passive_message_timer.stop(); + worldmap->passive_message_timer.start(0); stop(); } else @@ -451,8 +454,7 @@ Tile::draw(DrawingContext& context, Vector pos) if(images.size() > 1) { - size_t frame - = ((global_frame_counter*25) / anim_speed) % images.size(); + size_t frame = size_t(global_time * anim_fps) % images.size(); context.draw_surface(images[frame], pos, LAYER_TILES); } @@ -485,10 +487,7 @@ WorldMap::WorldMap() enter_level = false; name = ""; - music = "SALCON.MOD"; - - global_frame_counter = 0; - frame_timer.init(true); + music = "salcon.mod"; total_stats.reset(); } @@ -829,12 +828,6 @@ std::cerr << "one way only\n"; void WorldMap::update(float delta) { - if(!frame_timer.check()) - { - frame_timer.start(25); - global_frame_counter++; - } - if (enter_level && !tux->is_moving()) { /* Check special tile action */ @@ -870,9 +863,9 @@ WorldMap::update(float delta) // 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(level->name, - ST_GL_LOAD_LEVEL_FILE, level->vertical_flip, - &level->statistics); + GameSession session( + get_resource_filename(std::string("levels/" + level->name)), + ST_GL_LOAD_LEVEL_FILE, &level->statistics); switch (session.run()) {