a few fixes that I had lying around here, select walk animation in worldmap when...
[supertux.git] / src / level.cpp
index d6cd3c7..6c87b81 100644 (file)
 #include <memory>
 #include <stdexcept>
 
-#include "video/screen.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "lisp/writer.h"
-#include "level.h"
-#include "physic.h"
-#include "sector.h"
-#include "tile.h"
-#include "resources.h"
-#include "file_system.h"
-#include "object/gameobjs.h"
-#include "object/camera.h"
-#include "object/tilemap.h"
-#include "object/coin.h"
+#include "video/screen.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
+#include "level.hpp"
+#include "physic.hpp"
+#include "sector.hpp"
+#include "tile.hpp"
+#include "resources.hpp"
+#include "file_system.hpp"
+#include "object/gameobjs.hpp"
+#include "object/camera.hpp"
+#include "object/tilemap.hpp"
+#include "object/coin.hpp"
 
 // test
-#include "flip_level_transformer.h"
+#include "flip_level_transformer.hpp"
 
 using namespace std;
 
 Level::Level()
-  : name("noname"), author("Mr. X")
+  : name("noname"), author("Mr. X"), extro_music("leveldone.ogg"), extro_length(7.0)
 {
 }
 
@@ -85,6 +85,17 @@ Level::load(const std::string& filepath)
         iter.value()->get(name);
       } else if(token == "author") {
         iter.value()->get(author);
+      } else if(token == "extro") {
+        const lisp::Lisp* ext = iter.lisp();
+        lisp::ListIterator ext_iter(ext);
+        while(ext_iter.next()) {
+          const std::string& ext_token = ext_iter.item();
+          if(ext_token == "music") {
+            ext_iter.value()->get(extro_music);
+          } else if(ext_token == "length") {
+            ext_iter.value()->get(extro_length);
+          }
+        }
       } else if(token == "sector") {
         Sector* sector = new Sector;
         sector->parse(*(iter.lisp()));