Reverted change in game_session.cpp and game_session.hpp from 4059 to fix bug.
authorArvid Norlander <anmaster@berlios.de>
Fri, 21 Jul 2006 20:56:10 +0000 (20:56 +0000)
committerArvid Norlander <anmaster@berlios.de>
Fri, 21 Jul 2006 20:56:10 +0000 (20:56 +0000)
SVN-Revision: 4062

src/game_session.cpp
src/game_session.hpp

index c2aaebd..c5729eb 100644 (file)
@@ -122,8 +122,7 @@ GameSession::restart_level(bool fromBeginning)
   level->stats.total_badguys = level->get_total_badguys();
   level->stats.total_secrets = level->get_total_count<SecretAreaTrigger>();
   level->stats.reset();
-  if (!fromBeginning)
-    level->stats.declare_invalid();
+  if (!fromBeginning) level->stats.declare_invalid();
 
   if (fromBeginning) reset_sector="";
   if(reset_sector != "") {
@@ -484,9 +483,14 @@ GameSession::update(float elapsed_time)
 
   // Update the world state and all objects in the world
   if(!game_pause) {
-    currentsector->update(elapsed_time * speed_factor);
-    play_time += elapsed_time;
-    currentsector->update(elapsed_time);
+    // Update the world
+    if (end_sequence == ENDSEQUENCE_RUNNING) {
+      currentsector->update(elapsed_time/2);
+    } else if(end_sequence == NO_ENDSEQUENCE) {
+      play_time += elapsed_time; //TODO: make sure we don't count cutscene time
+      level->stats.time = play_time;
+      currentsector->update(elapsed_time);
+    }
   }
 
   // update sounds
@@ -585,7 +589,6 @@ GameSession::start_sequence(const std::string& sequencename)
     if(end_sequence)
       return;
 
-    speed_factor = 0.5;
     end_sequence = ENDSEQUENCE_RUNNING;
     endsequence_timer.start(7.3);
     last_x_pos = -1;
index 92a0b69..abc507e 100644 (file)
@@ -82,12 +82,6 @@ public:
 
   void toggle_pause();
 
-  /**
-   * Allows adjusting the game speed with a factor. 1.0 means normal speed
-   * 0.0 means the game is stopped.
-   */
-  void adjust_game_speed(float factor);
-
 private:
   void check_end_conditions();
   void process_events();
@@ -133,9 +127,6 @@ private:
   std::string reset_sector;
   Vector reset_pos;
 
-  /// speed factos
-  float speed_factor;
-
   // the sector and spawnpoint we should spawn after this frame
   std::string newsector;
   std::string newspawnpoint;