added beginning of automatic docu generation for the scripting interface
[supertux.git] / src / game_session.cpp
index 1402e64..4f5495c 100644 (file)
 #include "control/codecontroller.h"
 #include "control/joystickkeyboardcontroller.h"
 #include "main.h"
+#include "file_system.h"
 #include "gameconfig.h"
 #include "gettext.h"
 
-// the engine will be run with a lofical framerate of 64fps.
-// We choose 64fps here because it is a power of 2, so 1/64 gives an "even"
+// the engine will be run with a logical framerate of 64fps.
+// We chose 64fps here because it is a power of 2, so 1/64 gives an "even"
 // binary fraction...
 static const float LOGICAL_FPS = 64.0;
 
@@ -84,6 +85,7 @@ GameSession::GameSession(const std::string& levelfile_, GameSessionMode mode,
   current_ = this;
   
   game_pause = false;
+  music_playing = false;
   fps_fps = 0;
 
   context = new DrawingContext();
@@ -129,7 +131,11 @@ GameSession::restart_level()
   if(mode == ST_GL_PLAY || mode == ST_GL_LOAD_LEVEL_FILE)
     levelintro();
 
-  currentsector->play_music(LEVEL_MUSIC);
+  if (!music_playing)
+  {
+    currentsector->play_music(LEVEL_MUSIC);
+    music_playing = true;
+  }
 
   if(capture_file != "")
     record_demo(capture_file);
@@ -181,7 +187,7 @@ GameSession::play_demo(const std::string& filename)
 void
 GameSession::levelintro()
 {
-  sound_manager->halt_music();
+  //sound_manager->halt_music();
   
   char str[60];
 
@@ -648,6 +654,12 @@ GameSession::set_reset_point(const std::string& sector, const Vector& pos)
   reset_pos = pos;
 }
 
+std::string
+GameSession::get_working_directory()
+{
+  return FileSystem::dirname(levelfile);
+}
+
 void
 GameSession::display_info_box(const std::string& text)
 {
@@ -753,7 +765,7 @@ std::string slotinfo(int slot)
   std::string title;
   std::stringstream stream;
   stream << slot;
-  slotfile = user_dir + "/save/slot" + stream.str() + ".stsg";
+  slotfile = "save/slot" + stream.str() + ".stsg";
 
   try {
     lisp::Parser parser;
@@ -784,7 +796,7 @@ bool process_load_game_menu()
   
   std::stringstream stream;
   stream << slot;
-  std::string slotfile = user_dir + "/save/slot" + stream.str() + ".stsg";
+  std::string slotfile = "save/slot" + stream.str() + ".stsg";
 
   fadeout(256);
   DrawingContext context;