working on the castle door, still testing other ideas for this image
[supertux.git] / src / worldmap.cpp
index 257cbc8..2896d64 100644 (file)
@@ -118,7 +118,7 @@ string_to_direction(const std::string& directory)
 Tux::Tux(WorldMap* worldmap_)
   : worldmap(worldmap_)
 {
-  tux_sprite = sprite_manager->create("worldmaptux");
+  tux_sprite = sprite_manager->create("images/worldmap/common/tux.sprite");
   
   offset = 0;
   moving = false;
@@ -136,19 +136,19 @@ Tux::draw(DrawingContext& context)
 {
   switch (player_status->bonus) {
     case GROWUP_BONUS:
-      tux_sprite->set_action("large");
+      tux_sprite->set_action(moving ? "large-walking" : "large-stop");
       break;
     case FIRE_BONUS:
-      tux_sprite->set_action("fire");
+      tux_sprite->set_action(moving ? "fire-walking" : "fire-stop");
       break;
     case NO_BONUS:
-      tux_sprite->set_action("small");
+      tux_sprite->set_action(moving ? "small-walking" : "small-stop");
       break;
     default:
 #ifdef DEBUG
       std::cerr << "Bonus type not handled in worldmap.\n";
 #endif
-      tux_sprite->set_action("large");
+      tux_sprite->set_action("large-stop");
       break;
   }
 
@@ -358,7 +358,7 @@ WorldMap::WorldMap()
   teleporterdot = new Surface("images/worldmap/common/teleporterdot.png");
 
   name = "<no title>";
-  music = "salcon.ogg";
+  music = "music/salcon.ogg";
   intro_displayed = false;
 
   total_stats.reset();
@@ -529,6 +529,17 @@ WorldMap::parse_level_tile(const lisp::Lisp* level_lisp)
   level_lisp->get("quit-worldmap", level.quit_worldmap);
 
   level_lisp->get("name", level.name);
+  
+  if (!PHYSFS_exists((levels_path + level.name).c_str()))
+  {
+       // Do we want to bail out instead...? We might get messages from modders
+       // who can't make their levels run because they're too dumb to watch
+       // their terminals...
+    std::cerr << "Error: level file '" << level.name
+      << "' does not exist and will not be added to the worldmap." << std::endl;
+    return;
+  }
+
   level_lisp->get("x", level.pos.x);
   level_lisp->get("y", level.pos.y);
 
@@ -837,7 +848,7 @@ WorldMap::update(float delta)
               break;
             }
 
-          sound_manager->play_music(std::string("music/") + music);
+          sound_manager->play_music(music);
           Menu::set_current(0);
           if (!savegame_file.empty())
             savegame(savegame_file);
@@ -990,7 +1001,7 @@ WorldMap::display()
 
   quit = false;
 
-  sound_manager->play_music(std::string("music/") + music);
+  sound_manager->play_music(music);
 
   if(!intro_displayed && intro_script != "") {
     try {
@@ -1056,7 +1067,7 @@ WorldMap::savegame(const std::string& filename)
     return;
 
   std::string dir = FileSystem::dirname(filename);
-  if(PHYSFS_exists(dir.c_str()) == 0 && PHYSFS_mkdir(dir.c_str()) == 0) {
+  if(PHYSFS_exists(dir.c_str()) == 0 && PHYSFS_mkdir(dir.c_str()) != 0) {
     std::ostringstream msg;
     msg << "Couldn't create directory '" << dir << "' for savegame:"
         << PHYSFS_getLastError();