<MatzeB> -updates the TODO file
authorIngo Ruhnke <grumbel@gmx.de>
Thu, 29 Apr 2004 00:15:11 +0000 (00:15 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Thu, 29 Apr 2004 00:15:11 +0000 (00:15 +0000)
<MatzeB> -should really fix the problems when picking up specials
<MatzeB> -should fix mriceblock not falling down
<MatzeB> -you can duck again while jumping
<MatzeB> -textscroller isn't framerate limited anymore
<MatzeB> -changes to the endsequence code, so that you can always hear the complete music single

grumbel: removed the duck while jumping thing, since that is reserved for the butt-jump

SVN-Revision: 827

TODO
src/badguy.cpp
src/gameloop.cpp
src/gameloop.h
src/music_manager.cpp
src/music_manager.h
src/player.cpp
src/player.h
src/special.cpp
src/text.cpp
src/worldmap.cpp

diff --git a/TODO b/TODO
index dcf60b2..a4b6dbf 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,12 +6,14 @@ Last update: April 26, 2004
 
 These are mostly bugs:
 
-- supertux crashs from time to time
+- supertux crashs from time to time - fixed
 - leveleditor lacks enemies support (will be fixed soon by Tobias)
-- sometimes you die after being in pause modus and unpausing
-- sometimes the level restarts/you die after collecing a growup
+- sometimes you die after being in pause modus and unpausing - still true?
+- sometimes the level restarts/you die after collecing a growup - fixed
 - mriceblock doesn't disapear after being kicked my another iceblock,
-  not sure when exactly it happens, might depend on direction or so
+  not sure when exactly it happens, might depend on direction or so - fixed
+- mriceblock doesn't fall down when being squished in the air - fixed
+- It's not possible to duck while jumping - fixed
+- Intro/Extro textspeed is CPU dependent - fixed
 - fadein/out for intro/extro would be nice
 
-
index bf6eb79..9a2faef 100644 (file)
@@ -205,11 +205,11 @@ BadGuy::action_mriceblock(float frame_ratio)
 {
   Player& tux = *World::current()->get_tux();
 
-  if(dying == DYING_NOT)
+  if(mode != HELD)
     fall();
   
   /* Move left/right: */
-  if (mode == NORMAL || mode == KICK)
+  if (mode != HELD)
     {
       // move
       physic.apply(frame_ratio, base.x, base.y);
index 7dca263..4e4c622 100644 (file)
@@ -58,7 +58,7 @@
 GameSession* GameSession::current_ = 0;
 
 GameSession::GameSession(const std::string& subset_, int levelnb_, int mode)
-  : world(0), st_gl_mode(mode), levelnb(levelnb_), end_sequence(false),
+  : world(0), st_gl_mode(mode), levelnb(levelnb_), end_sequence(NO_ENDSEQUENCE),
     subset(subset_)
 {
   current_ = this;
@@ -77,7 +77,7 @@ GameSession::restart_level()
 {
   game_pause   = false;
   exit_status  = NONE;
-  end_sequence = false;
+  end_sequence = NO_ENDSEQUENCE;
 
   fps_timer.init(true);
   frame_timer.init(true);
@@ -194,12 +194,13 @@ GameSession::on_escape_press()
 void
 GameSession::process_events()
 {
-  if (end_sequence)
+  if (end_sequence != NO_ENDSEQUENCE)
     {
       Player& tux = *world->get_tux();
-          
+         
+      tux.input.fire  = UP;
       tux.input.left  = UP;
-      tux.input.right = DOWN; 
+      tux.input.right = DOWN;
       tux.input.down  = UP; 
 
       if (int(last_x_pos) == int(tux.base.x))
@@ -246,7 +247,7 @@ GameSession::process_events()
             }
         }
     }
-  else
+  else // normal mode
     {
       if(!Menu::current() && !game_pause)
         st_pause_ticks_stop();
@@ -417,19 +418,28 @@ GameSession::check_end_conditions()
   Tile* endtile = collision_goal(tux->base);
 
   // fallback in case the other endpositions don't trigger
-  if (tux->base.x >= endpos || (endtile && endtile->data >= 1)
-      || (end_sequence && !endsequence_timer.check()))
+  if (!end_sequence && tux->base.x >= endpos)
+    {
+      end_sequence = ENDSEQUENCE_WAITING;
+      last_x_pos = -1;
+      music_manager->play_music(level_end_song, 0);
+      endsequence_timer.start(7000);
+    }
+  else if(end_sequence && !endsequence_timer.check())
     {
       exit_status = LEVEL_FINISHED;
       return;
     }
+  else if(end_sequence == ENDSEQUENCE_RUNNING && endtile && endtile->data >= 1)
+    {
+      end_sequence = ENDSEQUENCE_WAITING;
+    }
   else if(!end_sequence && endtile && endtile->data == 0)
     {
-      end_sequence = true;
+      end_sequence = ENDSEQUENCE_RUNNING;
       last_x_pos = -1;
-      music_manager->halt_music();
-      music_manager->play_music(level_end_song);
-      endsequence_timer.start(5000); // 5 seconds until we finish the map
+      music_manager->play_music(level_end_song, 0);
+      endsequence_timer.start(7000); // 5 seconds until we finish the map
     }
   else if (!end_sequence && tux->is_dead())
     {
@@ -455,8 +465,6 @@ GameSession::check_end_conditions()
 void
 GameSession::action(double frame_ratio)
 {
-  check_end_conditions();
-  
   if (exit_status == NONE)
     {
       // Update Tux and the World
@@ -570,9 +578,10 @@ GameSession::run()
           while (frame_ratio > 0)
             {
               // Update the world
-              if (end_sequence)
+              check_end_conditions();
+              if (end_sequence == ENDSEQUENCE_RUNNING)
                 action(.5f);
-              else
+              else if(end_sequence == NO_ENDSEQUENCE)
                 action(1.0f);
               frame_ratio -= 1.0f;
             }
index dda4fbb..6c95140 100644 (file)
@@ -59,7 +59,12 @@ class GameSession
 
   /** If true the end_sequence will be played, user input will be
       ignored while doing that */
-  bool end_sequence;
+  enum EndSequenceState {
+    NO_ENDSEQUENCE,
+    ENDSEQUENCE_RUNNING, // tux is running right
+    ENDSEQUENCE_WAITING  // waiting for the end of the music
+  };
+  EndSequenceState end_sequence;
   float last_x_pos;
 
   bool game_pause;
index e2f4125..7cf9e9c 100644 (file)
@@ -82,7 +82,7 @@ MusicManager::free_music(MusicResource* )
 }
 
 void
-MusicManager::play_music(const MusicRef& musicref)
+MusicManager::play_music(const MusicRef& musicref, int loops)
 {
   if(!audio_device)
     return;
@@ -97,7 +97,7 @@ MusicManager::play_music(const MusicRef& musicref)
   current_music->refcount++;
   
   if(music_enabled)
-    Mix_PlayMusic(current_music->music, -1);
+    Mix_PlayMusic(current_music->music, loops);
 }
 
 void
index d53a860..80706fd 100644 (file)
@@ -38,7 +38,7 @@ public:
   MusicRef load_music(const std::string& file);
   bool exists_music(const std::string& filename);
   
-  void play_music(const MusicRef& music);
+  void play_music(const MusicRef& music, int loops = -1);
   void halt_music();
 
   void enable_music(bool enable);
index 8d0a2ee..fe5604f 100644 (file)
@@ -455,11 +455,30 @@ Player::handle_input()
       duck = false;
       base.y -= 32;
       base.height = 64;
-      old_base = previous_base = base;
     }
 }
 
 void
+Player::grow()
+{
+  if(size == BIG)
+    return;
+  
+  size = BIG;
+  base.height = 64;
+  base.y -= 32;
+  // eventually go in duck mode if there's no space
+  if(collision_object_map(base))
+    {
+      base.height = 32;
+      base.y += 32;
+      duck = true;
+    }
+
+  old_base = previous_base = base;
+}
+
+void
 Player::grabdistros()
 {
   /* Grab distros: */
index 708d2ae..2199f23 100644 (file)
@@ -146,6 +146,7 @@ public:
   void keep_in_bounds();
   bool on_ground();
   bool under_solid();
+  void grow();
   
 private:
   void handle_horizontal_input();
index 4ae5fcd..4ce1025 100644 (file)
@@ -330,20 +330,13 @@ Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
       if (kind == UPGRADE_GROWUP)
         {
           play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
-          pplayer->size = BIG;
-          pplayer->base.height = 64;
-         pplayer->base.y -= 32;
+          pplayer->grow();
         }
       else if (kind == UPGRADE_ICEFLOWER)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
+          pplayer->grow();
           pplayer->got_coffee = true;
-          if (pplayer->size == SMALL)
-            {
-              pplayer->size = BIG;
-              pplayer->base.height = 64;
-              pplayer->base.y -= 32;
-            }
         }
       else if (kind == UPGRADE_HERRING)
         {
index 4ef3cfe..052608b 100644 (file)
@@ -222,7 +222,7 @@ Text::erasecenteredtext(const  char * text, int y, Surface * ptexture, int updat
 /* --- SCROLL TEXT FUNCTION --- */
 
 #define MAX_VEL     10
-#define SPEED_INC   1.0
+#define SPEED_INC   0.01
 #define SCROLL      60
 #define ITEMS_SPACE 4
 
@@ -236,7 +236,7 @@ void display_text_file(const std::string& file, const std::string& surface, floa
 void display_text_file(const std::string& file, Surface* surface, float scroll_speed)
 {
   int done;
-  int scroll;
+  float scroll;
   float speed;
   int y;
   int length;
@@ -266,13 +266,14 @@ void display_text_file(const std::string& file, Surface* surface, float scroll_s
 
 
   scroll = 0;
-  speed = scroll_speed;
+  speed = scroll_speed / 50;
   done = 0;
 
   length = names.num_items;
 
   SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
 
+  Uint32 lastticks = SDL_GetTicks();
   while(done == 0)
     {
       /* in case of input, exit */
@@ -322,19 +323,23 @@ void display_text_file(const std::string& file, Surface* surface, float scroll_s
         switch(names.item[i][0])
           {
           case ' ':
-            white_small_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+            white_small_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll),
+                A_HMIDDLE, A_TOP, 1);
             y += white_small_text->h+ITEMS_SPACE;
             break;
           case '       ':
-            white_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+            white_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll),
+                A_HMIDDLE, A_TOP, 1);
             y += white_text->h+ITEMS_SPACE;
             break;
           case '-':
-            white_big_text->drawf(names.item[i]+1, 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 3);
+            white_big_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll),
+                A_HMIDDLE, A_TOP, 3);
             y += white_big_text->h+ITEMS_SPACE;
             break;
           default:
-            blue_text->drawf(names.item[i], 0, screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+            blue_text->drawf(names.item[i], 0, screen->h+y-int(scroll),
+                A_HMIDDLE, A_TOP, 1);
             y += blue_text->h+ITEMS_SPACE;
             break;
           }
@@ -345,11 +350,13 @@ void display_text_file(const std::string& file, Surface* surface, float scroll_s
       if(screen->h+y-scroll < 0 && 20+screen->h+y-scroll < 0)
         done = 1;
 
-      scroll += (int)speed;
+      Uint32 ticks = SDL_GetTicks();
+      scroll += speed * (ticks - lastticks);
+      lastticks = ticks;
       if(scroll < 0)
         scroll = 0;
 
-      SDL_Delay(35);
+      SDL_Delay(10);
     }
   string_list_free(&names);
 
index 1971450..826f226 100644 (file)
@@ -681,7 +681,11 @@ WorldMap::update(float delta)
                       }
 
                     if (!level->extro_filename.empty())
-                      { // Display final credits and go back to the main menu
+                      { 
+                        MusicRef theme =
+                          music_manager->load_music(datadir + "/music/theme.mod");
+                        music_manager->play_music(theme);
+                        // Display final credits and go back to the main menu
                         display_text_file(level->extro_filename,
                                           "/images/background/extro.jpg", SCROLL_SPEED_MESSAGE);
                         display_text_file("CREDITS",