Included supertux.h stuff into it.
[supertux.git] / src / gameloop.cpp
index e99cee0..834f98f 100644 (file)
@@ -65,7 +65,7 @@ GameSession::GameSession(const std::string& filename)
   //assert(!"Don't call me");
   current_ = this;
 
-  world = new World; // &::global_world;
+  world = new World;
 
   fps_timer.init(true);
   frame_timer.init(true);
@@ -81,7 +81,7 @@ GameSession::GameSession(const std::string& subset_, int levelnb_, int mode)
 
   current_ = this;
 
-  world = new World; // &::global_world;
+  world = new World;
 
   fps_timer.init(true);
   frame_timer.init(true);
@@ -104,7 +104,6 @@ GameSession::GameSession(const std::string& subset_, int levelnb_, int mode)
     }
 
   world->get_level()->load_gfx();
-  loadshared();
   
   world->activate_bad_guys();
   world->activate_particle_systems();
@@ -171,7 +170,7 @@ GameSession::process_events()
     {
       /* Check for menu-events, if the menu is shown */
       if(show_menu)
-        menu_event(event);
+        current_menu->event(event);
 
       switch(event.type)
         {
@@ -363,7 +362,6 @@ GameSession::action(double frame_ratio)
               world->get_level()->free_song();
               world->arrays_free();
 
-              unloadshared();
               return(0);
             }
           tux.level_begin();
@@ -390,7 +388,6 @@ GameSession::action(double frame_ratio)
               world->get_level()->free_song();
               world->arrays_free();
 
-              unloadshared();
               return(0);
             } /* if (lives < 0) */
         }
@@ -609,7 +606,7 @@ GameSession::run()
       if (time_left.check())
         {
           /* are we low on time ? */
-          if ((timer_get_left(&time_left) < TIME_WARNING)
+          if (time_left.get_left() < TIME_WARNING
               && (get_current_music() != HURRYUP_MUSIC))     /* play the fast music */
             {
               set_current_music(HURRYUP_MUSIC);
@@ -624,7 +621,7 @@ GameSession::run()
       if(show_fps)
         {
           ++fps_cnt;
-          fps_fps = (1000.0 / (float)timer_get_gone(&fps_timer)) * (float)fps_cnt;
+          fps_fps = (1000.0 / (float)fps_timer.get_gone()) * (float)fps_cnt;
 
           if(!fps_timer.check())
             {
@@ -640,7 +637,6 @@ GameSession::run()
   world->get_level()->cleanup();
   world->get_level()->free_song();
 
-  unloadshared();
   world->arrays_free();
 
   return quit;
@@ -677,9 +673,9 @@ GameSession::drawstatus()
       text_draw(&white_text,"Press ESC To Return",0,20,1);
     }
 
-  if (timer_get_left(&time_left) > TIME_WARNING || (global_frame_counter % 10) < 5)
+  if (time_left.get_left() > TIME_WARNING || (global_frame_counter % 10) < 5)
     {
-      sprintf(str, "%d", timer_get_left(&time_left) / 1000 );
+      sprintf(str, "%d", time_left.get_left() / 1000 );
       text_draw(&white_text, "TIME", 224, 0, 1);
       text_draw(&gold_text, str, 304, 0, 1);
     }